fix: resolve migrateUI error
(cherry picked from commit 8f16718498cabf5bec2b7bfceace422f68362d58)
This commit is contained in:
@@ -153,32 +153,40 @@ const WaterfoxGlue = {
|
|||||||
|
|
||||||
async _migrateUI() {
|
async _migrateUI() {
|
||||||
let currentUIVersion = Services.prefs.getIntPref(
|
let currentUIVersion = Services.prefs.getIntPref(
|
||||||
"browser.migration.version"
|
"browser.migration.version",
|
||||||
|
128
|
||||||
);
|
);
|
||||||
|
|
||||||
async function enableTheme(id) {
|
async function enableTheme(id) {
|
||||||
AddonManager.getAddonByID(id).then(addon => addon.enable());
|
const addon = await AddonManager.getAddonByID(id);
|
||||||
|
// If we found it, enable it.
|
||||||
|
addon?.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUIVersion < 128) {
|
if (currentUIVersion < 128) {
|
||||||
// Ensure the theme id is set correctly for G5
|
// Ensure the theme id is set correctly for G5
|
||||||
const DEFAULT_THEME = "default-theme@mozilla.org";
|
const DEFAULT_THEME = "default-theme@mozilla.org";
|
||||||
AddonManager.getAddonsByTypes(["theme"]).then(themes => {
|
const themes = await AddonManager.getAddonsByTypes(["theme"]);
|
||||||
let activeTheme = themes.find(addon => addon.isActive);
|
let activeTheme = themes.find(addon => addon.isActive);
|
||||||
if (activeTheme) {
|
if (activeTheme) {
|
||||||
let themeId = activeTheme.id;
|
let themeId = activeTheme.id;
|
||||||
if (themeId == "lepton@waterfox.net") {
|
switch (themeId) {
|
||||||
|
case "lepton@waterfox.net":
|
||||||
enableTheme("default-theme@mozilla.org");
|
enableTheme("default-theme@mozilla.org");
|
||||||
} else if (themeId == "australis-light@waterfox.net") {
|
break;
|
||||||
|
case "australis-light@waterfox.net":
|
||||||
enableTheme("firefox-compact-light@mozilla.org");
|
enableTheme("firefox-compact-light@mozilla.org");
|
||||||
} else if (themeId == "australis-dark@waterfox.net") {
|
break;
|
||||||
|
case "australis-dark@waterfox.net":
|
||||||
enableTheme("firefox-compact-dark@mozilla.org");
|
enableTheme("firefox-compact-dark@mozilla.org");
|
||||||
}
|
break;
|
||||||
} else {
|
default:
|
||||||
// If no activeTheme detected, set default.
|
enableTheme(DEFAULT_THEME);
|
||||||
enableTheme(DEFAULT_THEME);
|
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
// If no activeTheme detected, set default.
|
||||||
|
enableTheme(DEFAULT_THEME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user