
henry pushed to branch mullvad-browser-140.0esr-15.0-1 at The Tor Project / Applications / Mullvad Browser Commits: 350f2221 by Henry Wilkes at 2025-07-17T14:13:07+01:00 fixup! BB 40926: Implemented the New Identity feature TB 43638: Add the cmd_newIdentity command element and use it. - - - - - 7 changed files: - browser/base/content/appmenu-viewcache.inc.xhtml - browser/base/content/browser-init.js - browser/base/content/browser-menubar.inc - browser/base/content/browser-sets.inc - browser/base/content/navigator-toolbox.inc.xhtml - browser/components/customizableui/CustomizeMode.sys.mjs - browser/components/newidentity/content/newidentity.js Changes: ===================================== browser/base/content/appmenu-viewcache.inc.xhtml ===================================== @@ -58,7 +58,8 @@ <toolbarbutton id="appMenu-new-identity" class="subviewbutton" data-l10n-id="appmenuitem-new-identity" - key="new-identity-key"/> + key="new-identity-key" + command="cmd_newIdentity"/> <toolbarseparator/> <toolbarbutton id="appMenu-bookmarks-button" class="subviewbutton subviewbutton-nav" ===================================== browser/base/content/browser-init.js ===================================== @@ -229,9 +229,6 @@ var gBrowserInit = { // Init the SecurityLevelButton SecurityLevelButton.init(); - // Init the NewIdentityButton - NewIdentityButton.init(); - // Certain kinds of automigration rely on this notification to complete // their tasks BEFORE the browser window is shown. SessionStore uses it to // restore tabs into windows AFTER important parts like gMultiProcessBrowser @@ -1043,8 +1040,6 @@ var gBrowserInit = { SecurityLevelButton.uninit(); - NewIdentityButton.uninit(); - if (gToolbarKeyNavEnabled) { ToolbarKeyboardNavigator.uninit(); } ===================================== browser/base/content/browser-menubar.inc ===================================== @@ -22,7 +22,9 @@ key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/> <menuseparator/> <menuitem id="menu_newIdentity" - key="new-identity-key" data-l10n-id="menu-new-identity"/> + command="cmd_newIdentity" + key="new-identity-key" + data-l10n-id="menu-new-identity"/> <menuseparator/> <menuitem id="menu_openLocation" hidden="true" ===================================== browser/base/content/browser-sets.inc ===================================== @@ -112,6 +112,8 @@ #ifdef XP_MACOSX <command id="zoomWindow" data-l10n-id="window-zoom-command" /> #endif + + <command id="cmd_newIdentity" /> </commandset> #include ../../components/places/content/placesCommands.inc.xhtml ===================================== browser/base/content/navigator-toolbox.inc.xhtml ===================================== @@ -574,7 +574,9 @@ command="cmd_newNavigator" tooltip="dynamic-shortcut-tooltip"/> - <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional" + <toolbarbutton id="new-identity-button" + command="cmd_newIdentity" + class="toolbarbutton-1 chromeclass-toolbar-additional" data-l10n-id="toolbar-new-identity"/> <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional" ===================================== browser/components/customizableui/CustomizeMode.sys.mjs ===================================== @@ -251,6 +251,7 @@ export class CustomizeMode { "Browser:NewUserContextTab", "Tools:PrivateBrowsing", "zoomWindow", + "cmd_newIdentity", ]); /** ===================================== browser/components/newidentity/content/newidentity.js ===================================== @@ -501,34 +501,6 @@ ChromeUtils.defineLazyGetter(this, "NewIdentityButton", () => { let newIdentityInProgress = false; return { - topics, - - init() { - // 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"); - button?.addEventListener("command", () => { - this.onCommand(); - }); - document - .getElementById("appMenu-viewCache") - .content.querySelector("#appMenu-new-identity") - ?.addEventListener("command", () => { - this.onCommand(); - }); - document - .getElementById("menu_newIdentity") - ?.addEventListener("command", () => { - this.onCommand(); - }); - }, - - uninit() {}, - async onCommand() { try { // Ignore if there's a New Identity in progress to avoid race View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/350f... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/350f... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
henry (@henry)