[tbb-commits] [tor-browser] 01/02: fixup! Bug 40926: Implemented the New Identity feature

gitolite role git at cupani.torproject.org
Mon Sep 19 23:00:08 UTC 2022


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 at 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 {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list