Title: [282607] trunk/Source/WebInspectorUI
Revision
282607
Author
pan...@apple.com
Date
2021-09-16 15:23:15 -0700 (Thu, 16 Sep 2021)

Log Message

Web Inspector: `FrameDOMTreeContentView` may update after it has `closed` called, causing hangs on some webpages on reload
https://bugs.webkit.org/show_bug.cgi?id=230186

Reviewed by Devin Rousso.

`FrameDOMTreeContentView` may be `closed` between a call to `_requestRootDOMNode` and the response being
provided to `_rootDOMNodeAvailable`. This can result in an attempt to select a DOM node in an old and detached
DOM tree. To combat this, add a flag to `ContentView` to mark a closed `ContentView` as such, and then return
early from `_rootDOMNodeAvailable` if the `ContentView` is already closed.

* UserInterface/Views/ContentView.js:
(WI.ContentView):
(WI.ContentView.prototype.closed):
(WI.ContentView.prototype.get isClosed):
* UserInterface/Views/FrameDOMTreeContentView.js:
(WI.FrameDOMTreeContentView.prototype._rootDOMNodeAvailable):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (282606 => 282607)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-09-16 22:20:35 UTC (rev 282606)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-09-16 22:23:15 UTC (rev 282607)
@@ -1,3 +1,22 @@
+2021-09-16  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: `FrameDOMTreeContentView` may update after it has `closed` called, causing hangs on some webpages on reload
+        https://bugs.webkit.org/show_bug.cgi?id=230186
+
+        Reviewed by Devin Rousso.
+
+        `FrameDOMTreeContentView` may be `closed` between a call to `_requestRootDOMNode` and the response being
+        provided to `_rootDOMNodeAvailable`. This can result in an attempt to select a DOM node in an old and detached
+        DOM tree. To combat this, add a flag to `ContentView` to mark a closed `ContentView` as such, and then return
+        early from `_rootDOMNodeAvailable` if the `ContentView` is already closed.
+
+        * UserInterface/Views/ContentView.js:
+        (WI.ContentView):
+        (WI.ContentView.prototype.closed):
+        (WI.ContentView.prototype.get isClosed):
+        * UserInterface/Views/FrameDOMTreeContentView.js:
+        (WI.FrameDOMTreeContentView.prototype._rootDOMNodeAvailable):
+
 2021-09-15  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: `TreeOutline` should return early when failing to find an ancestor while populating the tree

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js (282606 => 282607)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js	2021-09-16 22:20:35 UTC (rev 282606)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js	2021-09-16 22:23:15 UTC (rev 282607)
@@ -37,6 +37,7 @@
         this.element.classList.add("content-view");
 
         this._parentContainer = null;
+        this._isClosed = false;
     }
 
     // Static
@@ -338,6 +339,8 @@
 
     // Public
 
+    get isClosed() { return this._isClosed; }
+
     get representedObject()
     {
         return this._representedObject;
@@ -393,6 +396,7 @@
     closed()
     {
         // Implemented by subclasses.
+        this._isClosed = true;
     }
 
     saveToCookie(cookie)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js (282606 => 282607)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js	2021-09-16 22:20:35 UTC (rev 282606)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js	2021-09-16 22:23:15 UTC (rev 282607)
@@ -62,6 +62,9 @@
 
     _rootDOMNodeAvailable(rootDOMNode)
     {
+        if (this.isClosed)
+            return;
+
         this.domTreeOutline.rootDOMNode = rootDOMNode;
 
         if (!rootDOMNode) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to