feat: Added migration method for customizable UI, b=(no-bug), c=common

This commit is contained in:
Mr. M
2025-05-20 00:46:37 +02:00
parent 7a846fa458
commit 53ea662ef7

View File

@@ -6,7 +6,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
class ZenUIMigration {
PREF_NAME = 'zen.migration.version';
MIGRATION_VERSION = 2;
MIGRATION_VERSION = 3;
init(isNewProfile, win) {
if (!isNewProfile) {
@@ -30,6 +30,9 @@ class ZenUIMigration {
if (this._migrationVersion < 2) {
this._migrateV2(win);
}
if (this._migrationVersion < 3) {
this._migrateV3(win);
}
}
clearVariables() {
@@ -67,6 +70,18 @@ class ZenUIMigration {
Services.prefs.clearUserPref('zen.widget.windows.acrylic');
}
}
_migrateV3(win) {
const kArea = win.CustomizableUI.AREA_TABSTRIP;
const widgets = win.CustomizableUI.getWidgetsInArea(kArea);
for (const widget of widgets) {
const widgetId = widget.id;
if (widgetId === 'tabbrowser-tabs') {
continue;
}
win.CustomizableUI.removeWidgetFromArea(widgetId);
}
}
}
export var gZenUIMigration = new ZenUIMigration();