[tbb-commits] [tor-browser] 02/02: fixup! Bug 21952: Implement Onion-Location

gitolite role git at cupani.torproject.org
Wed Oct 26 21:00:36 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-1
in repository tor-browser.

commit d632a5f4cc14c3a6b3eafc548df0d8f3aa9fd028
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Wed Oct 26 10:28:58 2022 +0200

    fixup! Bug 21952: Implement Onion-Location
    
    Bug 41394: Expose privacy.prioritizeonions.enabled to Android.
---
 mobile/android/geckoview/api.txt                   |  3 ++
 .../mozilla/geckoview/GeckoRuntimeSettings.java    | 33 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt
index af1b7796e6d2..707a65a7eebc 100644
--- a/mobile/android/geckoview/api.txt
+++ b/mobile/android/geckoview/api.txt
@@ -807,6 +807,7 @@ 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();
@@ -832,6 +833,7 @@ 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);
@@ -871,6 +873,7 @@ 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);
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
index 547efce6bd54..a35294bfc6f0 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
@@ -475,6 +475,17 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
       getSettings().mTorSecurityLevel.set(level);
       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;
+    }
   }
 
   private GeckoRuntime mRuntime;
@@ -526,6 +537,8 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
   /* package */ final Pref<Integer> mSpoofEnglish = new Pref<>("privacy.spoof_english", 0);
   /* package */ final Pref<Integer> mTorSecurityLevel =
       new Pref<>("extensions.torbutton.security_slider", 4);
+  /* package */ final Pref<Boolean> mPrioritizeOnions =
+      new Pref<>("privacy.prioritizeonions.enabled", false);
 
   /* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM;
 
@@ -1310,6 +1323,26 @@ 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;
+  }
+
   @Override // Parcelable
   public void writeToParcel(final Parcel out, final int flags) {
     super.writeToParcel(out, flags);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list