summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/frames/crash-removed-iframe.html
blob: 54fac055b0e57d80186670f6c5c38fd7bc1cb999 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
    <title>Crash doing open on destroyed window</title> 
    <script> 
    function testCrash1() {
        var ifr = document.createElement('iframe');
        ifr.onload = function() {
            var win = ifr.contentWindow;
            ifr.parentNode.removeChild(ifr);
            win.open('pantz', '_top');
        };
        document.body.appendChild(ifr);
    }

    // Test with a deconnected iframe.
    function testCrash2() {
        var ifr = document.createElement('iframe');
        ifr.onload = function() {
            var win = ifr.contentWindow;
            ifr.parentNode.removeChild(ifr);
            win.open('pantz', ifr);
        };
        document.body.appendChild(ifr);
    }

    // Test with a new iframe.
    function testCrash3() {
        var ifr = document.createElement('iframe');
        var ifr2 = document.createElement('iframe');
        ifr.onload = function() {
            var win = ifr.contentWindow;
            ifr.parentNode.removeChild(ifr);
            win.open('pantz', ifr2);
        };
        document.body.appendChild(ifr);
    }

    function testCrash() {
        if (window.testRunner)
            testRunner.dumpAsText();

        testCrash1();
        testCrash2();
        testCrash3();
    }
    </script> 
</head>
<body onload="testCrash()">
    <p> Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=19588">19588</a>: CRASH doing open() on destroyed window</p>
    <p> If this page does not crash the test has passed. </p>
</body>
</html>