author | James Willcox <snorp@snorp.net> |
Wed, 18 Sep 2019 15:25:37 +0000 | |
changeset 493827 | 6736ed7f58054ef2add4c0339603903e5bce07e1 |
parent 493826 | 82c4e08d98907a2dfee21b41b80d53ab81095bd1 |
child 493828 | 73e41954d0f756ed01d7130790ebe5cdcdd6c388 |
push id | 36589 |
push user | nerli@mozilla.com |
push date | Wed, 18 Sep 2019 21:49:27 +0000 |
treeherder | mozilla-central@21aff209f5a9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | geckoview-reviewers, agi, esawin |
bugs | 1540065 |
milestone | 71.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -394,16 +394,17 @@ package org.mozilla.geckoview { method @UiThread public void onShutdown(); } @UiThread public static interface GeckoRuntime.ServiceWorkerDelegate { method @UiThread @NonNull public GeckoResult<GeckoSession> onOpenWindow(@NonNull String); } @AnyThread public final class GeckoRuntimeSettings extends RuntimeSettings { + method public boolean getAboutConfigEnabled(); method @NonNull public String[] getArguments(); method public boolean getAutomaticFontSizeAdjustment(); method public int getAutoplayDefault(); method @Nullable public String getConfigFilePath(); method public boolean getConsoleOutputEnabled(); method @NonNull public ContentBlocking.Settings getContentBlocking(); method @Nullable public Class<?> getCrashHandler(); method @Nullable public Float getDisplayDensityOverride(); @@ -420,16 +421,17 @@ package org.mozilla.geckoview { method public int getPreferredColorScheme(); method public boolean getRemoteDebuggingEnabled(); method @Nullable public GeckoRuntime getRuntime(); method @Nullable public Rect getScreenSizeOverride(); method @Nullable public RuntimeTelemetry.Delegate getTelemetryDelegate(); method public boolean getUseContentProcessHint(); method public boolean getUseMaxScreenDepth(); method public boolean getWebFontsEnabled(); + method @NonNull public GeckoRuntimeSettings setAboutConfigEnabled(boolean); method @NonNull public GeckoRuntimeSettings setAutomaticFontSizeAdjustment(boolean); method @NonNull public GeckoRuntimeSettings setAutoplayDefault(int); method @NonNull public GeckoRuntimeSettings setConsoleOutputEnabled(boolean); method @NonNull public GeckoRuntimeSettings setDoubleTapZoomingEnabled(boolean); method @NonNull public GeckoRuntimeSettings setFontInflationEnabled(boolean); method @NonNull public GeckoRuntimeSettings setFontSizeFactor(float); method @NonNull public GeckoRuntimeSettings setGlMsaaLevel(int); method @NonNull public GeckoRuntimeSettings setInputAutoZoomEnabled(boolean); @@ -443,16 +445,17 @@ package org.mozilla.geckoview { field public static final int COLOR_SCHEME_DARK = 1; field public static final int COLOR_SCHEME_LIGHT = 0; field public static final int COLOR_SCHEME_SYSTEM = -1; field public static final Parcelable.Creator<GeckoRuntimeSettings> CREATOR; } @AnyThread public static final class GeckoRuntimeSettings.Builder extends RuntimeSettings.Builder { ctor public Builder(); + method @NonNull public GeckoRuntimeSettings.Builder aboutConfigEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder arguments(@NonNull String[]); method @NonNull public GeckoRuntimeSettings.Builder automaticFontSizeAdjustment(boolean); method @NonNull public GeckoRuntimeSettings.Builder autoplayDefault(int); method @NonNull public GeckoRuntimeSettings.Builder configFilePath(@Nullable String); method @NonNull public GeckoRuntimeSettings.Builder consoleOutput(boolean); method @NonNull public GeckoRuntimeSettings.Builder contentBlocking(@NonNull ContentBlocking.Settings); method @NonNull public GeckoRuntimeSettings.Builder crashHandler(@Nullable Class<?>); method @NonNull public GeckoRuntimeSettings.Builder debugLogging(boolean);
--- 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 @@ -8,16 +8,19 @@ import android.provider.Settings import android.support.test.InstrumentationRegistry import android.support.test.filters.MediumTest import android.support.test.runner.AndroidJUnit4 import org.hamcrest.Matchers.* import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import kotlin.math.roundToInt +import org.mozilla.geckoview.GeckoSession +import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled +import org.mozilla.geckoview.test.util.Callbacks @RunWith(AndroidJUnit4::class) @MediumTest class RuntimeSettingsTest : BaseSessionTest() { @Ignore("disable test for frequently failing Bug 1538430") @Test fun automaticFontSize() { val settings = sessionRule.runtime.settings @@ -134,9 +137,39 @@ class RuntimeSettingsTest : BaseSessionT settings.fontSizeFactor = 1.0f prefValue = (sessionRule.getPrefs(fontInflationPref)[0] as Int) assertThat("Gecko font inflation pref remains turned off", prefValue, `is`(0)) assertThat("GeckoRuntimeSettings remains turned off", settings.fontInflationEnabled, `is`(false)) } + + @Test + @Ignore // Bug 1582150 + fun aboutConfig() { + val settings = sessionRule.runtime.settings; + + assertThat("about:config should be disabled by default", + settings.aboutConfigEnabled, equalTo(false)) + mainSession.delegateDuringNextWait(object : Callbacks.ProgressDelegate { + @AssertCalled + override fun onPageStop(session: GeckoSession, success: Boolean) { + assertThat("about:config load should fail", success, equalTo(false)) + } + }) + + mainSession.loadUri("about:config") + mainSession.waitForPageStop() + + settings.aboutConfigEnabled = true + + mainSession.delegateDuringNextWait(object : Callbacks.ProgressDelegate { + @AssertCalled + override fun onPageStop(session: GeckoSession, success: Boolean) { + assertThat("about:config load should succeed", success, equalTo(true)) + } + }) + + mainSession.loadUri("about:config") + mainSession.waitForPageStop() + } }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java @@ -400,16 +400,30 @@ public final class GeckoRuntimeSettings * @return This Builder instance. */ public @NonNull Builder debugLogging(final boolean enable) { getSettings().mDevToolsConsoleToLogcat.set(enable); getSettings().mConsoleServiceToLogcat.set(enable); getSettings().mGeckoViewLogLevel.set(enable ? "Debug" : "Fatal"); return this; } + + /** + * Sets whether or not about:config should be enabled. This is a page that allows + * users to directly modify Gecko preferences. Modification of some preferences may + * cause the app to break in unpredictable ways -- crashes, performance issues, security + * vulnerabilities, etc. + * + * @param flag True if about:config should be enabled, false otherwise. + * @return This Builder instance. + */ + public @NonNull Builder aboutConfigEnabled(final boolean flag) { + getSettings().mAboutConfig.set(flag); + return this; + } } private GeckoRuntime mRuntime; /* package */ boolean mUseContentProcess; /* package */ String[] mArgs; /* package */ Bundle mExtras; /* package */ String mConfigFilePath; @@ -444,16 +458,18 @@ public final class GeckoRuntimeSettings /* package */ final Pref<Boolean> mTelemetryEnabled = new Pref<>( "toolkit.telemetry.geckoview.streaming", false); /* package */ final Pref<String> mGeckoViewLogLevel = new Pref<>( "geckoview.logging", "Debug"); /* package */ final Pref<Boolean> mConsoleServiceToLogcat = new Pref<>( "consoleservice.logcat", true); /* package */ final Pref<Boolean> mDevToolsConsoleToLogcat = new Pref<>( "devtools.console.stdout.chrome", true); + /* package */ final Pref<Boolean> mAboutConfig = new Pref<>( + "general.aboutConfig.enable", false); /* package */ boolean mDebugPause; /* package */ boolean mUseMaxScreenDepth; /* package */ float mDisplayDensityOverride = -1.0f; /* package */ int mDisplayDpiOverride; /* package */ int mScreenWidthOverride; /* package */ int mScreenHeightOverride; /* package */ Class<? extends Service> mCrashHandler; @@ -1018,16 +1034,39 @@ public final class GeckoRuntimeSettings mGlMsaaLevel.commit(level); return this; } public @Nullable RuntimeTelemetry.Delegate getTelemetryDelegate() { return mTelemetryProxy.getDelegate(); } + /** + * Gets whether about:config is enabled or not. + * + * @return True if about:config is enabled, false otherwise. + */ + public boolean getAboutConfigEnabled() { + return mAboutConfig.get(); + } + + /** + * Sets whether or not about:config should be enabled. This is a page that allows + * users to directly modify Gecko preferences. Modification of some preferences may + * cause the app to break in unpredictable ways -- crashes, performance issues, security + * vulnerabilities, etc. + * + * @param flag True if about:config should be enabled, false otherwise. + * @return This GeckoRuntimeSettings instance. + */ + public @NonNull GeckoRuntimeSettings setAboutConfigEnabled(final boolean flag) { + mAboutConfig.commit(flag); + return this; + } + @Override // Parcelable public void writeToParcel(final Parcel out, final int flags) { super.writeToParcel(out, flags); ParcelableUtils.writeBoolean(out, mUseContentProcess); out.writeStringArray(mArgs); mExtras.writeToParcel(out, flags); ParcelableUtils.writeBoolean(out, mDebugPause);
--- 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 @@ -24,27 +24,30 @@ exclude: true additional HTTP request headers. - Added support for exposing the content blocking log in [`ContentBlockingController`][71.7].({{bugzilla}}1580201) - ⚠️ Added `nativeApp` to [`WebExtension.MessageDelegate.onMessage`][71.8] which exposes the native application identifier that was used to send the message. ({{bugzilla}}1546445) - Added [`GeckoRuntime.ServiceWorkerDelegate`][71.9] set via ['setServiceWorkerDelegate'][71.10] to support ServiceWorkerClients.openWindow() ([bug 1511033]({{bugzilla}}1511033)) +- Added ['GeckoRuntimeSettings.Builder#aboutConfigEnabled'][71.11] to control whether or + not `about:config` should be available. [71.1]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onBooleanScalar-org.mozilla.geckoview.RuntimeTelemetry.Metric- [71.2]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onLongScalar-org.mozilla.geckoview.RuntimeTelemetry.Metric- [71.3]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onStringScalar-org.mozilla.geckoview.RuntimeTelemetry.Metric- [71.4]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onHistogram-org.mozilla.geckoview.RuntimeTelemetry.Metric- [71.5]: {{javadoc_uri}}/RuntimeTelemetry.Metric.html [71.6]: {{javadoc_uri}}/GeckoSession.html#loadUri-java.lang.String-java.io.File-java.util.Map- [71.7]: {{javadoc_uri}}/ContentBlockingController.html [71.8]: {{javadoc_uri}}/WebExtension.MessageDelegate.html#onMessage-java.lang.String-java.lang.Object-org.mozilla.geckoview.WebExtension.MessageSender- [71.9]: {{javadoc_uri}}/GeckoRuntime.ServiceWorkerDelegate.html [71.10]: {{javadoc_uri}}/GeckoRuntime#setServiceWorkerDelegate-org.mozilla.geckoview.GeckoRuntime.ServiceWorkerDelegate- +[71.11]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#aboutConfigEnabled-boolean- ## v70 - Added API for session context assignment [`GeckoSessionSettings.Builder.contextId`][70.1] and deletion of data related to a session context [`StorageController.clearDataForSessionContext`][70.2]. ([bug 1501108]({{bugzilla}}1501108)) - Removed `setSession(session, runtime)` from [`GeckoView`][70.5]. With this change, `GeckoView` will no longer manage opening/closing of the @@ -357,9 +360,9 @@ exclude: true [65.19]: {{javadoc_uri}}/GeckoSession.NavigationDelegate.LoadRequest.html#isRedirect [65.20]: {{javadoc_uri}}/GeckoSession.html#LOAD_FLAGS_BYPASS_CLASSIFIER [65.21]: {{javadoc_uri}}/GeckoSession.ContentDelegate.ContextElement.html [65.22]: {{javadoc_uri}}/GeckoSession.ContentDelegate.html#onContextMenu-org.mozilla.geckoview.GeckoSession-int-int-org.mozilla.geckoview.GeckoSession.ContentDelegate.ContextElement- [65.23]: {{javadoc_uri}}/GeckoSession.FinderResult.html [65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String- [65.25]: {{javadoc_uri}}/GeckoResult.html -[api-version]: ec6b45461c040d8dc76aa0fed4917b3c4c07d67e +[api-version]: 16e050b1d50a9909b936c740a94220eaff4115a3
--- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java +++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java @@ -176,17 +176,18 @@ public class GeckoViewActivity extends A .consoleOutput(true) .contentBlocking(new ContentBlocking.Settings.Builder() .antiTracking(ContentBlocking.AntiTracking.DEFAULT | ContentBlocking.AntiTracking.STP) .safeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT) .cookieBehavior(ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS) .build()) .crashHandler(ExampleCrashHandler.class) - .telemetryDelegate(new ExampleTelemetryDelegate()); + .telemetryDelegate(new ExampleTelemetryDelegate()) + .aboutConfigEnabled(true); sGeckoRuntime = GeckoRuntime.create(this, runtimeSettingsBuilder.build()); sGeckoRuntime.getWebExtensionController().setTabDelegate(new WebExtensionController.TabDelegate() { @Override public GeckoResult<GeckoSession> onNewTab(WebExtension source, String uri) { final TabSession newSession = createSession(); mToolbarView.updateTabCount();