tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 50de4c1391e93825704d003031a7cbef9175ec93
parent dc2a07978a5e032db55196c56588fcb9bc2c6c86
Author: Maile Lucks <maile.lucks@gmail.com>
Date:   Thu,  9 Oct 2025 19:15:34 +0000

Bug 1933507 - Adjust placement of create profile and manage profiles button within the profiles toolbar panel depending on length of available profiles - r=jhirsch,profiles-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D264875

Diffstat:
Mbrowser/base/content/appmenu-viewcache.inc.xhtml | 9---------
Mbrowser/base/content/browser-profiles.js | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mbrowser/themes/shared/customizableui/panelUI-shared.css | 4----
3 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/browser/base/content/appmenu-viewcache.inc.xhtml b/browser/base/content/appmenu-viewcache.inc.xhtml @@ -239,16 +239,7 @@ class="subview-subheader" data-l10n-id="appmenu-other-profiles" /> <vbox id="profiles-list"></vbox> - <toolbarbutton id="profiles-create-profile-button" - class="subviewbutton subviewbutton-iconic" - data-l10n-id="appmenu-create-profile" - /> </vbox> - <toolbarseparator/> - <toolbarbutton id="profiles-manage-profiles-button" - class="subviewbutton panel-subview-footer-button" - data-l10n-id="appmenu-manage-profiles" - /> </panelview> <panelview id="appMenu-library-recentlyClosedTabs"/> diff --git a/browser/base/content/browser-profiles.js b/browser/base/content/browser-profiles.js @@ -256,6 +256,8 @@ var gProfiles = { currentProfile = SelectableProfileService.currentProfile; } + let subview = PanelMultiView.getViewNode(document, "PanelUI-profiles"); + let backButton = PanelMultiView.getViewNode( document, "profiles-appmenu-back-button" @@ -282,9 +284,62 @@ var gProfiles = { "profiles-edit-this-profile-button" ); + let profilesList = PanelMultiView.getViewNode(document, "profiles-list"); + // Automatically created by PanelMultiView. + const headerSeparator = profilesHeader.nextElementSibling; + let footerSeparator = PanelMultiView.getViewNode( + document, + "footer-separator" + ); + if (!footerSeparator) { + footerSeparator = document.createXULElement("toolbarseparator"); + footerSeparator.id = "footer-separator"; + } + + let createProfileButton = PanelMultiView.getViewNode( + document, + "profiles-create-profile-button" + ); + if (!createProfileButton) { + createProfileButton = document.createXULElement("toolbarbutton"); + createProfileButton.id = "profiles-create-profile-button"; + createProfileButton.classList.add( + "subviewbutton", + "subviewbutton-iconic" + ); + createProfileButton.setAttribute( + "data-l10n-id", + "appmenu-create-profile" + ); + } + + let manageProfilesButton = PanelMultiView.getViewNode( + document, + "profiles-manage-profiles-button" + ); + + if (!manageProfilesButton) { + manageProfilesButton = document.createXULElement("toolbarbutton"); + manageProfilesButton.id = "profiles-manage-profiles-button"; + manageProfilesButton.classList.add( + "subviewbutton", + "panel-subview-footer-button" + ); + manageProfilesButton.setAttribute( + "data-l10n-id", + "appmenu-manage-profiles" + ); + } + if (profiles.length < 2) { profilesHeader.removeAttribute("style"); editButton.hidden = true; + + headerSeparator.hidden = false; + footerSeparator.hidden = true; + const subviewBody = subview.querySelector(".panel-subview-body"); + subview.insertBefore(createProfileButton, subviewBody); + subview.insertBefore(manageProfilesButton, subviewBody); } else { profilesHeader.style.backgroundColor = "var(--appmenu-profiles-theme-bg)"; profilesHeader.style.color = "var(--appmenu-profiles-theme-fg)"; @@ -292,11 +347,15 @@ var gProfiles = { } if (currentProfile && profiles.length > 1) { - let subview = PanelMultiView.getViewNode(document, "PanelUI-profiles"); let { themeBg, themeFg } = currentProfile.theme; subview.style.setProperty("--appmenu-profiles-theme-bg", themeBg); subview.style.setProperty("--appmenu-profiles-theme-fg", themeFg); + headerSeparator.hidden = true; + subview.appendChild(footerSeparator); + subview.appendChild(createProfileButton); + subview.appendChild(manageProfilesButton); + let headerText = PanelMultiView.getViewNode( document, "profiles-header-content" @@ -322,7 +381,6 @@ var gProfiles = { let subtitle = PanelMultiView.getViewNode(document, "profiles-subtitle"); subtitle.hidden = profiles.length < 2; - let profilesList = PanelMultiView.getViewNode(document, "profiles-list"); while (profilesList.lastElementChild) { profilesList.lastElementChild.remove(); } diff --git a/browser/themes/shared/customizableui/panelUI-shared.css b/browser/themes/shared/customizableui/panelUI-shared.css @@ -2263,10 +2263,6 @@ radiogroup:focus-visible > .subviewradio[focused="true"] { /* ----- Profiles panels ----- */ -#PanelUI-profiles .panel-header + toolbarseparator { - display: none; -} - #profiles-header-content { max-width: 16em; white-space: nowrap;