Title: [124914] trunk
- Revision
- 124914
- Author
- [email protected]
- Date
- 2012-08-07 13:21:11 -0700 (Tue, 07 Aug 2012)
Log Message
Crash in ContainerNode::cloneChildNodes.
https://bugs.webkit.org/show_bug.cgi?id=93378
Reviewed by Levi Weintraub.
Source/WebCore:
Re-enabling the editing delete button controller in cloneChildNode was causing style changes,
thereby causing load events to fire. The load event can blow our nodes from underneath. This causes
crashes when we are nested inside cloneChildNodes. The patch just skips the delete button controller's
container element from being cloned and removes the hacky enable/disable logic.
Test: fast/dom/clone-node-load-event-crash.html
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::cloneChildNodes):
LayoutTests:
* fast/dom/clone-node-load-event-crash-expected.txt: Added.
* fast/dom/clone-node-load-event-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (124913 => 124914)
--- trunk/LayoutTests/ChangeLog 2012-08-07 20:15:57 UTC (rev 124913)
+++ trunk/LayoutTests/ChangeLog 2012-08-07 20:21:11 UTC (rev 124914)
@@ -1,3 +1,13 @@
+2012-08-07 Abhishek Arya <[email protected]>
+
+ Crash in ContainerNode::cloneChildNodes.
+ https://bugs.webkit.org/show_bug.cgi?id=93378
+
+ Reviewed by Levi Weintraub.
+
+ * fast/dom/clone-node-load-event-crash-expected.txt: Added.
+ * fast/dom/clone-node-load-event-crash.html: Added.
+
2012-08-07 Dmitry Titov <[email protected]>
[Chromium] Unreviewed, TestExpectations update.
Added: trunk/LayoutTests/fast/dom/clone-node-load-event-crash-expected.txt (0 => 124914)
--- trunk/LayoutTests/fast/dom/clone-node-load-event-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/clone-node-load-event-crash-expected.txt 2012-08-07 20:21:11 UTC (rev 124914)
@@ -0,0 +1,2 @@
+Tests that we don't crash due to incorrect load event firing during cloneNode.
+PASS. WebKit didn't crash.
Added: trunk/LayoutTests/fast/dom/clone-node-load-event-crash.html (0 => 124914)
--- trunk/LayoutTests/fast/dom/clone-node-load-event-crash.html (rev 0)
+++ trunk/LayoutTests/fast/dom/clone-node-load-event-crash.html 2012-08-07 20:21:11 UTC (rev 124914)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+</script>
+<div contenteditable='true' id='div'>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var div = document.getElementById('div');
+div.focus();
+document.body.contentEditable = 'true';
+
+function crash() {
+ embed = document.createElement('embed');
+ embed.setAttribute('type', 'text/foo');
+ document.body.appendChild(embed);
+ document.body.cloneNode(true);
+}
+
+function removeContent() {
+ document.body.innerHTML = "Tests that we don't crash due to incorrect load event firing during cloneNode. <br />\
+ PASS. WebKit didn't crash.";
+}
+
+window.addEventListener('load', removeContent, false);
+document.addEventListener('DOMContentLoaded', crash, false);
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/dom/clone-node-load-event-crash.html
___________________________________________________________________
Added: svn:executable
Modified: trunk/Source/WebCore/ChangeLog (124913 => 124914)
--- trunk/Source/WebCore/ChangeLog 2012-08-07 20:15:57 UTC (rev 124913)
+++ trunk/Source/WebCore/ChangeLog 2012-08-07 20:21:11 UTC (rev 124914)
@@ -1,3 +1,20 @@
+2012-08-07 Abhishek Arya <[email protected]>
+
+ Crash in ContainerNode::cloneChildNodes.
+ https://bugs.webkit.org/show_bug.cgi?id=93378
+
+ Reviewed by Levi Weintraub.
+
+ Re-enabling the editing delete button controller in cloneChildNode was causing style changes,
+ thereby causing load events to fire. The load event can blow our nodes from underneath. This causes
+ crashes when we are nested inside cloneChildNodes. The patch just skips the delete button controller's
+ container element from being cloned and removes the hacky enable/disable logic.
+
+ Test: fast/dom/clone-node-load-event-crash.html
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::cloneChildNodes):
+
2012-08-07 No'am Rosenthal <[email protected]>
GraphicsLayerAnimation shouldn't use HashMap<String>
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (124913 => 124914)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2012-08-07 20:15:57 UTC (rev 124913)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2012-08-07 20:21:11 UTC (rev 124914)
@@ -690,22 +690,16 @@
void ContainerNode::cloneChildNodes(ContainerNode *clone)
{
- // disable the delete button so it's elements are not serialized into the markup
- bool isEditorEnabled = false;
- if (document()->frame() && document()->frame()->editor()->canEdit()) {
- FrameSelection* selection = document()->frame()->selection();
- Element* root = selection ? selection->rootEditableElement() : 0;
- isEditorEnabled = root && isDescendantOf(root);
+ HTMLElement* deleteButtonContainerElement = 0;
+ if (Frame* frame = document()->frame())
+ deleteButtonContainerElement = frame->editor()->deleteButtonController()->containerElement();
- if (isEditorEnabled)
- document()->frame()->editor()->deleteButtonController()->disable();
- }
-
ExceptionCode ec = 0;
- for (Node* n = firstChild(); n && !ec; n = n->nextSibling())
+ for (Node* n = firstChild(); n && !ec; n = n->nextSibling()) {
+ if (n == deleteButtonContainerElement)
+ continue;
clone->appendChild(n->cloneNode(true), ec);
- if (isEditorEnabled && document()->frame())
- document()->frame()->editor()->deleteButtonController()->enable();
+ }
}
bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes