[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] 2 commits: fixup! Bug 21952: Implement Onion-Location

ma1 (@ma1) git at gitlab.torproject.org
Tue Mar 12 20:20:01 UTC 2024



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


Commits:
13864ce2 by hackademix at 2024-03-12T11:39:34+01:00
fixup! Bug 21952: Implement Onion-Location

Bug 42440: Remove the "Prioritize .onion sites when known" option

- - - - -
cc1d2cd0 by hackademix at 2024-03-12T17:14:18+01:00
fixup! Add TorStrings module for localization

Bug 42440: Remove the "Prioritize .onion sites when known" option

- - - - -


12 changed files:

- browser/components/onionservices/OnionLocationParent.sys.mjs
- − browser/components/onionservices/content/onionlocationPreferences.inc.xhtml
- − browser/components/onionservices/content/onionlocationPreferences.js
- browser/components/onionservices/jar.mn
- browser/components/preferences/privacy.inc.xhtml
- browser/components/preferences/privacy.js
- dom/base/Document.cpp
- mobile/android/geckoview/api.txt
- mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
- modules/libpref/init/StaticPrefList.yaml
- toolkit/modules/TorStrings.sys.mjs
- toolkit/torbutton/chrome/locale/en-US/onionLocation.properties


Changes:

=====================================
browser/components/onionservices/OnionLocationParent.sys.mjs
=====================================
@@ -3,8 +3,10 @@
 import { TorStrings } from "resource://gre/modules/TorStrings.sys.mjs";
 
 // Prefs
+
+// We keep the "prioritizeonions" name, even if obsolete, in order to
+// prevent the notification from being shown again to upgrading users.
 const NOTIFICATION_PREF = "privacy.prioritizeonions.showNotification";
-const PRIORITIZE_ONIONS_PREF = "privacy.prioritizeonions.enabled";
 
 // Element IDs
 const ONIONLOCATION_BOX_ID = "onion-location-box";
@@ -18,9 +20,8 @@ const NOTIFICATION_ANCHOR_ID = "onion-location-box";
 const STRING_ONION_AVAILABLE = TorStrings.onionLocation.onionAvailable;
 const NOTIFICATION_CANCEL_LABEL = TorStrings.onionLocation.notNow;
 const NOTIFICATION_CANCEL_ACCESSKEY = TorStrings.onionLocation.notNowAccessKey;
-const NOTIFICATION_OK_LABEL = TorStrings.onionLocation.alwaysPrioritize;
-const NOTIFICATION_OK_ACCESSKEY =
-  TorStrings.onionLocation.alwaysPrioritizeAccessKey;
+const NOTIFICATION_OK_LABEL = TorStrings.onionLocation.loadOnion;
+const NOTIFICATION_OK_ACCESSKEY = TorStrings.onionLocation.loadOnionAccessKey;
 const NOTIFICATION_TITLE = TorStrings.onionLocation.tryThis;
 const NOTIFICATION_DESCRIPTION = TorStrings.onionLocation.description;
 const NOTIFICATION_LEARN_MORE_URL =
@@ -90,9 +91,7 @@ export class OnionLocationParent extends JSWindowActorParent {
       label: NOTIFICATION_OK_LABEL,
       accessKey: NOTIFICATION_OK_ACCESSKEY,
       callback() {
-        Services.prefs.setBoolPref(PRIORITIZE_ONIONS_PREF, true);
         OnionLocationParent.redirect(browser);
-        win.openPreferences("privacy-onionservices");
       },
     };
 


=====================================
browser/components/onionservices/content/onionlocationPreferences.inc.xhtml deleted
=====================================
@@ -1,11 +0,0 @@
-# Copyright (c) 2020, The Tor Project, Inc.
-
-<groupbox id="onionServicesGroup" data-category="panePrivacy" data-subcategory="onionservices" hidden="true">
-  <label><html:h2 id="onionServicesTitle"></html:h2></label>
-  <label><label class="tail-with-learn-more" id="prioritizeOnionsDesc"></label><label
-  class="learnMore" is="text-link" id="onionServicesLearnMore"></label></label>
-  <radiogroup id="prioritizeOnionsRadioGroup" aria-labelledby="prioritizeOnionsDesc" preference="privacy.prioritizeonions.enabled">
-    <radio id="onionServicesRadioAlways" value="true"/>
-    <radio id="onionServicesRadioAsk" value="false"/>
-  </radiogroup>
-</groupbox>


=====================================
browser/components/onionservices/content/onionlocationPreferences.js deleted
=====================================
@@ -1,32 +0,0 @@
-// Copyright (c) 2020, The Tor Project, Inc.
-
-"use strict";
-
-ChromeUtils.defineESModuleGetters(this, {
-  TorStrings: "resource://gre/modules/TorStrings.sys.mjs",
-});
-
-const OnionLocationPreferences = {
-  init() {
-    document.getElementById("onionServicesTitle").textContent =
-      TorStrings.onionLocation.onionServicesTitle;
-    document.getElementById("prioritizeOnionsDesc").textContent =
-      TorStrings.onionLocation.prioritizeOnionsDescription;
-    const learnMore = document.getElementById("onionServicesLearnMore");
-    learnMore.textContent = TorStrings.onionLocation.learnMore;
-    learnMore.href = TorStrings.onionLocation.learnMoreURL;
-    if (TorStrings.onionLocation.learnMoreURL.startsWith("about:")) {
-      learnMore.setAttribute("useoriginprincipal", "true");
-    }
-    document.getElementById("onionServicesRadioAlways").label =
-      TorStrings.onionLocation.always;
-    document.getElementById("onionServicesRadioAsk").label =
-      TorStrings.onionLocation.askEverytime;
-  },
-};
-
-Object.defineProperty(this, "OnionLocationPreferences", {
-  value: OnionLocationPreferences,
-  enumerable: true,
-  writable: false,
-});


=====================================
browser/components/onionservices/jar.mn
=====================================
@@ -6,5 +6,4 @@ browser.jar:
     content/browser/onionservices/onionservices.css                (content/onionservices.css)
     content/browser/onionservices/savedKeysDialog.js               (content/savedKeysDialog.js)
     content/browser/onionservices/savedKeysDialog.xhtml            (content/savedKeysDialog.xhtml)
-    content/browser/onionservices/onionlocationPreferences.js      (content/onionlocationPreferences.js)
     skin/classic/browser/onionlocation.css                         (content/onionlocation.css)


=====================================
browser/components/preferences/privacy.inc.xhtml
=====================================
@@ -14,8 +14,6 @@
   <html:h1 data-l10n-id="privacy-header"/>
 </hbox>
 
-#include ../onionservices/content/onionlocationPreferences.inc.xhtml
-
 <!-- Tracking / Content Blocking -->
 <groupbox id="trackingGroup" data-category="panePrivacy" hidden="true" aria-describedby="contentBlockingDescription" class="highlighting-group">
   <label id="contentBlockingHeader"><html:h2 data-l10n-id="content-blocking-enhanced-tracking-protection"/></label>


=====================================
browser/components/preferences/privacy.js
=====================================
@@ -75,12 +75,6 @@ XPCOMUtils.defineLazyScriptGetter(
   "chrome://browser/content/securitylevel/securityLevel.js"
 );
 
