[tbb-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.11.0esr-13.5-1] 3 commits: fixup! Bug 41916: Letterboxing preferences UI

ma1 (@ma1) git at gitlab.torproject.org
Thu May 16 14:12:46 UTC 2024



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


Commits:
334f5c22 by Henry Wilkes at 2024-05-16T15:56:19+02:00
fixup! Bug 41916: Letterboxing preferences UI

Bug 42583: Use moz-support-link for the letterboxing preference.

Also update the url.

- - - - -
cfddacb5 by Henry Wilkes at 2024-05-16T16:11:27+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.

- - - - -
adcbe40d by Henry Wilkes at 2024-05-16T16:12:08+02:00
Bug 42583: Modify moz-support-link for Base Browser.

- - - - -


5 changed files:

- browser/components/preferences/letterboxing.inc.xhtml
- browser/components/securitylevel/content/securityLevel.js
- browser/components/securitylevel/content/securityLevelPanel.inc.xhtml
- browser/components/securitylevel/content/securityLevelPreferences.inc.xhtml
- toolkit/content/widgets/moz-support-link/moz-support-link.mjs


Changes:

=====================================
browser/components/preferences/letterboxing.inc.xhtml
=====================================
@@ -11,13 +11,11 @@
       data-l10n-id="letterboxing-overview"
       class="tail-with-learn-more"
     ></html:span>
-    <label
+    <html:a
+      is="moz-support-link"
+      tor-manual-page="anti-fingerprinting_letterboxing"
       data-l10n-id="letterboxing-learn-more"
-      class="learnMore text-link"
-      is="text-link"
-      href="about:manual#letterboxing"
-      useoriginprincipal="true"
-    />
+    ></html:a>
   </description>
 </vbox>
 <groupbox
@@ -32,13 +30,11 @@
       data-l10n-id="letterboxing-overview"
       class="tail-with-learn-more"
     ></html:span>
-    <label
+    <html:a
+      is="moz-support-link"
+      tor-manual-page="anti-fingerprinting_letterboxing"
       data-l10n-id="letterboxing-learn-more"
-      class="learnMore text-link"
-      is="text-link"
-      href="about:manual#letterboxing"
-      useoriginprincipal="true"
-    />
+    ></html:a>
   </description>
   <checkbox
     id="letterboxingRememberSize"
@@ -59,13 +55,11 @@
       data-l10n-id="letterboxing-overview"
       class="tail-with-learn-more"
     ></html:span>
-    <label
+    <html:a
+      is="moz-support-link"
+      tor-manual-page="anti-fingerprinting_letterboxing"
       data-l10n-id="letterboxing-learn-more"
-      class="learnMore text-link"
-      is="text-link"
-      href="about:manual#letterboxing"
-      useoriginprincipal="true"
-    />
+    ></html:a>
   </description>
   <description
     id="letterboxingAlignmentDesc"
@@ -110,13 +104,11 @@
       data-l10n-id="letterboxing-overview"
       class="tail-with-learn-more"
     ></html:span>
-    <label
+    <html:a
+      is="moz-support-link"
+      tor-manual-page="anti-fingerprinting_letterboxing"
       data-l10n-id="letterboxing-learn-more"
-      class="learnMore text-link"
-      is="text-link"
-      href="about:manual#letterboxing"
-      useoriginprincipal="true"
-    />
+    ></html:a>
   </description>
   <hbox align="center">
     <label


