morgan pushed to branch mullvad-browser-140.3.0esr-15.0-1 at The Tor Project / Applications / Mullvad Browser

Commits:

3 changed files:

Changes:

  • browser/components/places/content/historySidebar.js
    ... ... @@ -89,6 +89,33 @@ window.addEventListener("load", () => {
    89 89
         bhTooltip.removeAttribute("position")
    
    90 90
       );
    
    91 91
     
    
    92
    +  // Add a button to close the history sidebar. This should only be visible when
    
    93
    +  // this document is used for the revamped sidebar. See tor-browser#44108.
    
    94
    +  document
    
    95
    +    .getElementById("sidebar-panel-close")
    
    96
    +    .addEventListener("click", () => {
    
    97
    +      window.browsingContext.embedderWindowGlobal.browsingContext.window.SidebarController.toggle(
    
    98
    +        "viewHistorySidebar"
    
    99
    +      );
    
    100
    +    });
    
    101
    +  // Hack to convert the sidebar-menu-history Fluent string's label attribute
    
    102
    +  // into text content.
    
    103
    +  const headingEl = document.getElementById("sidebar-panel-header-history");
    
    104
    +  const updateHeadingText = () => {
    
    105
    +    const label = headingEl.getAttribute("label");
    
    106
    +    if (!label) {
    
    107
    +      return;
    
    108
    +    }
    
    109
    +    headingEl.textContent = label;
    
    110
    +    headingEl.removeAttribute("label");
    
    111
    +  };
    
    112
    +  const headingElObserver = new MutationObserver(updateHeadingText);
    
    113
    +  headingElObserver.observe(headingEl, {
    
    114
    +    attributes: true,
    
    115
    +    attributeFilter: ["label"],
    
    116
    +  });
    
    117
    +  updateHeadingText();
    
    118
    +
    
    92 119
       searchHistory("");
    
    93 120
     });
    
    94 121
     
    

  • browser/components/places/content/historySidebar.xhtml
    ... ... @@ -42,6 +42,9 @@
    42 42
     
    
    43 43
         <html:link rel="localization" href="toolkit/global/textActions.ftl"/>
    
    44 44
         <html:link rel="localization" href="browser/places.ftl"/>
    
    45
    +    <!-- Need sidebar-menu-history and sidebar-close-button.
    
    46
    +       - tor-browser#44108 -->
    
    47
    +    <html:link rel="localization" href="browser/sidebarMenu.ftl"/>
    
    45 48
       </linkset>
    
    46 49
     
    
    47 50
     #include placesCommands.inc.xhtml
    
    ... ... @@ -55,6 +58,26 @@
    55 58
     
    
    56 59
     #include placesContextMenu.inc.xhtml
    
    57 60
     #include bookmarksHistoryTooltip.inc.xhtml
    
    61
    +  <!-- For ESR 140, we want to use this old history sidebar for the revamped
    
    62
    +     - sidebar as well because it does not require the "firefoxview" component.
    
    63
    +     - So we need an internal heading element for this page to be used with the
    
    64
    +     - new sidebar only. We copy this from bookmarksSidebar.xhtml.
    
    65
    +     - See tor-browser#44108. -->
    
    66
    +  <box id="sidebar-panel-header" align="center">
    
    67
    +    <!-- (Mis)use the sidebar-menu-history string, which will set a "label"
    
    68
    +       - attribute, which we will convert to text content in javascript. -->
    
    69
    +    <html:h4
    
    70
    +      id="sidebar-panel-header-history"
    
    71
    +      data-l10n-id="sidebar-menu-history"
    
    72
    +      data-l10n-attrs="label"
    
    73
    +    ></html:h4>
    
    74
    +    <html:moz-button
    
    75
    +        id="sidebar-panel-close"
    
    76
    +        type="icon ghost"
    
    77
    +        iconsrc="chrome://global/skin/icons/close.svg"
    
    78
    +        data-l10n-id="sidebar-close-button">
    
    79
    +    </html:moz-button>
    
    80
    +  </box>
    
    58 81
     
    
    59 82
       <hbox id="sidebar-search-container">
    
    60 83
         <search-textbox id="search-box" flex="1"
    

  • browser/components/sidebar/browser-sidebar.js
    ... ... @@ -98,9 +98,10 @@ var SidebarController = {
    98 98
             "viewHistorySidebar",
    
    99 99
             this.makeSidebar({
    
    100 100
               elementId: "sidebar-switcher-history",
    
    101
    -          url: this.sidebarRevampEnabled
    
    102
    -            ? "chrome://browser/content/sidebar/sidebar-history.html"
    
    103
    -            : "chrome://browser/content/places/historySidebar.xhtml",
    
    101
    +          // sidebar-history.html requires the "firefoxview" component and
    
    102
    +          // requires more work. Stick to historySidebar.xhtml for ESR 140.
    
    103
    +          // See tor-browser#44108.
    
    104
    +          url: "chrome://browser/content/places/historySidebar.xhtml",
    
    104 105
               menuId: "menu_historySidebar",
    
    105 106
               triggerButtonId: "appMenuViewHistorySidebar",
    
    106 107
               keyId: "key_gotoHistory",