REGRESSION(r225898): The perf dashboard fails to open when there are no summary pages
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 20:35:11 +0000 (20:35 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 20:35:11 +0000 (20:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182210

Rubber-stamped by Chris Dumez.

The bug was caused by TestFreshnessPage unconditionally assuming that summaryPageConfiguration is set.
Fixed it by not creating TestFreshnessPage when there are no summary pages specified.

Also modernized the code to use const & let instead of var.

* public/v3/main.js:
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227749 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/main.js

index fb21c3f..60e669f 100644 (file)
@@ -1,5 +1,20 @@
 2018-01-29  Ryosuke Niwa  <rniwa@webkit.org>
 
+        REGRESSION(r225898): The perf dashboard fails to open when there are no summary pages
+        https://bugs.webkit.org/show_bug.cgi?id=182210
+
+        Rubber-stamped by Chris Dumez.
+
+        The bug was caused by TestFreshnessPage unconditionally assuming that summaryPageConfiguration is set.
+        Fixed it by not creating TestFreshnessPage when there are no summary pages specified.
+
+        Also modernized the code to use const & let instead of var.
+
+        * public/v3/main.js:
+        (main):
+
+2018-01-29  Ryosuke Niwa  <rniwa@webkit.org>
+
         Perf dashboard's page title can be set to a previously visited page
         https://bugs.webkit.org/show_bug.cgi?id=182209
 
index a545d7a..0ebc2f0 100644 (file)
@@ -11,7 +11,7 @@ function main() {
         'Shadow DOM API': () => { return !!Element.prototype.attachShadow; },
     };
 
-    for (let name in requiredFeatures) {
+    for (const name in requiredFeatures) {
         if (!requiredFeatures[name]())
             return alert(`Your browser does not support ${name}. Try using the latest Safari or Chrome.`);
     }
@@ -19,52 +19,52 @@ function main() {
     (new SpinningPage).open();
 
     Manifest.fetch().then(function (manifest) {
-        var dashboardToolbar = new DashboardToolbar;
-        var dashboardPages = [];
+        const dashboardToolbar = new DashboardToolbar;
+        const dashboardPages = [];
         if (manifest.dashboards) {
-            for (var name in manifest.dashboards)
+            for (const name in manifest.dashboards)
                 dashboardPages.push(new DashboardPage(name, manifest.dashboards[name], dashboardToolbar));
         }
 
-        var router = new PageRouter();
-        var chartsToolbar = new ChartsToolbar;
-
-        var summaryPages = [];
+        const summaryPages = [];
+        let testFreshnessPage = null;
         if (manifest.summaryPages) {
-            for (var summaryPage of manifest.summaryPages)
+            for (const summaryPage of manifest.summaryPages)
                 summaryPages.push(new SummaryPage(summaryPage));
+            testFreshnessPage = new TestFreshnessPage(manifest.summaryPages, manifest.testAgeToleranceInHours);
         }
 
-        var chartsPage = new ChartsPage(chartsToolbar);
-        var analysisCategoryPage = new AnalysisCategoryPage();
+        const chartsToolbar = new ChartsToolbar;
+        const chartsPage = new ChartsPage(chartsToolbar);
+        const analysisCategoryPage = new AnalysisCategoryPage();
+
+        summaryPages.push(chartsPage);
+        summaryPages.push(analysisCategoryPage);
+        if (testFreshnessPage)
+            summaryPages.push(testFreshnessPage);
 
-        var createAnalysisTaskPage = new CreateAnalysisTaskPage();
+        const createAnalysisTaskPage = new CreateAnalysisTaskPage();
         createAnalysisTaskPage.setParentPage(analysisCategoryPage);
 
-        var analysisTaskPage = new AnalysisTaskPage();
+        const analysisTaskPage = new AnalysisTaskPage();
         analysisTaskPage.setParentPage(analysisCategoryPage);
 
-        var buildRequestQueuePage = new BuildRequestQueuePage();
+        const buildRequestQueuePage = new BuildRequestQueuePage();
         buildRequestQueuePage.setParentPage(analysisCategoryPage);
 
-        const testHealthPage = new TestFreshnessPage(manifest.summaryPages, manifest.testAgeToleranceInHours);
-
-        var heading = new Heading(manifest.siteTitle);
-        heading.addPageGroup(summaryPages.concat([chartsPage, analysisCategoryPage, testHealthPage]));
+        const heading = new Heading(manifest.siteTitle);
+        heading.addPageGroup(summaryPages);
 
         heading.setTitle(manifest.siteTitle);
         heading.addPageGroup(dashboardPages);
 
-        var router = new PageRouter();
-        for (var summaryPage of summaryPages)
+        const router = new PageRouter();
+        for (const summaryPage of summaryPages)
             router.addPage(summaryPage);
-        router.addPage(chartsPage);
         router.addPage(createAnalysisTaskPage);
         router.addPage(analysisTaskPage);
         router.addPage(buildRequestQueuePage);
-        router.addPage(analysisCategoryPage);
-        router.addPage(testHealthPage);
-        for (var page of dashboardPages)
+        for (const page of dashboardPages)
             router.addPage(page);
 
         if (summaryPages.length)