Bug 1683245 - Migrate persisted values for elements given a new ID when <deck> was removed. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D100078

--HG--
extra : amend_source : 3c784585a2c753fd9ed978ed2808a853f84860b7
This commit is contained in:
Geoff Lankow 2020-12-22 12:45:30 +02:00
Родитель f8a67aa90d
Коммит 94587d2bae
1 изменённых файлов: 20 добавлений и 1 удалений

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

@ -110,6 +110,16 @@ var MailMigrator = {
});
},
_migrateXULStoreForElement(url, fromID, toID) {
Array.from(Services.xulStore.getAttributeEnumerator(url, fromID)).forEach(
attr => {
let value = Services.xulStore.getValue(url, fromID, attr);
Services.xulStore.setValue(url, toID, attr, value);
Services.xulStore.removeValue(url, fromID, attr);
}
);
},
/* eslint-disable complexity */
/**
* Determine if the UI has been upgraded in a way that requires us to reset
@ -118,7 +128,7 @@ var MailMigrator = {
_migrateUI() {
// The code for this was ported from
// mozilla/browser/components/nsBrowserGlue.js
const UI_VERSION = 23;
const UI_VERSION = 25;
const MESSENGER_DOCURL = "chrome://messenger/content/messenger.xhtml";
const MESSENGERCOMPOSE_DOCURL =
"chrome://messenger/content/messengercompose/messengercompose.xhtml";
@ -517,6 +527,15 @@ var MailMigrator = {
this._migrateSMTPToOAuth2("smtp.aol.com");
}
// Version 24 was used and backed out.
// Some elements changed ID, move their persisted values to the new ID.
if (currentUIVersion < 25) {
let url = "chrome://messenger/content/messenger.xhtml";
this._migrateXULStoreForElement(url, "view-deck", "view-box");
this._migrateXULStoreForElement(url, "displayDeck", "displayBox");
}
// Update the migration version.
Services.prefs.setIntPref(UI_VERSION_PREF, UI_VERSION);
} catch (e) {