summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/mochitest/test_ext_jsversion.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 /toolkit/components/extensions/test/mochitest/test_ext_jsversion.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 'toolkit/components/extensions/test/mochitest/test_ext_jsversion.html')
-rw-r--r--toolkit/components/extensions/test/mochitest/test_ext_jsversion.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_jsversion.html b/toolkit/components/extensions/test/mochitest/test_ext_jsversion.html
new file mode 100644
index 000000000..da0c355e0
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/test_ext_jsversion.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for simple WebExtension</title>
+ <meta charset="utf-8">
+ <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
+ <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
+ <script type="text/javascript" src="chrome_head.js"></script>
+ <script type="text/javascript" src="head.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="text/javascript">
+"use strict";
+
+add_task(function* test_versioned_js() {
+ // We need to deal with escaping the close script tags.
+ // May as well consolidate it into one place.
+ let script = attrs => `<script ${attrs}><\/script>`;
+
+ let extension = ExtensionTestUtils.loadExtension({
+ manifest: {
+ "background": {"page": "background.html"},
+ },
+
+ files: {
+ "background.html": `
+ <meta charset="utf-8">
+ ${script('src="background.js" type="application/javascript"')}
+ ${script('src="background-1.js" type="application/javascript;version=1.8"')}
+ ${script('src="background-2.js" type="application/javascript;version=latest"')}
+ ${script('src="background-3.js" type="application/javascript"')}
+ `,
+
+ "background.js": function() {
+ window.reportResult = msg => {
+ browser.test.assertEq(
+ msg, "background-script-3",
+ "Expected a message only from the unversioned background script.");
+
+ browser.test.sendMessage("finished");
+ };
+ },
+
+ "background-1.js": function() {
+ window.reportResult("background-script-1");
+ },
+ "background-2.js": function() {
+ window.reportResult("background-script-2");
+ },
+ "background-3.js": function() {
+ window.reportResult("background-script-3");
+ },
+ },
+ });
+
+ let messages = [/Versioned JavaScript.*not supported in WebExtension.*developer\.mozilla\.org/,
+ /Versioned JavaScript.*not supported in WebExtension.*developer\.mozilla\.org/];
+
+ let waitForConsole = new Promise(resolve => {
+ SimpleTest.monitorConsole(resolve, messages);
+ });
+
+ info("loading extension");
+
+ yield Promise.all([extension.startup(),
+ extension.awaitMessage("finished")]);
+
+ info("waiting for console");
+
+ SimpleTest.endMonitorConsole();
+ yield waitForConsole;
+
+ info("unloading extension");
+
+ yield extension.unload();
+
+ info("test complete");
+});
+
+</script>
+
+</body>
+</html>