[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 13:39:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 46bf01eae4224be376b7fc09176196fbd38af459
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 17:00:53 2010 +0000

    Crash when running plug-in layout tests
    https://bugs.webkit.org/show_bug.cgi?id=46269
    
    Reviewed by Adam Roben.
    
    Store the web page directly in the PluginView class, instead of getting it from the frame
    of the plug-in element; this fixes two crashes, one where the plug-in element had been deallocated
    before the plug-in view, and another where the plug-in element's document did not have a frame.
    
    This also makes things more robust since we're asserting in the WebPage destructor that no plug-ins have
    an outstanding reference to it.
    
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::webPage):
    (WebKit::PluginView::PluginView):
    (WebKit::PluginView::~PluginView):
    (WebKit::PluginView::initializePlugin):
    * WebProcess/Plugins/PluginView.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68052 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5cbe2fb..8ffc948 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,27 @@
 
         Reviewed by Adam Roben.
 
+        Crash when running plug-in layout tests
+        https://bugs.webkit.org/show_bug.cgi?id=46269
+
+        Store the web page directly in the PluginView class, instead of getting it from the frame
+        of the plug-in element; this fixes two crashes, one where the plug-in element had been deallocated
+        before the plug-in view, and another where the plug-in element's document did not have a frame.
+
+        This also makes things more robust since we're asserting in the WebPage destructor that no plug-ins have
+        an outstanding reference to it.
+        
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::webPage):
+        (WebKit::PluginView::PluginView):
+        (WebKit::PluginView::~PluginView):
+        (WebKit::PluginView::initializePlugin):
+        * WebProcess/Plugins/PluginView.h:
+
+2010-09-22  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
         Change a bunch of Vector<char> to Vector<uint8_t> to better indicate that we're
         dealing with raw bytes.
 
diff --git a/WebKit2/WebProcess/Plugins/PluginView.cpp b/WebKit2/WebProcess/Plugins/PluginView.cpp
index 2c7dfc3..d7bb0ea 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -221,10 +221,22 @@ void PluginView::Stream::didFinishLoading(NetscapePlugInStreamLoader*)
     m_pluginView = 0;
 }
 
-PluginView::PluginView(WebCore::HTMLPlugInElement* pluginElement, PassRefPtr<Plugin> plugin, const Plugin::Parameters& parameters)
+static inline WebPage* webPage(HTMLPlugInElement* pluginElement)
+{
+    Frame* frame = pluginElement->document()->frame();
+    ASSERT(frame);
+
+    WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->page();
+    ASSERT(webPage);
+
+    return webPage;
+}
+        
+PluginView::PluginView(HTMLPlugInElement* pluginElement, PassRefPtr<Plugin> plugin, const Plugin::Parameters& parameters)
     : PluginViewBase(0)
     , m_pluginElement(pluginElement)
     , m_plugin(plugin)
+    , m_webPage(webPage(pluginElement))
     , m_parameters(parameters)
     , m_isInitialized(false)
     , m_isWaitingUntilMediaCanStart(false)
@@ -233,14 +245,14 @@ PluginView::PluginView(WebCore::HTMLPlugInElement* pluginElement, PassRefPtr<Plu
     , m_npRuntimeObjectMap(this)
 {
 #if PLATFORM(MAC)
-    webPage()->addPluginView(this);
+    m_webPage->addPluginView(this);
 #endif
 }
 
 PluginView::~PluginView()
 {
 #if PLATFORM(MAC)
-    webPage()->removePluginView(this);
+    m_webPage->removePluginView(this);
 #endif
 
     ASSERT(!m_isBeingDestroyed);
@@ -271,14 +283,6 @@ Frame* PluginView::frame()
     return m_pluginElement->document()->frame();
 }
 
-WebPage* PluginView::webPage()
-{
-    WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame()->loader()->client())->webFrame()->page();
-    ASSERT(webPage);
-    
-    return webPage;
-}
-
 void PluginView::manualLoadDidReceiveResponse(const ResourceResponse& response)
 {
     // Compute the stream related data from the resource response.
@@ -381,9 +385,9 @@ void PluginView::initializePlugin()
         }
     }
 
-    setWindowFrame(webPage()->windowFrame());
-    setWindowIsVisible(webPage()->windowIsVisible());
-    setWindowIsFocused(webPage()->windowIsFocused());
+    setWindowFrame(m_webPage->windowFrame());
+    setWindowIsVisible(m_webPage->windowIsVisible());
+    setWindowIsFocused(m_webPage->windowIsFocused());
 #endif
 }
 
diff --git a/WebKit2/WebProcess/Plugins/PluginView.h b/WebKit2/WebProcess/Plugins/PluginView.h
index a7f9f8f..3838c1d 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/WebKit2/WebProcess/Plugins/PluginView.h
@@ -71,8 +71,6 @@ private:
     PluginView(WebCore::HTMLPlugInElement*, PassRefPtr<Plugin>, const Plugin::Parameters& parameters);
     virtual ~PluginView();
 
-    WebPage* webPage();
-
     void initializePlugin();
     void destroyPlugin();
 
@@ -132,6 +130,7 @@ private:
 
     WebCore::HTMLPlugInElement* m_pluginElement;
     RefPtr<Plugin> m_plugin;
+    WebPage* m_webPage;
     Plugin::Parameters m_parameters;
     
     bool m_isInitialized;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list