summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/removed-image-as-property.html
blob: 0062ce37fbe8261428eb21af3ef7b0812a282f67 (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
<body onload="test()">
<p>Test that an image isn't accessible via form.property syntax after being removed from document.</p>
<div>Testing...</div>
<form className="a">
<img src="" id="i">
</form>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function gc()
{
    if (window.GCController)
        return GCController.collect();

    for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
        var s = new String("abc");
    }
}

function test()
{
    var f = document.getElementsByTagName("form")[0];
    f.removeChild(document.getElementsByTagName("img")[0]);
    f.foobar;
    setTimeout(function() {
        gc();
        try {
            f.i.nodeName;
            document.getElementsByTagName("div")[0].innerHTML = "FAIL";
        } catch (ex) {
            document.getElementsByTagName("div")[0].innerHTML = "PASS";
        }
        if (window.testRunner)
            testRunner.notifyDone();
    }, 0);
}
</script>