Title: [267379] trunk/Source/WebInspectorUI
Revision
267379
Author
nvasil...@apple.com
Date
2020-09-21 16:09:18 -0700 (Mon, 21 Sep 2020)

Log Message

Web Inspector: Uncaught Exception: Missing node for given nodeId
https://bugs.webkit.org/show_bug.cgi?id=216067
<rdar://problem/68520144>

Reviewed by Devin Rousso.

* UserInterface/Views/ContentBrowserTabContentView.js:
(WI.ContentBrowserTabContentView.prototype.showDetailsSidebarPanels):
Rewrite `showDetailsSidebarPanels` in such way that causes no more than one change of selectedSidebarPanel.
Previously, `removeSidebarPanel` would cause the change of selectedSidebarPanel, resulting in showing
a panel with outdated `this.domNode`.

* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
Display a useful error with a relevant location instead of a generic Connection.js error.

* UserInterface/Views/Sidebar.js:
(WI.Sidebar.prototype.removeSidebarPanel):
After removing a panel, don't select the nearest panel. There doesn't seem to be a useful case for it.
The selected panel is determined at the removeSidebarPanel callsites.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (267378 => 267379)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-09-21 22:59:16 UTC (rev 267378)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-09-21 23:09:18 UTC (rev 267379)
@@ -1,3 +1,25 @@
+2020-09-21  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Uncaught Exception: Missing node for given nodeId
+        https://bugs.webkit.org/show_bug.cgi?id=216067
+        <rdar://problem/68520144>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/ContentBrowserTabContentView.js:
+        (WI.ContentBrowserTabContentView.prototype.showDetailsSidebarPanels):
+        Rewrite `showDetailsSidebarPanels` in such way that causes no more than one change of selectedSidebarPanel.
+        Previously, `removeSidebarPanel` would cause the change of selectedSidebarPanel, resulting in showing
+        a panel with outdated `this.domNode`.
+
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        Display a useful error with a relevant location instead of a generic Connection.js error.
+
+        * UserInterface/Views/Sidebar.js:
+        (WI.Sidebar.prototype.removeSidebarPanel):
+        After removing a panel, don't select the nearest panel. There doesn't seem to be a useful case for it.
+        The selected panel is determined at the removeSidebarPanel callsites.
+
 2020-09-21  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: Timelines: remove "stop requested" marker

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js (267378 => 267379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2020-09-21 22:59:16 UTC (rev 267378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2020-09-21 23:09:18 UTC (rev 267379)
@@ -177,6 +177,7 @@
         this._ignoreDetailsSidebarPanelCollapsedEvent = true;
 
         let hiddenSidebarPanels = 0;
+        let sidebarPanelToSelect = null;
 
         for (var i = 0; i < this.detailsSidebarPanels.length; ++i) {
             var sidebarPanel = this.detailsSidebarPanels[i];
@@ -192,7 +193,7 @@
 
                 if (this._lastSelectedDetailsSidebarPanelSetting.value === sidebarPanel.identifier) {
                     // Restore the sidebar panel selection if this sidebar panel was the last one selected by the user.
-                    WI.detailsSidebar.selectedSidebarPanel = sidebarPanel;
+                    sidebarPanelToSelect = sidebarPanel;
                 }
             } else {
                 // The sidebar panel can't inspect the current represented objects, so remove the panel and hide the toolbar item.
@@ -201,7 +202,9 @@
             }
         }
 
-        if (!WI.detailsSidebar.selectedSidebarPanel && WI.detailsSidebar.sidebarPanels.length)
+        if (sidebarPanelToSelect)
+            WI.detailsSidebar.selectedSidebarPanel = sidebarPanelToSelect;
+        else if (!WI.detailsSidebar.selectedSidebarPanel && WI.detailsSidebar.sidebarPanels.length)
             WI.detailsSidebar.selectedSidebarPanel = WI.detailsSidebar.sidebarPanels[0];
 
         if (!WI.detailsSidebar.sidebarPanels.length)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (267378 => 267379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2020-09-21 22:59:16 UTC (rev 267378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2020-09-21 23:09:18 UTC (rev 267379)
@@ -262,6 +262,12 @@
             const args = undefined;
             const generatePreview = false;
             object.callFunction(inspectedPage_node_collectPrototypes, args, generatePreview, nodePrototypesReady.bind(this));
+        }).catch((error) => {
+            // Bail if the DOM node changed while we were waiting for the async response.
+            if (this.domNode !== domNode)
+                return;
+
+            console.assert(false, "Cannot resolve node.", error, domNode);
         });
 
         function nodePrototypesReady(error, object, wasThrown)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js (267378 => 267379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2020-09-21 22:59:16 UTC (rev 267378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2020-09-21 23:09:18 UTC (rev 267379)
@@ -87,7 +87,7 @@
 
     removeSidebarPanel(sidebarPanelOrIdentifierOrIndex)
     {
-        var sidebarPanel = this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);
+        let sidebarPanel = this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);
         if (!sidebarPanel)
             return;
 
@@ -96,11 +96,6 @@
 
         sidebarPanel.selected = false;
 
-        if (this._selectedSidebarPanel === sidebarPanel) {
-            var index = this._sidebarPanels.indexOf(sidebarPanel);
-            this.selectedSidebarPanel = this._sidebarPanels[index - 1] || this._sidebarPanels[index + 1] || null;
-        }
-
         this._sidebarPanels.remove(sidebarPanel);
 
         if (this._navigationBar) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to