Title: [95204] trunk
Revision
95204
Author
[email protected]
Date
2011-09-15 11:40:04 -0700 (Thu, 15 Sep 2011)

Log Message

2011-09-15  James Simonsen  <[email protected]>

        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
        https://bugs.webkit.org/show_bug.cgi?id=68014

        Reviewed by Adam Barth.

        * plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt: Added.
        * plugins/destroy-during-npp-new-object-with-fallback-content.html: Added. Derivative of destroy-during-npp-new.html.
2011-09-15  James Simonsen  <[email protected]>

        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
        https://bugs.webkit.org/show_bug.cgi?id=68014

        Reviewed by Adam Barth.

        Test: plugins/destroy-during-npp-new.html under valgrind
              plugins/destroy-during-npp-new-object-with-fallback-content.html under valgrind

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::updateWidget):
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::updateWidget):
2011-09-15  James Simonsen  <[email protected]>

        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
        https://bugs.webkit.org/show_bug.cgi?id=68014

        Reviewed by Adam Barth.

        * src/FrameLoaderClientImpl.cpp:
        (WebKit::FrameLoaderClientImpl::createPlugin): Moved protection up to HTMLObjectElement and HTMLEmbedElement.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95203 => 95204)


--- trunk/LayoutTests/ChangeLog	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/LayoutTests/ChangeLog	2011-09-15 18:40:04 UTC (rev 95204)
@@ -1,3 +1,13 @@
+2011-09-15  James Simonsen  <[email protected]>
+
+        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
+        https://bugs.webkit.org/show_bug.cgi?id=68014
+
+        Reviewed by Adam Barth.
+
+        * plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt: Added.
+        * plugins/destroy-during-npp-new-object-with-fallback-content.html: Added. Derivative of destroy-during-npp-new.html.
+
 2011-09-14  Sam Weinig  <[email protected]>
 
         Experiment with removing ability to call a collection (except document.all)

Added: trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt (0 => 95204)


--- trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt	2011-09-15 18:40:04 UTC (rev 95204)
@@ -0,0 +1 @@
+SUCCESS
Property changes on: trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content.html (0 => 95204)


--- trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content.html	                        (rev 0)
+++ trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content.html	2011-09-15 18:40:04 UTC (rev 95204)
@@ -0,0 +1,42 @@
+<html>
+<head>
+    <script type="text/_javascript_">
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.setCanOpenWindows();
+        layoutTestController.waitUntilDone();
+    }
+
+    var newWindow = window.open("data:text/html,Hello world!")
+
+    function tryCloseWindow(w) {
+        if (!w)
+            return;
+
+        w.close();
+
+        function doneIfClosed() {
+            if (w.closed) {
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+                return;
+            }
+            setTimeout(doneIfClosed, 1);
+        };
+        doneIfClosed();
+    }
+
+    window._onload_ = function() {
+        tryCloseWindow(newWindow);
+
+        var testPlugin = document.getElementById('testPlugin');
+        if (!testPlugin || !testPlugin.parentNode)
+            document.documentElement.appendChild(document.createTextNode("SUCCESS"));
+    }
+    </script>
+</head>
+<body>
+    <p>This tests a plug-in that removes itself from the document during NPP_New.  It passes if it does not crash during removal (<a href="" or when a window is next closed (<a href=""
+    <object id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200" cleardocumentduringnew>fallback content</object>
+</body>
+</html>
Property changes on: trunk/LayoutTests/plugins/destroy-during-npp-new-object-with-fallback-content.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (95203 => 95204)


--- trunk/Source/WebCore/ChangeLog	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/Source/WebCore/ChangeLog	2011-09-15 18:40:04 UTC (rev 95204)
@@ -1,3 +1,18 @@
+2011-09-15  James Simonsen  <[email protected]>
+
+        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
+        https://bugs.webkit.org/show_bug.cgi?id=68014
+
+        Reviewed by Adam Barth.
+
+        Test: plugins/destroy-during-npp-new.html under valgrind
+              plugins/destroy-during-npp-new-object-with-fallback-content.html under valgrind
+
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateWidget):
+
 2011-09-15  Sam Weinig  <[email protected]>
 
         Experiment with removing ability to call a collection (except document.all)

Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (95203 => 95204)


--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2011-09-15 18:40:04 UTC (rev 95204)
@@ -178,6 +178,7 @@
         return;
     }
 
+    RefPtr<HTMLEmbedElement> protect(this); // Loading the plugin might remove us from the document.
     SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
     // FIXME: beforeLoad could have detached the renderer!  Just like in the <object> case above.
     loader->requestObject(this, m_url, getAttribute(nameAttr), m_serviceType, paramNames, paramValues);

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (95203 => 95204)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2011-09-15 18:40:04 UTC (rev 95204)
@@ -327,6 +327,7 @@
     if (!renderer())
         return;
 
+    RefPtr<HTMLObjectElement> protect(this); // Loading the plugin might remove us from the document.
     SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
     bool success = beforeLoadAllowedLoad && hasValidClassId() && loader->requestObject(this, url, getAttribute(nameAttr), serviceType, paramNames, paramValues);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (95203 => 95204)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-15 18:40:04 UTC (rev 95204)
@@ -1,3 +1,13 @@
+2011-09-15  James Simonsen  <[email protected]>
+
+        Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins
+        https://bugs.webkit.org/show_bug.cgi?id=68014
+
+        Reviewed by Adam Barth.
+
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::createPlugin): Moved protection up to HTMLObjectElement and HTMLEmbedElement.
+
 2011-09-15  David Levin  <[email protected]>
 
         [chromium] Attempt to fix the shared build after r95188.

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (95203 => 95204)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2011-09-15 18:27:48 UTC (rev 95203)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2011-09-15 18:40:04 UTC (rev 95204)
@@ -1486,8 +1486,6 @@
     if (!m_webFrame->client())
         return 0;
 
-    RefPtr<HTMLPlugInElement> protect(element);
-
     WebPluginParams params;
     params.url = ""
     params.mimeType = mimeType;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to