<!DOCTYPE html>
<div id="sample" contenteditable="true"></div>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

function $(id) { return document.getElementById(id); }

if (window.internals) {
    internals.settings.setUnifiedTextCheckerEnabled(true);
    internals.setContinuousSpellCheckingEnabled(true);
}

var text1 = document.createTextNode('abc');
var text2 = document.createTextNode(' defg');
var sample = $('sample');
sample.appendChild(text1);
sample.appendChild(text2);
var selection = window.getSelection();
selection.collapse(sample, 0);
selection.extend(sample, 2);
sample.normalize();

if (window.testRunner)
    document.body.textContent = 'PASS; NOT CRASHED';
</script>