=====================================
browser/components/securitylevel/content/securityLevel.js
=====================================
@@ -157,6 +157,9 @@ var SecurityLevelPanel = {
   _populated: false,
 
   _populateXUL() {
+    // TODO: Used for #securityLevel-learnMore. Remove with esr 128.
+    window.ensureCustomElements("moz-support-link");
+
     this._elements = {
       panel: document.getElementById("securityLevel-panel"),
       background: document.getElementById("securityLevel-background"),
@@ -171,9 +174,7 @@ var SecurityLevelPanel = {
 
     const learnMoreEl = document.getElementById("securityLevel-learnMore");
     learnMoreEl.addEventListener("click", event => {
-      window.openTrustedLinkIn(learnMoreEl.href, "tab");
       this.hide();
-      event.preventDefault();
     });
 
     this._elements.restoreDefaultsButton.addEventListener("command", () => {


=====================================
browser/components/securitylevel/content/securityLevelPanel.inc.xhtml
=====================================
@@ -23,9 +23,10 @@
     </html:p>
     <html:p id="securityLevel-summary"></html:p>
     <html:a
+      is="moz-support-link"
       id="securityLevel-learnMore"
+      tor-manual-page="security-settings"
       data-l10n-id="security-level-panel-learn-more-link"
-      href="https://mullvad.net/en/browser/hard-facts#security-levels"
     ></html:a>
   </vbox>
   <hbox class="panel-footer">


=====================================
browser/components/securitylevel/content/securityLevelPreferences.inc.xhtml
=====================================
@@ -12,13 +12,11 @@
         class="tail-with-learn-more"
         data-l10n-id="security-level-preferences-overview"
       ></html:span>
-      <label
-        id="securityLevel-learnMore"
-        class="learnMore text-link"
-        is="text-link"
+      <html:a
+        is="moz-support-link"
+        tor-manual-page="security-settings"
         data-l10n-id="security-level-preferences-learn-more-link"
-        href="https://mullvad.net/en/browser/hard-facts#security-levels"
-      />
+      ></html:a>
     </description>
     <hbox
       id="securityLevel-customNotification"


=====================================
toolkit/content/widgets/moz-support-link/moz-support-link.mjs
=====================================
@@ -17,7 +17,9 @@ MozXULElement.insertFTLIfNeeded("browser/components/mozSupportLink.ftl");
 export default class MozSupportLink extends HTMLAnchorElement {
   static SUPPORT_URL = "https://www.mozilla.org/";
   static get observedAttributes() {
-    return ["support-page", "utm-content"];
+    // We add tor-manual-page for pages hosted at tor project. Also shared with
+    // base-browser/mullvad-browser. See tor-browser#42583.
+    return ["support-page", "utm-content", "tor-manual-page"];
   }
 
   /**
@@ -96,12 +98,33 @@ export default class MozSupportLink extends HTMLAnchorElement {
   }
 
   attributeChangedCallback(attrName, oldVal, newVal) {
-    if (attrName === "support-page" || attrName === "utm-content") {
+    if (
+      attrName === "support-page" ||
+      attrName === "utm-content" ||
+      attrName === "tor-manual-page"
+    ) {
       this.#setHref();
     }
   }
 
   #setHref() {
+    let torManualPage = this.getAttribute("tor-manual-page");
+    if (torManualPage) {
+      const [page, anchor] = torManualPage.split("_", 2);
+
+      let locale = Services.locale.appLocaleAsBCP47;
+      if (locale === "ja-JP-macos") {
+        // Convert quirk-locale to the locale used for tor project.
+        locale = "ja";
+      }
+
+      let href = `https://tb-manual.torproject.org/${locale}/${page}/`;
+      if (anchor) {
+        href = `${href}#${anchor}`;
+      }
+      this.href = href;
+      return;
+    }
     let supportPage = this.getAttribute("support-page") ?? "";
     // Customize the link in about:preferences.
     // See mullvad-browser#244 and tor-browser#41910.
@@ -128,21 +151,7 @@ customElements.define("moz-support-link", MozSupportLink, { extends: "a" });
  *          Otherwise the url in unmodified form.
  */
 export function formatUTMParams(contentAttribute, url) {
-  if (!contentAttribute) {
-    return url;
-  }
-  let parsedUrl = new URL(url);
-  let domain = `.${parsedUrl.hostname}`;
-  if (
-    !domain.endsWith(".mozilla.org") &&
-    // For testing: addons-dev.allizom.org and addons.allizom.org
-    !domain.endsWith(".allizom.org")
-  ) {
-    return url;
-  }
-
-  parsedUrl.searchParams.set("utm_source", "firefox-browser");
-  parsedUrl.searchParams.set("utm_medium", "firefox-browser");
-  parsedUrl.searchParams.set("utm_content", contentAttribute);
-  return parsedUrl.href;
+  // Do not add utm parameters. See tor-browser#42583.
+  // NOTE: This method is also present in about:addons.
+  return url;
 }



View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/904de2aaacadf51e07dfd04994b1b215b81f8a1d...adcbe40d7ce0dc6f920e8a42d8475c2745fedf94

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/904de2aaacadf51e07dfd04994b1b215b81f8a1d...adcbe40d7ce0dc6f920e8a42d8475c2745fedf94
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240516/2adf1d33/attachment-0001.htm>


More information about the tbb-commits mailing list