Title: [110776] trunk/Source/WebCore
Revision
110776
Author
[email protected]
Date
2012-03-14 16:08:51 -0700 (Wed, 14 Mar 2012)

Log Message

<rdar://problem/11045584> and https://bugs.webkit.org/show_bug.cgi?id=81166 Repro crash in compositing/iframes/page-cache-layer-tree.html

Reviewed by Sam Weinig.

No new tests. (Discovered from and covered by existing test)

ScriptCachedFrameData doesn't need to keep a DOMWindow:
* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
* bindings/js/ScriptCachedFrameData.h:
(ScriptCachedFrameData):

CachedFrame should grab it off the Frame directly and store it locally:
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
* history/CachedFrame.h:
(WebCore::CachedFrameBase::domWindow):
(CachedFrameBase):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110775 => 110776)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 23:01:05 UTC (rev 110775)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 23:08:51 UTC (rev 110776)
@@ -1,3 +1,25 @@
+2012-03-14  Brady Eidson  <[email protected]>
+
+        <rdar://problem/11045584> and https://bugs.webkit.org/show_bug.cgi?id=81166
+        Repro crash in compositing/iframes/page-cache-layer-tree.html
+
+        Reviewed by Sam Weinig.
+
+        No new tests. (Discovered from and covered by existing test)
+
+        ScriptCachedFrameData doesn't need to keep a DOMWindow:
+        * bindings/js/ScriptCachedFrameData.cpp:
+        (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+        * bindings/js/ScriptCachedFrameData.h:
+        (ScriptCachedFrameData):
+
+        CachedFrame should grab it off the Frame directly and store it locally:
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrame::CachedFrame):
+        * history/CachedFrame.h:
+        (WebCore::CachedFrameBase::domWindow):
+        (CachedFrameBase):
+
 2012-03-14  Tony Chang  <[email protected]>
 
         fix negative flexing in auto sized columns

Modified: trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp (110775 => 110776)


--- trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp	2012-03-14 23:01:05 UTC (rev 110775)
+++ trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp	2012-03-14 23:08:51 UTC (rev 110776)
@@ -45,7 +45,6 @@
 namespace WebCore {
 
 ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame)
-    : m_domWindow(0)
 {
     JSLock lock(SilenceAssertionsOnly);
 
@@ -56,17 +55,11 @@
     for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
         JSDOMWindow* window = iter->second->window();
         m_windows.add(iter->first.get(), Strong<JSDOMWindow>(window->globalData(), window));
-        m_domWindow = window->impl();
     }
 
     scriptController->attachDebugger(0);
 }
 
-DOMWindow* ScriptCachedFrameData::domWindow() const
-{
-    return m_domWindow;
-}
-
 ScriptCachedFrameData::~ScriptCachedFrameData()
 {
     clear();

Modified: trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h (110775 => 110776)


--- trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h	2012-03-14 23:01:05 UTC (rev 110775)
+++ trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h	2012-03-14 23:08:51 UTC (rev 110776)
@@ -38,7 +38,6 @@
 namespace WebCore {
     class Frame;
     class JSDOMWindow;
-    class DOMWindow;
     class DOMWrapperWorld;
 
     class ScriptCachedFrameData {
@@ -51,11 +50,9 @@
 
         void restore(Frame*);
         void clear();
-        DOMWindow* domWindow() const;
 
     private:
         JSDOMWindowSet m_windows;
-        DOMWindow* m_domWindow;
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/history/CachedFrame.cpp (110775 => 110776)


--- trunk/Source/WebCore/history/CachedFrame.cpp	2012-03-14 23:01:05 UTC (rev 110775)
+++ trunk/Source/WebCore/history/CachedFrame.cpp	2012-03-14 23:08:51 UTC (rev 110776)
@@ -173,10 +173,11 @@
     m_document->suspendScriptedAnimationControllerCallbacks();
     m_document->suspendActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive);
     m_cachedFrameScriptData = adoptPtr(new ScriptCachedFrameData(frame));
-    
-    if (DOMWindow* domWindow = m_cachedFrameScriptData->domWindow())
-        domWindow->suspendForPageCache();
 
+    m_domWindow = frame->domWindow();
+    ASSERT(m_domWindow);
+    m_domWindow->suspendForPageCache();
+
     frame->loader()->client()->savePlatformDataToCachedFrame(this);
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/history/CachedFrame.h (110775 => 110776)


--- trunk/Source/WebCore/history/CachedFrame.h	2012-03-14 23:01:05 UTC (rev 110775)
+++ trunk/Source/WebCore/history/CachedFrame.h	2012-03-14 23:08:51 UTC (rev 110776)
@@ -26,6 +26,7 @@
 #ifndef CachedFrame_h
 #define CachedFrame_h
 
+#include "DOMWindow.h"
 #include "KURL.h"
 #include "ScriptCachedFrameData.h"
 #include <wtf/PassOwnPtr.h>
@@ -50,7 +51,7 @@
     Document* document() const { return m_document.get(); }
     FrameView* view() const { return m_view.get(); }
     const KURL& url() const { return m_url; }
-    DOMWindow* domWindow() const { return m_cachedFrameScriptData->domWindow(); }
+    DOMWindow* domWindow() const { return m_domWindow.get(); }
     bool isMainFrame() { return m_isMainFrame; }
 
 protected:
@@ -59,6 +60,7 @@
     
     RefPtr<Document> m_document;
     RefPtr<DocumentLoader> m_documentLoader;
+    RefPtr<DOMWindow> m_domWindow;
     RefPtr<FrameView> m_view;
     RefPtr<Node> m_mousePressNode;
     KURL m_url;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to