dom/plugins/test/mochitest/test_npruntime_identifiers.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial