Bug 1365509: Don't trigger a sync load of the add-ons DB at startup when a built-in LWT is enabled. r=rhelmer

MozReview-Commit-ID: AG0dXSnBwZ3

--HG--
extra : rebase_source : 30111612390a833c4add3bb63d0948cbe2eaf0a2
This commit is contained in:
Kris Maglione 2017-05-17 13:51:42 -07:00
Родитель cf88e25324
Коммит 0436b5c05b
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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);