summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/parser/remove-current-node-parent-x.xhtml
blob: 38933f507edee78a6e4f284f2fbaf1208a71a5ce (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
33
34
35
36
37
38
39
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    var body = document.getElementsByTagName('body')[0];
    var newBody = document.createElement("body");
    body.parentNode.replaceChild(newBody, body);

    function msg(text)
    {
        var n = document.createElement("p");
        n.appendChild(document.createTextNode(text));
        document.body.appendChild(n);
    }

    function verify()
    {
        msg("Test for bug 30049: Manipulating DOM from a script while parsing XHTML can cause a crash.");
        msg("Should say PASS:");
        // Even though a subtree is removed, parsing continues.
        msg(body.getElementsByTagName("foo").length == 1 ? "PASS" : "FAIL");
        if (window.testRunner)
            testRunner.notifyDone();
    }

    setTimeout(verify, 100);
</script>
<script>
    alert("FAIL"); // Firefox compatibility.
</script>
<foo/>
</body>
</html>