Title: [105938] trunk
- Revision
- 105938
- Author
- [email protected]
- Date
- 2012-01-25 16:00:03 -0800 (Wed, 25 Jan 2012)
Log Message
HTMLEmbedObject should match HTMLObjectElement by stopping any load when it is removed from beforeload
https://bugs.webkit.org/show_bug.cgi?id=74360
Reviewed by Adam Barth.
Source/WebCore:
Neither of these !renderer() checks is strictly necessary since requestObject()
makes the same check. However requestObject() asserts before it makes that
check, so it makes sense to add the check to HTMLEmebedObject instead of
removing the check from HTMLObjectElement.
I also moved the protect RefPtr to before the beforeload dispatch since
beforeload can remove the whole DOM element (as this test does) and
thus I beleive the renderer() check could be checking free'd memory.
Updated fast/dom/beforeload/remove-flash-in-beforeload-listener.html to test
<embed> as well as <object>.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
LayoutTests:
Test <embed> as well as <object> in this test.
* fast/dom/beforeload/remove-flash-in-beforeload-listener.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (105937 => 105938)
--- trunk/LayoutTests/ChangeLog 2012-01-25 23:56:30 UTC (rev 105937)
+++ trunk/LayoutTests/ChangeLog 2012-01-26 00:00:03 UTC (rev 105938)
@@ -1,3 +1,14 @@
+2012-01-25 Eric Seidel <[email protected]>
+
+ HTMLEmbedObject should match HTMLObjectElement by stopping any load when it is removed from beforeload
+ https://bugs.webkit.org/show_bug.cgi?id=74360
+
+ Reviewed by Adam Barth.
+
+ Test <embed> as well as <object> in this test.
+
+ * fast/dom/beforeload/remove-flash-in-beforeload-listener.html:
+
2012-01-25 Noel Gordon <[email protected]>
[Chromium] Layout Test fast/canvas/webgl/invalid-passed-params.html is failing
Modified: trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener.html (105937 => 105938)
--- trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener.html 2012-01-25 23:56:30 UTC (rev 105937)
+++ trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener.html 2012-01-26 00:00:03 UTC (rev 105938)
@@ -20,6 +20,7 @@
<body>
<p>This page tests that you can correctly remove a flash object in a beforeload listener without causing a crash.</p>
<object type="application/x-shockwave-flash" data=""
+ <embed type="application/x-shockwave-flash" src=""
<div id="console"></div>
<script>
function checkObjectRemoval()
@@ -45,4 +46,3 @@
</script>
</body>
</html>
-
Modified: trunk/Source/WebCore/ChangeLog (105937 => 105938)
--- trunk/Source/WebCore/ChangeLog 2012-01-25 23:56:30 UTC (rev 105937)
+++ trunk/Source/WebCore/ChangeLog 2012-01-26 00:00:03 UTC (rev 105938)
@@ -1,3 +1,26 @@
+2012-01-25 Eric Seidel <[email protected]>
+
+ HTMLEmbedObject should match HTMLObjectElement by stopping any load when it is removed from beforeload
+ https://bugs.webkit.org/show_bug.cgi?id=74360
+
+ Reviewed by Adam Barth.
+
+ Neither of these !renderer() checks is strictly necessary since requestObject()
+ makes the same check. However requestObject() asserts before it makes that
+ check, so it makes sense to add the check to HTMLEmebedObject instead of
+ removing the check from HTMLObjectElement.
+ I also moved the protect RefPtr to before the beforeload dispatch since
+ beforeload can remove the whole DOM element (as this test does) and
+ thus I beleive the renderer() check could be checking free'd memory.
+
+ Updated fast/dom/beforeload/remove-flash-in-beforeload-listener.html to test
+ <embed> as well as <object>.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::updateWidget):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::updateWidget):
+
2012-01-25 Kent Tamura <[email protected]>
Move focus/blur handling code of HTMLInputElement to InputType
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (105937 => 105938)
--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-01-25 23:56:30 UTC (rev 105937)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-01-26 00:00:03 UTC (rev 105938)
@@ -154,6 +154,7 @@
Vector<String> paramValues;
parametersForPlugin(paramNames, paramValues);
+ RefPtr<HTMLEmbedElement> protect(this); // Loading the plugin might remove us from the document.
bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url);
if (!beforeLoadAllowedLoad) {
if (document()->isPluginDocument()) {
@@ -164,8 +165,9 @@
}
return;
}
+ if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer.
+ 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 (105937 => 105938)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-01-25 23:56:30 UTC (rev 105937)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-01-26 00:00:03 UTC (rev 105938)
@@ -289,18 +289,13 @@
if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
return;
+ RefPtr<HTMLObjectElement> protect(this); // beforeload and plugin loading can make arbitrary DOM mutations.
bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url);
- // beforeload events can modify the DOM, potentially causing
- // RenderWidget::destroy() to be called. Ensure we haven't been
- // destroyed before continuing.
- // FIXME: Should this render fallback content?
- if (!renderer())
+ if (!renderer()) // Do not load the plugin if beforeload removed this element or its 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);
-
if (!success && fallbackContent)
renderFallbackContent();
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes