Verified Commit 447df7e0 authored by henry's avatar henry Committed by ma1
Browse files

BB 43902: Modify the new sidebar for Base Browser.

parent 1e7b42c3
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -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("");
});

+23 −0
Original line number Diff line number Diff line
@@ -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"
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@
  </radiogroup>
  <checkbox id="browserLayoutShowSidebar" data-l10n-id="browser-layout-show-sidebar"
            preference="sidebar.revamp"/>
  <description class="indent" data-l10n-id="browser-layout-show-sidebar-desc"></description>
  <description class="indent" data-l10n-id="browser-layout-show-sidebar-desc-limited"></description>
</groupbox>

<!-- Letterboxing -->
+16 −3
Original line number Diff line number Diff line
@@ -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",
@@ -113,6 +114,9 @@ var SidebarController = {
          gleanEvent: Glean.history.sidebarToggle,
          gleanClickEvent: Glean.sidebar.historyIconClick,
          recordSidebarVersion: true,
          // In permanent private browsing, the history panel can be opened, but
          // we hide the sidebar button to control this. tor-browser#43902.
          visible: !PrivateBrowsingUtils.permanentPrivateBrowsing,
        }),
      ],
      [
@@ -131,6 +135,15 @@ var SidebarController = {
            ? "sidebar-synced-tabs-context-menu"
            : undefined,
          gleanClickEvent: Glean.sidebar.syncedTabsIconClick,
          // firefoxview is disabled. tor-browser#42037 and tor-browser#43902.
          // See bugzilla bug 1983505.
          // NOTE: The menuId and elementId menu items (sidebar switchers)
          // should be hidden via the `sync-ui-item` class, which will *one*
          // time hide the menu items via gSync.init.
          // #sidebar-switcher-tabs is already in the initial browser DOM,
          // and #menu_tabsSidebar is created during SidebarController.init,
          // which seems to run prior to gSync.init.
          visible: false,
        }),
      ],
      [