Title: [122021] releases/WebKitGTK/webkit-1.8
Revision
122021
Author
[email protected]
Date
2012-07-06 13:19:36 -0700 (Fri, 06 Jul 2012)

Log Message

Merge 112051 - Crash in ContainerNode::resumePostAttachCallbacks.
https://bugs.webkit.org/show_bug.cgi?id=82159

Patch by Abhishek Arya <[email protected]> on 2012-03-25
Reviewed by Hajime Morita.

Source/WebCore:

Test: plugins/object-onfocus-mutation-crash.html

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::resumePostAttachCallbacks): dispatching post attach
callbacks when our attach depth is 1 can fire mutation events such as onfocus
which can blow away |this|. Need to protect it with a RefPtr.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::attach): add calls to suspend attach callbacks
until the function completes.

LayoutTests:

* plugins/object-onfocus-mutation-crash-expected.txt: Added.
* plugins/object-onfocus-mutation-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (122020 => 122021)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:19:29 UTC (rev 122020)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:19:36 UTC (rev 122021)
@@ -1,3 +1,13 @@
+2012-03-25  Abhishek Arya  <[email protected]>
+
+        Crash in ContainerNode::resumePostAttachCallbacks.
+        https://bugs.webkit.org/show_bug.cgi?id=82159
+
+        Reviewed by Hajime Morita.
+
+        * plugins/object-onfocus-mutation-crash-expected.txt: Added.
+        * plugins/object-onfocus-mutation-crash.html: Added.
+
 2012-03-09  Tom Sepez  <[email protected]>
 
         Hold cached images with a CachedResourceHandle rather than a raw pointer for CSSCrossfadeValue

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash-expected.txt (0 => 122021)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash-expected.txt	2012-07-06 20:19:36 UTC (rev 122021)
@@ -0,0 +1 @@
+PASS. WebKit didn't crash.
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash.html (0 => 122021)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash.html	2012-07-06 20:19:36 UTC (rev 122021)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function finish() {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function crash() {
+    document.body.innerHTML = "PASS. WebKit didn't crash.";
+    setTimeout("finish()", 0);
+}
+</script>
+<object data=""
+<input autofocus="" _onfocus_="crash()">
+</object>
+</body>
+</html>
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/plugins/object-onfocus-mutation-crash.html
___________________________________________________________________

Added: svn:executable

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (122020 => 122021)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:19:29 UTC (rev 122020)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:19:36 UTC (rev 122021)
@@ -1,3 +1,20 @@
+2012-03-25  Abhishek Arya  <[email protected]>
+
+        Crash in ContainerNode::resumePostAttachCallbacks.
+        https://bugs.webkit.org/show_bug.cgi?id=82159
+
+        Reviewed by Hajime Morita.
+
+        Test: plugins/object-onfocus-mutation-crash.html
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::resumePostAttachCallbacks): dispatching post attach
+        callbacks when our attach depth is 1 can fire mutation events such as onfocus
+        which can blow away |this|. Need to protect it with a RefPtr.
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::attach): add calls to suspend attach callbacks
+        until the function completes.
+
 2012-03-09  Tom Sepez  <[email protected]>
 
         Hold cached images with a CachedResourceHandle rather than a raw pointer for CSSCrossfadeValue

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp (122020 => 122021)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp	2012-07-06 20:19:29 UTC (rev 122020)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp	2012-07-06 20:19:36 UTC (rev 122021)
@@ -732,6 +732,8 @@
 void ContainerNode::resumePostAttachCallbacks()
 {
     if (s_attachDepth == 1) {
+        RefPtr<ContainerNode> protect(this);
+
         if (s_postAttachCallbackQueue)
             dispatchPostAttachCallbacks();
         if (s_shouldReEnableMemoryCacheCallsAfterAttach) {

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/html/HTMLPlugInImageElement.cpp (122020 => 122021)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/html/HTMLPlugInImageElement.cpp	2012-07-06 20:19:29 UTC (rev 122020)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/html/HTMLPlugInImageElement.cpp	2012-07-06 20:19:36 UTC (rev 122021)
@@ -153,6 +153,8 @@
 
 void HTMLPlugInImageElement::attach()
 {
+    suspendPostAttachCallbacks();
+
     bool isImage = isImageType();
     
     if (!isImage)
@@ -165,6 +167,8 @@
             m_imageLoader = adoptPtr(new HTMLImageLoader(this));
         m_imageLoader->updateFromElement();
     }
+
+    resumePostAttachCallbacks();
 }
     
 void HTMLPlugInImageElement::detach()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to