-XPCOMUtils.defineLazyScriptGetter(
-  this,
-  ["OnionLocationPreferences"],
-  "chrome://browser/content/onionservices/onionlocationPreferences.js"
-);
-
 XPCOMUtils.defineLazyPreferenceGetter(
   this,
   "OS_AUTH_ENABLED",
@@ -167,9 +161,6 @@ Preferences.addAll([
   // Do not track
   { id: "privacy.donottrackheader.enabled", type: "bool" },
 
-  // Onion Location
-  { id: "privacy.prioritizeonions.enabled", type: "bool" },
-
   // Media
   { id: "media.autoplay.default", type: "int" },
 
@@ -349,13 +340,6 @@ var gPrivacyPane = {
     });
   },
 
-  /**
-   * Show the OnionLocation preferences UI
-   */
-  _initOnionLocation() {
-    OnionLocationPreferences.init();
-  },
-
   /**
    * Whether the prompt to restart Firefox should appear when changing the autostart pref.
    */
@@ -899,7 +883,6 @@ var gPrivacyPane = {
     this._initTrackingProtectionExtensionControl();
     OnionServicesAuthPreferences.init();
     this._initSecurityLevel();
-    this._initOnionLocation();
 
     Services.telemetry.setEventRecordingEnabled("pwmgr", true);
 


=====================================
dom/base/Document.cpp
=====================================
@@ -6976,14 +6976,7 @@ void Document::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) {
     nsCOMPtr<nsIURI> onionURI;
     if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(onionURI), aData)) &&
         IsValidOnionLocation(Document::GetDocumentURI(), onionURI)) {
-      if (StaticPrefs::privacy_prioritizeonions_enabled()) {
-        nsCOMPtr<nsIRefreshURI> refresher(mDocumentContainer);
-        if (refresher) {
-          refresher->RefreshURI(onionURI, NodePrincipal(), 0);
-        }
-      } else {
-        mOnionLocationURI = onionURI;
-      }
+      mOnionLocationURI = onionURI;
     }
   }
 }


