Modified: trunk/Source/WebInspectorUI/ChangeLog (208894 => 208895)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-11-18 21:55:09 UTC (rev 208894)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-11-18 22:04:08 UTC (rev 208895)
@@ -1,3 +1,57 @@
+2016-11-18 Matt Baker <[email protected]>
+
+ Web Inspector: TimelineDataGridNode assertions when refreshing page
+ https://bugs.webkit.org/show_bug.cgi?id=162642
+ <rdar://problem/28505898>
+
+ Reviewed by Timothy Hatcher.
+
+ This patch fixes a number of deficiencies in the Network tab that caused
+ TimelineDataGridNode graphs to refresh before the tab became visible.
+
+ * UserInterface/Views/ElementsTabContentView.js:
+ (WebInspector.ElementsTabContentView):
+ (WebInspector.ElementsTabContentView.prototype.shown):
+ Drive-by fix: defer showing the DOM content view until the tab is shown.
+
+ * UserInterface/Views/NetworkGridContentView.js:
+ (WebInspector.NetworkGridContentView):
+ Drive-by event listener cleanup.
+ (WebInspector.NetworkGridContentView.prototype.get startTime):
+ (WebInspector.NetworkGridContentView.prototype.get endTime):
+ Back endTime with a variable, instead of using the ruler value which
+ isn't valid before the tab is shown for the first time.
+
+ (WebInspector.NetworkGridContentView.prototype.shown):
+ Force the grid to update its layout, and that of the Timeline column ruler.
+ During layout the ruler's secondsPerPixel value is used, which isn't
+ valid until the ruler does an initial layout.
+
+ (WebInspector.NetworkGridContentView.prototype.reset):
+ Clear pending records. This was causing duplicates to appear when the
+ inspected page was refreshed multiple times prior to showing the Network
+ tab for the first time.
+
+ (WebInspector.NetworkGridContentView.prototype.layout):
+ Should more closely match behavior in NetworkTimelineView.prototype.layout.
+ Graph end time padding is added if no longer updating the current time.
+
+ (WebInspector.NetworkGridContentView.prototype._networkTimelineRecordAdded):
+ Track endTime of the last record added, so that the graph end time can
+ be padded once the current time is no longer being updated.
+
+ (WebInspector.NetworkGridContentView.prototype._update):
+ (WebInspector.NetworkGridContentView.prototype._stopUpdatingCurrentTime):
+ Graph end time padding shouldn't be applied here, since this isn't called
+ if the inspected page finishes loading before the view is shown.
+
+ (WebInspector.NetworkGridContentView.prototype._clearNetworkItems): Deleted.
+ Replaced by an arrow function.
+
+ * UserInterface/Views/NetworkSidebarPanel.js:
+ (WebInspector.NetworkSidebarPanel.prototype._networkTimelineReset):
+ Don't show the content view if the tab is hidden.
+
2016-11-17 Devin Rousso <[email protected]>
Web Inspector: Shift clicking on named color value only shows its hex form
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js (208894 => 208895)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js 2016-11-18 21:55:09 UTC (rev 208894)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js 2016-11-18 22:04:08 UTC (rev 208895)
@@ -38,8 +38,6 @@
WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-
- this._showDOMTreeContentView();
}
static tabInfo()
@@ -86,6 +84,13 @@
cookie.nodeToSelect = undefined;
}
+ shown()
+ {
+ super.shown();
+
+ this._showDOMTreeContentView();
+ }
+
closed()
{
super.closed();
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js (208894 => 208895)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js 2016-11-18 21:55:09 UTC (rev 208894)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js 2016-11-18 22:04:08 UTC (rev 208895)
@@ -102,10 +102,11 @@
networkTimeline.addEventListener(WebInspector.Timeline.Event.Reset, this._networkTimelineReset, this);
this._clearNetworkItemsNavigationItem = new WebInspector.ButtonNavigationItem("clear-network-items", WebInspector.UIString("Clear Network Items"), "Images/NavigationItemTrash.svg", 15, 15);
- this._clearNetworkItemsNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearNetworkItems, this);
+ this._clearNetworkItemsNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, () => this.reset());
this._pendingRecords = [];
this._loadingResourceCount = 0;
+ this._lastRecordEndTime = NaN;
this._lastUpdateTimestamp = NaN;
this._startTime = NaN;
this._endTime = NaN;
@@ -115,9 +116,9 @@
// Public
get secondsPerPixel() { return this._timelineRuler.secondsPerPixel; }
- get startTime() { return this._startTime || 0; }
+ get startTime() { return this._startTime; }
get currentTime() { return this.endTime || this.startTime; }
- get endTime() { return this._timelineRuler.endTime; }
+ get endTime() { return this._endTime; }
get zeroTime() { return this.startTime; }
get selectionPathComponents()
@@ -141,6 +142,8 @@
this._dataGrid.shown();
+ this._dataGrid.updateLayout(WebInspector.View.LayoutReason.Resize);
+
if (this._loadingResourceCount && !this._scheduledCurrentTimeUpdateIdentifier)
this._startUpdatingCurrentTime();
}
@@ -170,7 +173,9 @@
if (this._scheduledCurrentTimeUpdateIdentifier)
this._stopUpdatingCurrentTime();
+ this._pendingRecords = [];
this._loadingResourceCount = 0;
+ this._lastRecordEndTime = NaN;
this._lastUpdateTimestamp = NaN;
this._startTime = NaN;
this._endTime = NaN;
@@ -183,17 +188,32 @@
layout()
{
- if (!isNaN(this._startTime)) {
- this._timelineRuler.zeroTime = this._startTime;
- this._timelineRuler.startTime = this._startTime;
- }
+ if (isNaN(this.startTime) || isNaN(this.endTime))
+ return;
+ let oldZeroTime = this._timelineRuler.zeroTime;
+ let oldStartTime = this._timelineRuler.startTime;
+ let oldEndTime = this._timelineRuler.endTime;
+
+ this._timelineRuler.zeroTime = this.zeroTime;
+ this._timelineRuler.startTime = this.startTime;
+
if (this.startTime >= this.endTime)
return;
- for (let dataGridNode of this._dataGrid.children)
- dataGridNode.refreshGraph();
+ if (!this._scheduledCurrentTimeUpdateIdentifier) {
+ this._timelineRuler.endTime = this.endTime;
+ this._endTime = this._lastRecordEndTime + WebInspector.TimelineRecordBar.MinimumWidthPixels * this.secondsPerPixel;
+ }
+ this._timelineRuler.endTime = this.endTime;
+
+ // We only need to refresh the graphs when the any of the times change.
+ if (this.zeroTime !== oldZeroTime || this.startTime !== oldStartTime || this.endTime !== oldEndTime) {
+ for (let dataGridNode of this._dataGrid.children)
+ dataGridNode.refreshGraph();
+ }
+
this._processPendingRecords();
}
@@ -243,7 +263,8 @@
if (this._loadingResourceCount)
return;
- this._endTime = resourceTimelineRecord.endTime;
+ this._lastRecordEndTime = resourceTimelineRecord.endTime;
+ this._endTime = Math.max(this._lastRecordEndTime, this._endTime);
if (this._scheduledCurrentTimeUpdateIdentifier)
this.debounce(150)._stopUpdatingCurrentTime();
@@ -266,7 +287,7 @@
return;
if (isNaN(this._startTime))
- this._startTime = resourceTimelineRecord.startTime;
+ this._startTime = this._endTime = resourceTimelineRecord.startTime;
// FIXME: <https://webkit.org/b/153634> Web Inspector: some background tabs think they are the foreground tab and do unnecessary work
if (!(WebInspector.tabBrowser.selectedTabContentView instanceof WebInspector.NetworkTabContentView))
@@ -304,10 +325,6 @@
this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
}
- _clearNetworkItems(event) {
- this.reset();
- }
-
_update(timestamp)
{
console.assert(this._scheduledCurrentTimeUpdateIdentifier);
@@ -314,7 +331,7 @@
if (!isNaN(this._lastUpdateTimestamp)) {
let timespanSinceLastUpdate = (timestamp - this._lastUpdateTimestamp) / 1000 || 0;
- this._timelineRuler.endTime = this.currentTime + timespanSinceLastUpdate;
+ this._endTime += timespanSinceLastUpdate;
this.updateLayout();
}
@@ -350,7 +367,6 @@
cancelAnimationFrame(this._scheduledCurrentTimeUpdateIdentifier);
this._scheduledCurrentTimeUpdateIdentifier = undefined;
- this._timelineRuler.endTime = this._endTime + WebInspector.TimelineRecordBar.MinimumWidthPixels * this.secondsPerPixel;
this.needsLayout();
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js (208894 => 208895)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js 2016-11-18 21:55:09 UTC (rev 208894)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js 2016-11-18 22:04:08 UTC (rev 208895)
@@ -174,7 +174,9 @@
_networkTimelineReset(event)
{
this.contentBrowser.contentViewContainer.closeAllContentViews();
- this.showDefaultContentView();
+
+ if (this.visible)
+ this.showDefaultContentView();
}
_contentBrowserCurrentContentViewDidChange(event)