Index: third_party/WebKit/LayoutTests/editing/selection/modify_move/move_backward_line_import_crash.html |
diff --git a/third_party/WebKit/LayoutTests/editing/selection/modify_move/move_backward_line_import_crash.html b/third_party/WebKit/LayoutTests/editing/selection/modify_move/move_backward_line_import_crash.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b1ccd247a95bfb5afae6787ca38fb8f5bd3764bf |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/selection/modify_move/move_backward_line_import_crash.html |
@@ -0,0 +1,28 @@ |
+<!doctype html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<div id="sample"></div> |
+<div id="log"></div> |
+<script> |
+test(() => { |
+ var sample = document.getElementById('sample'); |
+ sample.innerHTML = '<select><option>1</option></select><style>@import url(-)</style>'; |
+ // Mark tree dirty |
+ document.body.appendChild(sample); |
+ // Force layout |
+ sample.offsetHeight; |
+ |
+ var importElement = document.createElement('link'); |
+ importElement.setAttribute('rel', 'import'); |
+ sample.appendChild(importElement); |
+ |
+ var selection = window.getSelection(); |
+ selection.collapse(sample, 1); |
+ selection.modify('move', 'backward', 'line'); |
+ |
+ assert_equals(selection.anchorNode, sample, 'anchorNode'); |
+ assert_equals(selection.anchorOffset, 0, 'anchorOffset'); |
+ assert_equals(selection.focusNode, sample, 'focusNode'); |
+ assert_equals(selection.focusOffset, 0, 'focusOffset'); |
+}, 'move backward line should not crash with link/import'); |
+</script> |