diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js new file mode 100644 index 0000000000..564e9086ac --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js @@ -0,0 +1,47 @@ +let profileDir; +add_task(async function setup() { + profileDir = gProfD.clone(); + profileDir.append("extensions"); + + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + await promiseStartupManager(); +}); + +// When installing an unpacked addon we derive the ID from the +// directory name. Make sure that if the directory name is not a valid +// addon ID that we reject it. +add_task(async 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 { + await 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; + } + await promiseRestartManager(); + + let addon = await promiseAddonByID(dir); + Assert.equal(addon, null); + addon = await promiseAddonByID(MANIFEST_ID); + Assert.equal(addon, null); + } +}); |