Title: [255937] releases/WebKitGTK/webkit-2.28/Source/WebCore
Revision
255937
Author
[email protected]
Date
2020-02-06 07:11:01 -0800 (Thu, 06 Feb 2020)

Log Message

Merge r255885 - Web Inspector: ensure that `didClearWindowObjectInWorld` is dispatched for the main world first
https://bugs.webkit.org/show_bug.cgi?id=207232

Reviewed by Timothy Hatcher.

It is necessary to order the `DOMWrapperWorld`s because certain callers expect the main
world to be the first item in the list, as they use the main world as an indicator of when
the page is ready to start evaluating _javascript_. For example, Web Inspector waits for the
main world change to clear any injected scripts and debugger/breakpoint state.

* bindings/js/WebCoreJSClientData.cpp:
(WebCore::JSVMClientData::getAllWorlds):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog (255936 => 255937)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-06 15:10:57 UTC (rev 255936)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-06 15:11:01 UTC (rev 255937)
@@ -1,3 +1,18 @@
+2020-02-05  Devin Rousso  <[email protected]>
+
+        Web Inspector: ensure that `didClearWindowObjectInWorld` is dispatched for the main world first
+        https://bugs.webkit.org/show_bug.cgi?id=207232
+
+        Reviewed by Timothy Hatcher.
+
+        It is necessary to order the `DOMWrapperWorld`s because certain callers expect the main
+        world to be the first item in the list, as they use the main world as an indicator of when
+        the page is ready to start evaluating _javascript_. For example, Web Inspector waits for the
+        main world change to clear any injected scripts and debugger/breakpoint state.
+
+        * bindings/js/WebCoreJSClientData.cpp:
+        (WebCore::JSVMClientData::getAllWorlds):
+
 2020-02-05  Andres Gonzalez  <[email protected]>
 
         Check for null return from AXIsolatedTree::nodeForID.

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/bindings/js/WebCoreJSClientData.cpp (255936 => 255937)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/bindings/js/WebCoreJSClientData.cpp	2020-02-06 15:10:57 UTC (rev 255936)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/bindings/js/WebCoreJSClientData.cpp	2020-02-06 15:11:01 UTC (rev 255937)
@@ -104,10 +104,35 @@
 void JSVMClientData::getAllWorlds(Vector<Ref<DOMWrapperWorld>>& worlds)
 {
     ASSERT(worlds.isEmpty());
-    
+
     worlds.reserveInitialCapacity(m_worldSet.size());
-    for (auto it = m_worldSet.begin(), end = m_worldSet.end(); it != end; ++it)
-        worlds.uncheckedAppend(*(*it));
+
+    // It is necessary to order the `DOMWrapperWorld`s because certain callers expect the main world
+    // to be the first item in the list, as they use the main world as an indicator of when the page
+    // is ready to start evaluating _javascript_. For example, Web Inspector waits for the main world
+    // change to clear any injected scripts and debugger/breakpoint state.
+
+    auto& mainNormalWorld = mainThreadNormalWorld();
+
+    // Add main normal world.
+    if (m_worldSet.contains(&mainNormalWorld))
+        worlds.uncheckedAppend(mainNormalWorld);
+
+    // Add other normal worlds.
+    for (auto* world : m_worldSet) {
+        if (world->type() != DOMWrapperWorld::Type::Normal)
+            continue;
+        if (world == &mainNormalWorld)
+            continue;
+        worlds.uncheckedAppend(*world);
+    }
+
+    // Add non-normal worlds.
+    for (auto* world : m_worldSet) {
+        if (world->type() == DOMWrapperWorld::Type::Normal)
+            continue;
+        worlds.uncheckedAppend(*world);
+    }
 }
 
 void JSVMClientData::initNormalWorld(VM* vm)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to