Bug 1383782 - Record an installDate when a temporary add-on is reloaded, r?aswan
MozReview-Commit-ID: FXIAeBCuGfd
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -3460,16 +3460,18 @@ this.XPIProvider = {
if (!oldAddon.bootstrap) {
logger.warn("Non-restartless Add-on is already installed", addon.id);
throw new Error("Non-restartless add-on with ID "
+ oldAddon.id + " is already installed");
} else {
logger.warn("Addon with ID " + oldAddon.id + " already installed,"
+ " older version will be disabled");
+ addon.installDate = oldAddon.installDate;
+
let existingAddonID = oldAddon.id;
let existingAddon = oldAddon._sourceBundle;
// We'll be replacing a currently active bootstrapped add-on so
// call its uninstall method
let newVersion = addon.version;
let oldVersion = oldAddon.version;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
@@ -103,16 +103,18 @@ add_task(async function test_unsigned_no
// Install the same directory again, as if re-installing or reloading.
const [secondAddon] = await Promise.all([
AddonManager.installTemporaryAddon(addonDir),
promiseWebExtensionStartup(),
]);
// The IDs should be the same.
equal(secondAddon.id, addon.id, "Reinstalled add-on has the expected ID");
+ equal(secondAddon.installDate.valueOf(), addon.installDate.valueOf(),
+ "Reloaded add-on has the expected installDate.");
secondAddon.uninstall();
Services.obs.notifyObservers(addonDir, "flush-cache-entry");
addonDir.remove(true);
AddonTestUtils.useRealCertChecks = false;
});
// We should be able to install two extensions from manifests without IDs