summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/selection/replace-selection-crash.html
blob: 7876389fbae2d89bc2b463ca4c4bfb6be40adecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<html>
    <head>
        <script>
            function test()
            {
                if (window.layoutTestController)
                    layoutTestController.dumpAsText();

                document.getElementsByTagName("div")[0].focus();

                var sel = window.getSelection();
                var paragraphs = document.getElementsByTagName("p");
                sel.setBaseAndExtent(paragraphs[0].lastChild, 0, paragraphs[0].lastChild, 2);
                document.execCommand("InsertHTML", false, '<p>No crash!</p>');
                sel.setBaseAndExtent(paragraphs[1].lastChild, 2, paragraphs[1].lastChild, 4);
                document.execCommand("InsertHTML", false, '<p>No crash!</p>');
                sel.setBaseAndExtent(paragraphs[2].lastChild, 4, paragraphs[2].lastChild, 6);
                document.execCommand("InsertHTML", false, '<p>No crash!</p>');
                sel.setBaseAndExtent(paragraphs[3].lastChild, 0, paragraphs[3].lastChild, 6);
                document.execCommand("InsertHTML", false, '<p>No crash!</p>');
            }
        </script>
    </head>
    <body onload="test()">
        <div contenteditable>
            <p><span style="white-space: pre">    </span>select&nbsp;</p>
            <p><span style="white-space: pre">    </span>select&nbsp;</p>
            <p><span style="white-space: pre">    </span>select&nbsp;</p>
            <p><span style="white-space: pre">    </span>select&nbsp;</p>
        </div>
    </body>
</html>