summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-10 02:49:12 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-10 02:49:12 -0500
commit4fb11cd5966461bccc3ed1599b808237be6b0de9 (patch)
treed7f0ccd49cebb3544d52635ff1bd6ed4d763823f /toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js
parentf164d9124708b50789dbb6959e1de96cc5697c48 (diff)
downloadUXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar
UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.gz
UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.lz
UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.xz
UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.zip
Move WebExtensions enabled Add-ons Manager
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js')
-rw-r--r--toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js b/toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js
new file mode 100644
index 000000000..29a3dacf7
--- /dev/null
+++ b/toolkit/mozapps/webextensions/test/xpcshell/test_webextension_paths.js
@@ -0,0 +1,55 @@
+function run_test() {
+ run_next_test();
+}
+
+let profileDir;
+add_task(function* setup() {
+ profileDir = gProfD.clone();
+ profileDir.append("extensions");
+
+ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
+ startupManager();
+});
+
+// When installing an unpacked addon we derive the ID from the
+// directory name. Make sure that if the directoy name is not a valid
+// addon ID that we reject it.
+add_task(function* test_bad_unpacked_path() {
+ let MANIFEST_ID = "webext_bad_path@tests.mozilla.org";
+
+ let manifest = {
+ name: "path test",
+ description: "test of a bad directory name",
+ manifest_version: 2,
+ version: "1.0",
+
+ browser_specific_settings: {
+ gecko: {
+ id: MANIFEST_ID
+ }
+ }
+ };
+
+ const directories = [
+ "not a valid ID",
+ '"quotes"@tests.mozilla.org',
+ ];
+
+ for (let dir of directories) {
+ try {
+ yield promiseWriteWebManifestForExtension(manifest, profileDir, dir);
+ } catch (ex) {
+ // This can fail if the underlying filesystem (looking at you windows)
+ // doesn't handle some of the characters in the ID. In that case,
+ // just ignore this test on this platform.
+ continue;
+ }
+ yield promiseRestartManager();
+
+ let addon = yield promiseAddonByID(dir);
+ do_check_eq(addon, null);
+ addon = yield promiseAddonByID(MANIFEST_ID);
+ do_check_eq(addon, null);
+ }
+});
+