mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 760356: Only show the addon compat UI when necessary; r=unfocused
--HG-- rename : toolkit/mozapps/extensions/test/addons/test_bug542391_5/install.rdf => toolkit/mozapps/extensions/test/addons/min1max3b/install.rdf rename : toolkit/mozapps/extensions/test/addons/test_bug542391_6/install.rdf => toolkit/mozapps/extensions/test/addons/override1x2-1x3/install.rdf
This commit is contained in:
parent
2f534f79b1
commit
4cc2228656
@ -1260,7 +1260,7 @@ var AddonManagerInternal = {
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("The hotfix add-on was not signed by the expected " +
|
||||
"certificate and so will not be installed.");
|
||||
"certificate and so will not be installed.", e);
|
||||
aInstall.cancel();
|
||||
}
|
||||
},
|
||||
|
@ -14,21 +14,23 @@ const PREF_XPINSTALL_ENABLED = "xpinstall.enabled";
|
||||
// timeout (in milliseconds) to wait for response to the metadata ping
|
||||
const METADATA_TIMEOUT = 30000;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm");
|
||||
|
||||
Components.utils.import("resource://gre/modules/Log.jsm");
|
||||
let logger = Log.repository.getLogger("addons.update-dialog");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate", "resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modules/addons/AddonRepository.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Log", "resource://gre/modules/Log.jsm");
|
||||
let logger = null;
|
||||
|
||||
var gUpdateWizard = {
|
||||
// When synchronizing app compatibility info this contains all installed
|
||||
// add-ons. When checking for compatible versions this contains only
|
||||
// incompatible add-ons.
|
||||
addons: [],
|
||||
// Contains a list of add-ons that were disabled prior to the application
|
||||
// upgrade.
|
||||
inactiveAddonIDs: [],
|
||||
// Contains a Set of IDs for add-on that were disabled by the application update.
|
||||
affectedAddonIDs: null,
|
||||
// The add-ons that we found updates available for
|
||||
addonsToUpdate: [],
|
||||
shouldSuggestAutoChecking: false,
|
||||
@ -50,7 +52,9 @@ var gUpdateWizard = {
|
||||
|
||||
init: function gUpdateWizard_init()
|
||||
{
|
||||
this.inactiveAddonIDs = window.arguments[0];
|
||||
logger = Log.repository.getLogger("addons.update-dialog");
|
||||
// XXX could we pass the addons themselves rather than the IDs?
|
||||
this.affectedAddonIDs = new Set(window.arguments[0]);
|
||||
|
||||
try {
|
||||
this.shouldSuggestAutoChecking =
|
||||
@ -161,11 +165,11 @@ var gOfflinePage = {
|
||||
// Addon listener to count addons enabled/disabled by metadata checks
|
||||
let listener = {
|
||||
onDisabled: function listener_onDisabled(aAddon) {
|
||||
logger.debug("onDisabled for ${id}", aAddon);
|
||||
gUpdateWizard.affectedAddonIDs.add(aAddon.id);
|
||||
gUpdateWizard.metadataDisabled++;
|
||||
},
|
||||
onEnabled: function listener_onEnabled(aAddon) {
|
||||
logger.debug("onEnabled for ${id}", aAddon);
|
||||
gUpdateWizard.affectedAddonIDs.delete(aAddon.id);
|
||||
gUpdateWizard.metadataEnabled++;
|
||||
}
|
||||
};
|
||||
@ -174,45 +178,49 @@ var gVersionInfoPage = {
|
||||
_completeCount: 0,
|
||||
_totalCount: 0,
|
||||
_versionInfoDone: false,
|
||||
onPageShow: function gVersionInfoPage_onPageShow()
|
||||
{
|
||||
onPageShow: Task.async(function* gVersionInfoPage_onPageShow() {
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
"cancelButtonText", false);
|
||||
|
||||
// Retrieve all add-ons in order to sync their app compatibility information
|
||||
AddonManager.getAllAddons(aAddons => {
|
||||
gUpdateWizard.disabled = gUpdateWizard.affectedAddonIDs.size;
|
||||
|
||||
// Ensure compatibility overrides are up to date before checking for
|
||||
// individual addon updates.
|
||||
AddonManager.addAddonListener(listener);
|
||||
if (AddonRepository.isMetadataStale()) {
|
||||
// Do the metadata ping, listening for any newly enabled/disabled add-ons.
|
||||
yield AddonRepository.repopulateCache(METADATA_TIMEOUT);
|
||||
if (gUpdateWizard.shuttingDown) {
|
||||
logger.debug("getAllAddons completed after dialog closed");
|
||||
logger.debug("repopulateCache completed after dialog closed");
|
||||
}
|
||||
}
|
||||
// Fetch the add-ons that are still affected by this update,
|
||||
// excluding the hotfix add-on.
|
||||
let idlist = [id for (id of gUpdateWizard.affectedAddonIDs)
|
||||
if (id != AddonManager.hotfixID)];
|
||||
if (idlist.length < 1) {
|
||||
gVersionInfoPage.onAllUpdatesFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
gUpdateWizard.addons = [a for (a of aAddons)
|
||||
if (a.type != "plugin" && a.id != AddonManager.hotfixID)];
|
||||
logger.debug("Fetching affected addons " + idlist.toSource());
|
||||
let fetchedAddons = yield new Promise((resolve, reject) =>
|
||||
AddonManager.getAddonsByIDs(idlist, resolve));
|
||||
// We shouldn't get nulls here, but let's be paranoid...
|
||||
gUpdateWizard.addons = [a for (a of fetchedAddons) if (a)];
|
||||
if (gUpdateWizard.addons.length < 1) {
|
||||
gVersionInfoPage.onAllUpdatesFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
|
||||
gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
|
||||
|
||||
// Count the add-ons newly disabled by this application update
|
||||
for (let addon of gUpdateWizard.addons) {
|
||||
if (gUpdateWizard.inactiveAddonIDs.indexOf(addon.id) != -1) {
|
||||
gUpdateWizard.disabled++;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure compatibility overrides are up to date before checking for
|
||||
// individual addon updates.
|
||||
AddonManager.addAddonListener(listener);
|
||||
AddonRepository.repopulateCache(METADATA_TIMEOUT).then(() => {
|
||||
if (gUpdateWizard.shuttingDown) {
|
||||
logger.debug("repopulateCache completed after dialog closed");
|
||||
}
|
||||
|
||||
for (let addon of gUpdateWizard.addons) {
|
||||
logger.debug("VersionInfo Finding updates for " + addon.id);
|
||||
addon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
for (let addon of gUpdateWizard.addons) {
|
||||
logger.debug("VersionInfo Finding updates for ${id}", addon);
|
||||
addon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
}
|
||||
}),
|
||||
|
||||
onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
@ -227,14 +235,12 @@ var gVersionInfoPage = {
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgraded", 0);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed", 0);
|
||||
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined", 0);
|
||||
// Filter out any add-ons that were disabled before the application was
|
||||
// upgraded or are already compatible
|
||||
logger.debug("VersionInfo updates finished: inactive " +
|
||||
gUpdateWizard.inactiveAddonIDs.toSource() + " found " +
|
||||
// Filter out any add-ons that are now enabled.
|
||||
logger.debug("VersionInfo updates finished: found " +
|
||||
[addon.id + ":" + addon.appDisabled for (addon of gUpdateWizard.addons)].toSource());
|
||||
let filteredAddons = [];
|
||||
for (let a of gUpdateWizard.addons) {
|
||||
if (a.appDisabled && gUpdateWizard.inactiveAddonIDs.indexOf(a.id) < 0) {
|
||||
if (a.appDisabled) {
|
||||
logger.debug("Continuing with add-on " + a.id);
|
||||
filteredAddons.push(a);
|
||||
}
|
||||
@ -291,7 +297,7 @@ var gVersionInfoPage = {
|
||||
// If we're still in the update check window and the add-on is now active
|
||||
// then it won't have been disabled by startup
|
||||
if (aAddon.active) {
|
||||
AddonManagerPrivate.removeStartupChange("disabled", aAddon.id);
|
||||
AddonManagerPrivate.removeStartupChange(AddonManager.STARTUP_CHANGE_DISABLED, aAddon.id);
|
||||
gUpdateWizard.metadataEnabled++;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@ const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseUR
|
||||
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
|
||||
const PREF_GETADDONS_DB_SCHEMA = "extensions.getAddons.databaseSchema"
|
||||
|
||||
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
|
||||
const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold";
|
||||
const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days
|
||||
|
||||
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
|
||||
|
||||
const API_VERSION = "1.5";
|
||||
@ -537,6 +541,29 @@ this.AddonRepository = {
|
||||
return AddonDatabase.shutdown(false);
|
||||
},
|
||||
|
||||
metadataAge: function() {
|
||||
let now = Math.round(Date.now() / 1000);
|
||||
|
||||
let lastUpdate = 0;
|
||||
try {
|
||||
lastUpdate = Services.prefs.getIntPref(PREF_METADATA_LASTUPDATE);
|
||||
} catch (e) {}
|
||||
|
||||
// Handle clock jumps
|
||||
if (now < lastUpdate) {
|
||||
return now;
|
||||
}
|
||||
return now - lastUpdate;
|
||||
},
|
||||
|
||||
isMetadataStale: function AddonRepo_isMetadataStale() {
|
||||
let threshold = DEFAULT_METADATA_UPDATETHRESHOLD_SEC;
|
||||
try {
|
||||
threshold = Services.prefs.getIntPref(PREF_METADATA_UPDATETHRESHOLD_SEC);
|
||||
} catch (e) {}
|
||||
return (this.metadataAge() > threshold);
|
||||
},
|
||||
|
||||
/**
|
||||
* Asynchronously get a cached add-on by id. The add-on (or null if the
|
||||
* add-on is not found) is passed to the specified callback. If caching is
|
||||
@ -1748,7 +1775,13 @@ var AddonDatabase = {
|
||||
*/
|
||||
repopulate: function AD_repopulate(aAddons, aCallback) {
|
||||
this.DB.addons.clear();
|
||||
this.insertAddons(aAddons, aCallback);
|
||||
this.insertAddons(aAddons, function repopulate_insertAddons() {
|
||||
let now = Math.round(Date.now() / 1000);
|
||||
logger.debug("Cache repopulated, setting " + PREF_METADATA_LASTUPDATE + " to " + now);
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, now);
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -433,6 +433,7 @@ UpdateParser.prototype = {
|
||||
onLoad: function UP_onLoad() {
|
||||
let request = this.request;
|
||||
this.request = null;
|
||||
this._doneAt = new Error("place holder");
|
||||
|
||||
let requireBuiltIn = true;
|
||||
try {
|
||||
@ -478,7 +479,7 @@ UpdateParser.prototype = {
|
||||
results = parseRDFManifest(this.id, this.updateKey, request);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn(e);
|
||||
logger.warn("onUpdateCheckComplete failed to parse RDF manifest", e);
|
||||
this.notifyError(AddonUpdateChecker.ERROR_PARSE_ERROR);
|
||||
return;
|
||||
}
|
||||
@ -490,6 +491,9 @@ UpdateParser.prototype = {
|
||||
logger.warn("onUpdateCheckComplete notification failed", e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.warn("onUpdateCheckComplete may not properly cancel", new Error("stack marker"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -502,6 +506,7 @@ UpdateParser.prototype = {
|
||||
*/
|
||||
onTimeout: function() {
|
||||
this.request = null;
|
||||
this._doneAt = new Error("Timed out");
|
||||
logger.warn("Request for " + this.url + " timed out");
|
||||
this.notifyError(AddonUpdateChecker.ERROR_TIMEOUT);
|
||||
},
|
||||
@ -530,6 +535,7 @@ UpdateParser.prototype = {
|
||||
}
|
||||
|
||||
this.request = null;
|
||||
this._doneAt = new Error("UP_onError");
|
||||
|
||||
this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
|
||||
},
|
||||
@ -552,8 +558,13 @@ UpdateParser.prototype = {
|
||||
* Called to cancel an in-progress update check.
|
||||
*/
|
||||
cancel: function UP_cancel() {
|
||||
if (!this.request) {
|
||||
logger.error("Trying to cancel already-complete request", this._doneAt);
|
||||
return;
|
||||
}
|
||||
this.request.abort();
|
||||
this.request = null;
|
||||
this._doneAt = new Error("UP_cancel");
|
||||
this.notifyError(AddonUpdateChecker.ERROR_CANCELLED);
|
||||
}
|
||||
};
|
||||
|
@ -40,6 +40,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
|
||||
"resource://gre/modules/devtools/Console.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
|
||||
"@mozilla.org/extensions/blocklist;1",
|
||||
Ci.nsIBlocklistService);
|
||||
XPCOMUtils.defineLazyServiceGetter(this,
|
||||
"ChromeRegistry",
|
||||
"@mozilla.org/chrome/chrome-registry;1",
|
||||
@ -147,10 +150,10 @@ const PENDING_INSTALL_METADATA =
|
||||
// DB schema version to ensure changes are picked up ASAP.
|
||||
const STATIC_BLOCKLIST_PATTERNS = [
|
||||
{ creator: "Mozilla Corp.",
|
||||
level: Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
level: Blocklist.STATE_BLOCKED,
|
||||
blockID: "i162" },
|
||||
{ creator: "Mozilla.org",
|
||||
level: Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
level: Blocklist.STATE_BLOCKED,
|
||||
blockID: "i162" }
|
||||
];
|
||||
|
||||
@ -579,20 +582,17 @@ function applyBlocklistChanges(aOldAddon, aNewAddon, aOldAppVersion,
|
||||
aNewAddon.userDisabled = aOldAddon.userDisabled;
|
||||
aNewAddon.softDisabled = aOldAddon.softDisabled;
|
||||
|
||||
let bs = Cc["@mozilla.org/extensions/blocklist;1"].
|
||||
getService(Ci.nsIBlocklistService);
|
||||
|
||||
let oldBlocklistState = bs.getAddonBlocklistState(createWrapper(aOldAddon),
|
||||
aOldAppVersion,
|
||||
aOldPlatformVersion);
|
||||
let newBlocklistState = bs.getAddonBlocklistState(createWrapper(aNewAddon));
|
||||
let oldBlocklistState = Blocklist.getAddonBlocklistState(createWrapper(aOldAddon),
|
||||
aOldAppVersion,
|
||||
aOldPlatformVersion);
|
||||
let newBlocklistState = Blocklist.getAddonBlocklistState(createWrapper(aNewAddon));
|
||||
|
||||
// If the blocklist state hasn't changed then the properties don't need to
|
||||
// change
|
||||
if (newBlocklistState == oldBlocklistState)
|
||||
return;
|
||||
|
||||
if (newBlocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
|
||||
if (newBlocklistState == Blocklist.STATE_SOFTBLOCKED) {
|
||||
if (aNewAddon.type != "theme") {
|
||||
// The add-on has become softblocked, set softDisabled if it isn't already
|
||||
// userDisabled
|
||||
@ -621,7 +621,7 @@ function isUsableAddon(aAddon) {
|
||||
if (aAddon.type == "theme" && aAddon.internalName == XPIProvider.defaultSkin)
|
||||
return true;
|
||||
|
||||
if (aAddon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
|
||||
if (aAddon.blocklistState == Blocklist.STATE_BLOCKED)
|
||||
return false;
|
||||
|
||||
if (AddonManager.checkUpdateSecurity && !aAddon.providesUpdatesSecurely)
|
||||
@ -943,7 +943,7 @@ function loadManifestFromRDF(aUri, aStream) {
|
||||
}
|
||||
else {
|
||||
addon.userDisabled = false;
|
||||
addon.softDisabled = addon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED;
|
||||
addon.softDisabled = addon.blocklistState == Blocklist.STATE_SOFTBLOCKED;
|
||||
}
|
||||
|
||||
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
|
||||
@ -1573,6 +1573,20 @@ function makeSafe(aFunction) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a bit of per-addon telemetry
|
||||
* @param aAddon the addon to record
|
||||
*/
|
||||
function recordAddonTelemetry(aAddon) {
|
||||
let loc = aAddon.defaultLocale;
|
||||
if (loc) {
|
||||
if (loc.name)
|
||||
XPIProvider.setTelemetry(aAddon.id, "name", loc.name);
|
||||
if (loc.creator)
|
||||
XPIProvider.setTelemetry(aAddon.id, "creator", loc.creator);
|
||||
}
|
||||
}
|
||||
|
||||
this.XPIProvider = {
|
||||
// An array of known install locations
|
||||
installLocations: null,
|
||||
@ -1605,8 +1619,6 @@ this.XPIProvider = {
|
||||
allAppGlobal: true,
|
||||
// A string listing the enabled add-ons for annotating crash reports
|
||||
enabledAddons: null,
|
||||
// An array of add-on IDs of add-ons that were inactive during startup
|
||||
inactiveAddonIDs: [],
|
||||
// Keep track of startup phases for telemetry
|
||||
runPhase: XPI_STARTING,
|
||||
// Keep track of the newest file in each add-on, in case we want to
|
||||
@ -1629,27 +1641,30 @@ this.XPIProvider = {
|
||||
},
|
||||
|
||||
// Keep track of in-progress operations that support cancel()
|
||||
_inProgress: new Set(),
|
||||
_inProgress: [],
|
||||
|
||||
doing: function XPI_doing(aCancellable) {
|
||||
this._inProgress.add(aCancellable);
|
||||
this._inProgress.push(aCancellable);
|
||||
},
|
||||
|
||||
done: function XPI_done(aCancellable) {
|
||||
return this._inProgress.delete(aCancellable);
|
||||
let i = this._inProgress.indexOf(aCancellable);
|
||||
if (i != -1) {
|
||||
this._inProgress.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
cancelAll: function XPI_cancelAll() {
|
||||
// Cancelling one may alter _inProgress, so restart the iterator after each
|
||||
while (this._inProgress.size > 0) {
|
||||
for (let c of this._inProgress) {
|
||||
try {
|
||||
c.cancel();
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("Cancel failed", e);
|
||||
}
|
||||
this._inProgress.delete(c);
|
||||
// Cancelling one may alter _inProgress, so don't use a simple iterator
|
||||
while (this._inProgress.length > 0) {
|
||||
let c = this._inProgress.shift();
|
||||
try {
|
||||
c.cancel();
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("Cancel failed", e);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1867,22 +1882,34 @@ this.XPIProvider = {
|
||||
// Changes to installed extensions may have changed which theme is selected
|
||||
this.applyThemeChange();
|
||||
|
||||
// If the application has been upgraded and there are add-ons outside the
|
||||
// application directory then we may need to synchronize compatibility
|
||||
// information but only if the mismatch UI isn't disabled
|
||||
if (aAppChanged && !this.allAppGlobal &&
|
||||
Prefs.getBoolPref(PREF_EM_SHOW_MISMATCH_UI, true)) {
|
||||
this.showUpgradeUI();
|
||||
flushCaches = true;
|
||||
}
|
||||
else if (aAppChanged === undefined) {
|
||||
if (aAppChanged === undefined) {
|
||||
// For new profiles we will never need to show the add-on selection UI
|
||||
Services.prefs.setBoolPref(PREF_SHOWN_SELECTION_UI, true);
|
||||
}
|
||||
else if (aAppChanged && !this.allAppGlobal &&
|
||||
Prefs.getBoolPref(PREF_EM_SHOW_MISMATCH_UI, true)) {
|
||||
if (!Prefs.getBoolPref(PREF_SHOWN_SELECTION_UI, false)) {
|
||||
// Flip a flag to indicate that we interrupted startup with an interactive prompt
|
||||
Services.startup.interrupted = true;
|
||||
// This *must* be modal as it has to block startup.
|
||||
var features = "chrome,centerscreen,dialog,titlebar,modal";
|
||||
Services.ww.openWindow(null, URI_EXTENSION_SELECT_DIALOG, "", features, null);
|
||||
Services.prefs.setBoolPref(PREF_SHOWN_SELECTION_UI, true);
|
||||
// Ensure any changes to the add-ons list are flushed to disk
|
||||
Services.prefs.setBoolPref(PREF_PENDING_OPERATIONS,
|
||||
!XPIDatabase.writeAddonsList());
|
||||
}
|
||||
else {
|
||||
let addonsToUpdate = this.shouldForceUpdateCheck(aAppChanged);
|
||||
if (addonsToUpdate) {
|
||||
this.showUpgradeUI(addonsToUpdate);
|
||||
flushCaches = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flushCaches) {
|
||||
flushStartupCache();
|
||||
|
||||
// UI displayed early in startup (like the compatibility UI) may have
|
||||
// caused us to cache parts of the skin or locale in memory. These must
|
||||
// be flushed to allow extension provided skins and locales to take full
|
||||
@ -1986,8 +2013,6 @@ this.XPIProvider = {
|
||||
this.enabledAddons = null;
|
||||
this.allAppGlobal = true;
|
||||
|
||||
this.inactiveAddonIDs = [];
|
||||
|
||||
// If there are pending operations then we must update the list of active
|
||||
// add-ons
|
||||
if (Prefs.getBoolPref(PREF_PENDING_OPERATIONS, false)) {
|
||||
@ -2048,29 +2073,65 @@ this.XPIProvider = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows the "Compatibility Updates" UI
|
||||
* If the application has been upgraded and there are add-ons outside the
|
||||
* application directory then we may need to synchronize compatibility
|
||||
* information but only if the mismatch UI isn't disabled.
|
||||
*
|
||||
* @returns False if no update check is needed, otherwise an array of add-on
|
||||
* IDs to check for updates. Array may be empty if no add-ons can be/need
|
||||
* to be updated, but the metadata check needs to be performed.
|
||||
*/
|
||||
showUpgradeUI: function XPI_showUpgradeUI() {
|
||||
shouldForceUpdateCheck: function XPI_shouldForceUpdateCheck(aAppChanged) {
|
||||
AddonManagerPrivate.recordSimpleMeasure("XPIDB_metadata_age", AddonRepository.metadataAge());
|
||||
|
||||
let startupChanges = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
|
||||
logger.debug("shouldForceUpdateCheck startupChanges: " + startupChanges.toSource());
|
||||
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startup_disabled", startupChanges.length);
|
||||
|
||||
let forceUpdate = [];
|
||||
if (startupChanges.length > 0) {
|
||||
let addons = XPIDatabase.getAddons();
|
||||
for (let addon of addons) {
|
||||
if ((startupChanges.indexOf(addon.id) != -1) &&
|
||||
(addon.permissions() & AddonManager.PERM_CAN_UPGRADE)) {
|
||||
logger.debug("shouldForceUpdateCheck: can upgrade disabled add-on " + addon.id);
|
||||
forceUpdate.push(addon.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AddonRepository.isMetadataStale()) {
|
||||
logger.debug("shouldForceUpdateCheck: metadata is stale");
|
||||
return forceUpdate;
|
||||
}
|
||||
if (forceUpdate.length > 0) {
|
||||
return forceUpdate;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows the "Compatibility Updates" UI.
|
||||
*
|
||||
* @param aAddonIDs
|
||||
* Array opf addon IDs that were disabled by the application update, and
|
||||
* should therefore be checked for updates.
|
||||
*/
|
||||
showUpgradeUI: function XPI_showUpgradeUI(aAddonIDs) {
|
||||
logger.debug("XPI_showUpgradeUI: " + aAddonIDs.toSource());
|
||||
// Flip a flag to indicate that we interrupted startup with an interactive prompt
|
||||
Services.startup.interrupted = true;
|
||||
|
||||
if (!Prefs.getBoolPref(PREF_SHOWN_SELECTION_UI, false)) {
|
||||
// This *must* be modal as it has to block startup.
|
||||
var features = "chrome,centerscreen,dialog,titlebar,modal";
|
||||
Services.ww.openWindow(null, URI_EXTENSION_SELECT_DIALOG, "", features, null);
|
||||
Services.prefs.setBoolPref(PREF_SHOWN_SELECTION_UI, true);
|
||||
}
|
||||
else {
|
||||
var variant = Cc["@mozilla.org/variant;1"].
|
||||
createInstance(Ci.nsIWritableVariant);
|
||||
variant.setFromVariant(this.inactiveAddonIDs);
|
||||
var variant = Cc["@mozilla.org/variant;1"].
|
||||
createInstance(Ci.nsIWritableVariant);
|
||||
variant.setFromVariant(aAddonIDs);
|
||||
|
||||
// This *must* be modal as it has to block startup.
|
||||
var features = "chrome,centerscreen,dialog,titlebar,modal";
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
|
||||
}
|
||||
// This *must* be modal as it has to block startup.
|
||||
var features = "chrome,centerscreen,dialog,titlebar,modal";
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
|
||||
|
||||
// Ensure any changes to the add-ons list are flushed to disk
|
||||
Services.prefs.setBoolPref(PREF_PENDING_OPERATIONS,
|
||||
@ -2670,10 +2731,10 @@ this.XPIProvider = {
|
||||
// The ID in the manifest that was loaded must match the ID of the old
|
||||
// add-on.
|
||||
if (newAddon.id != aOldAddon.id)
|
||||
throw new Error("Incorrect id in install manifest");
|
||||
throw new Error("Incorrect id in install manifest for existing add-on " + aOldAddon.id);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("Add-on is invalid", e);
|
||||
logger.warn("updateMetadata: Add-on " + aOldAddon.id + " is invalid", e);
|
||||
XPIDatabase.removeAddonMetadata(aOldAddon);
|
||||
if (!aInstallLocation.locked)
|
||||
aInstallLocation.uninstallAddon(aOldAddon.id);
|
||||
@ -2962,7 +3023,7 @@ this.XPIProvider = {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("Add-on is invalid", e);
|
||||
logger.warn("addMetadata: Add-on " + aId + " is invalid", e);
|
||||
|
||||
// Remove the invalid add-on from the install location if the install
|
||||
// location isn't locked, no restart will be necessary
|
||||
@ -3038,7 +3099,7 @@ this.XPIProvider = {
|
||||
// then it was probably either softDisabled or userDisabled
|
||||
if (!newAddon.active && newAddon.visible && !isAddonDisabled(newAddon)) {
|
||||
// If the add-on is softblocked then assume it is softDisabled
|
||||
if (newAddon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED)
|
||||
if (newAddon.blocklistState == Blocklist.STATE_SOFTBLOCKED)
|
||||
newAddon.softDisabled = true;
|
||||
else
|
||||
newAddon.userDisabled = true;
|
||||
@ -3154,16 +3215,7 @@ this.XPIProvider = {
|
||||
let addonState = addonStates[aOldAddon.id];
|
||||
delete addonStates[aOldAddon.id];
|
||||
|
||||
// Remember add-ons that were inactive during startup
|
||||
if (aOldAddon.visible && !aOldAddon.active)
|
||||
XPIProvider.inactiveAddonIDs.push(aOldAddon.id);
|
||||
|
||||
// record a bit more per-addon telemetry
|
||||
let loc = aOldAddon.defaultLocale;
|
||||
if (loc) {
|
||||
XPIProvider.setTelemetry(aOldAddon.id, "name", loc.name);
|
||||
XPIProvider.setTelemetry(aOldAddon.id, "creator", loc.creator);
|
||||
}
|
||||
recordAddonTelemetry(aOldAddon);
|
||||
|
||||
// Check if the add-on has been changed outside the XPI provider
|
||||
if (aOldAddon.updateDate != addonState.mtime) {
|
||||
@ -4355,10 +4407,11 @@ this.XPIProvider = {
|
||||
*/
|
||||
uninstallAddon: function XPI_uninstallAddon(aAddon) {
|
||||
if (!(aAddon.inDatabase))
|
||||
throw new Error("Can only uninstall installed addons.");
|
||||
throw new Error("Cannot uninstall addon " + aAddon.id + " because it is not installed");
|
||||
|
||||
if (aAddon._installLocation.locked)
|
||||
throw new Error("Cannot uninstall addons from locked install locations");
|
||||
throw new Error("Cannot uninstall addon " + aAddon.id
|
||||
+ " from locked install location " + aAddon._installLocation.name);
|
||||
|
||||
if ("_hasResourceCache" in aAddon)
|
||||
aAddon._hasResourceCache = new Map();
|
||||
@ -5598,11 +5651,7 @@ AddonInstall.prototype = {
|
||||
XPIProvider.setTelemetry(this.addon.id, "location", this.installLocation.name);
|
||||
XPIProvider.setTelemetry(this.addon.id, "scan_MS", scanTime);
|
||||
XPIProvider.setTelemetry(this.addon.id, "scan_items", scanItems);
|
||||
let loc = this.addon.defaultLocale;
|
||||
if (loc) {
|
||||
XPIProvider.setTelemetry(this.addon.id, "name", loc.name);
|
||||
XPIProvider.setTelemetry(this.addon.id, "creator", loc.creator);
|
||||
}
|
||||
recordAddonTelemetry(this.addon);
|
||||
}
|
||||
}).bind(this)).then(null, (e) => {
|
||||
logger.warn("Failed to install " + this.file.path + " from " + this.sourceURI.spec, e);
|
||||
@ -6143,9 +6192,7 @@ AddonInternal.prototype = {
|
||||
if (staticItem)
|
||||
return staticItem.level;
|
||||
|
||||
let bs = Cc["@mozilla.org/extensions/blocklist;1"].
|
||||
getService(Ci.nsIBlocklistService);
|
||||
return bs.getAddonBlocklistState(createWrapper(this));
|
||||
return Blocklist.getAddonBlocklistState(createWrapper(this));
|
||||
},
|
||||
|
||||
get blocklistURL() {
|
||||
@ -6155,9 +6202,7 @@ AddonInternal.prototype = {
|
||||
return url.replace(/%blockID%/g, staticItem.blockID);
|
||||
}
|
||||
|
||||
let bs = Cc["@mozilla.org/extensions/blocklist;1"].
|
||||
getService(Ci.nsIBlocklistService);
|
||||
return bs.getAddonBlocklistURL(createWrapper(this));
|
||||
return Blocklist.getAddonBlocklistURL(createWrapper(this));
|
||||
},
|
||||
|
||||
applyCompatibilityUpdate: function AddonInternal_applyCompatibilityUpdate(aUpdate, aSyncCompatibility) {
|
||||
@ -6245,7 +6290,44 @@ AddonInternal.prototype = {
|
||||
|
||||
// Compatibility info may have changed so update appDisabled
|
||||
this.appDisabled = !isUsableAddon(this);
|
||||
}
|
||||
},
|
||||
|
||||
permissions: function AddonInternal_permissions() {
|
||||
let permissions = 0;
|
||||
|
||||
// Add-ons that aren't installed cannot be modified in any way
|
||||
if (!(this.inDatabase))
|
||||
return permissions;
|
||||
|
||||
// Experiments can only be uninstalled. An uninstall reflects the user
|
||||
// intent of "disable this experiment." This is partially managed by the
|
||||
// experiments manager.
|
||||
if (this.type == "experiment") {
|
||||
return AddonManager.PERM_CAN_UNINSTALL;
|
||||
}
|
||||
|
||||
if (!this.appDisabled) {
|
||||
if (this.userDisabled || this.softDisabled) {
|
||||
permissions |= AddonManager.PERM_CAN_ENABLE;
|
||||
}
|
||||
else if (this.type != "theme") {
|
||||
permissions |= AddonManager.PERM_CAN_DISABLE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add-ons that are in locked install locations, or are pending uninstall
|
||||
// cannot be upgraded or uninstalled
|
||||
if (!this._installLocation.locked && !this.pendingUninstall) {
|
||||
// Add-ons that are installed by a file link cannot be upgraded
|
||||
if (!this._installLocation.isLinkedAddon(this.id)) {
|
||||
permissions |= AddonManager.PERM_CAN_UPGRADE;
|
||||
}
|
||||
|
||||
permissions |= AddonManager.PERM_CAN_UNINSTALL;
|
||||
}
|
||||
|
||||
return permissions;
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -6579,40 +6661,7 @@ function AddonWrapper(aAddon) {
|
||||
});
|
||||
|
||||
this.__defineGetter__("permissions", function AddonWrapper_permisionsGetter() {
|
||||
let permissions = 0;
|
||||
|
||||
// Add-ons that aren't installed cannot be modified in any way
|
||||
if (!(aAddon.inDatabase))
|
||||
return permissions;
|
||||
|
||||
// Experiments can only be uninstalled. An uninstall reflects the user
|
||||
// intent of "disable this experiment." This is partially managed by the
|
||||
// experiments manager.
|
||||
if (aAddon.type == "experiment") {
|
||||
return AddonManager.PERM_CAN_UNINSTALL;
|
||||
}
|
||||
|
||||
if (!aAddon.appDisabled) {
|
||||
if (this.userDisabled) {
|
||||
permissions |= AddonManager.PERM_CAN_ENABLE;
|
||||
}
|
||||
else if (aAddon.type != "theme") {
|
||||
permissions |= AddonManager.PERM_CAN_DISABLE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add-ons that are in locked install locations, or are pending uninstall
|
||||
// cannot be upgraded or uninstalled
|
||||
if (!aAddon._installLocation.locked && !aAddon.pendingUninstall) {
|
||||
// Add-ons that are installed by a file link cannot be upgraded
|
||||
if (!aAddon._installLocation.isLinkedAddon(aAddon.id)) {
|
||||
permissions |= AddonManager.PERM_CAN_UPGRADE;
|
||||
}
|
||||
|
||||
permissions |= AddonManager.PERM_CAN_UNINSTALL;
|
||||
}
|
||||
|
||||
return permissions;
|
||||
return aAddon.permissions();
|
||||
});
|
||||
|
||||
this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() {
|
||||
|
@ -4,9 +4,9 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_1@tests.mozilla.org</em:id>
|
||||
<em:id>min1max1@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 1</em:name>
|
||||
<em:name>Test minVersion 1 maxVersion 1</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,9 +4,9 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_2@tests.mozilla.org</em:id>
|
||||
<em:id>min1max2@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 2</em:name>
|
||||
<em:name>Test minVersion 1 maxVersion 2</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,9 +4,9 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_5@tests.mozilla.org</em:id>
|
||||
<em:id>min1max3@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 5</em:name>
|
||||
<em:name>Test minVersion 1 maxVersion 3</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,7 +4,7 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_4@tests.mozilla.org</em:id>
|
||||
<em:id>min1max3b@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 4</em:name>
|
||||
<em:name>Another Test minVersion 1 maxVersion 3</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,7 +4,7 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_6@tests.mozilla.org</em:id>
|
||||
<em:id>override1x2-1x3@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug542391.rdf</em:updateURL>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 6</em:name>
|
||||
<em:name>Test override compat from 1..2 to 1..3</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,9 +4,9 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_3@tests.mozilla.org</em:id>
|
||||
<em:id>upgradeable1x2-3@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 3</em:name>
|
||||
<em:name>Test min 1 max 2 upgrade to 3</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -4,9 +4,9 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug542391_3@tests.mozilla.org</em:id>
|
||||
<em:id>upgradeable1x2-3@tests.mozilla.org</em:id>
|
||||
<em:version>2.0</em:version>
|
||||
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
@ -16,7 +16,7 @@
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Bug 542391 Test 3</em:name>
|
||||
<em:name>Test min 1 max 2 upgrade to 3</em:name>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -110,7 +110,9 @@ function uninstall_test_addons(aCallback) {
|
||||
});
|
||||
}
|
||||
|
||||
function open_compatibility_window(aInactiveAddonIds, aCallback) {
|
||||
// Open the compatibility dialog, with the list of addon IDs
|
||||
// that were disabled by this "update"
|
||||
function open_compatibility_window(aDisabledAddons, aCallback) {
|
||||
// This will reset the longer timeout multiplier to 2 which will give each
|
||||
// test that calls open_compatibility_window a minimum of 60 seconds to
|
||||
// complete.
|
||||
@ -118,9 +120,9 @@ function open_compatibility_window(aInactiveAddonIds, aCallback) {
|
||||
|
||||
var variant = Cc["@mozilla.org/variant;1"].
|
||||
createInstance(Ci.nsIWritableVariant);
|
||||
variant.setFromVariant(aInactiveAddonIds);
|
||||
variant.setFromVariant(aDisabledAddons);
|
||||
|
||||
// Cannot be modal as we want to interract with it, shouldn't cause problems
|
||||
// Cannot be modal as we want to interact with it, shouldn't cause problems
|
||||
// with testing though.
|
||||
var features = "chrome,centerscreen,dialog,titlebar";
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
@ -193,14 +195,15 @@ function check_telemetry({disabled, metaenabled, metadisabled, upgraded, failed,
|
||||
|
||||
// Tests that the right add-ons show up in the mismatch dialog and updates can
|
||||
// be installed
|
||||
add_test(function() {
|
||||
add_test(function basic_mismatch() {
|
||||
install_test_addons(function() {
|
||||
// These add-ons were inactive in the old application
|
||||
var inactiveAddonIds = [
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
// These add-ons become disabled
|
||||
var disabledAddonIds = [
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"
|
||||
];
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
|
||||
@ -210,7 +213,7 @@ add_test(function() {
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(!a6.isCompatible, "addon6 should not be compatible");
|
||||
|
||||
open_compatibility_window(inactiveAddonIds, function(aWindow) {
|
||||
open_compatibility_window(disabledAddonIds, function(aWindow) {
|
||||
var doc = aWindow.document;
|
||||
wait_for_page(aWindow, "mismatch", function(aWindow) {
|
||||
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
|
||||
@ -221,7 +224,8 @@ add_test(function() {
|
||||
is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
|
||||
is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
|
||||
|
||||
ok(a5.isCompatible, "addon5 should be compatible");
|
||||
// If it wasn't disabled by this run, we don't try to enable it
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(a6.isCompatible, "addon6 should be compatible");
|
||||
|
||||
var button = doc.documentElement.getButton("next");
|
||||
@ -270,7 +274,7 @@ add_test(function() {
|
||||
is(a8.version, "2.0", "addon8 should have updated");
|
||||
is(a9.version, "2.0", "addon9 should have updated");
|
||||
|
||||
check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
|
||||
check_telemetry({disabled: 5, metaenabled: 1, metadisabled: 0,
|
||||
upgraded: 2, failed: 0, declined: 1});
|
||||
|
||||
uninstall_test_addons(run_next_test);
|
||||
@ -286,19 +290,20 @@ add_test(function() {
|
||||
|
||||
// Tests that the install failures show the install failed page and disabling
|
||||
// xpinstall shows the right UI.
|
||||
add_test(function() {
|
||||
add_test(function failure_page() {
|
||||
install_test_addons(function() {
|
||||
// These add-ons were inactive in the old application
|
||||
var inactiveAddonIds = [
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
// These add-ons become disabled
|
||||
var disabledAddonIds = [
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"
|
||||
];
|
||||
|
||||
Services.prefs.setBoolPref("xpinstall.enabled", false);
|
||||
|
||||
open_compatibility_window(inactiveAddonIds, function(aWindow) {
|
||||
open_compatibility_window(disabledAddonIds, function(aWindow) {
|
||||
var doc = aWindow.document;
|
||||
wait_for_page(aWindow, "mismatch", function(aWindow) {
|
||||
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
|
||||
@ -312,7 +317,7 @@ add_test(function() {
|
||||
AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org"],
|
||||
function([a5, a6]) {
|
||||
ok(a5.isCompatible, "addon5 should be compatible");
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(a6.isCompatible, "addon6 should be compatible");
|
||||
|
||||
var button = doc.documentElement.getButton("next");
|
||||
@ -356,7 +361,7 @@ add_test(function() {
|
||||
uninstall_test_addons(run_next_test);
|
||||
});
|
||||
|
||||
check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
|
||||
check_telemetry({disabled: 5, metaenabled: 1, metadisabled: 0,
|
||||
upgraded: 0, failed: 1, declined: 2});
|
||||
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
@ -369,7 +374,7 @@ add_test(function() {
|
||||
});
|
||||
|
||||
// Tests that no add-ons show up in the mismatch dialog when they are all disabled
|
||||
add_test(function() {
|
||||
add_test(function all_disabled() {
|
||||
install_test_addons(function() {
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
@ -385,21 +390,7 @@ add_test(function() {
|
||||
for (let addon of aAddons)
|
||||
addon.userDisabled = true;
|
||||
|
||||
// These add-ons were inactive in the old application
|
||||
var inactiveAddonIds = [
|
||||
"addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
];
|
||||
|
||||
open_compatibility_window(inactiveAddonIds, function(aWindow) {
|
||||
open_compatibility_window([], function(aWindow) {
|
||||
// Should close immediately on its own
|
||||
wait_for_window_close(aWindow, function() {
|
||||
uninstall_test_addons(run_next_test);
|
||||
@ -410,7 +401,7 @@ add_test(function() {
|
||||
});
|
||||
|
||||
// Tests that the right UI shows for when no updates are available
|
||||
add_test(function() {
|
||||
add_test(function no_updates() {
|
||||
install_test_addons(function() {
|
||||
AddonManager.getAddonsByIDs(["addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
@ -420,11 +411,11 @@ add_test(function() {
|
||||
for (let addon of aAddons)
|
||||
addon.uninstall();
|
||||
|
||||
// These add-ons were inactive in the old application
|
||||
// These add-ons were disabled by the upgrade
|
||||
var inactiveAddonIds = [
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org"
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org"
|
||||
];
|
||||
|
||||
open_compatibility_window(inactiveAddonIds, function(aWindow) {
|
||||
@ -456,7 +447,7 @@ add_test(function() {
|
||||
|
||||
// Tests that compatibility overrides are retrieved and affect addon
|
||||
// compatibility.
|
||||
add_test(function() {
|
||||
add_test(function overrides_retrieved() {
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
|
||||
Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
|
||||
is(AddonManager.strictCompatibility, false, "Strict compatibility should be disabled");
|
||||
|
@ -10,6 +10,7 @@ const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.
|
||||
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
|
||||
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
|
||||
|
||||
let repo = {};
|
||||
Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm", repo);
|
||||
@ -139,7 +140,7 @@ function promise_open_compatibility_window(aInactiveAddonIds) {
|
||||
// This will reset the longer timeout multiplier to 2 which will give each
|
||||
// test that calls open_compatibility_window a minimum of 60 seconds to
|
||||
// complete.
|
||||
requestLongerTimeout(100 /* XXX was 2 */);
|
||||
requestLongerTimeout(2);
|
||||
|
||||
var variant = Cc["@mozilla.org/variant;1"].
|
||||
createInstance(Ci.nsIWritableVariant);
|
||||
@ -207,12 +208,13 @@ function get_list_names(aList) {
|
||||
return items;
|
||||
}
|
||||
|
||||
// These add-ons were inactive in the old application
|
||||
// These add-ons became inactive during the upgrade
|
||||
let inactiveAddonIds = [
|
||||
ao2.id,
|
||||
ao4.id,
|
||||
ao5.id,
|
||||
ao10.id
|
||||
ao6.id,
|
||||
ao7.id,
|
||||
ao8.id,
|
||||
ao9.id
|
||||
];
|
||||
|
||||
// Make sure the addons in the list are not installed
|
||||
@ -225,96 +227,6 @@ function* check_addons_uninstalled(aAddonList) {
|
||||
yield true;
|
||||
}
|
||||
|
||||
|
||||
// Tests that the right add-ons show up in the mismatch dialog and updates can
|
||||
// be installed
|
||||
// This is a task-based rewrite of the first test in browser_bug557956.js
|
||||
// kept here to show the whole process so that other tests in this file can
|
||||
// pick and choose which steps to perform, but disabled since the logic is already
|
||||
// tested in browser_bug557956.js.
|
||||
// add_task(
|
||||
function start_update() {
|
||||
// Don't pull compatibility data during add-on install
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, false);
|
||||
let addonList = [ao3, ao5, ao6, ao7, ao8, ao9];
|
||||
yield promise_install_test_addons(addonList, TESTROOT + "cancelCompatCheck.sjs");
|
||||
|
||||
|
||||
// Check that the addons start out not compatible.
|
||||
let [a5, a6, a8, a9] = yield promise_addons_by_ids([ao5.id, ao6.id, ao8.id, ao9.id]);
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(!a6.isCompatible, "addon6 should not be compatible");
|
||||
ok(!a8.isCompatible, "addon8 should not be compatible");
|
||||
ok(!a9.isCompatible, "addon9 should not be compatible");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
// Check that opening the compatibility window loads and applies
|
||||
// the compatibility update
|
||||
let compatWindow = yield promise_open_compatibility_window(inactiveAddonIds);
|
||||
var doc = compatWindow.document;
|
||||
compatWindow = yield promise_page(compatWindow, "mismatch");
|
||||
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
|
||||
is(items.length, 4, "Should have seen 4 still incompatible items");
|
||||
is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
|
||||
is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
|
||||
is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
|
||||
is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
|
||||
|
||||
ok(a5.isCompatible, "addon5 should be compatible");
|
||||
ok(a6.isCompatible, "addon6 should be compatible");
|
||||
|
||||
// Click next to start finding updates for the addons that are still incompatible
|
||||
var button = doc.documentElement.getButton("next");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, compatWindow);
|
||||
|
||||
compatWindow = yield promise_page(compatWindow, "found");
|
||||
ok(doc.getElementById("xpinstallDisabledAlert").hidden,
|
||||
"Install should be allowed");
|
||||
|
||||
var list = doc.getElementById("found.updates");
|
||||
var items = get_list_names(list);
|
||||
is(items.length, 3, "Should have seen 3 updates available");
|
||||
is(items[0], "Addon7 2.0", "Should have seen update for addon7");
|
||||
is(items[1], "Addon8 2.0", "Should have seen update for addon8");
|
||||
is(items[2], "Addon9 2.0", "Should have seen update for addon9");
|
||||
|
||||
ok(!doc.documentElement.getButton("next").disabled,
|
||||
"Next button should be enabled");
|
||||
|
||||
// Uncheck all
|
||||
for (let listItem of list.childNodes)
|
||||
EventUtils.synthesizeMouse(listItem, 2, 2, { }, compatWindow);
|
||||
|
||||
ok(doc.documentElement.getButton("next").disabled,
|
||||
"Next button should not be enabled");
|
||||
|
||||
// Check the ones we want to install
|
||||
for (let listItem of list.childNodes) {
|
||||
if (listItem.label != "Addon7 2.0")
|
||||
EventUtils.synthesizeMouse(listItem, 2, 2, { }, compatWindow);
|
||||
}
|
||||
|
||||
var button = doc.documentElement.getButton("next");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, compatWindow);
|
||||
|
||||
compatWindow = yield promise_page(compatWindow, "finished");
|
||||
var button = doc.documentElement.getButton("finish");
|
||||
ok(!button.hidden, "Finish button should not be hidden");
|
||||
ok(!button.disabled, "Finish button should not be disabled");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, compatWindow);
|
||||
|
||||
compatWindow = yield promise_window_close(compatWindow);
|
||||
|
||||
// Check that the appropriate add-ons have been updated
|
||||
let [a8, a9] = yield promise_addons_by_ids(["addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"]);
|
||||
is(a8.version, "2.0", "addon8 should have updated");
|
||||
is(a9.version, "2.0", "addon9 should have updated");
|
||||
|
||||
yield promise_uninstall_test_addons();
|
||||
}
|
||||
// );
|
||||
|
||||
// Test what happens when the user cancels during AddonRepository.repopulateCache()
|
||||
// Add-ons that have updates available should not update if they were disabled before
|
||||
// For this test, addon8 became disabled during update and addon9 was previously disabled,
|
||||
@ -343,7 +255,7 @@ add_task(function cancel_during_repopulate() {
|
||||
ok(!a8.isCompatible, "addon8 should not be compatible");
|
||||
ok(!a9.isCompatible, "addon9 should not be compatible");
|
||||
|
||||
let compatWindow = yield promise_open_compatibility_window([ao9.id, ...inactiveAddonIds]);
|
||||
let compatWindow = yield promise_open_compatibility_window([ao5.id, ao8.id]);
|
||||
var doc = compatWindow.document;
|
||||
yield promise_page(compatWindow, "versioninfo");
|
||||
|
||||
@ -386,6 +298,8 @@ add_task(function cancel_during_findUpdates() {
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
|
||||
Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
|
||||
|
||||
// Clear the AddonRepository-last-updated preference to ensure that it reloads
|
||||
Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
|
||||
let observeUpdateDone = promise_observer("TEST:addon-repository-data-updated");
|
||||
let installsDone = promise_observer("TEST:all-updates-done");
|
||||
|
||||
@ -442,6 +356,8 @@ add_task(function cancel_mismatch() {
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
|
||||
Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
|
||||
|
||||
// Clear the AddonRepository-last-updated preference to ensure that it reloads
|
||||
Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
|
||||
let observeUpdateDone = promise_observer("TEST:addon-repository-data-updated");
|
||||
let installsDone = promise_observer("TEST:all-updates-done");
|
||||
|
||||
@ -510,11 +426,11 @@ add_task(function cancel_mismatch_no_updates() {
|
||||
// Check that the addons start out not compatible.
|
||||
let [a3, a5, a6] = yield promise_addons_by_ids([ao3.id, ao5.id, ao6.id]);
|
||||
ok(!a3.isCompatible, "addon3 should not be compatible");
|
||||
ok(!a5.isCompatible, "addon7 should not be compatible");
|
||||
ok(!a6.isCompatible, "addon8 should not be compatible");
|
||||
ok(!a5.isCompatible, "addon5 should not be compatible");
|
||||
ok(!a6.isCompatible, "addon6 should not be compatible");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
let compatWindow = yield promise_open_compatibility_window(inactiveAddonIds);
|
||||
let compatWindow = yield promise_open_compatibility_window([ao3.id, ao5.id, ao6.id]);
|
||||
var doc = compatWindow.document;
|
||||
info("Wait for mismatch page");
|
||||
yield promise_page(compatWindow, "mismatch");
|
||||
|
@ -9,12 +9,12 @@ const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.
|
||||
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
|
||||
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
|
||||
|
||||
Components.utils.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
let repo = {};
|
||||
let ARContext = Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm", repo);
|
||||
info("ARContext: " + Object.keys(ARContext).join(", "));
|
||||
|
||||
// Mock out the XMLHttpRequest factory for AddonRepository so
|
||||
// we can reply with a timeout
|
||||
@ -50,7 +50,7 @@ function promise_open_compatibility_window(aInactiveAddonIds) {
|
||||
// This will reset the longer timeout multiplier to 2 which will give each
|
||||
// test that calls open_compatibility_window a minimum of 60 seconds to
|
||||
// complete.
|
||||
requestLongerTimeout(100 /* XXX was 2 */);
|
||||
requestLongerTimeout(2);
|
||||
|
||||
var variant = Cc["@mozilla.org/variant;1"].
|
||||
createInstance(Ci.nsIWritableVariant);
|
||||
@ -98,6 +98,7 @@ function promise_window_close(aWindow) {
|
||||
// a timeout
|
||||
add_task(function* amo_ping_timeout() {
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
|
||||
let compatWindow = yield promise_open_compatibility_window([]);
|
||||
|
||||
let xhr = yield pXHRStarted.promise;
|
||||
|
@ -625,6 +625,7 @@ MockProvider.prototype = {
|
||||
* Register this provider with the AddonManager
|
||||
*/
|
||||
register: function MP_register() {
|
||||
info("Registering mock add-on provider");
|
||||
AddonManagerPrivate.registerProvider(this, this.types);
|
||||
},
|
||||
|
||||
@ -632,6 +633,7 @@ MockProvider.prototype = {
|
||||
* Unregister this provider with the AddonManager
|
||||
*/
|
||||
unregister: function MP_unregister() {
|
||||
info("Unregistering mock add-on provider");
|
||||
AddonManagerPrivate.unregisterProvider(this);
|
||||
},
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:extension:bug542391_6@tests.mozilla.org">
|
||||
<Description about="urn:mozilla:extension:override1x2-1x3@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<Seq>
|
||||
<li>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,19 +28,19 @@ var WindowWatcher = {
|
||||
expected: false,
|
||||
arguments: null,
|
||||
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_true(Services.startup.interrupted);
|
||||
do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG);
|
||||
do_check_true(this.expected);
|
||||
this.expected = false;
|
||||
this.arguments = arguments.QueryInterface(AM_Ci.nsIVariant);
|
||||
this.arguments = args.QueryInterface(AM_Ci.nsIVariant);
|
||||
|
||||
var updated = !gCheckUpdates;
|
||||
if (gCheckUpdates) {
|
||||
AddonManager.getAddonByID("bug542391_6@tests.mozilla.org", function(a6) {
|
||||
AddonManager.getAddonByID("override1x2-1x3@tests.mozilla.org", function(a6) {
|
||||
a6.findUpdates({
|
||||
onUpdateFinished: function() {
|
||||
AddonManagerPrivate.removeStartupChange("disabled", "bug542391_6@tests.mozilla.org");
|
||||
AddonManagerPrivate.removeStartupChange("disabled", "override1x2-1x3@tests.mozilla.org");
|
||||
updated = true;
|
||||
}
|
||||
}, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
@ -50,9 +50,9 @@ var WindowWatcher = {
|
||||
var installed = !gInstallUpdate;
|
||||
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");
|
||||
installAllFiles([do_get_addon("upgradeable1x2-3_2")], function() {
|
||||
AddonManagerPrivate.removeStartupChange("disabled", "upgradeable1x2-3@tests.mozilla.org");
|
||||
AddonManagerPrivate.addStartupChange("updated", "upgradeable1x2-3@tests.mozilla.org");
|
||||
installed = true;
|
||||
});
|
||||
}
|
||||
@ -287,8 +287,7 @@ function check_state_v3_2([a1, a2, a3, a4, a5, a6]) {
|
||||
|
||||
// Install all the test add-ons, disable two of them and "upgrade" the app to
|
||||
// version 2 which will appDisable one.
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
add_task(function* init() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, true);
|
||||
@ -314,190 +313,174 @@ function run_test() {
|
||||
|
||||
startupManager();
|
||||
|
||||
// Remove the add-on we installed directly in the profile directory;
|
||||
// this should show as uninstalled on next restart
|
||||
dest.remove(true);
|
||||
|
||||
installAllFiles([do_get_addon("test_bug542391_1"),
|
||||
do_get_addon("test_bug542391_2"),
|
||||
do_get_addon("test_bug542391_3_1"),
|
||||
do_get_addon("test_bug542391_4"),
|
||||
do_get_addon("test_bug542391_5"),
|
||||
do_get_addon("test_bug542391_6")], function install_and_restart() {
|
||||
// Load up an initial set of add-ons
|
||||
yield promiseInstallAllFiles([do_get_addon("min1max1"),
|
||||
do_get_addon("min1max2"),
|
||||
do_get_addon("upgradeable1x2-3_1"),
|
||||
do_get_addon("min1max3"),
|
||||
do_get_addon("min1max3b"),
|
||||
do_get_addon("override1x2-1x3")]);
|
||||
yield promiseRestartManager();
|
||||
|
||||
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"],
|
||||
callback_soon(function disable_and_restart([a2, a4]) {
|
||||
do_check_true(a2 != null && a4 != null);
|
||||
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",
|
||||
"bug542391_3@tests.mozilla.org",
|
||||
"bug542391_4@tests.mozilla.org",
|
||||
"bug542391_5@tests.mozilla.org",
|
||||
"bug542391_6@tests.mozilla.org"],
|
||||
callback_soon(function(addons) {
|
||||
check_state_v1(addons);
|
||||
|
||||
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",
|
||||
"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);
|
||||
|
||||
do_execute_soon(run_test_1);
|
||||
});
|
||||
}));
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
testserver.stop(do_test_finished);
|
||||
}
|
||||
|
||||
// Upgrade to version 3 which will appDisable two more add-ons. Check that the
|
||||
// 3 already disabled add-ons were passed to the mismatch dialog.
|
||||
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("uninstalled", ["addon1@tests.mozilla.org"]);
|
||||
check_startup_changes("disabled", []);
|
||||
check_startup_changes("enabled", []);
|
||||
do_check_false(WindowWatcher.expected);
|
||||
gCheckUpdates = false;
|
||||
|
||||
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);
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 3);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
|
||||
|
||||
do_execute_soon(run_test_2);
|
||||
});
|
||||
}
|
||||
|
||||
// Downgrade to version 2 which will remove appDisable from two add-ons and
|
||||
// should pass all 4 previously disabled add-ons.
|
||||
function run_test_2() {
|
||||
WindowWatcher.expected = true;
|
||||
restartManager("2");
|
||||
// user-disable two add-ons
|
||||
let [a2, a4] = yield promiseAddonsByIDs(["min1max2@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org"]);
|
||||
do_check_true(a2 != null && a4 != null);
|
||||
a2.userDisabled = true;
|
||||
a4.userDisabled = true;
|
||||
yield promiseRestartManager();
|
||||
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"]);
|
||||
check_startup_changes("enabled", []);
|
||||
|
||||
let addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v1(addons);
|
||||
|
||||
// Restart as version 2, add-on _1 should become app-disabled
|
||||
WindowWatcher.expected = true;
|
||||
yield promiseRestartManager("2");
|
||||
check_startup_changes("installed", []);
|
||||
check_startup_changes("updated", []);
|
||||
check_startup_changes("uninstalled", []);
|
||||
check_startup_changes("disabled", ["min1max1@tests.mozilla.org"]);
|
||||
check_startup_changes("enabled", []);
|
||||
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_v2(addons);
|
||||
addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v2(addons);
|
||||
});
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 4);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_3@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
|
||||
// Upgrade to version 3 which will appDisable addons
|
||||
// upgradeable1x2-3 and override1x2-1x3
|
||||
// Only the newly disabled add-ons should be passed to the
|
||||
// upgrade window
|
||||
add_task(function* run_test_1() {
|
||||
gCheckUpdates = true;
|
||||
WindowWatcher.expected = true;
|
||||
|
||||
do_execute_soon(run_test_5);
|
||||
});
|
||||
}
|
||||
yield promiseRestartManager("3");
|
||||
check_startup_changes("installed", []);
|
||||
check_startup_changes("updated", []);
|
||||
check_startup_changes("uninstalled", []);
|
||||
check_startup_changes("disabled", ["upgradeable1x2-3@tests.mozilla.org"]);
|
||||
check_startup_changes("enabled", []);
|
||||
do_check_false(WindowWatcher.expected);
|
||||
gCheckUpdates = false;
|
||||
|
||||
// Upgrade to version 3 which will appDisable two more add-ons. Check that when
|
||||
let addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v3(addons);
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 2);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("override1x2-1x3@tests.mozilla.org") >= 0);
|
||||
});
|
||||
|
||||
// Downgrade to version 2 which will remove appDisable from two add-ons
|
||||
// Still displays the compat window, because metadata is not recently updated
|
||||
add_task(function* run_test_2() {
|
||||
WindowWatcher.expected = true;
|
||||
yield promiseRestartManager("2");
|
||||
check_startup_changes("installed", []);
|
||||
check_startup_changes("updated", []);
|
||||
check_startup_changes("uninstalled", []);
|
||||
check_startup_changes("disabled", []);
|
||||
check_startup_changes("enabled", ["upgradeable1x2-3@tests.mozilla.org"]);
|
||||
do_check_false(WindowWatcher.expected);
|
||||
|
||||
let addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v2(addons);
|
||||
});
|
||||
|
||||
// Upgrade back to version 3 which should only appDisable
|
||||
// upgradeable1x2-3, because we already have the override
|
||||
// stored in our DB for override1x2-1x3. Ensure that when
|
||||
// the upgrade dialog updates an add-on no restart is necessary
|
||||
function run_test_5() {
|
||||
add_task(function* run_test_5() {
|
||||
Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, true);
|
||||
// tell the mock compatibility window to install the available upgrade
|
||||
gInstallUpdate = true;
|
||||
|
||||
WindowWatcher.expected = true;
|
||||
restartManager("3");
|
||||
yield promiseRestartManager("3");
|
||||
check_startup_changes("installed", []);
|
||||
check_startup_changes("updated", ["bug542391_3@tests.mozilla.org"]);
|
||||
check_startup_changes("updated", ["upgradeable1x2-3@tests.mozilla.org"]);
|
||||
check_startup_changes("uninstalled", []);
|
||||
check_startup_changes("disabled", []);
|
||||
check_startup_changes("enabled", []);
|
||||
do_check_false(WindowWatcher.expected);
|
||||
gInstallUpdate = false;
|
||||
|
||||
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_2(addons);
|
||||
let addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v3_2(addons);
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 3);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
|
||||
|
||||
do_execute_soon(run_test_6);
|
||||
});
|
||||
}
|
||||
do_check_eq(WindowWatcher.arguments.length, 1);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
});
|
||||
|
||||
// Downgrade to version 1 which will appEnable all the add-ons
|
||||
function run_test_6() {
|
||||
// except upgradeable1x2-3; the update we installed isn't compatible with 1
|
||||
add_task(function* run_test_6() {
|
||||
WindowWatcher.expected = true;
|
||||
restartManager("1");
|
||||
yield promiseRestartManager("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"]);
|
||||
check_startup_changes("disabled", ["upgradeable1x2-3@tests.mozilla.org"]);
|
||||
check_startup_changes("enabled", ["min1max1@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);
|
||||
let addons = yield promiseAddonsByIDs(["min1max1@tests.mozilla.org",
|
||||
"min1max2@tests.mozilla.org",
|
||||
"upgradeable1x2-3@tests.mozilla.org",
|
||||
"min1max3@tests.mozilla.org",
|
||||
"min1max3b@tests.mozilla.org",
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v1_2(addons);
|
||||
});
|
||||
|
||||
end_test();
|
||||
add_task(function* cleanup() {
|
||||
return new Promise((resolve, reject) => {
|
||||
testserver.stop(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
@ -92,12 +92,6 @@ function run_test() {
|
||||
restartManager();
|
||||
do_check_false(gCachePurged);
|
||||
|
||||
// Upgrading the app should force a cache flush due to potentially showing
|
||||
// the compatibility UI
|
||||
restartManager("2");
|
||||
do_check_true(gCachePurged);
|
||||
gCachePurged = false;
|
||||
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
@ -54,23 +54,30 @@ function run_test() {
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"
|
||||
maxVersion: "2"
|
||||
}],
|
||||
name: "Test Addon 1",
|
||||
}, profileDir);
|
||||
|
||||
// For a new profile it should disable showing the selection UI in the future
|
||||
// without showing the selection UI
|
||||
gExpectedURL = URI_EXTENSION_SELECT_DIALOG;
|
||||
startupManager();
|
||||
|
||||
// For a new profile it should disable showing the selection UI in the future
|
||||
do_check_true(Services.prefs.getBoolPref(PREF_SHOWN_SELECTION_UI));
|
||||
do_check_eq(gExpectedURL, URI_EXTENSION_SELECT_DIALOG);
|
||||
|
||||
// Reset the 'already shown' pref so that we can test that the first upgrade of
|
||||
// an existing profile shows the selection UI
|
||||
Services.prefs.clearUserPref(PREF_SHOWN_SELECTION_UI);
|
||||
|
||||
gExpectedURL = URI_EXTENSION_SELECT_DIALOG;
|
||||
restartManager("2");
|
||||
|
||||
do_check_true(Services.prefs.getBoolPref(PREF_SHOWN_SELECTION_UI));
|
||||
do_check_eq(gExpectedURL, null);
|
||||
|
||||
// Once we've seen the selection UI once, future upgrades will show the update dialog
|
||||
// but only if this upgrade disabled an add-on
|
||||
gExpectedURL = URI_EXTENSION_UPDATE_DIALOG;
|
||||
|
||||
restartManager("3");
|
||||
|
171
toolkit/mozapps/extensions/test/xpcshell/test_metadata_update.js
Normal file
171
toolkit/mozapps/extensions/test/xpcshell/test_metadata_update.js
Normal file
@ -0,0 +1,171 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test whether we need to block start-up to check add-on compatibility,
|
||||
* based on how long since the last succesful metadata ping.
|
||||
* All tests depend on having one add-on installed in the profile
|
||||
*/
|
||||
|
||||
|
||||
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
|
||||
const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI";
|
||||
|
||||
// Constants copied from AddonRepository.jsm
|
||||
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
|
||||
const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold";
|
||||
const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days
|
||||
|
||||
// The test extension uses an insecure update url.
|
||||
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
|
||||
// None of this works without the add-on repository cache
|
||||
Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
var testserver;
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
// This will be called to show the compatibility update dialog.
|
||||
var WindowWatcher = {
|
||||
expected: false,
|
||||
arguments: null,
|
||||
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_true(Services.startup.interrupted);
|
||||
do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG);
|
||||
do_check_true(this.expected);
|
||||
this.expected = false;
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIWindowWatcher)
|
||||
|| iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
var WindowWatcherFactory = {
|
||||
createInstance: function createInstance(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return WindowWatcher.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
|
||||
"Fake Window Watcher",
|
||||
"@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory);
|
||||
|
||||
// Return Date.now() in seconds, rounded
|
||||
function now() {
|
||||
return Math.round(Date.now() / 1000);
|
||||
}
|
||||
|
||||
// First time with a new profile, so we don't have a cache.lastUpdate pref
|
||||
add_task(function* checkFirstMetadata() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, true);
|
||||
|
||||
// Create and configure the HTTP server.
|
||||
testserver = new HttpServer();
|
||||
testserver.registerDirectory("/data/", do_get_file("data"));
|
||||
testserver.registerDirectory("/addons/", do_get_file("addons"));
|
||||
testserver.start(4444);
|
||||
|
||||
startupManager();
|
||||
|
||||
// Load up an add-on
|
||||
yield promiseInstallAllFiles([do_get_addon("min1max2")]);
|
||||
yield promiseRestartManager();
|
||||
|
||||
// Make sure that updating metadata for the first time sets the lastUpdate preference
|
||||
yield AddonRepository.repopulateCache();
|
||||
do_print("Update done, getting last update");
|
||||
let lastUpdate = Services.prefs.getIntPref(PREF_METADATA_LASTUPDATE);
|
||||
do_check_true(lastUpdate > 0);
|
||||
|
||||
// Make sure updating metadata again updates the preference
|
||||
let oldUpdate = lastUpdate - 2 * DEFAULT_METADATA_UPDATETHRESHOLD_SEC;
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, oldUpdate);
|
||||
yield AddonRepository.repopulateCache();
|
||||
do_check_neq(oldUpdate, Services.prefs.getIntPref(PREF_METADATA_LASTUPDATE));
|
||||
});
|
||||
|
||||
// First upgrade with no lastUpdate pref and no add-ons changing shows UI
|
||||
add_task(function* upgrade_no_lastupdate() {
|
||||
Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
|
||||
|
||||
WindowWatcher.expected = true;
|
||||
yield promiseRestartManager("2");
|
||||
do_check_false(WindowWatcher.expected);
|
||||
});
|
||||
|
||||
// Upgrade with lastUpdate more than default threshold and no add-ons changing shows UI
|
||||
add_task(function* upgrade_old_lastupdate() {
|
||||
let oldEnough = now() - DEFAULT_METADATA_UPDATETHRESHOLD_SEC - 1000;
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, oldEnough);
|
||||
|
||||
WindowWatcher.expected = true;
|
||||
// upgrade, downgrade, it has the same effect on the code path under test
|
||||
yield promiseRestartManager("1");
|
||||
do_check_false(WindowWatcher.expected);
|
||||
});
|
||||
|
||||
// Upgrade with lastUpdate less than default threshold and no add-ons changing doesn't show
|
||||
add_task(function* upgrade_young_lastupdate() {
|
||||
let notOldEnough = now() - DEFAULT_METADATA_UPDATETHRESHOLD_SEC + 1000;
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, notOldEnough);
|
||||
|
||||
WindowWatcher.expected = false;
|
||||
yield promiseRestartManager("2");
|
||||
do_check_false(WindowWatcher.expected);
|
||||
});
|
||||
|
||||
// Repeat more-than and less-than but with updateThreshold preference set
|
||||
// Upgrade with lastUpdate more than pref threshold and no add-ons changing shows UI
|
||||
const TEST_UPDATETHRESHOLD_SEC = 50000;
|
||||
add_task(function* upgrade_old_pref_lastupdate() {
|
||||
Services.prefs.setIntPref(PREF_METADATA_UPDATETHRESHOLD_SEC, TEST_UPDATETHRESHOLD_SEC);
|
||||
|
||||
let oldEnough = now() - TEST_UPDATETHRESHOLD_SEC - 1000;
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, oldEnough);
|
||||
|
||||
WindowWatcher.expected = true;
|
||||
yield promiseRestartManager("1");
|
||||
do_check_false(WindowWatcher.expected);
|
||||
});
|
||||
|
||||
// Upgrade with lastUpdate less than pref threshold and no add-ons changing doesn't show
|
||||
add_task(function* upgrade_young_pref_lastupdate() {
|
||||
let notOldEnough = now() - TEST_UPDATETHRESHOLD_SEC + 1000;
|
||||
Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, notOldEnough);
|
||||
|
||||
WindowWatcher.expected = false;
|
||||
yield promiseRestartManager("2");
|
||||
do_check_false(WindowWatcher.expected);
|
||||
});
|
||||
|
||||
|
||||
|
||||
add_task(function* cleanup() {
|
||||
return new Promise((resolve, reject) => {
|
||||
testserver.stop(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
@ -9,9 +9,7 @@ run-sequentially = Uses hardcoded ports in xpi files.
|
||||
[test_AddonRepository_compatmode.js]
|
||||
# Bug 676992: test consistently hangs on Android
|
||||
skip-if = os == "android"
|
||||
[test_DeferredSave.js]
|
||||
[test_LightweightThemeManager.js]
|
||||
[test_XPIcancel.js]
|
||||
[test_backgroundupdate.js]
|
||||
[test_bad_json.js]
|
||||
[test_badschema.js]
|
||||
|
@ -10,3 +10,6 @@ support-files =
|
||||
[include:xpcshell-shared.ini]
|
||||
|
||||
[test_asyncBlocklistLoad.js]
|
||||
[test_DeferredSave.js]
|
||||
[test_XPIcancel.js]
|
||||
[test_metadata_update.js]
|
||||
|
Loading…
Reference in New Issue
Block a user