Web Inspector: REGRESSION(r238168): Network: preserve log doesn't show main frame...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 01:28:49 +0000 (01:28 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 01:28:49 +0000 (01:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197220
<rdar://problem/49960464>

Reviewed by Timothy Hatcher.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.reset):
(WI.NetworkTableContentView.prototype._addCollection):
(WI.NetworkTableContentView.prototype._resetCollection): Added.
(WI.NetworkTableContentView.prototype._changeCollection):
(WI.NetworkTableContentView.prototype._mainResourceDidChange):
We want to add the frame's main resource in the case that it's the main frame, but we also
want to clear the main collection of data (e.g. if viewing an imported HAR).
Drive-by: `_groupByDOMNodeNavigationItem` was renamed in a previous patch.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244577 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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

index c72952e..985fe6b 100644 (file)
@@ -1,5 +1,23 @@
 2019-04-23  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: REGRESSION(r238168): Network: preserve log doesn't show main frame main resource changes
+        https://bugs.webkit.org/show_bug.cgi?id=197220
+        <rdar://problem/49960464>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView.prototype.reset):
+        (WI.NetworkTableContentView.prototype._addCollection):
+        (WI.NetworkTableContentView.prototype._resetCollection): Added.
+        (WI.NetworkTableContentView.prototype._changeCollection):
+        (WI.NetworkTableContentView.prototype._mainResourceDidChange):
+        We want to add the frame's main resource in the case that it's the main frame, but we also
+        want to clear the main collection of data (e.g. if viewing an imported HAR).
+        Drive-by: `_groupByDOMNodeNavigationItem` was renamed in a previous patch.
+
+2019-04-23  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Network: support drag/drop for importing
         https://bugs.webkit.org/show_bug.cgi?id=197221
 
index d6350d2..a7a9fc7 100644 (file)
@@ -306,12 +306,7 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
     reset()
     {
         this._runForMainCollection((collection) => {
-            collection.entries = [];
-            collection.filteredEntries = [];
-            collection.pendingInsertions = [];
-            collection.pendingUpdates = [];
-            collection.waterfallStartTime = NaN;
-            collection.waterfallEndTime = NaN;
+            this._resetCollection(collection);
         });
 
         for (let detailView of this._detailViewMap.values())
@@ -526,20 +521,22 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
 
     _addCollection()
     {
-        let collection = {
-            entries: [],
-            filteredEntries: [],
-            pendingInsertions: [],
-            pendingUpdates: [],
-            waterfallStartTime: NaN,
-            waterfallEndTime: NaN,
-        };
-
+        let collection = {};
+        this._resetCollection(collection);
         this._collections.push(collection);
-
         return collection;
     }
 
+    _resetCollection(collection)
+    {
+        collection.entries = [];
+        collection.filteredEntries = [];
+        collection.pendingInsertions = [];
+        collection.pendingUpdates = [];
+        collection.waterfallStartTime = NaN;
+        collection.waterfallEndTime = NaN;
+    }
+
     _setActiveCollection(collection)
     {
         console.assert(this._collections.includes(collection));
@@ -586,7 +583,7 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
 
         let isMain = collection === this._mainCollection;
         this._checkboxesNavigationItemGroup.hidden = !isMain;
-        this._groupByDOMNodeNavigationItem.hidden = !isMain;
+        this._groupMediaRequestsByDOMNodeNavigationItem.hidden = !isMain;
         this._clearNetworkItemsNavigationItem.enabled = isMain;
         this._collectionsPathNavigationItem.components = [this._pathComponentsMap.get(collection)];
 
@@ -1588,13 +1585,11 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
 
     _mainResourceDidChange(event)
     {
-        let frame = event.target;
-        if (!frame.isMainFrame() || !WI.settings.clearNetworkOnNavigate.value)
-            return;
-
-        this.reset();
-
         this._runForMainCollection((collection) => {
+            let frame = event.target;
+            if (frame.isMainFrame() && WI.settings.clearNetworkOnNavigate.value)
+                this._resetCollection(collection);
+
             if (this._transitioningPageTarget) {
                 this._transitioningPageTarget = false;
                 this._needsInitialPopulate = true;