Index: LayoutTests/editing/execCommand/insert-html-to-document-element-crash.html |
diff --git a/LayoutTests/editing/execCommand/insert-html-to-document-element-crash.html b/LayoutTests/editing/execCommand/insert-html-to-document-element-crash.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7c4c671a9e8027a0c3250120e6e0d2c73e7852c0 |
--- /dev/null |
+++ b/LayoutTests/editing/execCommand/insert-html-to-document-element-crash.html |
@@ -0,0 +1,25 @@ |
+<!DOCTYPE html> |
+<head> |
+<script> |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+onload = function() { |
+ // Make documentElement to P element without HTML and BODY. |
+ var htmlElement = document.documentElement; |
+ var target = document.getElementById('target'); |
+ document.replaceChild(target, htmlElement); |
+ |
+ document.designMode = 'on'; |
+ window.getSelection().collapse(target, 0); |
+ document.execCommand('InsertHTML', false, '<pre></pre>'); |
+ |
+ // Here, document.documentElement is null. |
+ document.write('PASS if Blink doesn\'t crash.'); |
+}; |
+</script> |
+</head> |
+<body> |
+<p id="target"></p> |
+</body> |
+</html> |