summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_npruntime_identifiers.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/plugins/test/mochitest/test_npruntime_identifiers.html')
-rw-r--r--dom/plugins/test/mochitest/test_npruntime_identifiers.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_npruntime_identifiers.html b/dom/plugins/test/mochitest/test_npruntime_identifiers.html
new file mode 100644
index 000000000..a19a59be5
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_npruntime_identifiers.html
@@ -0,0 +1,67 @@
+<html>
+<head>
+ <title>NPN_Invoke Tests</title>
+ <script type="text/javascript"
+ src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="plugin-utils.js"></script>
+ <link rel="stylesheet" type="text/css"
+ href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+ <p id="display"></p>
+
+ <script class="testbody" type="application/javascript">
+ ////
+ // This test exercises NP identifiers by querying the reflector to make sure
+ // that identifiers are translated to values correctly.
+
+ SimpleTest.waitForExplicitFinish();
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+
+ var testsRun = 0;
+
+ function doTest() {
+ SpecialPowers.gc();
+
+ var reflector = document.getElementById("subframe").contentDocument.getElementById("plugin1").getReflector();
+
+ var i, prop, randomnumber;
+
+ for (i = 0; i < 20; ++i) {
+ randomnumber=Math.floor(Math.random()*1001);
+ prop = "prop" + randomnumber;
+ is(reflector[prop], prop, "Property " + prop);
+ }
+
+ for (i = -10; i < 0; ++i) {
+ is(reflector[i], String(i), "Property " + i);
+ prop = "prop" + i;
+ is(reflector[prop], prop, "Property " + prop);
+ }
+
+ for (i = 0; i < 10; ++i) {
+ is(reflector[i], i, "Property " + i);
+ prop = "prop" + i;
+ is(reflector[prop], prop, "Property " + prop);
+ }
+
+ is(reflector.a, 'a', "Property .a");
+ is(reflector['a'], 'a', "Property ['a']");
+ reflector = null;
+
+ SpecialPowers.gc();
+
+ ++testsRun;
+ if (testsRun == 3) {
+ SimpleTest.finish();
+ }
+ else {
+ document.getElementById('subframe').contentWindow.location.reload(true);
+ }
+ }
+ </script>
+
+ <iframe id="subframe" src="npruntime_identifiers_subpage.html" onload="doTest()"></iframe>
+
+</body>
+</html>