Bug 1245956 - Don't distinguish preliminary signing for add-ons part 2 r?mossop
MozReview-Commit-ID: 61Ihbe8qp0N
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -3247,18 +3247,17 @@ this.XPIProvider = {
logger.error("Unable to read add-on manifest from " + stageDirEntry.path, e);
// This add-on can't be installed so just remove it now
seenFiles.push(stageDirEntry.leafName);
seenFiles.push(jsonfile.leafName);
continue;
}
if (mustSign(addon.type) &&
- (addon.signedState <= AddonManager.SIGNEDSTATE_MISSING ||
- (foreignInstall && addon.signedState < AddonManager.SIGNEDSTATE_SIGNED))) {
+ addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
logger.warn("Refusing to install staged add-on " + id + " with signed state " + addon.signedState);
seenFiles.push(stageDirEntry.leafName);
seenFiles.push(jsonfile.leafName);
continue;
}
// Check for a cached metadata for this add-on, it may contain updated
// compatibility information
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js
@@ -337,43 +337,46 @@ add_task(function*() {
});
// Preliminarily-signed sideloaded add-ons should work
add_task(function*() {
let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.preliminary), profileDir, ID);
startupManager();
- // Currently we leave the sideloaded add-on there but just don't run it
let addon = yield promiseAddonByID(ID);
do_check_neq(addon, null);
do_check_false(addon.appDisabled);
do_check_true(addon.isActive);
do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_PRELIMINARY);
do_check_eq(getActiveVersion(), 2);
addon.uninstall();
yield promiseShutdownManager();
resetPrefs();
do_check_false(file.exists());
clearCache(file);
});
+// Preliminarily-signed sideloaded add-ons should work via staged install
add_task(function*() {
let stage = profileDir.clone();
stage.append("staged");
let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.preliminary), stage, ID);
startupManager();
- // Should have refused to install preliminarily signed version
let addon = yield promiseAddonByID(ID);
- do_check_eq(addon, null);
- do_check_eq(getActiveVersion(), -1);
+ do_check_neq(addon, null);
+ do_check_false(addon.appDisabled);
+ do_check_true(addon.isActive);
+ do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_PRELIMINARY);
+ do_check_eq(getActiveVersion(), 2);
+
+ addon.uninstall();
+ yield promiseShutdownManager();
+ resetPrefs();
do_check_false(file.exists());
clearCache(file);
-
- yield promiseShutdownManager();
- resetPrefs();
});