Bug 1297752 - Issue a warning when "*" is used as part of strict_min_version in a WebExtension manifest.json. r=kmag

MozReview-Commit-ID: 9BKjBe2Gigo

--HG--
extra : rebase_source : 1aabd1d437b5ed4ea1a829eacc98c6f1aa008b90
This commit is contained in:
Bob Silverberg 2016-08-29 15:10:38 -04:00
parent 8567ef57e9
commit 87d0ea2fcb
2 changed files with 36 additions and 0 deletions

View File

@ -929,6 +929,11 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
logger.warn("Ignoring applications property in manifest"); logger.warn("Ignoring applications property in manifest");
} }
// 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");
}
let addon = new AddonInternal(); let addon = new AddonInternal();
addon.id = bss.id; addon.id = bss.id;
addon.version = manifest.version; addon.version = manifest.version;

View File

@ -363,4 +363,35 @@ add_task(function* test_strict_min_max() {
addon.uninstall(); addon.uninstall();
flushAndRemove(addonDir); flushAndRemove(addonDir);
// * in min will generate a warning
for (let version of ["0.*", "0.*.0"]) {
newId = "strict_min_star@tests.mozilla.org";
let apps = {
applications: {
gecko: {
id: newId,
strict_min_version: version,
},
},
}
let testManifest = Object.assign(apps, MANIFEST);
let addonDir = yield promiseWriteWebManifestForExtension(testManifest, gTmpD,
"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");
let addon = yield promiseAddonByID(newId);
notEqual(addon, null, "Add-on is installed");
equal(addon.id, newId, "Add-on has the expected id");
addon.uninstall();
flushAndRemove(addonDir);
}
}); });