Title: [115498] trunk/Source/WebCore
Revision
115498
Author
[email protected]
Date
2012-04-27 14:55:29 -0700 (Fri, 27 Apr 2012)

Log Message

If you get a list of DOMWrapperWorld*'s and then plan to allocate in the heap, you should ref
the DOMWrapperWorld*'s
https://bugs.webkit.org/show_bug.cgi?id=85098
<rdar://problem/11318170>

Reviewed by Sam Weinig.

No new tests because this addresses hard-to-repro flaky behavior arising from GCs at inconvenient
times.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::getAllWorlds):
* bindings/js/ScriptController.h:
(ScriptController):
* bindings/js/WebCoreJSClientData.h:
(WebCore::WebCoreJSClientData::getAllWorlds):
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::getAllWorlds):
* bindings/v8/ScriptController.h:
(ScriptController):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds):
(WebCore::FrameLoader::dispatchGlobalObjectAvailableInAllWorlds):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115497 => 115498)


--- trunk/Source/WebCore/ChangeLog	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/ChangeLog	2012-04-27 21:55:29 UTC (rev 115498)
@@ -1,3 +1,29 @@
+2012-04-27  Filip Pizlo  <[email protected]>
+
+        If you get a list of DOMWrapperWorld*'s and then plan to allocate in the heap, you should ref
+        the DOMWrapperWorld*'s
+        https://bugs.webkit.org/show_bug.cgi?id=85098
+        <rdar://problem/11318170>
+
+        Reviewed by Sam Weinig.
+
+        No new tests because this addresses hard-to-repro flaky behavior arising from GCs at inconvenient
+        times.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::getAllWorlds):
+        * bindings/js/ScriptController.h:
+        (ScriptController):
+        * bindings/js/WebCoreJSClientData.h:
+        (WebCore::WebCoreJSClientData::getAllWorlds):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::getAllWorlds):
+        * bindings/v8/ScriptController.h:
+        (ScriptController):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds):
+        (WebCore::FrameLoader::dispatchGlobalObjectAvailableInAllWorlds):
+
 2012-04-27  Geoffrey Garen  <[email protected]>
 
         Removed the sole use of Weak<Unknown>

Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (115497 => 115498)


--- trunk/Source/WebCore/bindings/js/ScriptController.cpp	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp	2012-04-27 21:55:29 UTC (rev 115498)
@@ -167,7 +167,7 @@
     return DOMWrapperWorld::create(JSDOMWindow::commonJSGlobalData());
 }
 
-void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
+void ScriptController::getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds)
 {
     static_cast<WebCoreJSClientData*>(JSDOMWindow::commonJSGlobalData()->clientData)->getAllWorlds(worlds);
 }

Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (115497 => 115498)


--- trunk/Source/WebCore/bindings/js/ScriptController.h	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h	2012-04-27 21:55:29 UTC (rev 115498)
@@ -84,7 +84,7 @@
         return windowShell(world)->window();
     }
 
-    static void getAllWorlds(Vector<DOMWrapperWorld*>&);
+    static void getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >&);
 
     ScriptValue executeScript(const ScriptSourceCode&);
     ScriptValue executeScript(const String& script, bool forceUserGesture = false);

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h (115497 => 115498)


--- trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2012-04-27 21:55:29 UTC (rev 115498)
@@ -47,7 +47,7 @@
 
     DOMWrapperWorld* normalWorld() { return m_normalWorld.get(); }
 
-    void getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
+    void getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds)
     {
         copyToVector(m_worldSet, worlds);
     }

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (115497 => 115498)


--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-04-27 21:55:29 UTC (rev 115498)
@@ -377,7 +377,7 @@
     m_pluginObjects.remove(it);
 }
 
-void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
+void ScriptController::getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds)
 {
     worlds.append(mainThreadNormalWorld());
 }

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (115497 => 115498)


--- trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-04-27 21:55:29 UTC (rev 115498)
@@ -186,7 +186,7 @@
 
     // Dummy method to avoid a bunch of ifdef's in WebCore.
     void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
-    static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds);
+    static void getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds);
 
 private:
     Frame* m_frame;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (115497 => 115498)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-04-27 21:47:49 UTC (rev 115497)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-04-27 21:55:29 UTC (rev 115498)
@@ -3090,10 +3090,10 @@
     if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript))
         return;
 
-    Vector<DOMWrapperWorld*> worlds;
+    Vector<RefPtr<DOMWrapperWorld> > worlds;
     ScriptController::getAllWorlds(worlds);
     for (size_t i = 0; i < worlds.size(); ++i)
-        dispatchDidClearWindowObjectInWorld(worlds[i]);
+        dispatchDidClearWindowObjectInWorld(worlds[i].get());
 }
 
 void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
@@ -3113,10 +3113,10 @@
 
 void FrameLoader::dispatchGlobalObjectAvailableInAllWorlds()
 {
-    Vector<DOMWrapperWorld*> worlds;
+    Vector<RefPtr<DOMWrapperWorld> > worlds;
     ScriptController::getAllWorlds(worlds);
     for (size_t i = 0; i < worlds.size(); ++i)
-        m_client->dispatchGlobalObjectAvailable(worlds[i]);
+        m_client->dispatchGlobalObjectAvailable(worlds[i].get());
 }
 
 SandboxFlags FrameLoader::effectiveSandboxFlags() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to