summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html')
-rw-r--r--dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html b/dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html
new file mode 100644
index 000000000..75ec66e13
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+ <title>Test NPNVdocumentOrigin</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="plugin-utils.js"></script>
+</head>
+<body onload="runTest()">
+ <script class="testbody" type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+
+ function runTest() {
+ "use strict";
+ var p1 = document.getElementById("plugin1");
+ var realOrigin = "http://mochi.test:8888";
+
+ // Test with no modifications
+ is(p1.getNPNVdocumentOrigin(), realOrigin, "Checking for expected origin.");
+
+ // This used to test that shadowing window.location.toString didn't confuse
+ // getNPNVdocumentOrigin. But now we explicitly throw when that happens. So
+ // just verify that we throw. There's no reason why getNPNVdocumentOrigin _would_
+ // be confused in this case anyway.
+ try {
+ window.location.toString = function() { return 'http://victim.rckc.at/'; }
+ ok(false, "Should throw when shadowing window.location.toString");
+ }
+ catch (e) {
+ ok(true, "Should throw when shadowing window.location.toString");
+ }
+
+ // Create a plugin in a new window with about:blank
+ var newWindow = window.open("about:blank");
+ newWindow.onload = function() {
+ newWindow.document.writeln('<embed id="plugin2" type="application/x-test" width="200" height="200"></embed>');
+ var p2 = newWindow.document.getElementById("plugin2");
+ is(p2.getNPNVdocumentOrigin(), realOrigin, "Checking for expected origin of plugin in new about:blank window.");
+ newWindow.close();
+
+ SimpleTest.finish();
+ };
+ }
+ </script>
+
+ <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
+</body>
+</html>