Web Inspector: Assertion in NetworkGridContentView when updating data grid for the...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jul 2016 18:40:27 +0000 (18:40 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jul 2016 18:40:27 +0000 (18:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160330
<rdar://problem/27600905>

Reviewed by Brian Burg.

When the first grid node is added, a view layout and current time update
are scheduled. A view layout occurring before the current time is updated
should be skipped, since the ruler end time hasn't been set.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView.prototype.layout):
Skip layout until current time is updated.
(WebInspector.NetworkGridContentView.prototype._update):
Remove unused variables `startTime` and `endTime`. Don't force a layout
if the elapsed time is zero.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js

index 32cdec4..1ce4050 100644 (file)
@@ -1,3 +1,22 @@
+2016-07-29  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Assertion in NetworkGridContentView when updating data grid for the first time
+        https://bugs.webkit.org/show_bug.cgi?id=160330
+        <rdar://problem/27600905>
+
+        Reviewed by Brian Burg.
+
+        When the first grid node is added, a view layout and current time update
+        are scheduled. A view layout occurring before the current time is updated
+        should be skipped, since the ruler end time hasn't been set.
+
+        * UserInterface/Views/NetworkGridContentView.js:
+        (WebInspector.NetworkGridContentView.prototype.layout):
+        Skip layout until current time is updated.
+        (WebInspector.NetworkGridContentView.prototype._update):
+        Remove unused variables `startTime` and `endTime`. Don't force a layout
+        if the elapsed time is zero.
+
 2016-07-28  Chris Dumez  <cdumez@apple.com>
 
         Parameters to Event.initEvent() should be mandatory
index 804703a..acb3c88 100644 (file)
@@ -181,6 +181,9 @@ WebInspector.NetworkGridContentView = class NetworkGridContentView extends WebIn
         this._timelineRuler.zeroTime = this.zeroTime;
         this._timelineRuler.startTime = this.zeroTime;
 
+        if (this.startTime >= this.endTime)
+            return;
+
         for (let dataGridNode of this._dataGrid.children)
             dataGridNode.refreshGraph();
 
@@ -287,17 +290,14 @@ WebInspector.NetworkGridContentView = class NetworkGridContentView extends WebIn
     {
         console.assert(this._scheduledCurrentTimeUpdateIdentifier);
 
-        let startTime = this.startTime;
-        let currentTime = this.currentTime;
-        let endTime = this.endTime;
-        let timespanSinceLastUpdate = (timestamp - this._lastUpdateTimestamp) / 1000 || 0;
+        if (!isNaN(this._lastUpdateTimestamp)) {
+            let timespanSinceLastUpdate = (timestamp - this._lastUpdateTimestamp) / 1000 || 0;
+            this._timelineRuler.endTime = this.currentTime + timespanSinceLastUpdate;
 
-        currentTime += timespanSinceLastUpdate;
+            this.updateLayout();
+        }
 
-        this._timelineRuler.endTime = currentTime;
         this._lastUpdateTimestamp = timestamp;
-        this.updateLayout();
-
         this._scheduledCurrentTimeUpdateIdentifier = requestAnimationFrame(this._updateCallback);
     }