diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index af88bd2517cb..b4474cf0676a 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -672,6 +672,8 @@ function _setCurrentTheme(aData, aLocal) { Services.obs.notifyObservers(cancel, "lightweight-theme-change-requested", JSON.stringify(aData)); + let notify = true; + if (aData) { let theme = LightweightThemeManager.getUsedTheme(aData.id); let isInstall = !theme || theme.version != aData.version; @@ -691,10 +693,14 @@ function _setCurrentTheme(aData, aLocal) { let current = LightweightThemeManager.currentTheme; let usedThemes = _usedThemesExceptId(aData.id); - if (current && current.id != aData.id) + if (current && current.id != aData.id) { usedThemes.splice(1, 0, aData); - else + } else { + if (current && current.id == aData.id) { + notify = false; + } usedThemes.unshift(aData); + } _updateUsedThemes(usedThemes); if (isInstall) @@ -704,8 +710,10 @@ function _setCurrentTheme(aData, aLocal) { if (cancel.data) return null; - AddonManagerPrivate.notifyAddonChanged(aData ? aData.id + ID_SUFFIX : null, - ADDON_TYPE, needsRestart); + if (notify) { + AddonManagerPrivate.notifyAddonChanged(aData ? aData.id + ID_SUFFIX : null, + ADDON_TYPE, needsRestart); + } return LightweightThemeManager.currentTheme; } diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index 1bb3a7ab0ae3..2c7d4b7d254b 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -813,8 +813,9 @@ this.XPIDatabase = { // jank-tastic! Must synchronously load DB if the theme switches from // an XPI theme to a lightweight theme before the DB has loaded, // because we're called from sync XPIProvider.addonChanged - logger.warn("Synchronous load of XPI database due to getAddonsByType([" + - aTypes.join(", ") + "])"); + logger.warn(`Synchronous load of XPI database due to ` + + `getAddonsByType([${aTypes.join(", ")}]) ` + + `Stack: ${Error().stack}`); AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_byType", XPIProvider.runPhase); this.syncLoadDB(true); } @@ -832,7 +833,8 @@ this.XPIDatabase = { getVisibleAddonForInternalName(aInternalName) { if (!this.addonDB) { // This may be called when the DB hasn't otherwise been loaded - logger.warn("Synchronous load of XPI database due to getVisibleAddonForInternalName"); + logger.warn(`Synchronous load of XPI database due to ` + + `getVisibleAddonForInternalName. Stack: ${Error().stack}`); AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_forInternalName", XPIProvider.runPhase); this.syncLoadDB(true);