2006-09-12 Anders Carlsson <acarlsson@apple.com>
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 17:48:45 +0000 (17:48 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 17:48:45 +0000 (17:48 +0000)
        Reviewed by John Sullivan.

        Do the plugin object cleanup in Frame::clear instead of setView.

        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::setView):
        (WebCore::FrameMac::cleanupPluginObjects):
        * page/Frame.cpp:
        (WebCore::Frame::clear):
        * page/Frame.h:

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

WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/page/Frame.cpp
WebCore/page/Frame.h

index 948f8877a7ef0eec042badae39721f6890c8907c..54e67921e4440ed2c995a5e88bb94b05be053fbc 100644 (file)
@@ -1,3 +1,17 @@
+2006-09-12  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by John Sullivan.
+
+        Do the plugin object cleanup in Frame::clear instead of setView.
+        
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::setView):
+        (WebCore::FrameMac::cleanupPluginObjects):
+        * page/Frame.cpp:
+        (WebCore::Frame::clear):
+        * page/Frame.h:
+
 2006-09-12  MorganL  <morlmor@yahoo.com>
 
         Reviewed/landed by aroben.
index 553e9cdd85350dd76100c46c7665be4abe182822..10481de14ed0573780afe6fa1a9e40d546d10b93 100644 (file)
@@ -249,7 +249,6 @@ public:
     virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
     virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
     void addPluginRootObject(KJS::Bindings::RootObject* root);
-    void cleanupPluginRootObjects();
     
     virtual void registerCommandForUndo(PassRefPtr<EditCommand>);
     virtual void registerCommandForRedo(PassRefPtr<EditCommand>);
@@ -323,7 +322,8 @@ public:
 protected:
     virtual void startRedirectionTimer();
     virtual void stopRedirectionTimer();
-
+    virtual void cleanupPluginObjects();
+    
 private:
     virtual void handleMousePressEvent(const MouseEventWithHitTestResults&);
     virtual void handleMouseMoveEvent(const MouseEventWithHitTestResults&);
index 644a54dab63fa60158de2afd6072e3049c477d8f..7b2f47b9996ba1f2886d2a2ec8379b8e9af05d75 100644 (file)
@@ -580,20 +580,6 @@ void FrameMac::setView(FrameView *view)
     
     d->m_view = view;
     
-    // Delete old PlugIn data structures
-    cleanupPluginRootObjects();
-    _bindingRoot = 0;
-    HardRelease(_windowScriptObject);
-    _windowScriptObject = 0;
-
-    if (_windowScriptNPObject) {
-        // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window
-        // script object properly.
-        // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point.
-        _NPN_DeallocateObject(_windowScriptNPObject);
-        _windowScriptNPObject = 0;
-    }
-
     // Only one form submission is allowed per view of a part.
     // Since this part may be getting reused as a result of being
     // pulled from the back/forward cache, reset this flag.
@@ -3038,14 +3024,27 @@ void FrameMac::addPluginRootObject(KJS::Bindings::RootObject *root)
     m_rootObjects.append(root);
 }
 
-void FrameMac::cleanupPluginRootObjects()
+void FrameMac::cleanupPluginObjects()
 {
+    // Delete old plug-in data structures
     JSLock lock;
-
+    
     unsigned count = m_rootObjects.size();
     for (unsigned i = 0; i < count; i++)
         m_rootObjects[i]->removeAllNativeReferences();
     m_rootObjects.clear();
+    
+    _bindingRoot = 0;
+    HardRelease(_windowScriptObject);
+    _windowScriptObject = 0;
+    
+    if (_windowScriptNPObject) {
+        // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window
+        // script object properly.
+        // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point.
+        _NPN_DeallocateObject(_windowScriptNPObject);
+        _windowScriptNPObject = 0;
+    }
 }
 
 void FrameMac::registerCommandForUndoOrRedo(PassRefPtr<EditCommand> cmd, bool isRedo)
index eb80d201f17339af0d3ba50e6972c07f5567211e..ce88276dd257293a1a1571308bdae7e39f20b82f 100644 (file)
@@ -453,7 +453,8 @@ void Frame::clear(bool clearWindowProperties)
   d->m_decoder = 0;
 
   d->m_plugins.clear();
-
+  cleanupPluginObjects();
+  
   d->m_scheduledRedirection = noRedirectionScheduled;
   d->m_delayRedirect = 0;
   d->m_redirectURL = DeprecatedString::null;
index 2e54ecbae2475a850cd8c4b835524334230b81a0..25d1c18fe79a35efcdc1e970d5cc1e20cc393d2f 100644 (file)
@@ -750,6 +750,7 @@ private:
 protected:
     virtual void startRedirectionTimer();
     virtual void stopRedirectionTimer();
+    virtual void cleanupPluginObjects() { }
     
     void handleAutoscroll(RenderLayer*);
     void startAutoscrollTimer();