Loading browser/components/customizableui/CustomizableUI.sys.mjs +32 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,11 @@ var kVersion = 19; var kVersionBaseBrowser = 2; const NoScriptId = "_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action"; /** * The current version for tor browser. */ var kVersionTorBrowser = 1; /** * 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 @@ -224,6 +229,7 @@ var CustomizableUIInternal = { this._updateForNewProtonVersion(); this._markObsoleteBuiltinButtonsSeen(); this._updateForBaseBrowser(); this._updateForTorBrowser(); this.registerArea( CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, Loading Loading @@ -259,6 +265,8 @@ 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", Loading Loading @@ -904,6 +912,25 @@ 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); } } } }, _placeNewDefaultWidgetsInArea(aArea) { let futurePlacedWidgets = gFuturePlacements.get(aArea); let savedPlacements = Loading Loading @@ -2747,6 +2774,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 @@ -2830,6 +2861,7 @@ var CustomizableUIInternal = { dirtyAreaCache: gDirtyAreaCache, currentVersion: kVersion, currentVersionBaseBrowser: kVersionBaseBrowser, currentVersionTorBrowser: kVersionTorBrowser, newElementCount: gNewElementCount, }; Loading Loading
browser/components/customizableui/CustomizableUI.sys.mjs +32 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,11 @@ var kVersion = 19; var kVersionBaseBrowser = 2; const NoScriptId = "_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action"; /** * The current version for tor browser. */ var kVersionTorBrowser = 1; /** * 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 @@ -224,6 +229,7 @@ var CustomizableUIInternal = { this._updateForNewProtonVersion(); this._markObsoleteBuiltinButtonsSeen(); this._updateForBaseBrowser(); this._updateForTorBrowser(); this.registerArea( CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, Loading Loading @@ -259,6 +265,8 @@ 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", Loading Loading @@ -904,6 +912,25 @@ 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); } } } }, _placeNewDefaultWidgetsInArea(aArea) { let futurePlacedWidgets = gFuturePlacements.get(aArea); let savedPlacements = Loading Loading @@ -2747,6 +2774,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 @@ -2830,6 +2861,7 @@ var CustomizableUIInternal = { dirtyAreaCache: gDirtyAreaCache, currentVersion: kVersion, currentVersionBaseBrowser: kVersionBaseBrowser, currentVersionTorBrowser: kVersionTorBrowser, newElementCount: gNewElementCount, }; Loading