2008-05-30 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 May 2008 10:40:19 +0000 (10:40 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 May 2008 10:40:19 +0000 (10:40 +0000)
        Revert fix for 19285, it just caused more crashes and I need time
        to fix it properly.

        * bindings/js/JSDOMWindowBase.cpp:
        (WebCore::JSDOMWindowBase::~JSDOMWindowBase):
        * bindings/js/JSDOMWindowShell.cpp:
        (WebCore::JSDOMWindowShell::JSDOMWindowShell):
        (WebCore::JSDOMWindowShell::updateDocument):
        * bindings/js/JSDOMWindowShell.h:
        (WebCore::JSDOMWindowShell::setWindow):
        (WebCore::JSDOMWindowShell::clearFormerWindow):
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::clear):
        (WebCore::KJSProxy::initScript):
        * bindings/js/kjs_proxy.h:
        * page/Frame.cpp:
        (WebCore::Frame::setDocument):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34261 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowShell.cpp
WebCore/bindings/js/JSDOMWindowShell.h
WebCore/bindings/js/kjs_proxy.cpp
WebCore/bindings/js/kjs_proxy.h
WebCore/page/Frame.cpp

index 98e9b8430553429d3325b0a7a6f48785fcdbb0d3..d14b5c5d20966507edcd16d2dbcc1ce38702f5d7 100644 (file)
@@ -1,3 +1,23 @@
+2008-05-30  Maciej Stachowiak  <mjs@apple.com>
+
+        Revert fix for 19285, it just caused more crashes and I need time
+        to fix it properly.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::~JSDOMWindowBase):
+        * bindings/js/JSDOMWindowShell.cpp:
+        (WebCore::JSDOMWindowShell::JSDOMWindowShell):
+        (WebCore::JSDOMWindowShell::updateDocument):
+        * bindings/js/JSDOMWindowShell.h:
+        (WebCore::JSDOMWindowShell::setWindow):
+        (WebCore::JSDOMWindowShell::clearFormerWindow):
+        * bindings/js/kjs_proxy.cpp:
+        (WebCore::KJSProxy::clear):
+        (WebCore::KJSProxy::initScript):
+        * bindings/js/kjs_proxy.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::setDocument):
+
 2008-05-30  Adam Treat  <treat@kde.org>
 
         Reviewed by Simon.
