This is an automated email from the git hooks/post-receive script.
richard pushed a change to branch tor-browser-102.2.0esr-12.0-3 in repository tor-browser.
from ff839fde49f3c fixup! Bug 40925: Implemented the Security Level component new f6a93bb092169 fixup! Bug 40926: Implemented the New Identity feature new cd000078e5f91 fixup! Bug 40925: Implemented the Security Level component
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: .../components/newidentity/content/newidentity.js | 24 ++++----- .../securitylevel/content/securityLevel.js | 58 ++++++++++------------ 2 files changed, 38 insertions(+), 44 deletions(-)
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.2.0esr-12.0-3 in repository tor-browser.
commit f6a93bb092169f51aede505339d431a268a813ea Author: Henry Wilkes henry@torproject.org AuthorDate: Wed Sep 7 16:30:03 2022 +0100
fixup! Bug 40926: Implemented the New Identity feature
Provide a label attribute for #new-identity-button equal to the tooltiptext on load.
Also fix the initiation so that the button works if it is added to the DOM later on through customizing the toolbar. --- .../components/newidentity/content/newidentity.js | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/browser/components/newidentity/content/newidentity.js b/browser/components/newidentity/content/newidentity.js index 0c1b2b4c5be7b..67a00dbc6f750 100644 --- a/browser/components/newidentity/content/newidentity.js +++ b/browser/components/newidentity/content/newidentity.js @@ -468,11 +468,18 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { topics,
init() { - CustomizableUI.addListener(this); - - const button = document.querySelector("#new-identity-button"); + // We first search in the DOM for the identity button. If it does not + // exist it may be in the toolbox palette. In the latter case we still + // need to initialize the button in case it is added back later through + // customization. + const button = + document.getElementById("new-identity-button") || + window.gNavToolbox.palette.querySelector("#new-identity-button"); if (button) { button.setAttribute("tooltiptext", NewIdentityStrings.new_identity); + // Include an equal label, shown in the overflow menu or during + // customization. + button.setAttribute("label", NewIdentityStrings.new_identity); button.addEventListener("command", () => { this.onCommand(); }); @@ -501,16 +508,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { } },
- uninit() { - CustomizableUI.removeListener(this); - }, - - onCustomizeStart(window) { - const button = document.querySelector("#new-identity-button"); - button.setAttribute("label", NewIdentityStrings.new_identity); - }, - - onWidgetAfterDOMChange(aNode, aNextNode, aContainer, aWasRemoval) {}, + uninit() {},
async onCommand() { try {
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.2.0esr-12.0-3 in repository tor-browser.
commit cd000078e5f919eac673b9f193c5fb90c3fb5390 Author: Henry Wilkes henry@torproject.org AuthorDate: Thu Sep 8 17:39:07 2022 +0100
fixup! Bug 40925: Implemented the Security Level component
Provide a label attribute for #security-level-button on load.
Also tidy up the code so that the button is properly initialized whether it starts in the toolbar or not. --- .../securitylevel/content/securityLevel.js | 58 ++++++++++------------ 1 file changed, 27 insertions(+), 31 deletions(-)
diff --git a/browser/components/securitylevel/content/securityLevel.js b/browser/components/securitylevel/content/securityLevel.js index 11e63aa37945c..4b27ddbde5920 100644 --- a/browser/components/securitylevel/content/securityLevel.js +++ b/browser/components/securitylevel/content/securityLevel.js @@ -127,7 +127,8 @@ const SecurityLevelPrefs = { const SecurityLevelButton = { _securityPrefsBranch: null,
- _configUIFromPrefs(securityLevelButton) { + _configUIFromPrefs() { + const securityLevelButton = this.button; if (securityLevelButton != null) { const level = SecurityLevelPrefs.securitySliderLevel; if (!level) { @@ -142,42 +143,53 @@ const SecurityLevelButton = { } },
+ /** + * The node for this button. + * + * Note, the returned element may be part of the DOM or may live in the + * toolbox palette, where it may be added later to the DOM through + * customization. + * + * @type {MozToolbarbutton} + */ get button() { - let button = document.getElementById("security-level-button"); - if (!button) { - return null; - } - return button; + // We first search in the DOM for the security level button. If it does not + // exist it may be in the toolbox palette. We still want to return the + // button in the latter case to allow it to be initialized or adjusted in + // case it is added back through customization. + return ( + document.getElementById("security-level-button") || + window.gNavToolbox.palette.querySelector("#security-level-button") + ); },
get anchor() { - let anchor = this.button.icon; + let button = this.button; + let anchor = button?.icon; if (!anchor) { return null; }
- anchor.setAttribute("consumeanchor", SecurityLevelButton.button.id); + anchor.setAttribute("consumeanchor", button.id); return anchor; },
init() { + // Set a label to be be used as the accessible name, and to be shown in the + // overflow menu and during customization. + this.button?.setAttribute("label", SecurityLevelStrings.security_level); // set the initial class based off of the current pref - let button = this.button; - this._configUIFromPrefs(button); + this._configUIFromPrefs();
this._securityPrefsBranch = Services.prefs.getBranch( "extensions.torbutton." ); this._securityPrefsBranch.addObserver("", this);
- CustomizableUI.addListener(this); - SecurityLevelPanel.init(); },
uninit() { - CustomizableUI.removeListener(this); - this._securityPrefsBranch.removeObserver("", this); this._securityPrefsBranch = null;
@@ -188,28 +200,12 @@ const SecurityLevelButton = { switch (topic) { case "nsPref:changed": if (data === "security_slider" || data === "security_custom") { - this._configUIFromPrefs(this.button); + this._configUIFromPrefs(); } break; } },
- // callback for entering the 'Customize Firefox' screen to set icon - onCustomizeStart(window) { - let navigatorToolbox = document.getElementById("navigator-toolbox"); - let button = navigatorToolbox.palette.querySelector( - "#security-level-button" - ); - this._configUIFromPrefs(button); - }, - - // callback when CustomizableUI modifies DOM - onWidgetAfterDOMChange(aNode, aNextNode, aContainer, aWasRemoval) { - if (aNode.id == "security-level-button" && !aWasRemoval) { - this._configUIFromPrefs(aNode); - } - }, - // for when the toolbar button needs to be activated and displays the Security Level panel // // In the toolbarbutton xul you'll notice we register this callback for both onkeypress and
tor-commits@lists.torproject.org