summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/netscape-plugin-property-access-exception.html
blob: 89237d0783535d55e9de767ff000ce591f178234 (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
<html><body>
<embed name="plg" type="application/x-webkit-test-netscape"></embed>
<div id="getter">FAILURE: No exception caught on getting.</div>
<div id="setter">FAILURE: No exception caught on setting.</div>
<em>One could expect exceptions to be raised in the below cases, too - but Firefox doesn't
do that in most of these (I do get an exception in the first case, but that's inconsistent with not
getting it in the seconfd one).</em>
<div id="getter2">No exception caught on getting via testCallback.</div>
<div id="setter2">No exception caught on setting via testCallback.</div>
<div id="getter3">No exception caught on getting via testGetBrowserProperty.</div>
<div id="setter3">No exception caught on setting via testSetBrowserProperty.</div>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    var plg = document.getElementsByName("plg")[0];

    // Firefox sometimes behaves inconsistently, leaving an exception dangling until the next call.
    function sanityCheckExceptionState(logTarget)
    {
        try {
            plg.testEvaluate("");
        } catch (e) {
            document.getElementById(logTarget).innerHTML += " Huh? Exception raised later!";
        }
    }

    try {
        plg.testThrowExceptionProperty;
    } catch (e) {
        document.getElementById('getter').innerHTML = 'SUCCESS: Exception caught: ' + e;
    }
    sanityCheckExceptionState("getter");

    try {
        plg.testThrowExceptionProperty = "";
    } catch (e) {
        document.getElementById('setter').innerHTML = 'SUCCESS: Exception caught: ' + e;
    }
    sanityCheckExceptionState("setter");

    try {
        plg.testEvaluate("plg.testThrowExceptionProperty");
    } catch (e) {
        document.getElementById('getter2').innerHTML = 'Exception caught: ' + e;
    }
    sanityCheckExceptionState("getter2");

    try {
        plg.testEvaluate("plg.testThrowExceptionProperty = 0");
    } catch (e) {
        document.getElementById('setter2').innerHTML = 'Exception caught: ' + e;
    }
    sanityCheckExceptionState("setter2");

    try {
        plg.testGetBrowserProperty(plg, "testThrowExceptionProperty");
    } catch (e) {
        document.getElementById('getter3').innerHTML = 'Exception caught: ' + e;
    }
    sanityCheckExceptionState("getter3");

    try {
        plg.testSetBrowserProperty(plg, "testThrowExceptionProperty", 0);
    } catch (e) {
        document.getElementById('setter3').innerHTML = 'Exception caught: ' + e;
    }
    sanityCheckExceptionState("setter3");
</script>
</body>
</html>