Bug 666431: Track changes made to add-ons during early startup. r=robstrong

This commit is contained in:
Dave Townsend 2011-06-29 09:21:38 -07:00
parent 820becb78e
commit a35ab5e447
10 changed files with 356 additions and 98 deletions

View File

@ -39,6 +39,7 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
[
["AllPagesList", "popup_autocomplete", "cmd_openLocation"],
@ -555,18 +556,15 @@ var BrowserUI = {
CharsetMenu.init();
// If some add-ons were disabled during during an application update, alert user
if (Services.prefs.prefHasUserValue("extensions.disabledAddons")) {
let addons = Services.prefs.getCharPref("extensions.disabledAddons").split(",");
if (addons.length > 0) {
let addonIDs = AddonManager.getStartupChanges("disabled");
if (addonIDs.length > 0) {
let disabledStrings = Strings.browser.GetStringFromName("alertAddonsDisabled");
let label = PluralForm.get(addons.length, disabledStrings).replace("#1", addons.length);
let label = PluralForm.get(addonIDs.length, disabledStrings).replace("#1", addonIDs.length);
let image = "chrome://browser/skin/images/alert-addons-30.png";
let alerts = Cc["@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification(image, Strings.browser.GetStringFromName("alertAddons"), label, false, "", null);
}
Services.prefs.clearUserPref("extensions.disabledAddons");
}
#ifdef MOZ_UPDATER
// Check for updates in progress

View File

@ -273,6 +273,7 @@ var AddonManagerInternal = {
typeListeners: [],
providers: [],
types: {},
startupChanges: {},
// A read-only wrapper around the types dictionary
typesProxy: Proxy.create({
@ -385,6 +386,13 @@ var AddonManagerInternal = {
callProvider(provider, "startup", null, appChanged, oldAppVersion,
oldPlatformVersion);
});
// If this is a new profile just pretend that there were no changes
if (appChanged === undefined) {
for (let type in this.startupChanges)
delete this.startupChanges[type];
}
gStarted = true;
},
@ -467,7 +475,7 @@ var AddonManagerInternal = {
* Shuts down the addon manager and all registered providers, this must clean
* up everything in order for automated tests to fake restarts.
*/
shutdown: function AM_shutdown() {
shutdown: function AMI_shutdown() {
this.providers.forEach(function(provider) {
callProvider(provider, "shutdown");
});
@ -475,6 +483,8 @@ var AddonManagerInternal = {
this.installListeners.splice(0);
this.addonListeners.splice(0);
this.typeListeners.splice(0);
for (let type in this.startupChanges)
delete this.startupChanges[type];
gStarted = false;
},
@ -538,6 +548,49 @@ var AddonManagerInternal = {
});
},
/**
* Adds a add-on to the list of detected changes for this startup. If
* addStartupChange is called multiple times for the same add-on in the same
* startup then only the most recent change will be remembered.
*
* @param aType
* The type of change as a string. Providers can define their own
* types of changes or use the existing defined STARTUP_CHANGE_*
* constants
* @param aID
* The ID of the add-on
*/
addStartupChange: function AMI_addStartupChange(aType, aID) {
if (gStarted)
return;
// Ensure that an ID is only listed in one type of change
for (let type in this.startupChanges)
this.removeStartupChange(type, aID);
if (!(aType in this.startupChanges))
this.startupChanges[aType] = [];
this.startupChanges[aType].push(aID);
},
/**
* Removes a startup change for an add-on.
*
* @param aType
* The type of change
* @param aID
* The ID of the add-on
*/
removeStartupChange: function AMI_removeStartupChange(aType, aID) {
if (gStarted)
return;
if (!(aType in this.startupChanges))
return;
this.startupChanges[aType] = this.startupChanges[aType].filter(function(aItem) aItem != aID);
},
/**
* Calls all registered InstallListeners with an event. Any parameters after
* the extraListeners parameter are passed to the listener.
@ -1064,6 +1117,14 @@ var AddonManagerPrivate = {
AddonManagerInternal.backgroundUpdateCheck();
},
addStartupChange: function AMP_addStartupChange(aType, aID) {
AddonManagerInternal.addStartupChange(aType, aID);
},
removeStartupChange: function AMP_removeStartupChange(aType, aID) {
AddonManagerInternal.removeStartupChange(aType, aID);
},
notifyAddonChanged: function AMP_notifyAddonChanged(aId, aType, aPendingRestart) {
AddonManagerInternal.notifyAddonChanged(aId, aType, aPendingRestart);
},
@ -1220,6 +1281,26 @@ var AddonManager = {
// Options will be displayed in a new tab, if possible
OPTIONS_TYPE_TAB: 3,
// Constants for getStartupChanges, addStartupChange and removeStartupChange
// Add-ons that were detected as installed during startup. Doesn't include
// add-ons that were pending installation the last time the application ran.
STARTUP_CHANGE_INSTALLED: "installed",
// Add-ons that were detected as changed during startup. This includes an
// add-on moving to a different location, changing version or just having
// been detected as possibly changed.
STARTUP_CHANGE_CHANGED: "changed",
// Add-ons that were detected as uninstalled during startup. Doesn't include
// add-ons that were pending uninstallation the last time the application ran.
STARTUP_CHANGE_UNINSTALLED: "uninstalled",
// Add-ons that were detected as disabled during startup, normally because of
// an application change making an add-on incompatible. Doesn't include
// add-ons that were pending being disabled the last time the application ran.
STARTUP_CHANGE_DISABLED: "disabled",
// Add-ons that were detected as enabled during startup, normally because of
// an application change making an add-on compatible. Doesn't include
// add-ons that were pending being enabled the last time the application ran.
STARTUP_CHANGE_ENABLED: "enabled",
getInstallForURL: function AM_getInstallForURL(aUrl, aCallback, aMimetype,
aHash, aName, aIconURL,
aVersion, aLoadGroup) {
@ -1231,6 +1312,19 @@ var AddonManager = {
AddonManagerInternal.getInstallForFile(aFile, aCallback, aMimetype);
},
/**
* Gets an array of add-on IDs that changed during the most recent startup.
*
* @param aType
* The type of startup change to get
* @return An array of add-on IDs
*/
getStartupChanges: function AM_getStartupChanges(aType) {
if (!(aType in AddonManagerInternal.startupChanges))
return [];
return AddonManagerInternal.startupChanges[aType].slice(0);
},
getAddonByID: function AM_getAddonByID(aId, aCallback) {
AddonManagerInternal.getAddonByID(aId, aCallback);
},

View File

@ -68,7 +68,6 @@ const PREF_EM_EXTENSION_FORMAT = "extensions.";
const PREF_EM_ENABLED_SCOPES = "extensions.enabledScopes";
const PREF_EM_AUTO_DISABLED_SCOPES = "extensions.autoDisableScopes";
const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI";
const PREF_EM_DISABLED_ADDONS_LIST = "extensions.disabledAddons";
const PREF_XPI_ENABLED = "xpinstall.enabled";
const PREF_XPI_WHITELIST_REQUIRED = "xpinstall.whitelist.required";
const PREF_XPI_WHITELIST_PERMISSIONS = "xpinstall.whitelist.add";
@ -1456,14 +1455,6 @@ var XPIProvider = {
enabledAddons: null,
// An array of add-on IDs of add-ons that were inactive during startup
inactiveAddonIDs: [],
// A cache of the add-on IDs of add-ons that had changes performed to them
// during this session's startup. This is preliminary work, hopefully it will
// be expanded on in the future and an API made to get at it from the
// application.
startupChanges: {
// Add-ons that became disabled for compatibility reasons
appDisabled: []
},
/**
* Starts the XPI provider initializes the install locations and prefs.
@ -1586,25 +1577,14 @@ var XPIProvider = {
// Changes to installed extensions may have changed which theme is selected
this.applyThemeChange();
if (Services.prefs.prefHasUserValue(PREF_EM_DISABLED_ADDONS_LIST))
Services.prefs.clearUserPref(PREF_EM_DISABLED_ADDONS_LIST);
// If the application has been upgraded and there are add-ons outside the
// application directory then we may need to synchronize compatibility
// information
if (aAppChanged && !this.allAppGlobal) {
// Should we show a UI or just pass the list via a pref?
if (Prefs.getBoolPref(PREF_EM_SHOW_MISMATCH_UI, true)) {
// information but only if the mismatch UI isn't disabled
if (aAppChanged && !this.allAppGlobal &&
Prefs.getBoolPref(PREF_EM_SHOW_MISMATCH_UI, true)) {
this.showMismatchWindow();
flushCaches = true;
}
else if (this.startupChanges.appDisabled.length > 0) {
// Remember the list of add-ons that were disabled this startup so
// the application can notify the user however it wants to
Services.prefs.setCharPref(PREF_EM_DISABLED_ADDONS_LIST,
this.startupChanges.appDisabled.join(","));
}
}
if (flushCaches) {
flushStartupCache();
@ -1672,9 +1652,6 @@ var XPIProvider = {
this.enabledAddons = null;
this.allAppGlobal = true;
for (let type in this.startupChanges)
this.startupChanges[type] = [];
this.inactiveAddonIDs = [];
// If there are pending operations then we must update the list of active
@ -2306,6 +2283,9 @@ var XPIProvider = {
XPIDatabase.updateAddonMetadata(aOldAddon, newAddon, aAddonState.descriptor);
if (newAddon.visible) {
visibleAddons[newAddon.id] = newAddon;
// Remember add-ons that were changed during startup
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
newAddon.id);
// If this was the active theme and it is now disabled then enable the
// default theme
@ -2390,6 +2370,9 @@ var XPIProvider = {
visibleAddons[aOldAddon.id] = aOldAddon;
if (!aOldAddon.visible) {
// Remember add-ons that were changed during startup.
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
aOldAddon.id);
XPIDatabase.makeAddonVisible(aOldAddon);
if (aOldAddon.bootstrap) {
@ -2437,10 +2420,6 @@ var XPIProvider = {
let wasDisabled = isAddonDisabled(aOldAddon);
let isDisabled = isAddonDisabled(newAddon);
// Remember add-ons that became appDisabled by the application change
if (aOldAddon.visible && newAddon.appDisabled && !aOldAddon.appDisabled)
XPIProvider.startupChanges.appDisabled.push(aOldAddon.id);
// If either property has changed update the database.
if (newAddon.appDisabled != aOldAddon.appDisabled ||
newAddon.userDisabled != aOldAddon.userDisabled ||
@ -2459,6 +2438,11 @@ var XPIProvider = {
// If this is a visible add-on and it has changed disabled state then we
// may need a restart or to update the bootstrap list.
if (aOldAddon.visible && wasDisabled != isDisabled) {
// Remember add-ons that became disabled or enabled by the application
// change
let change = isDisabled ? AddonManager.STARTUP_CHANGE_DISABLED
: AddonManager.STARTUP_CHANGE_ENABLED;
AddonManagerPrivate.addStartupChange(change, aOldAddon.id);
if (aOldAddon.bootstrap) {
// Update the add-ons active state
aOldAddon.active = !isDisabled;
@ -2495,8 +2479,19 @@ var XPIProvider = {
// This add-on has disappeared
LOG("Add-on " + aOldAddon.id + " removed from " + aInstallLocation.name);
XPIDatabase.removeAddonMetadata(aOldAddon);
if (aOldAddon.active) {
// Remember add-ons that were uninstalled during startup
if (aOldAddon.visible) {
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_UNINSTALLED,
aOldAddon.id);
}
else if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED)
.indexOf(aOldAddon.id) != -1) {
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
aOldAddon.id);
}
if (aOldAddon.active) {
// Enable the default theme if the previously active theme has been
// removed
if (aOldAddon.type == "theme")
@ -2628,6 +2623,24 @@ var XPIProvider = {
}
if (newAddon.visible) {
// Remember add-ons that were installed during startup. If there was a
// cached manifest or migration data then this install is already
// expected
if (!aMigrateData && (!(aInstallLocation.name in aManifests) ||
!(aId in aManifests[aInstallLocation.name]))) {
// If a copy from a higher priority location was removed then this
// add-on has changed
if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_UNINSTALLED)
.indexOf(newAddon.id) != -1) {
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
newAddon.id);
}
else {
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_INSTALLED,
newAddon.id);
}
}
// Note if any visible add-on is not in the application install location
if (newAddon._installLocation.name != KEY_APP_GLOBAL)
XPIProvider.allAppGlobal = false;
@ -2696,6 +2709,14 @@ var XPIProvider = {
// Iterate through the add-ons installed the last time the application
// ran
addons.forEach(function(aOldAddon) {
// If a version of this add-on has been installed in an higher
// priority install location then count it as changed
if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED)
.indexOf(aOldAddon.id) != -1) {
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
aOldAddon.id);
}
// Check if the add-on is still installed
if (aOldAddon.id in addonStates) {
let addonState = addonStates[aOldAddon.id];

View File

@ -193,6 +193,10 @@ var gVersionInfoPage = {
/////////////////////////////////////////////////////////////////////////////
// UpdateListener
onUpdateFinished: function(aAddon, status) {
// If the add-on is now active then it won't have been disabled by startup
if (aAddon.active)
AddonManagerPrivate.removeStartupChange("disabled", aAddon.id);
if (status != AddonManager.UPDATE_STATUS_NO_ERROR)
gUpdateWizard.errorItems.push(aAddon);
@ -431,6 +435,9 @@ var gInstallingPage = {
},
onInstallEnded: function(aInstall) {
// Remember that this add-on was updated during startup
AddonManager.addStartupChange("updated", aInstall.id);
this.startNextInstall();
},

View File

@ -430,6 +430,20 @@ function isExtensionInAddonsList(aDir, aId) {
return isItemInAddonsList("extensions", aDir, aId);
}
function check_startup_changes(aType, aIds) {
var ids = aIds.slice(0);
ids.sort();
var changes = AddonManager.getStartupChanges(aType);
changes.sort();
// Remove the default theme if it is in the list
var pos = changes.indexOf("{972ce4c6-7e08-4474-a285-3208198ce6fd}");
if (pos != -1)
changes.splice(pos, 1);
do_check_eq(JSON.stringify(ids), JSON.stringify(changes));
}
/**
* Escapes any occurances of &, ", < or > with XML entities.
*

View File

@ -38,7 +38,6 @@
*/
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
const PREF_EM_DISABLED_ADDONS_LIST = "extensions.disabledAddons";
const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI";
// The test extension uses an insecure update url.
@ -69,6 +68,7 @@ var WindowWatcher = {
AddonManager.getAddonByID("bug542391_6@tests.mozilla.org", function(a6) {
a6.findUpdates({
onUpdateFinished: function() {
AddonManagerPrivate.removeStartupChange("disabled", "bug542391_6@tests.mozilla.org");
updated = true;
}
}, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
@ -79,6 +79,8 @@ var WindowWatcher = {
if (gInstallUpdate) {
// Simulate installing an update while in the dialog
installAllFiles([do_get_addon("test_bug542391_3_2")], function() {
AddonManagerPrivate.removeStartupChange("disabled", "bug542391_3@tests.mozilla.org");
AddonManagerPrivate.addStartupChange("updated", "bug542391_3@tests.mozilla.org");
installed = true;
});
}
@ -155,6 +157,45 @@ function check_state_v1([a1, a2, a3, a4, a5, a6]) {
do_check_true(isExtensionInAddonsList(profileDir, a6.id));
}
function check_state_v1_2([a1, a2, a3, a4, a5, a6]) {
do_check_neq(a1, null);
do_check_false(a1.appDisabled);
do_check_false(a1.userDisabled);
do_check_true(a1.isActive);
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_check_neq(a2, null);
do_check_false(a2.appDisabled);
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
do_check_false(isExtensionInAddonsList(profileDir, a2.id));
do_check_neq(a3, null);
do_check_true(a3.appDisabled);
do_check_false(a3.userDisabled);
do_check_false(a3.isActive);
do_check_false(isExtensionInAddonsList(profileDir, a3.id));
do_check_eq(a3.version, "2.0");
do_check_neq(a4, null);
do_check_false(a4.appDisabled);
do_check_true(a4.userDisabled);
do_check_false(a4.isActive);
do_check_false(isExtensionInAddonsList(profileDir, a4.id));
do_check_neq(a5, null);
do_check_false(a5.appDisabled);
do_check_false(a5.userDisabled);
do_check_true(a5.isActive);
do_check_true(isExtensionInAddonsList(profileDir, a5.id));
do_check_neq(a6, null);
do_check_false(a6.appDisabled);
do_check_false(a6.userDisabled);
do_check_true(a6.isActive);
do_check_true(isExtensionInAddonsList(profileDir, a6.id));
}
function check_state_v2([a1, a2, a3, a4, a5, a6]) {
do_check_neq(a1, null);
do_check_true(a1.appDisabled);
@ -311,6 +352,11 @@ function run_test() {
do_get_addon("test_bug542391_6")], function() {
restartManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", ["addon1@tests.mozilla.org"]);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
AddonManager.getAddonsByIDs(["bug542391_2@tests.mozilla.org",
"bug542391_4@tests.mozilla.org"],
@ -318,6 +364,11 @@ function run_test() {
a2.userDisabled = true;
a4.userDisabled = true;
restartManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
"bug542391_2@tests.mozilla.org",
@ -330,6 +381,11 @@ function run_test() {
WindowWatcher.expected = true;
restartManager("2");
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", ["bug542391_1@tests.mozilla.org"]);
check_startup_changes("enabled", []);
do_check_false(WindowWatcher.expected);
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
@ -358,6 +414,11 @@ function run_test_1() {
gCheckUpdates = true;
WindowWatcher.expected = true;
restartManager("3");
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", ["bug542391_3@tests.mozilla.org"]);
check_startup_changes("enabled", []);
do_check_false(WindowWatcher.expected);
gCheckUpdates = false;
@ -384,6 +445,11 @@ function run_test_1() {
function run_test_2() {
WindowWatcher.expected = true;
restartManager("2");
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", ["bug542391_3@tests.mozilla.org"]);
do_check_false(WindowWatcher.expected);
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
@ -401,59 +467,6 @@ function run_test_2() {
do_check_true(WindowWatcher.arguments.indexOf("bug542391_3@tests.mozilla.org") >= 0);
do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
run_test_3();
});
}
// Upgrade to version 3 which will appDisable two more add-ons.
function run_test_3() {
Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, false);
restartManager("3");
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
"bug542391_2@tests.mozilla.org",
"bug542391_3@tests.mozilla.org",
"bug542391_4@tests.mozilla.org",
"bug542391_5@tests.mozilla.org",
"bug542391_6@tests.mozilla.org"],
function(addons) {
check_state_v3(addons);
var disabled = [];
try {
disabled = Services.prefs.getCharPref(PREF_EM_DISABLED_ADDONS_LIST).split(",");
}
catch (e) {}
do_check_eq(disabled.length, 2);
do_check_true(disabled.indexOf("bug542391_2@tests.mozilla.org") >= 0);
do_check_true(disabled.indexOf("bug542391_3@tests.mozilla.org") >= 0);
Services.prefs.clearUserPref(PREF_EM_DISABLED_ADDONS_LIST);
run_test_4();
});
}
// Downgrade to version 2 which will remove appDisable from two add-ons.
function run_test_4() {
restartManager("2");
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
"bug542391_2@tests.mozilla.org",
"bug542391_3@tests.mozilla.org",
"bug542391_4@tests.mozilla.org",
"bug542391_5@tests.mozilla.org",
"bug542391_6@tests.mozilla.org"],
function(addons) {
check_state_v2(addons);
var disabled = [];
try {
disabled = Services.prefs.getCharPref(PREF_EM_DISABLED_ADDONS_LIST).split(",");
}
catch (e) {}
do_check_eq(disabled.length, 0);
run_test_5();
});
}
@ -466,6 +479,11 @@ function run_test_5() {
WindowWatcher.expected = true;
restartManager("3");
check_startup_changes("installed", []);
check_startup_changes("updated", ["bug542391_3@tests.mozilla.org"]);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
do_check_false(WindowWatcher.expected);
gInstallUpdate = false;
@ -483,6 +501,30 @@ function run_test_5() {
do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
run_test_6();
});
}
// Downgrade to version 1 which will appEnable all the add-ons
function run_test_6() {
WindowWatcher.expected = true;
restartManager("1");
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", ["bug542391_3@tests.mozilla.org"]);
check_startup_changes("enabled", ["bug542391_1@tests.mozilla.org"]);
do_check_false(WindowWatcher.expected);
AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
"bug542391_2@tests.mozilla.org",
"bug542391_3@tests.mozilla.org",
"bug542391_4@tests.mozilla.org",
"bug542391_5@tests.mozilla.org",
"bug542391_6@tests.mozilla.org"],
function(addons) {
check_state_v1_2(addons);
finish_test();
});
}

View File

@ -129,6 +129,11 @@ function run_test() {
Services.prefs.setCharPref("extensions.lastAppVersion", "1");
startupManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
do_check_false(oldCache.exists());

View File

@ -139,6 +139,12 @@ function run_test() {
db.close();
startupManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",

View File

@ -143,6 +143,12 @@ function run_test() {
Services.prefs.setCharPref("general.skins.selectedSkin", "theme1/1.0");
startupManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",

View File

@ -126,6 +126,11 @@ function run_test() {
}, "startupcache-invalidate", false);
startupManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
@ -169,6 +174,13 @@ function run_test_1() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, ["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -262,6 +274,11 @@ function run_test_2() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon3@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -318,6 +335,12 @@ function run_test_3() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -371,6 +394,11 @@ function run_test_4() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon1@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -405,6 +433,11 @@ function run_test_5() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, ["addon1@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -445,6 +478,11 @@ function run_test_6() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -489,6 +527,12 @@ function run_test_7() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -538,6 +582,11 @@ function run_test_8() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -581,6 +630,11 @@ function run_test_9() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, ["addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -633,6 +687,11 @@ function run_test_10() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, ["addon1@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -685,6 +744,12 @@ function run_test_11() {
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_CHANGED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, ["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"]);
check_startup_changes(AddonManager.STARTUP_CHANGE_DISABLED, []);
check_startup_changes(AddonManager.STARTUP_CHANGE_ENABLED, []);
do_check_true(gCachePurged);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",