index d266d0199aef0d3bceadda83dd9f546d7fe6e028..35ecfa6c70d66eeedbb7fbe14c270b4b5248e98b 100644 (file)
@@ -202,8 +202,7 @@ void JSDOMWindowBase::updateDocument()
 
 JSDOMWindowBase::~JSDOMWindowBase()
 {
-    if (m_impl->frame())
-        m_impl->frame()->scriptProxy()->clearFormerWindow(asJSDOMWindow(this));
+    d->m_shell->clearFormerWindow(asJSDOMWindow(this));
 
     clearAllTimeouts();
 
index 7b5c31fb672a4b00faf5422999c41c2209076f8a..00220ba14e22af30a0f930ac6d0ea21416a53c09 100644 (file)
@@ -44,6 +44,7 @@ const ClassInfo JSDOMWindowShell::s_info = { "JSDOMWindowShell", 0, 0, 0 };
 JSDOMWindowShell::JSDOMWindowShell(DOMWindow* domWindow)
     : Base(jsNull())
     , m_window(0)
+    , m_liveFormerWindows(new HashSet<JSDOMWindow*>)
 {
     m_window = new JSDOMWindow(domWindow, this);
     setPrototype(m_window->prototype());
@@ -144,6 +145,14 @@ void JSDOMWindowShell::clear()
 }
 
 
+void JSDOMWindowShell::updateDocument()
+{
+    m_window->updateDocument();
+    HashSet<JSDOMWindow*>::iterator end = m_liveFormerWindows->end();
+    for (HashSet<JSDOMWindow*>::iterator it = m_liveFormerWindows->begin(); it != end; ++it)
+        (*it)->updateDocument();
+}
+
 // ----
 // Conversion methods
 // ----
index 398001006256528e24b0c9d46090b7a5b21ea906..57c272ce792bbfb43c6bb021ebff5d5fc26413a7 100644 (file)
@@ -47,6 +47,7 @@ namespace WebCore {
         void setWindow(JSDOMWindow* window)
         {
             ASSERT_ARG(window, window);
+            m_liveFormerWindows->add(m_window);
             m_window = window;
             setPrototype(window->prototype());
         }
@@ -75,9 +76,13 @@ namespace WebCore {
         DOMWindow* impl() const;
         void disconnectFrame();
         void clear();
+        void updateDocument();
+
+        void clearFormerWindow(JSDOMWindow* window) { m_liveFormerWindows->remove(window); }
 
     private:
         JSDOMWindow* m_window;
+        HashSet<JSDOMWindow*>* m_liveFormerWindows;
     };
 
     KJS::JSValue* toJS(KJS::ExecState*, Frame*);
index ba098b133dc23d4919f8c16c6586cc0cf05ee3a4..bb11460b522ae2694ad7b087b6921bc6bd686862 100644 (file)
@@ -112,7 +112,6 @@ void KJSProxy::clear()
 
     JSLock lock;
     m_windowShell->window()->clear();
-    m_liveFormerWindows.add(m_windowShell->window());
     m_windowShell->setWindow(new JSDOMWindow(m_frame->domWindow(), m_windowShell));
     if (Page* page = m_frame->page()) {
         attachDebugger(page->debugger());
@@ -156,7 +155,7 @@ void KJSProxy::initScript()
     JSLock lock;
 
     m_windowShell = new JSDOMWindowShell(m_frame->domWindow());
-    updateDocument();
+    m_windowShell->updateDocument();
 
     if (Page* page = m_frame->page()) {
         attachDebugger(page->debugger());
@@ -211,15 +210,4 @@ void KJSProxy::attachDebugger(KJS::Debugger* debugger)
         currentDebugger->detach(m_windowShell->window());
 }
 
-void KJSProxy::updateDocument()
-{
-    JSLock lock;
-    if (m_windowShell)
-        m_windowShell->window()->updateDocument();
-    HashSet<JSDOMWindow*>::iterator end = m_liveFormerWindows.end();
-    for (HashSet<JSDOMWindow*>::iterator it = m_liveFormerWindows.begin(); it != end; ++it)
-        (*it)->updateDocument();
-}
-
-
 } // namespace WebCore
index 732a4f2f5818ece0df19ff930985d77e31573386..b74b196036247a43903f3082898f7a5bbab656ac 100644 (file)
@@ -77,9 +77,6 @@ public:
     void setPaused(bool b) { m_paused = b; }
     bool isPaused() const { return m_paused; }
 
-    void clearFormerWindow(JSDOMWindow* window) { m_liveFormerWindows.remove(window); }
-    void updateDocument();
-
 private:
     void initScriptIfNeeded()
     {
@@ -89,7 +86,6 @@ private:
     void initScript();
 
     KJS::ProtectedPtr<JSDOMWindowShell> m_windowShell;
-    HashSet<JSDOMWindow*> m_liveFormerWindows;
     Frame* m_frame;
     int m_handlerLineno;
     
index c74f84262fd6c45f4c525a104221b5a0d517d5b8..08aa942037b39a21eccb6edd385622818862cb60 100644 (file)
@@ -260,7 +260,10 @@ void Frame::setDocument(PassRefPtr<Document> newDoc)
         d->m_doc->attach();
 
     // Update the cached 'document' property, which is now stale.
-    d->m_jscript.updateDocument();
+    if (d->m_doc && d->m_jscript.haveWindowShell()) {
+        JSLock lock;
+        d->m_jscript.windowShell()->updateDocument();
+    }
 }
 
 Settings* Frame::settings() const