Bug 1155521 - Migrate Pocket add-on and social provider users to the new Pocket button (part 1, CustomizableUI changes). r=jaws

This commit is contained in:
Gijs Kruitbosch 2015-05-05 17:21:33 -07:00
Родитель 12293f0ffe
Коммит c831107cdb
1 изменённых файлов: 26 добавлений и 7 удалений

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

@ -294,14 +294,33 @@ let CustomizableUIInternal = {
let currentVersion = gSavedState.currentVersion;
for (let [id, widget] of gPalette) {
if (widget._introducedInVersion > currentVersion &&
widget.defaultArea) {
if (widget.defaultArea) {
let shouldAdd = false;
let shouldSetPref = false;
let prefId = "browser.toolbarbuttons.introduced." + widget.id;
if (widget._introducedInVersion === "pref") {
try {
shouldAdd = !Services.prefs.getBoolPref(prefId);
} catch (ex) {
// Pref doesn't exist:
shouldAdd = true;
}
shouldSetPref = shouldAdd;
} else if (widget._introducedInVersion > currentVersion) {
shouldAdd = true;
}
if (shouldAdd) {
let futurePlacements = gFuturePlacements.get(widget.defaultArea);
if (futurePlacements) {
futurePlacements.add(id);
} else {
gFuturePlacements.set(widget.defaultArea, new Set([id]));
}
if (shouldSetPref) {
Services.prefs.setBoolPref(prefId, true);
}
}
}
}