Loading browser/components/customizableui/CustomizableUI.sys.mjs +49 −8 Changes for browser/components/customizableui/CustomizableUI.sys.mjs: 49 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -75,6 +75,11 @@ var kVersion = 24; var kVersionBaseBrowser = 2; const NoScriptId = "_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action"; /** * The current version for tor browser. */ var kVersionTorBrowser = 2; /** * Buttons removed from built-ins by version they were removed. kVersion must be * bumped any time a new id is added to this. Use the button id as key, and Loading Loading @@ -210,13 +215,6 @@ XPCOMUtils.defineLazyPreferenceGetter( } ); XPCOMUtils.defineLazyPreferenceGetter( lazy, "resetPBMToolbarButtonEnabled", "browser.privatebrowsing.resetPBM.enabled", false ); XPCOMUtils.defineLazyPreferenceGetter( lazy, "sidebarRevampEnabled", Loading Loading @@ -338,6 +336,7 @@ var CustomizableUIInternal = { this.updateForNewProtonVersion(); this.markObsoleteBuiltinButtonsSeen(); this.updateForBaseBrowser(); this.updateForTorBrowser(); this.registerArea( CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, Loading Loading @@ -373,12 +372,19 @@ var CustomizableUIInternal = { // Base-browser additions tor-browser#41736. If you want to add to, remove // from, or rearrange this list, then bump the kVersionBaseBrowser and // update existing saved states in _updateForBaseBrowser. // Or if the change is only meant for tor-browser, bump kVersionTorBrowser // instead and update the existing saved states in _updateForTorBrowser. "security-level-button", "new-identity-button", "downloads-button", AppConstants.MOZ_DEV_EDITION ? "developer-button" : null, lazy.ippEnabled ? "ipprotection-button" : null, "fxa-toolbar-menu-button", lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null, // Remove reset-pbm-toolbar-button unconditionally. // NOTE: If we want to re-show this button, we may want to position it // elsewhere (just after security-level-button), and we will likely want // to migrate existing users so that it takes the place of the // new-identity-button. tor-browser#45262. ].filter(name => name); this.registerArea( Loading Loading @@ -1100,6 +1106,36 @@ var CustomizableUIInternal = { } }, updateForTorBrowser() { if (!gSavedState) { // Use the defaults. return; } const currentVersion = gSavedState.currentVersionTorBrowser; if (currentVersion < 1) { // Remove torbutton-button, which no longer exists. for (const placements of Object.values(gSavedState.placements)) { let buttonIndex = placements.indexOf("torbutton-button"); if (buttonIndex != -1) { placements.splice(buttonIndex, 1); } } } if (currentVersion < 2) { // Remove the reset-pbm button that was added in version 24 in // `updateForNewVersion`. tor-browser#45262. for (const placements of Object.values(gSavedState.placements)) { let buttonIndex = placements.indexOf("reset-pbm-toolbar-button"); if (buttonIndex != -1) { placements.splice(buttonIndex, 1); } } } }, /** * If a new area was defined, or new default widgets for an area are defined, * this reconciles the placements of those new default widgets with the Loading Loading @@ -3663,6 +3699,10 @@ var CustomizableUIInternal = { gSavedState.currentVersionBaseBrowser = 0; } if (!("currentVersionTorBrowser" in gSavedState)) { gSavedState.currentVersionTorBrowser = 0; } gSeenWidgets = new Set(gSavedState.seen || []); gDirtyAreaCache = new Set(gSavedState.dirtyAreaCache || []); gNewElementCount = gSavedState.newElementCount || 0; Loading Loading @@ -3960,6 +4000,7 @@ var CustomizableUIInternal = { dirtyAreaCache: gDirtyAreaCache, currentVersion: kVersion, currentVersionBaseBrowser: kVersionBaseBrowser, currentVersionTorBrowser: kVersionTorBrowser, newElementCount: gNewElementCount, }; Loading Loading
browser/components/customizableui/CustomizableUI.sys.mjs +49 −8 Changes for browser/components/customizableui/CustomizableUI.sys.mjs: 49 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -75,6 +75,11 @@ var kVersion = 24; var kVersionBaseBrowser = 2; const NoScriptId = "_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action"; /** * The current version for tor browser. */ var kVersionTorBrowser = 2; /** * Buttons removed from built-ins by version they were removed. kVersion must be * bumped any time a new id is added to this. Use the button id as key, and Loading Loading @@ -210,13 +215,6 @@ XPCOMUtils.defineLazyPreferenceGetter( } ); XPCOMUtils.defineLazyPreferenceGetter( lazy, "resetPBMToolbarButtonEnabled", "browser.privatebrowsing.resetPBM.enabled", false ); XPCOMUtils.defineLazyPreferenceGetter( lazy, "sidebarRevampEnabled", Loading Loading @@ -338,6 +336,7 @@ var CustomizableUIInternal = { this.updateForNewProtonVersion(); this.markObsoleteBuiltinButtonsSeen(); this.updateForBaseBrowser(); this.updateForTorBrowser(); this.registerArea( CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, Loading Loading @@ -373,12 +372,19 @@ var CustomizableUIInternal = { // Base-browser additions tor-browser#41736. If you want to add to, remove // from, or rearrange this list, then bump the kVersionBaseBrowser and // update existing saved states in _updateForBaseBrowser. // Or if the change is only meant for tor-browser, bump kVersionTorBrowser // instead and update the existing saved states in _updateForTorBrowser. "security-level-button", "new-identity-button", "downloads-button", AppConstants.MOZ_DEV_EDITION ? "developer-button" : null, lazy.ippEnabled ? "ipprotection-button" : null, "fxa-toolbar-menu-button", lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null, // Remove reset-pbm-toolbar-button unconditionally. // NOTE: If we want to re-show this button, we may want to position it // elsewhere (just after security-level-button), and we will likely want // to migrate existing users so that it takes the place of the // new-identity-button. tor-browser#45262. ].filter(name => name); this.registerArea( Loading Loading @@ -1100,6 +1106,36 @@ var CustomizableUIInternal = { } }, updateForTorBrowser() { if (!gSavedState) { // Use the defaults. return; } const currentVersion = gSavedState.currentVersionTorBrowser; if (currentVersion < 1) { // Remove torbutton-button, which no longer exists. for (const placements of Object.values(gSavedState.placements)) { let buttonIndex = placements.indexOf("torbutton-button"); if (buttonIndex != -1) { placements.splice(buttonIndex, 1); } } } if (currentVersion < 2) { // Remove the reset-pbm button that was added in version 24 in // `updateForNewVersion`. tor-browser#45262. for (const placements of Object.values(gSavedState.placements)) { let buttonIndex = placements.indexOf("reset-pbm-toolbar-button"); if (buttonIndex != -1) { placements.splice(buttonIndex, 1); } } } }, /** * If a new area was defined, or new default widgets for an area are defined, * this reconciles the placements of those new default widgets with the Loading Loading @@ -3663,6 +3699,10 @@ var CustomizableUIInternal = { gSavedState.currentVersionBaseBrowser = 0; } if (!("currentVersionTorBrowser" in gSavedState)) { gSavedState.currentVersionTorBrowser = 0; } gSeenWidgets = new Set(gSavedState.seen || []); gDirtyAreaCache = new Set(gSavedState.dirtyAreaCache || []); gNewElementCount = gSavedState.newElementCount || 0; Loading Loading @@ -3960,6 +4000,7 @@ var CustomizableUIInternal = { dirtyAreaCache: gDirtyAreaCache, currentVersion: kVersion, currentVersionBaseBrowser: kVersionBaseBrowser, currentVersionTorBrowser: kVersionTorBrowser, newElementCount: gNewElementCount, }; Loading