<!DOCTYPE html>
<html>
<body>
<p>This tests deleting the composition text does not result in a crash.<br>
To manually test, type in the box below using input method (e.g. Japanese or Chinese). WebKit on iOS should not crash.</p>
<div id="editor" style="border: solid 2px blue; padding: 5px;" contenteditable></div>
<div id="result"></div>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/ui-helper.js"></script>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

editor.focus();

async function runTest() {
    if (window.textInputController) {
        textInputController.setMarkedText("hello", 0, 5);
        await UIHelper.ensurePresentationUpdate();
        editor.firstChild.data = '';
        await UIHelper.ensurePositionInformationUpdateForElement(editor);
        result.textContent = 'PASS - WebKit did not crash';
    }
    testRunner.notifyDone();
}

window.onload = runTest;

var successfullyParsed = true;

</script>
</body>
</html>
