Bug 1515978 - Make GeckoRuntime#getSettings @NonNull. r=geckoview-reviewers,droeh
authorAgi Sferro <agi@mozilla.com>
Wed, 02 Jan 2019 20:06:32 +0000
changeset 452348 20eca8ed41e6183536c27f3bdbde4979a4794b91
parent 452287 7e75579b27d017c48a83e04db1588f7232cc750a
child 452349 bc5282261728d4a3c7b171f3c55579687654dc6b
push id35304
push userdvarga@mozilla.com
push dateThu, 03 Jan 2019 16:24:35 +0000
treeherdermozilla-central@5b837856dca7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, droeh
bugs1515978
milestone66.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
Bug 1515978 - Make GeckoRuntime#getSettings @NonNull. r=geckoview-reviewers,droeh Differential Revision: https://phabricator.services.mozilla.com/D15217
mobile/android/geckoview/api.txt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/LocaleTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
--- a/mobile/android/geckoview/api.txt
+++ b/mobile/android/geckoview/api.txt
@@ -130,17 +130,17 @@ package org.mozilla.geckoview {
   public final class GeckoRuntime implements android.os.Parcelable {
     ctor public GeckoRuntime();
     method @android.support.annotation.UiThread public void attachTo(@android.support.annotation.NonNull android.content.Context);
     method @android.support.annotation.UiThread @android.support.annotation.NonNull public static org.mozilla.geckoview.GeckoRuntime create(@android.support.annotation.NonNull android.content.Context);
     method @android.support.annotation.UiThread @android.support.annotation.NonNull public static org.mozilla.geckoview.GeckoRuntime create(@android.support.annotation.NonNull android.content.Context, @android.support.annotation.NonNull org.mozilla.geckoview.GeckoRuntimeSettings);
     method @android.support.annotation.UiThread @android.support.annotation.NonNull public static synchronized org.mozilla.geckoview.GeckoRuntime getDefault(@android.support.annotation.NonNull android.content.Context);
     method @android.support.annotation.UiThread @android.support.annotation.Nullable public org.mozilla.geckoview.GeckoRuntime.Delegate getDelegate();
     method @android.support.annotation.UiThread @android.support.annotation.Nullable public java.io.File getProfileDir();
-    method @android.support.annotation.AnyThread @android.support.annotation.Nullable public org.mozilla.geckoview.GeckoRuntimeSettings getSettings();
+    method @android.support.annotation.AnyThread @android.support.annotation.NonNull public org.mozilla.geckoview.GeckoRuntimeSettings getSettings();
     method @android.support.annotation.UiThread @android.support.annotation.NonNull public org.mozilla.geckoview.RuntimeTelemetry getTelemetry();
     method @android.support.annotation.UiThread public void orientationChanged();
     method @android.support.annotation.UiThread public void orientationChanged(int);
     method @android.support.annotation.AnyThread public void readFromParcel(@android.support.annotation.NonNull android.os.Parcel);
     method @android.support.annotation.UiThread public void setDelegate(@android.support.annotation.Nullable org.mozilla.geckoview.GeckoRuntime.Delegate);
     method @android.support.annotation.AnyThread public void shutdown();
     field public static final java.lang.String ACTION_CRASHED = "org.mozilla.gecko.ACTION_CRASHED";
     field public static final android.os.Parcelable.Creator<org.mozilla.geckoview.GeckoRuntime> CREATOR;
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/LocaleTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/LocaleTest.kt
@@ -15,17 +15,17 @@ import org.junit.Test
 import org.junit.runner.RunWith
 
 @MediumTest
 @RunWith(AndroidJUnit4::class)
 @WithDevToolsAPI
 class LocaleTest : BaseSessionTest() {
 
     @Test fun setLocale() {
-        sessionRule.runtime.getSettings()!!.setLocales(arrayOf("en-GB"));
+        sessionRule.runtime.settings.setLocales(arrayOf("en-GB"));
 
         val index = sessionRule.waitForChromeJS(String.format(
                 "(function() {" +
                 "  return ChromeUtils.import('resource://gre/modules/Services.jsm', {})" +
                 "    .Services.locale.requestedLocales.indexOf('en-GB');" +
                 "})()")) as Double;
 
         assertThat("Requested locale is found", index, greaterThanOrEqualTo(0.0));
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
@@ -169,17 +169,17 @@ class NavigationDelegateTest : BaseSessi
         testLoadExpectError(uri,
                 WebRequestError.ERROR_CATEGORY_SECURITY,
                 WebRequestError.ERROR_SECURITY_BAD_CERT);
     }
 
     @Setting(key = Setting.Key.USE_TRACKING_PROTECTION, value = "true")
     @Test fun trackingProtection() {
         val category = TrackingProtectionDelegate.CATEGORY_TEST;
-        sessionRule.runtime.settings!!.trackingProtectionCategories = category
+        sessionRule.runtime.settings.trackingProtectionCategories = category
         sessionRule.session.loadTestPath(TRACKERS_PATH)
 
         sessionRule.waitUntilCalled(
                 object : Callbacks.TrackingProtectionDelegate {
             @AssertCalled(count = 3)
             override fun onTrackerBlocked(session: GeckoSession, uri: String?,
                                           categories: Int) {
                 assertThat("Category should be set",
@@ -239,17 +239,17 @@ class NavigationDelegateTest : BaseSessi
                 return null
             }
         })
     }
 
     @Test fun bypassClassifier() {
         val phishingUri = "https://www.itisatrap.org/firefox/its-a-trap.html"
 
-        sessionRule.runtime.settings!!.blockPhishing = true
+        sessionRule.runtime.settings.blockPhishing = true
 
         sessionRule.session.loadUri(phishingUri + "?bypass=true",
                                     GeckoSession.LOAD_FLAGS_BYPASS_CLASSIFIER)
         sessionRule.session.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(
                 object : Callbacks.NavigationDelegate {
             @AssertCalled(false)
@@ -258,24 +258,24 @@ class NavigationDelegateTest : BaseSessi
                 return null
             }
         })
     }
 
     @Test fun safebrowsingPhishing() {
         val phishingUri = "https://www.itisatrap.org/firefox/its-a-trap.html"
 
-        sessionRule.runtime.settings!!.blockPhishing = true
+        sessionRule.runtime.settings.blockPhishing = true
 
         // Add query string to avoid bypassing classifier check because of cache.
         testLoadExpectError(phishingUri + "?block=true",
                         WebRequestError.ERROR_CATEGORY_SAFEBROWSING,
                         WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI)
 
-        sessionRule.runtime.settings!!.blockPhishing = false
+        sessionRule.runtime.settings.blockPhishing = false
 
         sessionRule.session.loadUri(phishingUri + "?block=false")
         sessionRule.session.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(
                 object : Callbacks.NavigationDelegate {
             @AssertCalled(false)
             override fun onLoadError(session: GeckoSession, uri: String?,
@@ -283,23 +283,23 @@ class NavigationDelegateTest : BaseSessi
                 return null
             }
         })
     }
 
     @Test fun safebrowsingMalware() {
         val malwareUri = "https://www.itisatrap.org/firefox/its-an-attack.html"
 
-        sessionRule.runtime.settings!!.blockMalware = true
+        sessionRule.runtime.settings.blockMalware = true
 
         testLoadExpectError(malwareUri + "?block=true",
                         WebRequestError.ERROR_CATEGORY_SAFEBROWSING,
                         WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI)
 
-        sessionRule.runtime.settings!!.blockMalware = false
+        sessionRule.runtime.settings.blockMalware = false
 
         sessionRule.session.loadUri(malwareUri + "?block=false")
         sessionRule.session.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(
                 object : Callbacks.NavigationDelegate {
             @AssertCalled(false)
             override fun onLoadError(session: GeckoSession, uri: String?,
@@ -307,23 +307,23 @@ class NavigationDelegateTest : BaseSessi
                 return null
             }
         })
     }
 
     @Test fun safebrowsingUnwanted() {
         val unwantedUri = "https://www.itisatrap.org/firefox/unwanted.html"
 
-        sessionRule.runtime.settings!!.blockMalware = true
+        sessionRule.runtime.settings.blockMalware = true
 
         testLoadExpectError(unwantedUri + "?block=true",
                         WebRequestError.ERROR_CATEGORY_SAFEBROWSING,
                         WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI)
 
-        sessionRule.runtime.settings!!.blockMalware = false
+        sessionRule.runtime.settings.blockMalware = false
 
         sessionRule.session.loadUri(unwantedUri + "?block=false")
         sessionRule.session.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(
                 object : Callbacks.NavigationDelegate {
             @AssertCalled(false)
             override fun onLoadError(session: GeckoSession, uri: String?,
@@ -331,23 +331,23 @@ class NavigationDelegateTest : BaseSessi
                 return null
             }
         })
     }
 
     @Test fun safebrowsingHarmful() {
         val harmfulUri = "https://www.itisatrap.org/firefox/harmful.html"
 
-        sessionRule.runtime.settings!!.blockMalware = true
+        sessionRule.runtime.settings.blockMalware = true
 
         testLoadExpectError(harmfulUri + "?block=true",
                         WebRequestError.ERROR_CATEGORY_SAFEBROWSING,
                         WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI)
 
-        sessionRule.runtime.settings!!.blockMalware = false
+        sessionRule.runtime.settings.blockMalware = false
 
         sessionRule.session.loadUri(harmfulUri + "?block=false")
         sessionRule.session.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(
                 object : Callbacks.NavigationDelegate {
             @AssertCalled(false)
             override fun onLoadError(session: GeckoSession, uri: String?,
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
@@ -328,17 +328,17 @@ public final class GeckoRuntime implemen
      * @return an instance of {@link GeckoRuntime.Delegate} or null if no delegate has been set.
      */
     @UiThread
     public @Nullable Delegate getDelegate() {
         return mDelegate;
     }
 
     @AnyThread
-    public @Nullable GeckoRuntimeSettings getSettings() {
+    public @NonNull GeckoRuntimeSettings getSettings() {
         return mSettings;
     }
 
     /* package */ void setPref(final String name, final Object value,
                                boolean override) {
         if (override || !GeckoAppShell.isFennec()) {
             // Override pref on Fennec only when requested to prevent
             // overriding of persistent prefs.
--- 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
@@ -93,9 +93,9 @@ layout: geckoview
 [65.23]: ../GeckoSession.FinderResult.html
 
 - Update [`CrashReporter#sendCrashReport`][65.24] to return the crash ID as a
   [`GeckoResult<String>`][65.25].
 
 [65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
 [65.25]: ../GeckoResult.html
 
-[api-version]: cdbaa3fa639126d2d45a0cd8e9508f95a9e98e33
+[api-version]: 8827d6c8c7c2aa54cfad31c21aca5dc7d6d42311