Bug 1026853 - Experiment is displayed as "pending removal" in detailed view. r=irving

This commit is contained in:
Blair McBride 2014-07-03 16:19:58 +12:00
parent 01e8b44f53
commit 1d9cc07ff7
2 changed files with 17 additions and 4 deletions

View File

@ -6646,10 +6646,15 @@ function AddonWrapper(aAddon) {
return AddonManager.PENDING_UNINSTALL;
}
if (aAddon.active && isAddonDisabled(aAddon))
pending |= AddonManager.PENDING_DISABLE;
else if (!aAddon.active && !isAddonDisabled(aAddon))
pending |= AddonManager.PENDING_ENABLE;
// Extensions have an intentional inconsistency between what the DB says is
// enabled and what we say to the ouside world. so we need to cover up that
// lie here as well.
if (aAddon.type != "experiment") {
if (aAddon.active && isAddonDisabled(aAddon))
pending |= AddonManager.PENDING_DISABLE;
else if (!aAddon.active && !isAddonDisabled(aAddon))
pending |= AddonManager.PENDING_ENABLE;
}
if (aAddon.pendingUpgrade)
pending |= AddonManager.PENDING_UPGRADE;

View File

@ -24,6 +24,10 @@ add_test(function test_experiment() {
"Background updates are disabled.");
Assert.equal(addon.permissions, AddonManager.PERM_CAN_UNINSTALL,
"Permissions are minimal.");
Assert.ok(!(addon.pendingOperations & AddonManager.PENDING_ENABLE),
"Should not be pending enable");
Assert.ok(!(addon.pendingOperations & AddonManager.PENDING_DISABLE),
"Should not be pending disable");
// Setting applyBackgroundUpdates should not work.
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
@ -72,6 +76,10 @@ add_test(function test_userDisabledNotPersisted() {
Assert.ok(addon, "Add-on retrieved.");
Assert.equal(addon.userDisabled, false, "Add-on is still enabled after API retrieve.");
Assert.ok(addon.isActive, "Add-on is still active.");
Assert.ok(!(addon.pendingOperations & AddonManager.PENDING_ENABLE),
"Should not be pending enable");
Assert.ok(!(addon.pendingOperations & AddonManager.PENDING_DISABLE),
"Should not be pending disable");
// Now when we restart the manager the add-on should revert state.
restartManager();