mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-20 14:25:38 +00:00
feat: Added migration method for customizable UI, b=(no-bug), c=common
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user