Bug 1571088 - Add LOAD_FLAGS_REPLACE_HISTORY to GeckoSession LoadFlags r=geckoview-reviewers,snorp,droeh
authorRandall E. Barker <rbarker@mozilla.com>
Wed, 07 Aug 2019 22:58:48 +0000
changeset 486858 0c2607dd7f5b9e87ad998225ac353c4fce6b6c02
parent 486857 3f835dfd987d1bcc4d132d946bcc710ecd1b6dc6
child 486859 ddac07ba936bdbe2a91cdbd45aa90c5515cae1b1
push id92000
push userrbarker@mozilla.com
push dateThu, 08 Aug 2019 00:42:50 +0000
treeherderautoland@0c2607dd7f5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, snorp, droeh
bugs1571088
milestone70.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 1571088 - Add LOAD_FLAGS_REPLACE_HISTORY to GeckoSession LoadFlags r=geckoview-reviewers,snorp,droeh Bug 1571088 - Add LOAD_FLAGS_REPLACE_HISTORY to GeckoSession LoadFlags Differential Revision: https://phabricator.services.mozilla.com/D40908
mobile/android/geckoview/api.txt
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
mobile/android/modules/geckoview/GeckoViewNavigation.jsm
--- a/mobile/android/geckoview/api.txt
+++ b/mobile/android/geckoview/api.txt
@@ -460,16 +460,17 @@ package org.mozilla.geckoview {
     field public static final int FINDER_FIND_WHOLE_WORD = 4;
     field public static final int LOAD_FLAGS_ALLOW_POPUPS = 8;
     field public static final int LOAD_FLAGS_BYPASS_CACHE = 1;
     field public static final int LOAD_FLAGS_BYPASS_CLASSIFIER = 16;
     field public static final int LOAD_FLAGS_BYPASS_PROXY = 2;
     field public static final int LOAD_FLAGS_EXTERNAL = 4;
     field public static final int LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 32;
     field public static final int LOAD_FLAGS_NONE = 0;
+    field public static final int LOAD_FLAGS_REPLACE_HISTORY = 64;
     field @Nullable protected GeckoSession.Window mWindow;
   }
 
   public static interface GeckoSession.ContentDelegate {
     method @UiThread default public void onCloseRequest(@NonNull GeckoSession);
     method @UiThread default public void onContextMenu(@NonNull GeckoSession, int, int, @NonNull GeckoSession.ContentDelegate.ContextElement);
     method @UiThread default public void onCrash(@NonNull GeckoSession);
     method @UiThread default public void onExternalResponse(@NonNull GeckoSession, @NonNull GeckoSession.WebResponseInfo);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -1481,17 +1481,17 @@ public class GeckoSession implements Par
             }
         }
         return mAccessibility;
     }
 
     @Retention(RetentionPolicy.SOURCE)
     @IntDef(flag = true,
             value = { LOAD_FLAGS_NONE, LOAD_FLAGS_BYPASS_CACHE, LOAD_FLAGS_BYPASS_PROXY,
-                      LOAD_FLAGS_EXTERNAL, LOAD_FLAGS_ALLOW_POPUPS, LOAD_FLAGS_FORCE_ALLOW_DATA_URI })
+                      LOAD_FLAGS_EXTERNAL, LOAD_FLAGS_ALLOW_POPUPS, LOAD_FLAGS_FORCE_ALLOW_DATA_URI, LOAD_FLAGS_REPLACE_HISTORY })
     /* package */ @interface LoadFlags {}
 
     // These flags follow similarly named ones in Gecko's nsIWebNavigation.idl
     // https://searchfox.org/mozilla-central/source/docshell/base/nsIWebNavigation.idl
     //
     // We do not use the same values directly in order to insulate ourselves from
     // changes in Gecko. Instead, the flags are converted in GeckoViewNavigation.jsm.
 
@@ -1527,16 +1527,21 @@ public class GeckoSession implements Par
 
     /**
      * Allows a top-level data: navigation to occur. E.g. view-image
      * is an explicit user action which should be allowed.
      */
     public static final int LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 1 << 5;
 
     /**
+     * This flag specifies that any existing history entry should be replaced.
+     */
+    public static final int LOAD_FLAGS_REPLACE_HISTORY = 1 << 6;
+
+    /**
      * Load the given URI.
      * @param uri The URI of the resource to load.
      */
     @AnyThread
     public void loadUri(final @NonNull String uri) {
         loadUri(uri, (GeckoSession)null, LOAD_FLAGS_NONE);
     }
 
--- 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
@@ -7,16 +7,18 @@ exclude: true
 ---
 
 {% capture javadoc_uri %}{{ site.url }}{{ site.baseurl}}/javadoc/mozilla-central/org/mozilla/geckoview{% endcapture %}
 
 # GeckoView API Changelog.
 
 ## v70
 
+- Add GeckoSession.LOAD_FLAGS_REPLACE_HISTORY
+
 - Removed the obsolete `success` parameter from
   [`CrashReporter#sendCrashReport(Context, File, File, String)`][70.3] and
   [`CrashReporter#sendCrashReport(Context, File, Map, String)`][70.4].
 - Added API for session context assignment
   [`GeckoSessionSettings.Builder.contextId`][70.1] and deletion of data
   related to a session context
   [`StorageController.clearDataForSessionContext`][70.2].
 - Removed `setSession(session, runtime)` from [`GeckoView`][70.5]. With this change, `GeckoView` will no longer
@@ -284,9 +286,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]: b101f0344e941cb50eaaf75326e126ce3efc52b4
+[api-version]: d2e22c0efa7c1dbec1f68965e035a9ccc47eca39
--- a/mobile/android/modules/geckoview/GeckoViewNavigation.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewNavigation.jsm
@@ -129,16 +129,20 @@ class GeckoViewNavigation extends GeckoV
         if (flags & (1 << 4)) {
           navFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER;
         }
 
         if (flags & (1 << 5)) {
           navFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
         }
 
+        if (flags & (1 << 6)) {
+          navFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
+        }
+
         if (this.settings.useMultiprocess) {
           this.moduleManager.updateRemoteTypeForURI(uri);
         }
 
         let triggeringPrincipal, referrerInfo, csp;
         if (referrerSessionId) {
           const referrerWindow = Services.ww.getWindowByName(
             referrerSessionId,