summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/nested-plugin-objects.html
blob: 0ffd60c24bfde27c915e120389a74a14554afd08 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html>
<script>

var callbackCount = 0;

function npapiCallback(x) {
    callbackCount++;
}

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

    var successCount = 0;
    var plugin = document.getElementById("testPlugin");

    var testObject = plugin.testObject;
    plugin.testPassTestObject("npapiCallback", testObject);
    var testObject2 = testObject.testObject;
    plugin.testPassTestObject("npapiCallback", testObject2);
    var testObject3 = testObject2.testObject;
    plugin.testPassTestObject("npapiCallback", testObject3);

    if (callbackCount == 3)
        successCount++;

    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++;
    }

    try {
        testObject2.property;
    } catch (e) {
        if (e instanceof ReferenceError)
            successCount++;
    }

    try {
        testObject3.property;
    } catch (e) {
        if (e instanceof ReferenceError)
            successCount++;
    }

    if (successCount == 5)
        document.getElementById('result').innerHTML = 'SUCCESS';
}

</script>

<body onload="runTest();">
<pre>
This tests that objects from plugin objects are properly cleaned up.

Example:
   plugin
     ------- (Creates) ------ Object1
                                  ------- (Creates) ------ Object2

It is important that both Object1 and Object2 cleanup as a result of
cleaning up the plugin.

<div id="result">FAILURE</div>
<embed id="testPlugin" type="application/x-blink-deprecated-test-plugin" width="200" height="200"></embed>
</body>
</html>