mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1009328 - Change the signature of callBootstrapMethod to be more flexible for changes r=Unfocused
This commit is contained in:
parent
1e908ccee8
commit
e291ede03d
@ -1918,8 +1918,7 @@ this.XPIProvider = {
|
||||
if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED)
|
||||
.indexOf(id) !== -1)
|
||||
reason = BOOTSTRAP_REASONS.ADDON_INSTALL;
|
||||
this.callBootstrapMethod(id, this.bootstrappedAddons[id].version,
|
||||
this.bootstrappedAddons[id].type, file,
|
||||
this.callBootstrapMethod(this.bootstrappedAddons[id], file,
|
||||
"startup", reason);
|
||||
}
|
||||
catch (e) {
|
||||
@ -1941,8 +1940,7 @@ this.XPIProvider = {
|
||||
for (let id in XPIProvider.bootstrappedAddons) {
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
file.persistentDescriptor = XPIProvider.bootstrappedAddons[id].descriptor;
|
||||
XPIProvider.callBootstrapMethod(id, XPIProvider.bootstrappedAddons[id].version,
|
||||
XPIProvider.bootstrappedAddons[id].type, file, "shutdown",
|
||||
XPIProvider.callBootstrapMethod(XPIProvider.bootstrappedAddons[id], file, "shutdown",
|
||||
BOOTSTRAP_REASONS.APP_SHUTDOWN);
|
||||
}
|
||||
Services.obs.removeObserver(this, "quit-application-granted");
|
||||
@ -2430,8 +2428,13 @@ this.XPIProvider = {
|
||||
BOOTSTRAP_REASONS.ADDON_UPGRADE :
|
||||
BOOTSTRAP_REASONS.ADDON_DOWNGRADE;
|
||||
|
||||
this.callBootstrapMethod(existingAddonID, oldBootstrap.version,
|
||||
oldBootstrap.type, existingAddon, "uninstall", uninstallReason,
|
||||
let addonDetails = {
|
||||
id: existingAddonID,
|
||||
version: oldBootstrap.version,
|
||||
type: oldBootstrap.type
|
||||
};
|
||||
this.callBootstrapMethod(addonDetails,
|
||||
existingAddon, "uninstall", uninstallReason,
|
||||
{ newVersion: newVersion });
|
||||
this.unloadBootstrapScope(existingAddonID);
|
||||
flushStartupCache();
|
||||
@ -2460,8 +2463,12 @@ this.XPIProvider = {
|
||||
|
||||
if (oldBootstrap) {
|
||||
// Re-install the old add-on
|
||||
this.callBootstrapMethod(existingAddonID, oldBootstrap.version,
|
||||
oldBootstrap.type, existingAddon, "install",
|
||||
let addonDetails = {
|
||||
id: existingAddonID,
|
||||
version: oldBootstrap.version,
|
||||
type: oldBootstrap.type
|
||||
};
|
||||
this.callBootstrapMethod(addonDetails, existingAddon, "install",
|
||||
BOOTSTRAP_REASONS.ADDON_INSTALL);
|
||||
}
|
||||
continue;
|
||||
@ -2716,8 +2723,7 @@ this.XPIProvider = {
|
||||
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
file.persistentDescriptor = aAddonState.descriptor;
|
||||
XPIProvider.callBootstrapMethod(newDBAddon.id, newDBAddon.version,
|
||||
newDBAddon.type, file, "install",
|
||||
XPIProvider.callBootstrapMethod(newDBAddon, file, "install",
|
||||
installReason, { oldVersion: aOldAddon.version });
|
||||
return false;
|
||||
}
|
||||
@ -2798,7 +2804,7 @@ this.XPIProvider = {
|
||||
// The add-on is bootstrappable so call its install script
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
file.persistentDescriptor = aAddonState.descriptor;
|
||||
XPIProvider.callBootstrapMethod(aOldAddon.id, aOldAddon.version, aOldAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(aOldAddon, file,
|
||||
"install",
|
||||
BOOTSTRAP_REASONS.ADDON_INSTALL);
|
||||
|
||||
@ -3095,8 +3101,7 @@ this.XPIProvider = {
|
||||
createInstance(Ci.nsIFile);
|
||||
oldAddonFile.persistentDescriptor = oldBootstrap.descriptor;
|
||||
|
||||
XPIProvider.callBootstrapMethod(newDBAddon.id, oldBootstrap.version,
|
||||
oldBootstrap.type, oldAddonFile, "uninstall",
|
||||
XPIProvider.callBootstrapMethod(oldBootstrap, oldAddonFile, "uninstall",
|
||||
installReason, { newVersion: newDBAddon.version });
|
||||
XPIProvider.unloadBootstrapScope(newDBAddon.id);
|
||||
|
||||
@ -3112,7 +3117,7 @@ this.XPIProvider = {
|
||||
// Visible bootstrapped add-ons need to have their install method called
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
file.persistentDescriptor = aAddonState.descriptor;
|
||||
XPIProvider.callBootstrapMethod(newDBAddon.id, newDBAddon.version, newDBAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(newDBAddon, file,
|
||||
"install", installReason, extraParams);
|
||||
if (!newDBAddon.active)
|
||||
XPIProvider.unloadBootstrapScope(newDBAddon.id);
|
||||
@ -4150,12 +4155,8 @@ this.XPIProvider = {
|
||||
/**
|
||||
* Calls a bootstrap method for an add-on.
|
||||
*
|
||||
* @param aId
|
||||
* The ID of the add-on
|
||||
* @param aVersion
|
||||
* The version of the add-on
|
||||
* @param aType
|
||||
* The type for the add-on
|
||||
* @param aAddon
|
||||
* An object representing the add-on, with `id`, `type` and `version`
|
||||
* @param aFile
|
||||
* The nsIFile for the add-on
|
||||
* @param aMethod
|
||||
@ -4166,12 +4167,16 @@ this.XPIProvider = {
|
||||
* An object of additional key/value pairs to pass to the method in
|
||||
* the params argument
|
||||
*/
|
||||
callBootstrapMethod: function XPI_callBootstrapMethod(aId, aVersion, aType, aFile,
|
||||
aMethod, aReason, aExtraParams) {
|
||||
callBootstrapMethod: function XPI_callBootstrapMethod(aAddon, aFile, aMethod, aReason, aExtraParams) {
|
||||
// Never call any bootstrap methods in safe mode
|
||||
if (Services.appinfo.inSafeMode)
|
||||
return;
|
||||
|
||||
if (!aAddon.id || !aAddon.version || aAddon.type) {
|
||||
logger.error("aAddon must include an id, version, and type");
|
||||
return;
|
||||
}
|
||||
|
||||
let timeStart = new Date();
|
||||
if (aMethod == "startup") {
|
||||
logger.debug("Registering manifest for " + aFile.path);
|
||||
@ -4180,21 +4185,21 @@ this.XPIProvider = {
|
||||
|
||||
try {
|
||||
// Load the scope if it hasn't already been loaded
|
||||
if (!(aId in this.bootstrapScopes))
|
||||
this.loadBootstrapScope(aId, aFile, aVersion, aType);
|
||||
if (!(aAddon.id in this.bootstrapScopes))
|
||||
this.loadBootstrapScope(aAddon.id, aFile, aAddon.version, aAddon.type);
|
||||
|
||||
// Nothing to call for locales
|
||||
if (aType == "locale")
|
||||
if (aAddon.type == "locale")
|
||||
return;
|
||||
|
||||
if (!(aMethod in this.bootstrapScopes[aId])) {
|
||||
logger.warn("Add-on " + aId + " is missing bootstrap method " + aMethod);
|
||||
logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod);
|
||||
return;
|
||||
}
|
||||
|
||||
let params = {
|
||||
id: aId,
|
||||
version: aVersion,
|
||||
id: aAddon.id,
|
||||
version: aAddon.version,
|
||||
installPath: aFile.clone(),
|
||||
resourceURI: getURIForResourceInFile(aFile, "")
|
||||
};
|
||||
@ -4205,13 +4210,13 @@ this.XPIProvider = {
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("Calling bootstrap method " + aMethod + " on " + aId + " version " +
|
||||
aVersion);
|
||||
logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " +
|
||||
aAddon.version);
|
||||
try {
|
||||
this.bootstrapScopes[aId][aMethod](params, aReason);
|
||||
this.bootstrapScopes[aAddon.id][aMethod](params, aReason);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warn("Exception running bootstrap method " + aMethod + " on " + aId, e);
|
||||
logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@ -4219,7 +4224,7 @@ this.XPIProvider = {
|
||||
logger.debug("Removing manifest for " + aFile.path);
|
||||
Components.manager.removeBootstrappedManifestLocation(aFile);
|
||||
}
|
||||
this.setTelemetry(aId, aMethod + "_MS", new Date() - timeStart);
|
||||
this.setTelemetry(aAddon.id, aMethod + "_MS", new Date() - timeStart);
|
||||
}
|
||||
},
|
||||
|
||||
@ -4322,7 +4327,7 @@ this.XPIProvider = {
|
||||
if (isDisabled) {
|
||||
if (aAddon.bootstrap) {
|
||||
let file = aAddon._installLocation.getLocationForID(aAddon.id);
|
||||
this.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file, "shutdown",
|
||||
this.callBootstrapMethod(aAddon, file, "shutdown",
|
||||
BOOTSTRAP_REASONS.ADDON_DISABLE);
|
||||
this.unloadBootstrapScope(aAddon.id);
|
||||
}
|
||||
@ -4331,7 +4336,7 @@ this.XPIProvider = {
|
||||
else {
|
||||
if (aAddon.bootstrap) {
|
||||
let file = aAddon._installLocation.getLocationForID(aAddon.id);
|
||||
this.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file, "startup",
|
||||
this.callBootstrapMethod(aAddon, file, "startup",
|
||||
BOOTSTRAP_REASONS.ADDON_ENABLE);
|
||||
}
|
||||
AddonManagerPrivate.callAddonListeners("onEnabled", wrapper);
|
||||
@ -4406,11 +4411,11 @@ this.XPIProvider = {
|
||||
|
||||
if (aAddon.bootstrap) {
|
||||
let file = aAddon._installLocation.getLocationForID(aAddon.id);
|
||||
XPIProvider.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(aAddon, file,
|
||||
"install", BOOTSTRAP_REASONS.ADDON_INSTALL);
|
||||
|
||||
if (aAddon.active) {
|
||||
XPIProvider.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(aAddon, file,
|
||||
"startup", BOOTSTRAP_REASONS.ADDON_INSTALL);
|
||||
}
|
||||
else {
|
||||
@ -4441,13 +4446,11 @@ this.XPIProvider = {
|
||||
if (aAddon.bootstrap) {
|
||||
let file = aAddon._installLocation.getLocationForID(aAddon.id);
|
||||
if (aAddon.active) {
|
||||
this.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file,
|
||||
"shutdown",
|
||||
this.callBootstrapMethod(aAddon, file, "shutdown",
|
||||
BOOTSTRAP_REASONS.ADDON_UNINSTALL);
|
||||
}
|
||||
|
||||
this.callBootstrapMethod(aAddon.id, aAddon.version, aAddon.type, file,
|
||||
"uninstall",
|
||||
this.callBootstrapMethod(aAddon, file, "uninstall",
|
||||
BOOTSTRAP_REASONS.ADDON_UNINSTALL);
|
||||
this.unloadBootstrapScope(aAddon.id);
|
||||
flushStartupCache();
|
||||
@ -5518,16 +5521,12 @@ AddonInstall.prototype = {
|
||||
let file = this.existingAddon._installLocation
|
||||
.getLocationForID(this.existingAddon.id);
|
||||
if (this.existingAddon.active) {
|
||||
XPIProvider.callBootstrapMethod(this.existingAddon.id,
|
||||
this.existingAddon.version,
|
||||
this.existingAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(this.existingAddon, file,
|
||||
"shutdown", reason,
|
||||
{ newVersion: this.addon.version });
|
||||
}
|
||||
|
||||
XPIProvider.callBootstrapMethod(this.existingAddon.id,
|
||||
this.existingAddon.version,
|
||||
this.existingAddon.type, file,
|
||||
XPIProvider.callBootstrapMethod(this.existingAddon, file,
|
||||
"uninstall", reason,
|
||||
{ newVersion: this.addon.version });
|
||||
XPIProvider.unloadBootstrapScope(this.existingAddon.id);
|
||||
@ -5568,8 +5567,7 @@ AddonInstall.prototype = {
|
||||
}
|
||||
|
||||
if (this.addon.bootstrap) {
|
||||
XPIProvider.callBootstrapMethod(this.addon.id, this.addon.version,
|
||||
this.addon.type, file, "install",
|
||||
XPIProvider.callBootstrapMethod(this.addon, file, "install",
|
||||
reason, extraParams);
|
||||
}
|
||||
|
||||
@ -5584,8 +5582,7 @@ AddonInstall.prototype = {
|
||||
|
||||
if (this.addon.bootstrap) {
|
||||
if (this.addon.active) {
|
||||
XPIProvider.callBootstrapMethod(this.addon.id, this.addon.version,
|
||||
this.addon.type, file, "startup",
|
||||
XPIProvider.callBootstrapMethod(this.addon, file, "startup",
|
||||
reason, extraParams);
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user