--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -868,30 +868,16 @@ function isUsableAddon(aAddon) {
logger.warn(`Add-on ${aAddon.id} is not compatible with target application.`);
return false;
}
}
return true;
}
-function createAddonDetails(id, aAddon) {
- return {
- id: id || aAddon.id,
- type: aAddon.type,
- version: aAddon.version,
- multiprocessCompatible: aAddon.multiprocessCompatible,
- mpcOptedOut: aAddon.mpcOptedOut,
- runInSafeMode: aAddon.runInSafeMode,
- dependencies: aAddon.dependencies,
- hasEmbeddedWebExtension: aAddon.hasEmbeddedWebExtension,
- startupData: aAddon.startupData,
- };
-}
-
/**
* Converts an internal add-on type to the type presented through the API.
*
* @param aType
* The internal add-on type
* @return an external add-on type
*/
function getExternalType(aType) {
@@ -2238,18 +2224,17 @@ this.XPIProvider = {
}
try {
let reason = BOOTSTRAP_REASONS.APP_STARTUP;
// Eventually set INSTALLED reason when a bootstrap addon
// is dropped in profile folder and automatically installed
if (AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED)
.indexOf(addon.id) !== -1)
reason = BOOTSTRAP_REASONS.ADDON_INSTALL;
- this.callBootstrapMethod(createAddonDetails(addon.id, addon),
- addon.file, "startup", reason);
+ this.callBootstrapMethod(addon, addon.file, "startup", reason);
} catch (e) {
logger.error("Failed to load bootstrap addon " + addon.id + " from " +
addon.descriptor, e);
}
}
AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_end");
} catch (e) {
logger.error("bootstrap startup failed", e);
@@ -2263,33 +2248,31 @@ this.XPIProvider = {
XPIProvider._closing = true;
for (let addon of XPIProvider.sortBootstrappedAddons().reverse()) {
// If no scope has been loaded for this add-on then there is no need
// to shut it down (should only happen when a bootstrapped add-on is
// pending enable)
if (!XPIProvider.activeAddons.has(addon.id))
continue;
- let addonDetails = createAddonDetails(addon.id, addon);
-
// If the add-on was pending disable then shut it down and remove it
// from the persisted data.
let reason = BOOTSTRAP_REASONS.APP_SHUTDOWN;
if (addon.disable) {
reason = BOOTSTRAP_REASONS.ADDON_DISABLE;
} else if (addon.location.name == KEY_APP_TEMPORARY) {
reason = BOOTSTRAP_REASONS.ADDON_UNINSTALL;
let locations = Array.from(XPIStates.db.values())
.filter(loc => loc.name != TemporaryInstallLocation.name);
let existing = XPIStates.findAddon(addon.id, locations);
if (existing) {
reason = newVersionReason(addon.version, existing.version);
}
}
- XPIProvider.callBootstrapMethod(addonDetails, addon.file,
+ XPIProvider.callBootstrapMethod(addon, addon.file,
"shutdown", reason);
}
Services.obs.removeObserver(this, "quit-application-granted");
}
}, "quit-application-granted");
// Detect final-ui-startup for telemetry reporting
Services.obs.addObserver({
@@ -2375,29 +2358,27 @@ this.XPIProvider = {
let locations = Array.from(XPIStates.db.values())
.filter(loc => loc != tempLocation);
let existing = XPIStates.findAddon(id, locations);
if (existing) {
reason = newVersionReason(addon.version, existing.version);
}
- this.callBootstrapMethod(createAddonDetails(id, addon),
- addon.file, "uninstall", reason);
+ this.callBootstrapMethod(addon, addon.file, "uninstall", reason);
this.unloadBootstrapScope(id);
TemporaryInstallLocation.uninstallAddon(id);
if (existing) {
let newAddon = XPIDatabase.makeAddonLocationVisible(id, existing.location.name);
let file = new nsIFile(newAddon.path);
let data = {oldVersion: addon.version};
- this.callBootstrapMethod(createAddonDetails(id, newAddon),
- file, "install", reason, data);
+ this.callBootstrapMethod(newAddon, file, "install", reason, data);
}
}
}
this.activeAddons.clear();
this.allAppGlobal = true;
// If there are pending operations then we must update the list of active
@@ -2966,17 +2947,17 @@ this.XPIProvider = {
oldBootstrap = existingAddon;
// We'll be replacing a currently active bootstrapped add-on so
// call its uninstall method
let newVersion = addon.version;
let oldVersion = existingAddon;
let uninstallReason = newVersionReason(oldVersion, newVersion);
- this.callBootstrapMethod(createAddonDetails(existingAddonID, existingAddon),
+ this.callBootstrapMethod(existingAddon,
file, "uninstall", uninstallReason,
{ newVersion });
this.unloadBootstrapScope(existingAddonID);
flushChromeCaches();
}
} catch (e) {
}
}
@@ -2995,18 +2976,17 @@ this.XPIProvider = {
new StagedAddonInstall(location, stageDirEntry, addon);
// Make sure not to delete the cached manifest json file
seenFiles.pop();
delete aManifests[location.name][id];
if (oldBootstrap) {
// Re-install the old add-on
- this.callBootstrapMethod(createAddonDetails(existingAddonID, oldBootstrap),
- existingAddon, "install",
+ this.callBootstrapMethod(oldBootstrap, existingAddon, "install",
BOOTSTRAP_REASONS.ADDON_INSTALL);
}
continue;
}
}
try {
location.cleanStagingDir(seenFiles);