Index: third_party/WebKit/LayoutTests/editing/pasteboard/paste-webkit-editable-content-changed-crash.html |
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/paste-webkit-editable-content-changed-crash.html b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-webkit-editable-content-changed-crash.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..decfcf109e1bf0652d7d43cdf70d53733f6f4168 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-webkit-editable-content-changed-crash.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<div id="src"> |
+<div>Some text.</div> |
+<div>Some other text.</div> |
+</div> |
+<div contenteditable="true" id="dest"></div> |
+<div id="log"></div> |
+<script> |
+// A repro of crbug.com/580950, which crashes in debug build. |
+document.body.onload = function() { |
+ var src = document.getElementById('src'); |
+ var dest = document.getElementById('dest'); |
+ var sel = window.getSelection(); |
+ dest.addEventListener('webkitEditableContentChanged', () => dest.innerHTML = 'foo'); |
+ |
+ test(function() { |
+ sel.setBaseAndExtent(src, 0, src, src.childNodes.length); |
+ document.execCommand('copy'); |
+ dest.focus(); |
+ document.execCommand('paste'); |
+ |
+ assert_equals(dest.innerHTML, 'foo'); |
+ }, 'A pasting that fires a webkitEditableContentChanged event should not crash.'); |
+} |
+</script> |