Web Inspector: Navigating to resource sometimes shows different resource
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 23:47:16 +0000 (23:47 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 23:47:16 +0000 (23:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195978
<rdar://problem/49043191>

Reviewed by Timothy Hatcher.

* UserInterface/Views/NavigationSidebarPanel.js:
(WI.NavigationSidebarPanel.prototype.cancelRestoringState):
Reset _pendingViewStateCookie so _checkElementsForPendingViewStateCookie could exit early.

* UserInterface/Views/ResourceSidebarPanel.js:
(WI.ResourceSidebarPanel.prototype.initialLayout):
(WI.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
(WI.ResourceSidebarPanel.prototype._createMainFrameTreeElement):
Don't try to change content view on initialLayout.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js

index 9a21984..d1cf661 100644 (file)
@@ -1,3 +1,21 @@
+2019-04-17  Nikita Vasilyev  <nvasilyev@apple.com>
+
+        Web Inspector: Navigating to resource sometimes shows different resource
+        https://bugs.webkit.org/show_bug.cgi?id=195978
+        <rdar://problem/49043191>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WI.NavigationSidebarPanel.prototype.cancelRestoringState):
+        Reset _pendingViewStateCookie so _checkElementsForPendingViewStateCookie could exit early.
+
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WI.ResourceSidebarPanel.prototype.initialLayout):
+        (WI.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
+        (WI.ResourceSidebarPanel.prototype._createMainFrameTreeElement):
+        Don't try to change content view on initialLayout.
+
 2019-04-17  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: CPU Usage Timeline - Include # of Network Requests in the Statistics section
index d5b2566..edc33a8 100644 (file)
@@ -122,6 +122,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel
 
     cancelRestoringState()
     {
+        this._pendingViewStateCookie = null;
         if (!this._finalAttemptToRestoreViewStateTimeout)
             return;
 
index 3b53f78..7b1d610 100644 (file)
@@ -198,7 +198,7 @@ WI.ResourceSidebarPanel = class ResourceSidebarPanel extends WI.NavigationSideba
         super.initialLayout();
 
         if (WI.networkManager.mainFrame)
-            this._mainFrameMainResourceDidChange(WI.networkManager.mainFrame);
+            this._createMainFrameTreeElement(WI.networkManager.mainFrame);
 
         for (let script of WI.debuggerManager.knownNonResourceScripts) {
             this._addScript(script);
@@ -278,17 +278,10 @@ WI.ResourceSidebarPanel = class ResourceSidebarPanel extends WI.NavigationSideba
     {
         this.contentBrowser.contentViewContainer.closeAllContentViews();
 
-        if (this._mainFrameTreeElement) {
-            this.contentTreeOutline.removeChild(this._mainFrameTreeElement);
-            this._mainFrameTreeElement = null;
-        }
-
+        this._createMainFrameTreeElement(mainFrame);
         if (!mainFrame)
             return;
 
-        this._mainFrameTreeElement = new WI.FrameTreeElement(mainFrame);
-        this.contentTreeOutline.insertChild(this._mainFrameTreeElement, 0);
-
         function delayedWork()
         {
             if (!this.contentTreeOutline.selectedTreeElement) {
@@ -305,6 +298,20 @@ WI.ResourceSidebarPanel = class ResourceSidebarPanel extends WI.NavigationSideba
         setTimeout(delayedWork.bind(this));
     }
 
+    _createMainFrameTreeElement(mainFrame)
+    {
+        if (this._mainFrameTreeElement) {
+            this.contentTreeOutline.removeChild(this._mainFrameTreeElement);
+            this._mainFrameTreeElement = null;
+        }
+
+        if (!mainFrame)
+            return;
+
+        this._mainFrameTreeElement = new WI.FrameTreeElement(mainFrame);
+        this.contentTreeOutline.insertChild(this._mainFrameTreeElement, 0);
+    }
+
     _scriptWasAdded(event)
     {
         this._addScript(event.data.script);