=====================================
mobile/android/geckoview/api.txt
=====================================
@@ -801,7 +801,6 @@ package org.mozilla.geckoview {
     method public boolean getLoginAutofillEnabled();
     method public boolean getPauseForDebuggerEnabled();
     method public int getPreferredColorScheme();
-    method public boolean getPrioritizeOnions();
     method public boolean getRemoteDebuggingEnabled();
     method @Nullable public GeckoRuntime getRuntime();
     method @Nullable public Rect getScreenSizeOverride();
@@ -827,7 +826,6 @@ package org.mozilla.geckoview {
     method public void setLocales(@Nullable String[]);
     method @NonNull public GeckoRuntimeSettings setLoginAutofillEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int);
-    method @NonNull public GeckoRuntimeSettings setPrioritizeOnions(boolean);
     method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setSpoofEnglish(boolean);
     method @NonNull public GeckoRuntimeSettings setTorSecurityLevel(int);
@@ -867,7 +865,6 @@ package org.mozilla.geckoview {
     method @NonNull public GeckoRuntimeSettings.Builder locales(@Nullable String[]);
     method @NonNull public GeckoRuntimeSettings.Builder loginAutofillEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder pauseForDebugger(boolean);
-    method @NonNull public GeckoRuntimeSettings.Builder prioritizeOnions(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder preferredColorScheme(int);
     method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int);


=====================================
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
=====================================
@@ -477,17 +477,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
       return this;
     }
 
-    /**
-     * Sets whether the browser should prioritize .onion sites when available.
-     *
-     * @param flag  True if we should prioritize .onion sites, false otherwise
-     * @return This Builder instance.
-     */
-    public @NonNull Builder prioritizeOnions(final boolean flag) {
-      getSettings().mPrioritizeOnions.set(flag);
-      return this;
-    }
-
     public @NonNull Builder useNewBootstrap(final boolean flag) {
       getSettings().mUseNewBootstrap.set(flag);
       return this;
@@ -543,8 +532,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
   /* package */ final Pref<Integer> mSpoofEnglish = new Pref<>("privacy.spoof_english", 0);
   /* package */ final Pref<Integer> mSecurityLevel =
       new Pref<>("browser.security_level.security_slider", 4);
-  /* package */ final Pref<Boolean> mPrioritizeOnions =
-      new Pref<>("privacy.prioritizeonions.enabled", false);
   /* package */ final Pref<Boolean> mUseNewBootstrap =
       new Pref<>("browser.tor_android.use_new_bootstrap", false);
 
@@ -1339,26 +1326,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
     return this;
   }
 
-  /**
-   * Gets whether we should prioritize .onion sites.
-   *
-   * @return Whether we should prioritize .onion sites.
-   */
-  public boolean getPrioritizeOnions() {
-    return mPrioritizeOnions.get();
-  }
-
-  /**
-   * Sets whether we should prioritize .onion sites.
-   *
-   * @param flag Whether we should prioritize .onion sites.
-   * @return This GeckoRuntimeSettings instance.
-   */
-  public @NonNull GeckoRuntimeSettings setPrioritizeOnions(final boolean flag) {
-    mPrioritizeOnions.commit(flag);
-    return this;
-  }
-
   public boolean getUseNewBootstrap() {
     return mUseNewBootstrap.get();
   }


=====================================
modules/libpref/init/StaticPrefList.yaml
=====================================
@@ -13578,11 +13578,6 @@
   value: ""
   mirror: never
 
-- name: privacy.prioritizeonions.enabled
-  type: RelaxedAtomicBool
-  value: false
-  mirror: always
-
 #---------------------------------------------------------------------------
 # Prefs starting with "prompts."
 #---------------------------------------------------------------------------


=====================================
toolkit/modules/TorStrings.sys.mjs
=====================================
@@ -439,20 +439,15 @@ const Loader = {
   */
   onionLocation() {
     const strings = {
-      alwaysPrioritize: "Always Prioritize Onionsites",
-      alwaysPrioritizeAccessKey: "a",
+      learnMore: "Learn more…",
+      loadOnion: "Visit the .onion",
+      loadOnionAccessKey: "V",
       notNow: "Not Now",
       notNowAccessKey: "n",
       description:
-        "Website publishers can protect users by adding a security layer. This prevents eavesdroppers from knowing that you are the one visiting that website.",
-      tryThis: "Try this: Onionsite",
-      onionAvailable: "Onionsite available",
-      learnMore: "Learn more",
-      always: "Always",
-      askEverytime: "Ask you every time",
-      prioritizeOnionsDescription:
-        "Prioritize onionsites when they are available.",
-      onionServicesTitle: "Onion Services",
+        "There's a more private and secure version of this site available over the Tor network via onion services. Onion services help website publishers and their visitors defeat surveillance and censorship.",
+      tryThis: "Try Onion Services",
+      onionAvailable: ".onion available",
     };
 
     const tsb = new TorPropertyStringBundle(


=====================================
toolkit/torbutton/chrome/locale/en-US/onionLocation.properties
=====================================
@@ -4,10 +4,10 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Onion-Location strings.
-onionLocation.alwaysPrioritize=Always Prioritize Onions
-# Localization note: this is the access key for "Always Prioritize Onions".
+onionLocation.loadOnion=Visit the .onion
+# Localization note: this is the access key for "Visit the .onion".
 # It should be a character that appears in that string.
-onionLocation.alwaysPrioritizeAccessKey=a
+onionLocation.loadOnionAccessKey=V
 onionLocation.notNow=Not Now
 # Localization note: this is the access key for "Not now".
 # It should be a character that appears in that string.
@@ -16,7 +16,3 @@ onionLocation.description=There's a more private and secure version of this site
 onionLocation.tryThis=Try Onion Services
 onionLocation.onionAvailable=.onion available
 onionLocation.learnMore=Learn more…
-onionLocation.always=Always
-onionLocation.askEverytime=Ask every time
-onionLocation.prioritizeOnionsDescription=Prioritize .onion sites when known.
-onionLocation.onionServicesTitle=Onion Services



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/2cf77af7408a3c00b5bc55cb17342f6052359233...cc1d2cd0a65c9afd7f8006c0cd163c175480a294

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/2cf77af7408a3c00b5bc55cb17342f6052359233...cc1d2cd0a65c9afd7f8006c0cd163c175480a294
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/20240312/f50db45d/attachment-0001.htm>


More information about the tbb-commits mailing list