[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][base-browser-115.11.0esr-13.5-1] 2 commits: fixup! Bug 40925: Implemented the Security Level component



Title: GitLab

ma1 pushed to branch base-browser-115.11.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • b6dc6774
    by Henry Wilkes at 2024-05-16T16:13:07+02:00
    fixup! Bug 40925: Implemented the Security Level component
    
    Bug 42583: Use moz-support-link for the security level "Learn more"
    links. These take you to the tor project web link in base browser.
    
  • cb6a91ea
    by Henry Wilkes at 2024-05-16T16:13:08+02:00
    Bug 42583: Modify moz-support-link for Base Browser.
    

4 changed files:

Changes:

  • browser/components/securitylevel/content/securityLevel.js
    ... ... @@ -157,6 +157,9 @@ var SecurityLevelPanel = {
    157 157
       _populated: false,
    
    158 158
     
    
    159 159
       _populateXUL() {
    
    160
    +    // TODO: Used for #securityLevel-learnMore. Remove with esr 128.
    
    161
    +    window.ensureCustomElements("moz-support-link");
    
    162
    +
    
    160 163
         this._elements = {
    
    161 164
           panel: document.getElementById("securityLevel-panel"),
    
    162 165
           background: document.getElementById("securityLevel-background"),
    
    ... ... @@ -171,9 +174,7 @@ var SecurityLevelPanel = {
    171 174
     
    
    172 175
         const learnMoreEl = document.getElementById("securityLevel-learnMore");
    
    173 176
         learnMoreEl.addEventListener("click", event => {
    
    174
    -      window.openTrustedLinkIn(learnMoreEl.href, "tab");
    
    175 177
           this.hide();
    
    176
    -      event.preventDefault();
    
    177 178
         });
    
    178 179
     
    
    179 180
         this._elements.restoreDefaultsButton.addEventListener("command", () => {
    

  • browser/components/securitylevel/content/securityLevelPanel.inc.xhtml
    ... ... @@ -23,9 +23,10 @@
    23 23
         </html:p>
    
    24 24
         <html:p id="securityLevel-summary"></html:p>
    
    25 25
         <html:a
    
    26
    +      is="moz-support-link"
    
    26 27
           id="securityLevel-learnMore"
    
    28
    +      tor-manual-page="security-settings"
    
    27 29
           data-l10n-id="security-level-panel-learn-more-link"
    
    28
    -      href="">"about:manual#security-settings"
    
    29 30
         ></html:a>
    
    30 31
       </vbox>
    
    31 32
       <hbox class="panel-footer">
    

  • browser/components/securitylevel/content/securityLevelPreferences.inc.xhtml
    ... ... @@ -12,14 +12,11 @@
    12 12
             class="tail-with-learn-more"
    
    13 13
             data-l10n-id="security-level-preferences-overview"
    
    14 14
           ></html:span>
    
    15
    -      <label
    
    16
    -        id="securityLevel-learnMore"
    
    17
    -        class="learnMore text-link"
    
    18
    -        is="text-link"
    
    15
    +      <html:a
    
    16
    +        is="moz-support-link"
    
    17
    +        tor-manual-page="security-settings"
    
    19 18
             data-l10n-id="security-level-preferences-learn-more-link"
    
    20
    -        href="">"about:manual#security-settings"
    
    21
    -        useoriginprincipal="true"
    
    22
    -      />
    
    19
    +      ></html:a>
    
    23 20
         </description>
    
    24 21
         <hbox
    
    25 22
           id="securityLevel-customNotification"
    

  • toolkit/content/widgets/moz-support-link/moz-support-link.mjs
    ... ... @@ -17,7 +17,9 @@ MozXULElement.insertFTLIfNeeded("browser/components/mozSupportLink.ftl");
    17 17
     export default class MozSupportLink extends HTMLAnchorElement {
    
    18 18
       static SUPPORT_URL = "https://www.mozilla.org/";
    
    19 19
       static get observedAttributes() {
    
    20
    -    return ["support-page", "utm-content"];
    
    20
    +    // We add tor-manual-page for pages hosted at tor project. Also shared with
    
    21
    +    // base-browser/mullvad-browser. See tor-browser#42583.
    
    22
    +    return ["support-page", "utm-content", "tor-manual-page"];
    
    21 23
       }
    
    22 24
     
    
    23 25
       /**
    
    ... ... @@ -96,12 +98,33 @@ export default class MozSupportLink extends HTMLAnchorElement {
    96 98
       }
    
    97 99
     
    
    98 100
       attributeChangedCallback(attrName, oldVal, newVal) {
    
    99
    -    if (attrName === "support-page" || attrName === "utm-content") {
    
    101
    +    if (
    
    102
    +      attrName === "support-page" ||
    
    103
    +      attrName === "utm-content" ||
    
    104
    +      attrName === "tor-manual-page"
    
    105
    +    ) {
    
    100 106
           this.#setHref();
    
    101 107
         }
    
    102 108
       }
    
    103 109
     
    
    104 110
       #setHref() {
    
    111
    +    let torManualPage = this.getAttribute("tor-manual-page");
    
    112
    +    if (torManualPage) {
    
    113
    +      const [page, anchor] = torManualPage.split("_", 2);
    
    114
    +
    
    115
    +      let locale = Services.locale.appLocaleAsBCP47;
    
    116
    +      if (locale === "ja-JP-macos") {
    
    117
    +        // Convert quirk-locale to the locale used for tor project.
    
    118
    +        locale = "ja";
    
    119
    +      }
    
    120
    +
    
    121
    +      let href = `https://tb-manual.torproject.org/${locale}/${page}/`;
    
    122
    +      if (anchor) {
    
    123
    +        href = `${href}#${anchor}`;
    
    124
    +      }
    
    125
    +      this.href = href;
    
    126
    +      return;
    
    127
    +    }
    
    105 128
         let supportPage = this.getAttribute("support-page") ?? "";
    
    106 129
         let base = MozSupportLink.SUPPORT_URL + supportPage;
    
    107 130
         this.href = this.hasAttribute("utm-content")
    
    ... ... @@ -122,21 +145,7 @@ customElements.define("moz-support-link", MozSupportLink, { extends: "a" });
    122 145
      *          Otherwise the url in unmodified form.
    
    123 146
      */
    
    124 147
     export function formatUTMParams(contentAttribute, url) {
    
    125
    -  if (!contentAttribute) {
    
    126
    -    return url;
    
    127
    -  }
    
    128
    -  let parsedUrl = new URL(url);
    
    129
    -  let domain = `.${parsedUrl.hostname}`;
    
    130
    -  if (
    
    131
    -    !domain.endsWith(".mozilla.org") &&
    
    132
    -    // For testing: addons-dev.allizom.org and addons.allizom.org
    
    133
    -    !domain.endsWith(".allizom.org")
    
    134
    -  ) {
    
    135
    -    return url;
    
    136
    -  }
    
    137
    -
    
    138
    -  parsedUrl.searchParams.set("utm_source", "firefox-browser");
    
    139
    -  parsedUrl.searchParams.set("utm_medium", "firefox-browser");
    
    140
    -  parsedUrl.searchParams.set("utm_content", contentAttribute);
    
    141
    -  return parsedUrl.href;
    
    148
    +  // Do not add utm parameters. See tor-browser#42583.
    
    149
    +  // NOTE: This method is also present in about:addons.
    
    150
    +  return url;
    
    142 151
     }

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits