morgan pushed to branch tor-browser-140.3.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits: 3fffcac5 by Henry Wilkes at 2025-09-18T11:34:04+01:00 fixup! BB 43902: Modify the new sidebar for Base Browser. TB 44108: Use the old history panel for the new sidebar. We do this to avoid the "firefoxview" component. We modify the old sidebar to include a heading element and a close button. - - - - - 3 changed files: - browser/components/places/content/historySidebar.js - browser/components/places/content/historySidebar.xhtml - browser/components/sidebar/browser-sidebar.js Changes: ===================================== browser/components/places/content/historySidebar.js ===================================== @@ -89,6 +89,33 @@ window.addEventListener("load", () => { bhTooltip.removeAttribute("position") ); + // Add a button to close the history sidebar. This should only be visible when + // this document is used for the revamped sidebar. See tor-browser#44108. + document + .getElementById("sidebar-panel-close") + .addEventListener("click", () => { + window.browsingContext.embedderWindowGlobal.browsingContext.window.SidebarController.toggle( + "viewHistorySidebar" + ); + }); + // Hack to convert the sidebar-menu-history Fluent string's label attribute + // into text content. + const headingEl = document.getElementById("sidebar-panel-header-history"); + const updateHeadingText = () => { + const label = headingEl.getAttribute("label"); + if (!label) { + return; + } + headingEl.textContent = label; + headingEl.removeAttribute("label"); + }; + const headingElObserver = new MutationObserver(updateHeadingText); + headingElObserver.observe(headingEl, { + attributes: true, + attributeFilter: ["label"], + }); + updateHeadingText(); + searchHistory(""); }); ===================================== browser/components/places/content/historySidebar.xhtml ===================================== @@ -42,6 +42,9 @@ <html:link rel="localization" href="toolkit/global/textActions.ftl"/> <html:link rel="localization" href="browser/places.ftl"/> + <!-- Need sidebar-menu-history and sidebar-close-button. + - tor-browser#44108 --> + <html:link rel="localization" href="browser/sidebarMenu.ftl"/> </linkset> #include placesCommands.inc.xhtml @@ -55,6 +58,26 @@ #include placesContextMenu.inc.xhtml #include bookmarksHistoryTooltip.inc.xhtml + <!-- For ESR 140, we want to use this old history sidebar for the revamped + - sidebar as well because it does not require the "firefoxview" component. + - So we need an internal heading element for this page to be used with the + - new sidebar only. We copy this from bookmarksSidebar.xhtml. + - See tor-browser#44108. --> + <box id="sidebar-panel-header" align="center"> + <!-- (Mis)use the sidebar-menu-history string, which will set a "label" + - attribute, which we will convert to text content in javascript. --> + <html:h4 + id="sidebar-panel-header-history" + data-l10n-id="sidebar-menu-history" + data-l10n-attrs="label" + ></html:h4> + <html:moz-button + id="sidebar-panel-close" + type="icon ghost" + iconsrc="chrome://global/skin/icons/close.svg" + data-l10n-id="sidebar-close-button"> + </html:moz-button> + </box> <hbox id="sidebar-search-container"> <search-textbox id="search-box" flex="1" ===================================== browser/components/sidebar/browser-sidebar.js ===================================== @@ -98,9 +98,10 @@ var SidebarController = { "viewHistorySidebar", this.makeSidebar({ elementId: "sidebar-switcher-history", - url: this.sidebarRevampEnabled - ? "chrome://browser/content/sidebar/sidebar-history.html" - : "chrome://browser/content/places/historySidebar.xhtml", + // sidebar-history.html requires the "firefoxview" component and + // requires more work. Stick to historySidebar.xhtml for ESR 140. + // See tor-browser#44108. + url: "chrome://browser/content/places/historySidebar.xhtml", menuId: "menu_historySidebar", triggerButtonId: "appMenuViewHistorySidebar", keyId: "key_gotoHistory", View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/3fffcac5a0bab7e0ad4da4e8c3eaba569fd3c63a -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/3fffcac5a0bab7e0ad4da4e8c3eaba569fd3c63a You're receiving this email because of your account on gitlab.torproject.org.
_______________________________________________ tbb-commits mailing list -- tbb-commits@lists.torproject.org To unsubscribe send an email to tbb-commits-le...@lists.torproject.org