mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 714841 - With 30 lightweight themes installed, Add-ons Manager appearance pane is slow to load. r=dtownsend
This commit is contained in:
parent
b739574682
commit
31fb50a746
@ -92,6 +92,8 @@ __defineSetter__("_maxUsedThemes", function(aVal) {
|
||||
return this._maxUsedThemes = aVal;
|
||||
});
|
||||
|
||||
var _usedThemes = null;
|
||||
|
||||
// Holds the ID of the theme being enabled or disabled while sending out the
|
||||
// events so cached AddonWrapper instances can return correct values for
|
||||
// permissions and pendingOperations
|
||||
@ -100,12 +102,16 @@ var _themeIDBeingDisbled = null;
|
||||
|
||||
var LightweightThemeManager = {
|
||||
get usedThemes () {
|
||||
if (_usedThemes)
|
||||
return _usedThemes;
|
||||
|
||||
try {
|
||||
return JSON.parse(_prefs.getComplexValue("usedThemes",
|
||||
Ci.nsISupportsString).data);
|
||||
_usedThemes = JSON.parse(_prefs.getComplexValue("usedThemes",
|
||||
Ci.nsISupportsString).data);
|
||||
} catch (e) {
|
||||
return [];
|
||||
_usedThemes = [];
|
||||
}
|
||||
return _usedThemes;
|
||||
},
|
||||
|
||||
get currentTheme () {
|
||||
@ -408,7 +414,8 @@ var LightweightThemeManager = {
|
||||
return;
|
||||
}
|
||||
|
||||
aCallback([new AddonWrapper(a) for each (a in this.usedThemes)]);
|
||||
let themes = this.usedThemes;
|
||||
aCallback([new AddonWrapper(a) for each (a in themes)]);
|
||||
},
|
||||
};
|
||||
|
||||
@ -746,6 +753,10 @@ function _prefObserver(aSubject, aTopic, aData) {
|
||||
// Update the theme list to remove any themes over the number we keep
|
||||
_updateUsedThemes(LightweightThemeManager.usedThemes);
|
||||
break;
|
||||
case "usedThemes":
|
||||
// Clear the cache - it will be repopulated next time it's used.
|
||||
_usedThemes = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user