blob: ae679fa03dd8956759a49c2e73edc1a021e39b3a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/util.js"></script>
</head>
<body>
<div id="container">
<div id="destination" contentEditable></div>
</div>
<script>
description("WebKit should not crash after the text has changed and results are served from cache."
+ " To test manually, type 'Spell wellcome. Is it broken?', delete the words 'Is it broken?'."
+ " The test succeeds when WebKit does not crash and 'wellcome' has spelling marker.");
initSpellTest("destination", "Spell wellcome. Is it broken?", function(textNode) {
misspellingString = () => {
const range = internals.markerRangeForNode(textNode, "spelling", 0);
return range ? range.toString() : null;
};
// Select the text "Is it broken?".
var deleteRange = document.createRange();
deleteRange.setStart(textNode, 15);
deleteRange.setEnd(textNode, 29);
window.getSelection().removeAllRanges();
window.getSelection().addRange(deleteRange);
shouldBeEqualToString("window.getSelection().toString()", " Is it broken?");
// Del key to delete the text "Is it broken?".
eventSender.keyDown(String.fromCharCode(0x007F), null);
shouldBecomeEqualToString("misspellingString()", "wellcome", function() {
document.getElementById("destination").innerHTML = "";
finishJSTest();
});
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>