Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <html>
2 <head>
3 <title>NPN_Invoke Tests</title>
4 <script type="text/javascript"
5 src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="utils.js"></script>
7 <link rel="stylesheet" type="text/css"
8 href="/tests/SimpleTest/test.css" />
9 </head>
10 <body>
11 <p id="display"></p>
13 <script class="testbody" type="application/javascript">
14 ////
15 // This test exercises NP identifiers by querying the reflector to make sure
16 // that identifiers are translated to values correctly.
18 SimpleTest.waitForExplicitFinish();
19 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
21 var testsRun = 0;
23 function doTest() {
24 SpecialPowers.gc();
26 var reflector = document.getElementById("subframe").contentDocument.getElementById("plugin1").getReflector();
28 var i, prop, randomnumber;
30 for (i = 0; i < 20; ++i) {
31 randomnumber=Math.floor(Math.random()*1001);
32 prop = "prop" + randomnumber;
33 is(reflector[prop], prop, "Property " + prop);
34 }
36 for (i = -10; i < 10; ++i) {
37 is(reflector[i], i, "Property " + i);
38 prop = "prop" + i;
39 is(reflector[prop], prop, "Property " + prop);
40 }
42 is(reflector.a, 'a', "Property .a");
43 is(reflector['a'], 'a', "Property ['a']");
44 reflector = null;
46 SpecialPowers.gc();
48 ++testsRun;
49 if (testsRun == 3) {
50 SimpleTest.finish();
51 }
52 else {
53 document.getElementById('subframe').contentWindow.location.reload(true);
54 }
55 }
56 </script>
58 <iframe id="subframe" src="npruntime_identifiers_subpage.html" onload="doTest()"></iframe>
60 </body>
61 </html>