summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_bug738396.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_bug738396.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_bug738396.html')
-rw-r--r--dom/plugins/test/mochitest/test_bug738396.html88
1 files changed, 88 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_bug738396.html b/dom/plugins/test/mochitest/test_bug738396.html
new file mode 100644
index 000000000..ead7f5c1a
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_bug738396.html
@@ -0,0 +1,88 @@
+<!doctype html>
+<html>
+<head>
+ <title>Test for Bug 738396</title>
+ <script type="application/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"/>
+
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+ <script type="text/javascript">
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED,
+ "Java Test Plug-in");
+
+ SpecialPowers.pushPrefEnv({ "set": [
+ ['plugin.java.mime', 'application/x-java-test']
+ ] }, loadFrame);
+ SimpleTest.waitForExplicitFinish();
+
+ function loadFrame() {
+ var iframe = document.createElement("iframe");
+ iframe.src = "./file_bug738396.html";
+ iframe.addEventListener("load", function() {
+ runTest(iframe.contentDocument);
+ });
+ document.body.appendChild(iframe);
+ }
+
+ function runTest(doc) {
+ // Check that the canonicalized version of the codebase 'good' was passed
+ // to the plugin in all cases
+ var a = doc.createElement('a');
+ a.href = "good";
+ var goodCodebase = a.href;
+ var codebasevis = doc.getElementById("codebasevis")
+ .querySelectorAll("applet, object, embed");
+ for (var elem of codebasevis) {
+ var codebase = null;
+ try {
+ codebase = elem.getJavaCodebase();
+ } catch (e) {}
+ is(codebase, goodCodebase,
+ "Check that the test plugin sees the proper codebase");
+ }
+ // Check that none of the applets in blockedcodebase were allowed to spawn
+ var blockedcodebase = doc.getElementById("blockedcodebase")
+ .querySelectorAll("applet, object, embed");
+ for (var elem of blockedcodebase) {
+ var spawned = false;
+ try {
+ elem.getObjectValue();
+ spawned = true;
+ } catch (e) {}
+ ok(!spawned, "Plugin should not be allowed to spawn");
+ }
+
+ // With no codebase, the codebase should resolve to "."
+ a.href = ".";
+ goodCodebase = a.href;
+ var nocodebase = doc.getElementById("nocodebase")
+ .querySelectorAll("applet, object, embed");
+ for (var elem of nocodebase) {
+ var codebase = null;
+ try {
+ codebase = elem.getJavaCodebase();
+ } catch (e) {}
+ is(codebase, goodCodebase, "Codebase should resolve to '.'");
+ }
+
+ // With empty codebase, the codebase should resolve to "/"
+ a.href = "/";
+ goodCodebase = a.href;
+ var nocodebase = doc.getElementById("emptycodebase")
+ .querySelectorAll("applet, object, embed");
+ for (var elem of nocodebase) {
+ var codebase = null;
+ try {
+ codebase = elem.getJavaCodebase();
+ } catch (e) {}
+ is(codebase, goodCodebase, "Codebase should resolve to '/'");
+ }
+
+ SimpleTest.finish();
+ }
+</script>
+</body>
+</html>