Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: third_party/WebKit/LayoutTests/dom/document/adoptNode-reparenting-crash.html

Issue 2752673003: DOM: adoptNode() should not crash by reparenting the specified node in removeChild(). (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/dom/document/adoptNode-reparenting-crash.html
diff --git a/third_party/WebKit/LayoutTests/dom/document/adoptNode-reparenting-crash.html b/third_party/WebKit/LayoutTests/dom/document/adoptNode-reparenting-crash.html
new file mode 100644
index 0000000000000000000000000000000000000000..a8691dddc8964fd994cdbc4e5d4f2ffa0ef62665
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/dom/document/adoptNode-reparenting-crash.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div id="test-container"><script>
+var sacrifice;
+test(() => {
+ let testContainer = document.getElementById('test-container');
+ let iframe = document.createElement('iframe');
+ testContainer.appendChild(iframe);
+ let doc = iframe.contentDocument;
+ let script = doc.createElementNS('http://www.w3.org/2000/svg', 'script');
+ script.type = 'invalid-type';
+ script.textContent = 'document.body.appendChild(parent.sacrifice)';
+ sacrifice = document.createElement('div');
+ script.appendChild(sacrifice);
+ doc.body.appendChild(script);
+ script.type = '';
+ // adoptNode() calls script.removeNode(sacrifice) internally, and this DOM
+ // mutation kicks the script.
+ document.adoptNode(sacrifice);
+}, 'Reparenting in removeNode() in adoptNode() should not crash.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698