Title: [129696] branches/chromium/1271
Revision
129696
Author
[email protected]
Date
2012-09-26 13:30:20 -0700 (Wed, 26 Sep 2012)

Log Message

Merge 129469
BUG=150966
Review URL: https://codereview.chromium.org/10989043

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented-expected.txt (from rev 129469, trunk/LayoutTests/fast/dom/adopt-node-prevented-expected.txt) (0 => 129696)


--- branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented-expected.txt	                        (rev 0)
+++ branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented-expected.txt	2012-09-26 20:30:20 UTC (rev 129696)
@@ -0,0 +1,10 @@
+Test that adoptNode fails safely if prevented by a DOM mutation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS target.ownerDocument.location is document.location
+

Copied: branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented.html (from rev 129469, trunk/LayoutTests/fast/dom/adopt-node-prevented.html) (0 => 129696)


--- branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented.html	                        (rev 0)
+++ branches/chromium/1271/LayoutTests/fast/dom/adopt-node-prevented.html	2012-09-26 20:30:20 UTC (rev 129696)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+  <div id="newParent"></div>
+  <a href="" id="target"></a>
+<script>
+description("Test that adoptNode fails safely if prevented by a DOM mutation.");
+
+function run() {
+    newParent = document.getElementById("newParent");
+    target = document.getElementById("target");
+    target.addEventListener("blur", function () { newParent.appendChild(target); }, false);
+    target.focus();
+    var anotherDocument = document.implementation.createDocument("", "", null);
+
+    try { anotherDocument.adoptNode(target); } catch(e) {}
+    shouldBe("target.ownerDocument.location", "document.location");
+}
+
+document.addEventListener("DOMContentLoaded", run, false);
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/chromium/1271/Source/WebCore/dom/Document.cpp (129695 => 129696)


--- branches/chromium/1271/Source/WebCore/dom/Document.cpp	2012-09-26 20:27:40 UTC (rev 129695)
+++ branches/chromium/1271/Source/WebCore/dom/Document.cpp	2012-09-26 20:30:20 UTC (rev 129696)
@@ -1068,8 +1068,11 @@
                 return 0;
             }
         }
-        if (source->parentNode())
+        if (source->parentNode()) {
             source->parentNode()->removeChild(source.get(), ec);
+            if (ec)
+                return 0;
+        }
     }
 
     this->adoptIfNeeded(source.get());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to