<html>
<head>
    <script>
        function test()
        {
            if (window.layoutTextController)
                layoutTestController.dumpAsText();

            var edit = document.getElementById("edit");
            while (edit.nextSibling)
                edit.nextSibling.parentNode.removeChild(edit.nextSibling);

            var source = document.getElementById("source");
            var selection = getSelection();

            selection.setPosition(source.firstChild, 5);
            selection.modify("extend", "forward", "word");

            document.execCommand("Copy");
            edit.focus();
            document.execCommand("SelectAll");
            document.execCommand("Paste");
        }
    </script>
</head>
<body onload="test()">
<p>
    Test for <i><a href="rdar://problem/6864786">rdar://problem/6864786</a>: REGRESSION: Crash below ApplyStyleCommand::applyInlineStyleToRange when reviewing a patch in Bugzilla</i>.
</p>
<p>
    The test passes if it does not crash.
</p>
<div id="source" style="font-size: 36px">Copy the second word in this sentence.</div>
<pre id="edit" style="-webkit-user-modify: read-write-plaintext-only;">Select All here and paste<br></pre>
</body>
</html>
