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

Unified Diff: LayoutTests/editing/undo/undo-set-selection-crash.html

Issue 326323003: Fix a crash caused by invalid selection set by Undo command. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix minor issues in test. Created 6 years, 6 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 | LayoutTests/editing/undo/undo-set-selection-crash-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/undo/undo-set-selection-crash.html
diff --git a/LayoutTests/editing/undo/undo-set-selection-crash.html b/LayoutTests/editing/undo/undo-set-selection-crash.html
new file mode 100644
index 0000000000000000000000000000000000000000..6f6cb2876fc409bf63effebdfc10d396fdc42dfc
--- /dev/null
+++ b/LayoutTests/editing/undo/undo-set-selection-crash.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<div id="test-div" contentEditable="true"><select></select></div>
+<script>
+description('Undo command should not make a selection anchored in another document.');
+
+window.jsTestIsAsync = true;
+
+var div = document.getElementById('test-div');
+var selection = window.getSelection();
+
+div.focus();
+document.execCommand('SelectAll');
+document.execCommand('Indent');
+document.execCommand('Outdent');
+
+var anotherDocument = document.implementation.createHTMLDocument('');
+anotherDocument.body.appendChild(selection.getRangeAt(0).extractContents());
+
+div.contentEditable = false;
+
+document.execCommand('Undo');
+document.execCommand('FindString', false, 'x');
+
+window.setTimeout(function () {
+ document.body.removeChild(div);
+ testPassed('Did not crash.');
+ finishJSTest();
+}, 0);
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/editing/undo/undo-set-selection-crash-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698