Fix the bug that sometimes analysis task results pane is missing.
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 May 2017 18:29:05 +0000 (18:29 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 May 2017 18:29:05 +0000 (18:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172404

Reviewed by Ryosuke Niwa.

AnalysisTaskPage._didFetchTask and AnalaysisTaskPage._fetchRelatedInfoForTaskId should be called in order.
The race between those two functions causes the analysis task results pane sometimes missing.

* public/v3/components/analysis-results-viewer.js:
(AnalysisResultsViewer.prototype.render): Fix the bug in r217173 that commitSet can be undefined.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskPage.prototype.updateFromSerializedState): Use arrow function to get rid of self variable.
Use `const` instead of var for constant variable. And call _didFetchTask before calling _fetchRelatedInfoForTaskId.
(AnalysisTaskPage.prototype._renderTaskNameAndStatus):
(AnalysisTaskPage.cssTemplate):

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

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/components/analysis-results-viewer.js
Websites/perf.webkit.org/public/v3/pages/analysis-task-page.js

index 820866c..039ce59 100644 (file)
@@ -1,3 +1,21 @@
+2017-05-22  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Fix the bug that sometimes analysis task results pane is missing.
+        https://bugs.webkit.org/show_bug.cgi?id=172404
+
+        Reviewed by Ryosuke Niwa.
+
+        AnalysisTaskPage._didFetchTask and AnalaysisTaskPage._fetchRelatedInfoForTaskId should be called in order.
+        The race between those two functions causes the analysis task results pane sometimes missing.
+
+        * public/v3/components/analysis-results-viewer.js:
+        (AnalysisResultsViewer.prototype.render): Fix the bug in r217173 that commitSet can be undefined.
+        * public/v3/pages/analysis-task-page.js:
+        (AnalysisTaskPage.prototype.updateFromSerializedState): Use arrow function to get rid of self variable.
+        Use `const` instead of var for constant variable. And call _didFetchTask before calling _fetchRelatedInfoForTaskId.
+        (AnalysisTaskPage.prototype._renderTaskNameAndStatus):
+        (AnalysisTaskPage.cssTemplate):
+
 2017-05-19  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add a commit log viewer next to the analysis results viewer
index d72c5e5..ecd6e2f 100644 (file)
@@ -62,6 +62,8 @@ class AnalysisResultsViewer extends ResultsTable {
 
         for (const label of this._rangeSelectorLabels) {
             const commitSet = this._selectedRange[label];
+            if (!commitSet)
+                continue;
             const list = this._selectorRadioButtonList[label] || [];
             for (const item of list) {
                 if (item.commitSet.equals(commitSet))
index c3dc754..10a2dd2 100644 (file)
@@ -222,7 +222,7 @@ class AnalysisTaskConfiguratorPane extends ComponentBase {
     {
         super.render();
     }
-    
+
     static htmlTemplate()
     {
         return `<custom-configuration-test-group-form id="form"></custom-configuration-test-group-form>`;
@@ -465,21 +465,21 @@ class AnalysisTaskPage extends PageWithHeading {
 
     updateFromSerializedState(state)
     {
-        var self = this;
         if (state.remainingRoute) {
-            var taskId = parseInt(state.remainingRoute);
-            AnalysisTask.fetchById(taskId).then(this._didFetchTask.bind(this), function (error) {
-                self._errorMessage = `Failed to fetch the analysis task ${state.remainingRoute}: ${error}`;
-                self.enqueueToRender();
+            const taskId = parseInt(state.remainingRoute);
+            AnalysisTask.fetchById(taskId).then(this._didFetchTask.bind(this)).then(() => {
+                this._fetchRelatedInfoForTaskId(taskId);
+            }, (error) => {
+                this._errorMessage = `Failed to fetch the analysis task ${state.remainingRoute}: ${error}`;
+                this.enqueueToRender();
             });
-            this._fetchRelatedInfoForTaskId(taskId);
         } else if (state.buildRequest) {
-            var buildRequestId = parseInt(state.buildRequest);
-            AnalysisTask.fetchByBuildRequestId(buildRequestId).then(this._didFetchTask.bind(this)).then(function (task) {
-                self._fetchRelatedInfoForTaskId(task.id());
-            }, function (error) {
-                self._errorMessage = `Failed to fetch the analysis task for the build request ${buildRequestId}: ${error}`;
-                self.enqueueToRender();
+            const buildRequestId = parseInt(state.buildRequest);
+            AnalysisTask.fetchByBuildRequestId(buildRequestId).then(this._didFetchTask.bind(this)).then((task) => {
+                this._fetchRelatedInfoForTaskId(task.id());
+            }, (error) => {
+                this._errorMessage = `Failed to fetch the analysis task for the build request ${buildRequestId}: ${error}`;
+                this.enqueueToRender();
             });
         }
     }
@@ -647,7 +647,7 @@ class AnalysisTaskPage extends PageWithHeading {
             const platform = task.platform();
             const metric = task.metric();
             const subtitle = `${metric.fullName()} on ${platform.label()}`;
-            this.renderReplace(this.content('platform-metric-names'), 
+            this.renderReplace(this.content('platform-metric-names'),
                 link(subtitle, this.router().url('charts', ChartsPage.createStateForAnalysisTask(task))));
         }
         this.content('change-type').value = changeType || 'unconfirmed';
@@ -957,7 +957,7 @@ class AnalysisTaskPage extends PageWithHeading {
                 padding: 0 1rem;
                 border-bottom: solid 1px #ccc;
             }
-            
+
             #results-pane {
                 margin-top: 1rem;
             }