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

ma1 (@ma1) git at gitlab.torproject.org
Wed Mar 13 18:22:30 UTC 2024



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


Commits:
4b69c259 by hackademix at 2024-03-13T19:21:59+01:00
fixup! Bug 21952: Implement Onion-Location

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

- - - - -


10 changed files:

- browser/components/onionservices/OnionLocationParent.jsm
- − 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


Changes:

=====================================
browser/components/onionservices/OnionLocationParent.jsm
=====================================
@@ -8,8 +8,10 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm");
 
 // 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";
@@ -23,9 +25,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 =
@@ -95,9 +96,7 @@ 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,34 +0,0 @@
-// Copyright (c) 2020, The Tor Project, Inc.
-
-"use strict";
-
-ChromeUtils.defineModuleGetter(
-  this,
-  "TorStrings",
-  "resource:///modules/TorStrings.jsm"
-);
-
-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,14 +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;
     }
   }
@@ -538,8 +530,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 */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM;
 
@@ -1332,23 +1322,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;
   }
 


=====================================
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."
 #---------------------------------------------------------------------------



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4b69c25929cce11ca9758996f04ec830bb53e670

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4b69c25929cce11ca9758996f04ec830bb53e670
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/20240313/786c08a6/attachment-0001.htm>


More information about the tbb-commits mailing list