summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/netscape-destroy-plugin-script-objects.html
blob: a25e9c160b547e52cca531783a5375d7677b3cc4 (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>
<script>
function runTest()
{
    if (window.testRunner)
        testRunner.dumpAsText();
        
    var successCount = 0;
    var plugin = document.getElementById("testPlugin");
    plugin.logDestroy = true;
    
    var testObject = plugin.testObject;        
    plugin.parentNode.removeChild(plugin);
    
    try {
        testObject.property;
    } catch (e) {
        if (e instanceof ReferenceError)
            successCount++;
    }

    try {
        testObject.property = 'hello';
    } catch (e) {
        if (e instanceof ReferenceError)
            successCount++;
    }
    
    if (successCount == 2)
        document.getElementById('result').innerHTML = 'SUCCESS';
}

</script>

<body onload="runTest();">
This tests that accessing plug-in script objects from a destroyed plugin cause throws the right exceptions.
<div id="result">FAILURE</div>
<embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed>
</body>
</html>