提交 a219b941 编写于 作者: B Bob Silverberg

Bug 1297752 - Issue a warning when "*" is used as part of strict_min_version...

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

Uplift to beta

--HG--
extra : source : 4b4cc630c39914a480dc04ef773ee17ed01baf42
上级 7273932a
......@@ -894,6 +894,11 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
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();
addon.id = bss.id;
addon.version = manifest.version;
......
......@@ -175,3 +175,48 @@ add_task(function* test_two_ids() {
addon.uninstall();
});
add_task(function* strict_min_star() {
const addonId = "strict_min_max@tests.mozilla.org";
const MANIFEST = {
name: "strict min star test",
description: "test strict min with star",
manifest_version: 2,
version: "1.0",
};
function flushAndRemove(file) {
// flush JAR cache and remove the file
Services.obs.notifyObservers(file, "flush-cache-entry", null);
file.remove(true);
}
// * in min will generate a warning
for (let version of ["0.*", "0.*.0"]) {
let apps = {
applications: {
gecko: {
id: addonId,
strict_min_version: version,
},
},
}
let testManifest = Object.assign(apps, MANIFEST);
let addonDir = writeWebManifestForExtension(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(addonId);
notEqual(addon, null, "Add-on is installed");
equal(addon.id, addonId, "Add-on has the expected id");
addon.uninstall();
flushAndRemove(addonDir);
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册