[BASILISK] Align browser glue with TychoAM for enableable add-ons.

This commit is contained in:
wolfbeast 2019-01-28 15:56:37 +01:00 committed by Roy Tam
commit 8dab928cc3

View file

@ -1080,24 +1080,19 @@ BrowserGlue.prototype = {
// For any add-ons that were installed disabled and can be enabled offer
// them to the user.
let win = RecentWindow.getMostRecentBrowserWindow();
AddonManager.getAllAddons(addons => {
for (let addon of addons) {
// If this add-on has already seen (or seen is undefined for non-XPI
// add-ons) then skip it.
if (addon.seen !== false) {
continue;
}
let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
if (changedIDs.length > 0) {
let win = this.getMostRecentBrowserWindow();
AddonManager.getAddonsByIDs(changedIDs, function(aAddons) {
aAddons.forEach(function(aAddon) {
// If the add-on isn't user disabled or can't be enabled then skip it.
if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE))
return;
// If this add-on cannot be enabled (either already enabled or
// appDisabled) then skip it.
if (!(addon.permissions & AddonManager.PERM_CAN_ENABLE)) {
continue;
}
win.openUILinkIn("about:newaddon?id=" + addon.id, "tab");
}
});
win.openUILinkIn("about:newaddon?id=" + aAddon.id, "tab");
})
});
}
let signingRequired;
if (AppConstants.MOZ_REQUIRE_SIGNING) {
@ -1110,10 +1105,15 @@ BrowserGlue.prototype = {
let disabledAddons = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
AddonManager.getAddonsByIDs(disabledAddons, (addons) => {
for (let addon of addons) {
if (addon && addon.type == "experiment")
// WEs return null, skip.
if (!addon) {
continue;
}
if (addon.type == "experiment")
continue;
if (addon && addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
if (addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
this._notifyUnsignedAddonsDisabled();
break;
}