diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt index dd074c9b9cbd..f9ca0466d247 100644 --- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -846,7 +846,6 @@ package org.mozilla.geckoview { method public int getGlMsaaLevel(); method public boolean getInputAutoZoomEnabled(); method public boolean getJavaScriptEnabled(); - method @NonNull public int getLargeKeepaliveFactor(); method @Nullable public String[] getLocales(); method public boolean getLoginAutofillEnabled(); method public boolean getPauseForDebuggerEnabled(); @@ -855,8 +854,6 @@ package org.mozilla.geckoview { method @Nullable public GeckoRuntime getRuntime(); method @Nullable public Rect getScreenSizeOverride(); method @Nullable public RuntimeTelemetry.Delegate getTelemetryDelegate(); - method @NonNull public String getTrustedRecursiveResolverUri(); - method public int getTrustedRecusiveResolverMode(); method public boolean getUseMaxScreenDepth(); method public boolean getWebFontsEnabled(); method public boolean getWebManifestEnabled(); @@ -875,13 +872,10 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings setGlMsaaLevel(int); method @NonNull public GeckoRuntimeSettings setInputAutoZoomEnabled(boolean); method @NonNull public GeckoRuntimeSettings setJavaScriptEnabled(boolean); - method @NonNull public GeckoRuntimeSettings setLargeKeepaliveFactor(int); method public void setLocales(@Nullable String[]); method @NonNull public GeckoRuntimeSettings setLoginAutofillEnabled(boolean); method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int); method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean); - method @NonNull public GeckoRuntimeSettings setTrustedRecursiveResolverMode(int); - method @NonNull public GeckoRuntimeSettings setTrustedRecursiveResolverUri(@NonNull String); method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean); method @NonNull public GeckoRuntimeSettings setWebManifestEnabled(boolean); field public static final int ALLOW_ALL = 0; @@ -891,10 +885,6 @@ package org.mozilla.geckoview { field public static final Parcelable.Creator CREATOR; field public static final int HTTPS_ONLY = 2; field public static final int HTTPS_ONLY_PRIVATE = 1; - field public static final int TRR_MODE_DISABLED = 5; - field public static final int TRR_MODE_FIRST = 2; - field public static final int TRR_MODE_OFF = 0; - field public static final int TRR_MODE_ONLY = 3; } @AnyThread public static final class GeckoRuntimeSettings.Builder extends RuntimeSettings.Builder { @@ -922,7 +912,6 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings.Builder glMsaaLevel(int); method @NonNull public GeckoRuntimeSettings.Builder inputAutoZoomEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder javaScriptEnabled(boolean); - method @NonNull public GeckoRuntimeSettings.Builder largeKeepaliveFactor(int); method @NonNull public GeckoRuntimeSettings.Builder locales(@Nullable String[]); method @NonNull public GeckoRuntimeSettings.Builder loginAutofillEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder pauseForDebugger(boolean); @@ -930,8 +919,6 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int); method @NonNull public GeckoRuntimeSettings.Builder telemetryDelegate(@NonNull RuntimeTelemetry.Delegate); - method @NonNull public GeckoRuntimeSettings.Builder trustedRecursiveResolverMode(int); - method @NonNull public GeckoRuntimeSettings.Builder trustedRecursiveResolverUri(@NonNull String); method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean); method @NonNull public GeckoRuntimeSettings.Builder webFontsEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder webManifest(boolean); @@ -944,9 +931,6 @@ package org.mozilla.geckoview { @Retention(value=RetentionPolicy.SOURCE) public static interface GeckoRuntimeSettings.HttpsOnlyMode { } - @Retention(value=RetentionPolicy.SOURCE) public static interface GeckoRuntimeSettings.TrustedRecursiveResolverMode { - } - public class GeckoSession { ctor public GeckoSession(); ctor public GeckoSession(@Nullable GeckoSessionSettings); diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt index 1ae4926b84d1..038515084f6c 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt @@ -216,38 +216,6 @@ class RuntimeSettingsTest : BaseSessionTest() { ) } - @Test - fun largeKeepaliveFactor() { - val defaultLargeKeepaliveFactor = 1 - val settings = sessionRule.runtime.settings - - val largeKeepaliveFactorPref = "network.http.largeKeepaliveFactor" - var prefValue = (sessionRule.getPrefs(largeKeepaliveFactorPref)[0] as Int) - assertThat( - "default LargeKeepaliveFactor should be 1", - prefValue, - `is`(defaultLargeKeepaliveFactor), - ) - - for (factor in 1..10) { - settings.setLargeKeepaliveFactor(factor) - prefValue = (sessionRule.getPrefs(largeKeepaliveFactorPref)[0] as Int) - assertThat( - "setting LargeKeepaliveFactor to an integer value between 1..10 should work", - prefValue, - `is`(factor), - ) - } - - settings.setLargeKeepaliveFactor(128) - prefValue = (sessionRule.getPrefs(largeKeepaliveFactorPref)[0] as Int) - assertThat( - "set LargeKeepaliveFactor to default when input is invalid", - prefValue, - `is`(defaultLargeKeepaliveFactor), - ) - } - @Test fun aboutConfig() { // This is broken in automation because document channel is enabled by default diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TrustedRecursiveResolverTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TrustedRecursiveResolverTest.kt deleted file mode 100644 index b2dfd754c2cc..000000000000 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TrustedRecursiveResolverTest.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -package org.mozilla.geckoview.test - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.MediumTest -import org.hamcrest.Matchers.* // ktlint-disable no-wildcard-imports -import org.junit.Test -import org.junit.runner.RunWith -import org.mozilla.geckoview.GeckoRuntimeSettings - -@RunWith(AndroidJUnit4::class) -@MediumTest -class TrustedRecursiveResolverTest : BaseSessionTest() { - - @Test fun trustedRecursiveResolverMode() { - val settings = sessionRule.runtime.settings - val trustedRecursiveResolverModePerf = "network.trr.mode" - - var prefValue = (sessionRule.getPrefs(trustedRecursiveResolverModePerf)[0] as Int) - assertThat( - "Initial TRR mode should be TRR_MODE_OFF (0)", - prefValue, - `is`(0), - ) - - settings.setTrustedRecursiveResolverMode(GeckoRuntimeSettings.TRR_MODE_FIRST) - prefValue = (sessionRule.getPrefs(trustedRecursiveResolverModePerf)[0] as Int) - - assertThat( - "Setting TRR mode to TRR_MODE_FIRST (2)", - prefValue, - `is`(2), - ) - - settings.setTrustedRecursiveResolverMode(GeckoRuntimeSettings.TRR_MODE_ONLY) - prefValue = (sessionRule.getPrefs(trustedRecursiveResolverModePerf)[0] as Int) - - assertThat( - "Setting TRR mode to TRR_MODE_ONLY (3)", - prefValue, - `is`(3), - ) - - settings.setTrustedRecursiveResolverMode(GeckoRuntimeSettings.TRR_MODE_DISABLED) - prefValue = (sessionRule.getPrefs(trustedRecursiveResolverModePerf)[0] as Int) - - assertThat( - "Setting TRR mode to TRR_MODE_DISABLED (5)", - prefValue, - `is`(5), - ) - - settings.setTrustedRecursiveResolverMode(GeckoRuntimeSettings.TRR_MODE_OFF) - prefValue = (sessionRule.getPrefs(trustedRecursiveResolverModePerf)[0] as Int) - - assertThat( - "Setting TRR mode to TRR_MODE_OFF (0)", - prefValue, - `is`(0), - ) - } - - @Test fun trustedRecursiveResolverUrl() { - val settings = sessionRule.runtime.settings - val trustedRecursiveResolverUriPerf = "network.trr.uri" - - var prefValue = (sessionRule.getPrefs(trustedRecursiveResolverUriPerf)[0] as String) - assertThat( - "Initial TRR Uri should be empty", - prefValue, - `is`(""), - ) - - val exampleValue = "https://mozilla.cloudflare-dns.com/dns-query" - settings.setTrustedRecursiveResolverUri(exampleValue) - prefValue = (sessionRule.getPrefs(trustedRecursiveResolverUriPerf)[0] as String) - assertThat( - "Setting custom TRR Uri should work", - prefValue, - `is`(exampleValue), - ) - } -} 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 a1a98f8b6fe2..0e0ad20e7870 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 @@ -490,42 +490,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { getSettings().mExtensionsWebAPIEnabled.set(flag); return this; } - - /** - * Sets whether and how DNS-over-HTTPS (Trusted Recursive Resolver) is configured. - * - * @param mode One of the {@link GeckoRuntimeSettings#TRR_MODE_OFF TrustedRecursiveResolverMode} - * constants. - * @return This Builder instance. - */ - public @NonNull Builder trustedRecursiveResolverMode( - final @TrustedRecursiveResolverMode int mode) { - getSettings().setTrustedRecursiveResolverMode(mode); - return this; - } - - /** - * Set the DNS-over-HTTPS server URI. - * - * @param uri URI of the DNS-over-HTTPS server. - * @return This Builder instance. - */ - public @NonNull Builder trustedRecursiveResolverUri(final @NonNull String uri) { - getSettings().setTrustedRecursiveResolverUri(uri); - return this; - } - - /** - * Set the factor by which to increase the keepalive timeout when the NS_HTTP_LARGE_KEEPALIVE - * flag is used for a connection. - * - * @param factor FACTOR by which to increase the keepalive timeout. - * @return This Builder instance. - */ - public @NonNull Builder largeKeepaliveFactor(final int factor) { - getSettings().setLargeKeepaliveFactor(factor); - return this; - } } private GeckoRuntime mRuntime; @@ -573,11 +537,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { new Pref("dom.security.https_only_mode", false); /* package */ final Pref mHttpsOnlyPrivateMode = new Pref("dom.security.https_only_mode_pbm", false); - /* package */ final Pref mTrustedRecursiveResolverMode = - new Pref<>("network.trr.mode", 0); - /* package */ final Pref mTrustedRecursiveResolverUri = new Pref<>("network.trr.uri", ""); - /* package */ final Pref mLargeKeepalivefactor = - new Pref<>("network.http.largeKeepaliveFactor", 1); /* package */ final Pref mProcessCount = new Pref<>("dom.ipc.processCount", 2); /* package */ final Pref mExtensionsWebAPIEnabled = new Pref<>("extensions.webapi.enabled", false); @@ -1374,129 +1333,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { return this; } - /** The trusted recursive resolver (TRR) modes. */ - @Retention(RetentionPolicy.SOURCE) - @IntDef({TRR_MODE_OFF, TRR_MODE_FIRST, TRR_MODE_ONLY, TRR_MODE_DISABLED}) - public @interface TrustedRecursiveResolverMode {} - - /** Off (default). Use native DNS resolution by default. */ - public static final int TRR_MODE_OFF = 0; - - /** - * First. Use TRR first, and only if the name resolve fails use the native resolver as a fallback. - */ - public static final int TRR_MODE_FIRST = 2; - - /** Only. Only use TRR, never use the native resolver. */ - public static final int TRR_MODE_ONLY = 3; - - /** - * Off by choice. This is the same as 0 but marks it as done by choice and not done by default. - */ - public static final int TRR_MODE_DISABLED = 5; - - /** - * Get whether and how DNS-over-HTTPS (Trusted Recursive Resolver) is configured. - * - * @return One of the {@link GeckoRuntimeSettings#TRR_MODE_OFF TrustedRecursiveResolverMode} - * constants. - */ - public @TrustedRecursiveResolverMode int getTrustedRecusiveResolverMode() { - final int mode = mTrustedRecursiveResolverMode.get(); - switch (mode) { - case 2: - return TRR_MODE_FIRST; - case 3: - return TRR_MODE_ONLY; - case 5: - return TRR_MODE_DISABLED; - default: - case 0: - return TRR_MODE_OFF; - } - } - - /** - * Get the factor by which to increase the keepalive timeout when the NS_HTTP_LARGE_KEEPALIVE flag - * is used for a connection. - * - * @return An integer factor. - */ - public @NonNull int getLargeKeepaliveFactor() { - return mLargeKeepalivefactor.get(); - } - - /** - * Set whether and how DNS-over-HTTPS (Trusted Recursive Resolver) is configured. - * - * @param mode One of the {@link GeckoRuntimeSettings#TRR_MODE_OFF TrustedRecursiveResolverMode} - * constants. - * @return This GeckoRuntimeSettings instance. - */ - public @NonNull GeckoRuntimeSettings setTrustedRecursiveResolverMode( - final @TrustedRecursiveResolverMode int mode) { - switch (mode) { - case TRR_MODE_OFF: - case TRR_MODE_FIRST: - case TRR_MODE_ONLY: - case TRR_MODE_DISABLED: - mTrustedRecursiveResolverMode.commit(mode); - break; - default: - throw new IllegalArgumentException("Invalid setting for setTrustedRecursiveResolverMode"); - } - return this; - } - - private static final int DEFAULT_LARGE_KEEPALIVE_FACTOR = 1; - - private int sanitizeLargeKeepaliveFactor(final int factor) { - if (factor < 1 || factor > 10) { - if (BuildConfig.DEBUG_BUILD) { - throw new IllegalArgumentException( - "largeKeepaliveFactor must be between 1 to 10 inclusive"); - } else { - Log.e(LOGTAG, "largeKeepaliveFactor must be between 1 to 10 inclusive"); - return DEFAULT_LARGE_KEEPALIVE_FACTOR; - } - } - - return factor; - } - - /** - * Set the factor by which to increase the keepalive timeout when the NS_HTTP_LARGE_KEEPALIVE flag - * is used for a connection. - * - * @param factor FACTOR by which to increase the keepalive timeout. - * @return This GeckoRuntimeSettings instance. - */ - public @NonNull GeckoRuntimeSettings setLargeKeepaliveFactor(final int factor) { - final int newFactor = sanitizeLargeKeepaliveFactor(factor); - mLargeKeepalivefactor.commit(newFactor); - return this; - } - - /** - * Get the DNS-over-HTTPS (DoH) server URI. - * - * @return URI of the DoH server. - */ - public @NonNull String getTrustedRecursiveResolverUri() { - return mTrustedRecursiveResolverUri.get(); - } - - /** - * Set the DNS-over-HTTPS server URI. - * - * @param uri URI of the DNS-over-HTTPS server. - * @return This GeckoRuntimeSettings instance. - */ - public @NonNull GeckoRuntimeSettings setTrustedRecursiveResolverUri(final @NonNull String uri) { - mTrustedRecursiveResolverUri.commit(uri); - return this; - } - // For internal use only /* protected */ @NonNull GeckoRuntimeSettings setProcessCount(final int processCount) { diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md index d2cca4f92fbe..c662292809f5 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md @@ -15,13 +15,6 @@ exclude: true ## v119 - Added `remoteType` to GeckoView child crash intent. ([bug 1851518]({{bugzilla}}1851518)) -- Added [`GeckoRuntimeSettings#setTrustedRecursiveResolverMode`][119.1] to enable DNS-over-HTTPS using different resolver modes ([bug 1591533]({{bugzilla}}1591533)). -- Added [`GeckoRuntimeSettings#setTrustedRecursiveResolverUri`][119.2] to specify the DNS-over-HTTPS server to be used if DoH is enabled ([bug 1591533]({{bugzilla}}1591533)). -- Added [`GeckoRuntimeSettings#setLargeKeepaliveFactor`][119.3] to increase the keepalive timeout used for a connection ([bug 1591533]({{bugzilla}}1591533)). - -[119.1]: {{javadoc_uri}}/GeckoRuntimeSettings.html#setTrustedRecursiveResolverMode-int- -[119.2]: {{javadoc_uri}}/GeckoRuntimeSettings.html#setTrustedRecursiveResolverUri-java.lang.String- -[119.3]: {{javadoc_uri}}/GeckoRuntimeSettings.html#setLargeKeepaliveFactor-int- ## v118 - Added [`ExperimentDelegate`][118.1] to allow GeckoView to send and retrieve experiment information from an embedder. @@ -1435,4 +1428,4 @@ to allow adding gecko profiler markers. [65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport(android.content.Context,android.os.Bundle,java.lang.String) [65.25]: {{javadoc_uri}}/GeckoResult.html -[api-version]: 87397d7c25be7722bce85c49c52c3e5ce4e8c420 +[api-version]: ee73ede94d2e7c382fe9e9793c1fecbb01beb18d