From 626a01dd551c27903b61a28cd575e65561b5858f Mon Sep 17 00:00:00 2001 From: Damilola Edwards Date: Thu, 12 Oct 2023 14:30:35 +0100 Subject: [PATCH] Open non-zero coverage reports in corpus by default --- fuzzing/coverage/report_template.gohtml | 35 +++++++++++++++---------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/fuzzing/coverage/report_template.gohtml b/fuzzing/coverage/report_template.gohtml index cab7c07e..d7993e81 100644 --- a/fuzzing/coverage/report_template.gohtml +++ b/fuzzing/coverage/report_template.gohtml @@ -68,6 +68,9 @@ .collapsible-active:after { content: "\2212"; } + .collapsible-active + .collapsible-container { + max-height: none; + } .collapsible-container { margin-bottom: 5px; max-height: 0; @@ -150,12 +153,21 @@ {{$linesCoveredPercentInt := percentageInt $linesCovered $linesActive}} {{/* Output a collapsible header/container for each source*/}} - + {{if not $linesCoveredPercentInt}} + + {{else}} + + {{end}}

@@ -214,17 +226,12 @@ for (i = 0; i < collapsibleHeaders.length; i++) { collapsibleHeaders[i].addEventListener("click", function() { this.classList.toggle("collapsible-active"); - const collapsibleContainer = this.nextElementSibling; - if (collapsibleContainer.style.maxHeight){ - collapsibleContainer.style.maxHeight = null; - } else { - collapsibleContainer.style.maxHeight = collapsibleContainer.scrollHeight + "px"; - } + }); } - // If there's only one item, expand it by default. - if (collapsibleHeaders.length === 1) { + // If there's only one item and that item has 0% coverage, expand it by default. + if (collapsibleHeaders.length === 1 && !collapsibleHeaders.className.contains("collapsible-active")) { collapsibleHeaders[0].click(); }