mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1298923 - Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json, r=kmag
MozReview-Commit-ID: BeHU7ZPB1NG --HG-- extra : rebase_source : c3e5e1aba0f3db247b9b9bf27b79290342cbcfe1
This commit is contained in:
parent
a990edd08a
commit
21f8f5eff5
@ -931,7 +931,7 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
|
||||
|
||||
// A * is illegal in strict_min_version
|
||||
if (bss.strict_min_version && bss.strict_min_version.split(".").some(part => part == "*")) {
|
||||
logger.warn("The use of '*' in strict_min_version is deprecated");
|
||||
throw new Error("The use of '*' in strict_min_version is invalid");
|
||||
}
|
||||
|
||||
let addon = new AddonInternal();
|
||||
|
@ -414,7 +414,7 @@ add_task(function* test_strict_min_max() {
|
||||
addon.uninstall();
|
||||
flushAndRemove(addonDir);
|
||||
|
||||
// * in min will generate a warning
|
||||
// * in min will throw an error
|
||||
for (let version of ["0.*", "0.*.0"]) {
|
||||
newId = "strict_min_star@tests.mozilla.org";
|
||||
let apps = {
|
||||
@ -425,23 +425,19 @@ add_task(function* test_strict_min_max() {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
let testManifest = Object.assign(apps, MANIFEST);
|
||||
|
||||
let addonDir = yield promiseWriteWebManifestForExtension(testManifest, gTmpD,
|
||||
"strict_min_star");
|
||||
"strict_min_star");
|
||||
|
||||
let { messages } = yield promiseConsoleOutput(function* () {
|
||||
yield AddonManager.installTemporaryAddon(addonDir);
|
||||
});
|
||||
ok(messages.some(msg => msg.message.includes("The use of '*' in strict_min_version is deprecated")),
|
||||
"Deprecation warning for strict_min_version with '*' was generated");
|
||||
yield Assert.rejects(
|
||||
AddonManager.installTemporaryAddon(addonDir),
|
||||
/The use of '\*' in strict_min_version is invalid/,
|
||||
"loading an extension with a * in strict_min_version throws an exception");
|
||||
|
||||
let addon = yield promiseAddonByID(newId);
|
||||
|
||||
notEqual(addon, null, "Add-on is installed");
|
||||
equal(addon.id, newId, "Add-on has the expected id");
|
||||
|
||||
addon.uninstall();
|
||||
equal(addon, null, "Add-on is not installed");
|
||||
flushAndRemove(addonDir);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user