Skip to content
Snippets Groups Projects
Verified Commit 0c741144 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

Bug 41736: Customize toolbar for tor-browser.

parent 65469ecf
Branches
Tags
1 merge request!1222Bug 43166: Rebased alpha onto 128.3.0esr
......@@ -65,6 +65,11 @@ var kVersion = 20;
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
......@@ -228,6 +233,7 @@ var CustomizableUIInternal = {
this._updateForNewProtonVersion();
this._markObsoleteBuiltinButtonsSeen();
this._updateForBaseBrowser();
this._updateForTorBrowser();
this.registerArea(
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL,
......@@ -264,6 +270,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",
......@@ -930,6 +938,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 =
......@@ -2773,6 +2800,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;
......@@ -2856,6 +2887,7 @@ var CustomizableUIInternal = {
dirtyAreaCache: gDirtyAreaCache,
currentVersion: kVersion,
currentVersionBaseBrowser: kVersionBaseBrowser,
currentVersionTorBrowser: kVersionTorBrowser,
newElementCount: gNewElementCount,
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment