summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/destroy-plugin-from-callback.html
blob: 135eec1dd0d27c8658f85f9d899dc07b8a84af3f (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
<html>
<body onload="test()">
<embed name="plg" type="application/x-webkit-test-netscape">
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    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");
        }
    }

    var recursionsRemaining = 2;

    function pluginCallback()
    {
        if (--recursionsRemaining)
            test();
        else {
            document.write("PASS if no crash.<br>");
            gc();
        }
    }

    function test()
    {
        try {
            plg.testCallback("pluginCallback");
        } catch (ex) {
            alert("Exception: " + ex.description + ". Test plugin was not found");
        }
    }
</script>
</body>
</html>