Title: [126668] branches/chromium/1229
- Revision
- 126668
- Author
- [email protected]
- Date
- 2012-08-24 18:04:50 -0700 (Fri, 24 Aug 2012)
Log Message
Merge 125237
BUG=139168
Review URL: https://chromiumcodereview.appspot.com/10868092
Modified Paths
Added Paths
Diff
Copied: branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2-expected.txt (from rev 125237, trunk/LayoutTests/fast/events/mutation-during-replace-child-2-expected.txt) (0 => 126668)
--- branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2-expected.txt (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2-expected.txt 2012-08-25 01:04:50 UTC (rev 126668)
@@ -0,0 +1,10 @@
+Ensures that replaceChild() throws an exception if mutation even handler does something wrong
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS target.replaceChild(newChild, oldChild); threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2.html (from rev 125237, trunk/LayoutTests/fast/events/mutation-during-replace-child-2.html) (0 => 126668)
--- branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2.html (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/events/mutation-during-replace-child-2.html 2012-08-25 01:04:50 UTC (rev 126668)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div>
+ <div id="target">
+ <b></b><b id="oldChild"></b><b></b>
+ </div>
+ <div id="newChild"></div>
+</div>
+
+<script>
+description("Ensures that replaceChild() throws an exception if mutation even handler does something wrong");
+var target = document.getElementById('target');
+var oldChild = document.getElementById('oldChild');
+var newChild = document.getElementById('newChild');
+
+var numCalled = 0;
+
+function handler(){
+ numCalled++;
+ if (numCalled < 2)
+ return;
+ document.removeEventListener("DOMNodeRemoved", handler, false);
+ target.parentNode.removeChild(target);
+ newChild.appendChild(target);
+}
+document.addEventListener("DOMNodeRemoved", handler, false);
+shouldThrow("target.replaceChild(newChild, oldChild);", "'Error: HIERARCHY_REQUEST_ERR: DOM Exception 3'");
+</script>
+<script src=""
+</body>
+</html>
+
Modified: branches/chromium/1229/Source/WebCore/dom/ContainerNode.cpp (126667 => 126668)
--- branches/chromium/1229/Source/WebCore/dom/ContainerNode.cpp 2012-08-25 00:58:42 UTC (rev 126667)
+++ branches/chromium/1229/Source/WebCore/dom/ContainerNode.cpp 2012-08-25 01:04:50 UTC (rev 126668)
@@ -281,6 +281,11 @@
if (ec)
return false;
+ // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent.
+ checkReplaceChild(newChild.get(), oldChild, ec);
+ if (ec)
+ return false;
+
InspectorInstrumentation::willInsertDOMNode(document(), this);
// Add the new child(ren)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes