Backed out 9 changesets (bug 1522637) for causing bug 1528188. a=backout
authorRazvan Maries <rmaries@mozilla.com>
Fri, 15 Feb 2019 18:21:36 +0200
changeset 459548 99f1a95f032e1d90d5ab85c1d9a091df06fcf8d2
parent 459476 fc01e86f7e8032341f66c023abce37589dd801a0
child 459549 57ab0251343c3162086a39f7b9d7ae679c063e05
push id111964
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:54:44 +0000
treeherdermozilla-inbound@db3c4f905082 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1522637, 1528188
milestone67.0a1
backs oute4ca191d62a5560839ca721e66c7620b674a366b
540e5f3187687f52ad001e9617085bd4a89abf43
0886a317a108846dd95ce823ce61562b72ac63fd
4c7c512a262d64daf7cbad08151ed2658f76ecdb
d7eb272688be8ce52e4f8dac46ee3155bffad0d8
67e838f49f4b1605ca384a95444bf58c0a763b43
7e38890c72faf2ace27670ffe9ba72d383a6c2e4
e6ca9ad18d1568b4362f2559aa3c7f07c5ecff39
0f759e91eca848094098d25c2654ba9661d1f75a
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
Backed out 9 changesets (bug 1522637) for causing bug 1528188. a=backout Backed out changeset e4ca191d62a5 (bug 1522637) Backed out changeset 540e5f318768 (bug 1522637) Backed out changeset 0886a317a108 (bug 1522637) Backed out changeset 4c7c512a262d (bug 1522637) Backed out changeset d7eb272688be (bug 1522637) Backed out changeset 67e838f49f4b (bug 1522637) Backed out changeset 7e38890c72fa (bug 1522637) Backed out changeset e6ca9ad18d15 (bug 1522637) Backed out changeset 0f759e91eca8 (bug 1522637)
browser/app/profile/firefox.js
browser/base/content/test/tabs/browser_new_web_tab_in_file_process_pref.js
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/SessionStore.jsm
browser/components/sessionstore/TabState.jsm
docshell/base/nsDocShell.cpp
docshell/base/nsIWebNavigation.idl
docshell/shistory/nsISHistory.idl
docshell/shistory/nsSHistory.cpp
dom/ipc/WindowGlobalChild.h
ipc/glue/BackgroundUtils.cpp
netwerk/base/LoadInfo.cpp
netwerk/base/LoadInfo.h
netwerk/base/nsILoadInfo.idl
netwerk/ipc/NeckoChannelParams.ipdlh
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsIHttpProtocolHandler.idl
netwerk/test/browser/browser_cross_process_redirect.js
testing/marionette/client/marionette_driver/expected.py
toolkit/components/browser/nsWebBrowser.cpp
toolkit/components/remotebrowserutils/tests/browser/browser.ini
toolkit/components/remotebrowserutils/tests/browser/browser_httpResponseProcessSelection.js
toolkit/components/remotebrowserutils/tests/browser/browser_httpToFileHistory.js
toolkit/components/remotebrowserutils/tests/browser/head.js
toolkit/modules/E10SUtils.jsm
toolkit/modules/sessionstore/SessionHistory.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -478,19 +478,16 @@ pref("browser.tabs.delayHidingAudioPlayi
 // New, experimental, tab open/close animations.
 pref("browser.tabs.newanimations", false);
 
 // Pref to control whether we use separate privileged content processes.
 #if defined(NIGHTLY_BUILD) && !defined(MOZ_ASAN)
 pref("browser.tabs.remote.separatePrivilegedContentProcess", true);
 #endif
 
-// Turn on HTTP response process selection.
-pref("browser.tabs.remote.useHTTPResponseProcessSelection", true);
-
 pref("browser.ctrlTab.recentlyUsedOrder", true);
 
 // By default, do not export HTML at shutdown.
 // If true, at shutdown the bookmarks in your menu and toolbar will
 // be exported as HTML to the bookmarks.html file.
 pref("browser.bookmarks.autoExportHTML",          false);
 
 // The maximum number of daily bookmark backups to
--- a/browser/base/content/test/tabs/browser_new_web_tab_in_file_process_pref.js
+++ b/browser/base/content/test/tabs/browser_new_web_tab_in_file_process_pref.js
@@ -19,17 +19,16 @@ function CheckBrowserNotInPid(browser, u
 
 // Test for bug 1343184.
 add_task(async function() {
   // Set prefs to ensure file content process, to allow linked web content in
   // file URI process and allow more that one file content process.
   await SpecialPowers.pushPrefEnv(
     {set: [["browser.tabs.remote.separateFileUriProcess", true],
            ["browser.tabs.remote.allowLinkedWebInFileUriProcess", true],
-           ["browser.tabs.remote.useHTTPResponseProcessSelection", false],
            ["dom.ipc.processCount.file", 2]]});
 
   // Open file:// page.
   let dir = getChromeDir(getResolvedURI(gTestPath));
   dir.append(TEST_FILE);
   const uriString = Services.io.newFileURI(dir).spec;
   await BrowserTestUtils.withNewTab(uriString, async function(fileBrowser) {
     // Get the file:// URI pid for comparison later.
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -181,18 +181,17 @@ ContentRestoreInternal.prototype = {
       webNavigation.setCurrentURI(Services.io.newURI("about:blank"));
     }
 
     try {
       if (loadArguments) {
         // If the load was started in another process, and the in-flight channel
         // was redirected into this process, resume that load within our process.
         if (loadArguments.redirectLoadSwitchId) {
-          webNavigation.resumeRedirectedLoad(loadArguments.redirectLoadSwitchId,
-                                             loadArguments.redirectHistoryIndex);
+          webNavigation.resumeRedirectedLoad(loadArguments.redirectLoadSwitchId);
           return true;
         }
 
         // A load has been redirected to a new process so get history into the
         // same state it was before the load started then trigger the load.
         // Referrer information is now stored as a referrerInfo property. We
         // should also cope with the old format of passing `referrer` and
         // `referrerPolicy` separately.
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -43,17 +43,19 @@ const SCREEN_EDGE_SLOP = 8;
 
 // global notifications observed
 const OBSERVING = [
   "browser-window-before-show", "domwindowclosed",
   "quit-application-granted", "browser-lastwindow-close-granted",
   "quit-application", "browser:purge-session-history",
   "browser:purge-session-history-for-domain",
   "idle-daily", "clear-origin-attributes-data",
-  "http-on-may-change-process",
+  "http-on-examine-response",
+  "http-on-examine-merged-response",
+  "http-on-examine-cached-response",
 ];
 
 // XUL Window properties to (re)store
 // Restored in restoreDimensions()
 const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
 
 // Hideable window features to (re)store
 // Restored in restoreWindowFeatures()
@@ -807,18 +809,20 @@ var SessionStoreInternal = {
         let userContextId = 0;
         try {
           userContextId = JSON.parse(aData).userContextId;
         } catch (e) {}
         if (userContextId) {
           this._forgetTabsWithUserContextId(userContextId);
         }
         break;
-      case "http-on-may-change-process":
-        this.onMayChangeProcess(aSubject);
+      case "http-on-examine-response":
+      case "http-on-examine-cached-response":
+      case "http-on-examine-merged-response":
+        this.onExamineResponse(aSubject);
         break;
     }
   },
 
   /**
    * This method handles incoming messages sent by the session store content
    * script via the Frame Message Manager or Parent Process Message Manager,
    * and thus enables communication with OOP tabs.
@@ -2277,18 +2281,16 @@ var SessionStoreInternal = {
   },
 
   /**
    * Perform a destructive process switch into a distinct process.
    * This method is asynchronous, as it requires multiple calls into content
    * processes.
    */
   async _doProcessSwitch(aBrowser, aRemoteType, aChannel, aSwitchId) {
-    debug(`[process-switch]: performing switch from ${aBrowser.remoteType} to ${aRemoteType}`);
-
     // Don't try to switch tabs before delayed startup is completed.
     await aBrowser.ownerGlobal.delayedStartupPromise;
 
     // Perform a navigateAndRestore to trigger the process switch.
     let tab = aBrowser.ownerGlobal.gBrowser.getTabForBrowser(aBrowser);
     let loadArguments = {
       newFrameloader: true,  // Switch even if remoteType hasn't changed.
       remoteType: aRemoteType,  // Don't derive remoteType to switch to.
@@ -2302,109 +2304,73 @@ var SessionStoreInternal = {
     // If the process switch seems to have failed, send an error over to our
     // caller, to give it a chance to kill our channel.
     if (aBrowser.remoteType != aRemoteType ||
         !aBrowser.frameLoader || !aBrowser.frameLoader.tabParent) {
       throw Cr.NS_ERROR_FAILURE;
     }
 
     // Tell our caller to redirect the load into this newly created process.
-    let tabParent = aBrowser.frameLoader.tabParent;
-    debug(`[process-switch]: new tabID: ${tabParent.tabId}`);
-    return tabParent;
+    return aBrowser.frameLoader.tabParent;
   },
 
   // Examine the channel response to see if we should change the process
   // performing the given load.
-  onMayChangeProcess(aChannel) {
+  onExamineResponse(aChannel) {
     if (!E10SUtils.useHttpResponseProcessSelection()) {
       return;
     }
 
     if (!aChannel.isDocument || !aChannel.loadInfo) {
       return; // Not a document load.
     }
 
-    // Check that this is a toplevel document load.
-    let cpType = aChannel.loadInfo.externalContentPolicyType;
-    let toplevel = cpType == Ci.nsIContentPolicy.TYPE_DOCUMENT;
-    if (!toplevel) {
-      debug(`[process-switch]: non-toplevel - ignoring`);
-      return;
-    }
-
-    // Check that the document has a corresponding BrowsingContext.
-    let browsingContext = toplevel
-        ? aChannel.loadInfo.browsingContext
-        : aChannel.loadInfo.frameBrowsingContext;
+    let browsingContext = aChannel.loadInfo.browsingContext;
     if (!browsingContext) {
-      debug(`[process-switch]: no BrowsingContext - ignoring`);
-      return;
+      return; // Not loading in a browsing context.
+    }
+
+    if (browsingContext.parent) {
+      return; // Not a toplevel load, can't flip procs.
     }
 
     // Get principal for a document already loaded in the BrowsingContext.
     let currentPrincipal = null;
     if (browsingContext.currentWindowGlobal) {
       currentPrincipal = browsingContext.currentWindowGlobal.documentPrincipal;
     }
 
-    // Ensure we have an nsIParentChannel listener for a remote load.
-    let parentChannel;
-    try {
-      parentChannel = aChannel.notificationCallbacks
-                              .getInterface(Ci.nsIParentChannel);
-    } catch (e) {
-      debug(`[process-switch]: No nsIParentChannel callback - ignoring`);
-      return;
-    }
-
-    // Ensure we have a nsITabParent for our remote load.
-    let tabParent;
-    try {
-      tabParent = parentChannel.QueryInterface(Ci.nsIInterfaceRequestor)
-                               .getInterface(Ci.nsITabParent);
-    } catch (e) {
-      debug(`[process-switch]: No nsITabParent for channel - ignoring`);
-      return;
-    }
-
-    // Ensure we're loaded in a regular tabbrowser environment, and can swap processes.
+    let parentChannel = aChannel.notificationCallbacks
+                                .getInterface(Ci.nsIParentChannel);
+    if (!parentChannel) {
+      return; // Not an actor channel
+    }
+
+    let tabParent = parentChannel.QueryInterface(Ci.nsIInterfaceRequestor)
+                                 .getInterface(Ci.nsITabParent);
+    if (!tabParent || !tabParent.ownerElement) {
+      console.warn("warning: Missing tabParent");
+      return; // Not an embedded browsing context
+    }
+
     let browser = tabParent.ownerElement;
-    if (!browser) {
-      debug(`[process-switch]: TabParent has no ownerElement - ignoring`);
-    }
-
-    let tabbrowser = browser.ownerGlobal.gBrowser;
-    if (!tabbrowser) {
-      debug(`[process-switch]: cannot find tabbrowser for loading tab - ignoring`);
-      return;
-    }
-
-    let tab = tabbrowser.getTabForBrowser(browser);
-    if (!tab) {
-      debug(`[process-switch]: not a normal tab, so cannot swap processes - ignoring`);
-      return;
-    }
-
-    // Determine the process type the load should be performed in.
+    if (browser.tagName !== "browser") {
+      console.warn("warning: Not a xul:browser element:", browser.tagName);
+      return; // Not a vanilla xul:browser element performing embedding.
+    }
+
     let resultPrincipal =
       Services.scriptSecurityManager.getChannelResultPrincipal(aChannel);
+    let useRemoteTabs = browser.ownerGlobal.gMultiProcessBrowser;
     let remoteType = E10SUtils.getRemoteTypeForPrincipal(resultPrincipal,
-                                                         true,
+                                                         useRemoteTabs,
                                                          browser.remoteType,
                                                          currentPrincipal);
     if (browser.remoteType == remoteType) {
-      debug(`[process-switch]: type (${remoteType}) is compatible - ignoring`);
-      return;
-    }
-
-    if (remoteType == E10SUtils.NOT_REMOTE ||
-        browser.remoteType == E10SUtils.NOT_REMOTE) {
-      debug(`[process-switch]: non-remote source/target - ignoring`);
-      return;
+      return; // Already in compatible process.
     }
 
     // ------------------------------------------------------------------------
     // DANGER ZONE: Perform a process switch into the new process. This is
     // destructive.
     // ------------------------------------------------------------------------
     let identifier = ++this._switchIdMonotonic;
     let tabPromise = this._doProcessSwitch(browser, remoteType,
@@ -3260,24 +3226,16 @@ var SessionStoreInternal = {
       restoreContentReason: RESTORE_TAB_CONTENT_REASON.NAVIGATE_AND_RESTORE,
     };
 
     if (historyIndex >= 0) {
       tabState.index = historyIndex + 1;
       tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
     } else {
       options.loadArguments = loadArguments;
-
-      // If we're resuming a load which has been redirected from another
-      // process, record the history index which is currently being requested.
-      // It has to be offset by 1 to get back to native history indices from
-      // SessionStore history indicies.
-      if (loadArguments.redirectLoadSwitchId) {
-        loadArguments.redirectHistoryIndex = tabState.requestedIndex - 1;
-      }
     }
 
     // Need to reset restoring tabs.
     if (TAB_STATE_FOR_BROWSER.has(tab.linkedBrowser)) {
       this._resetLocalTabRestoringState(tab);
     }
 
     // Restore the state into the tab.
--- a/browser/components/sessionstore/TabState.jsm
+++ b/browser/components/sessionstore/TabState.jsm
@@ -179,18 +179,14 @@ var TabStateInternal = {
 
         if (value.hasOwnProperty("userContextId")) {
           tabData.userContextId = value.userContextId;
         }
 
         if (value.hasOwnProperty("index")) {
           tabData.index = value.index;
         }
-
-        if (value.hasOwnProperty("requestedIndex")) {
-          tabData.requestedIndex = value.requestedIndex;
-        }
       } else {
         tabData[key] = value;
       }
     }
   },
 };
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -12988,49 +12988,31 @@ nsDocShell::SetOriginAttributesBeforeLoa
   if (!attrs.Init(aCx, aOriginAttributes)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   return SetOriginAttributes(attrs);
 }
 
 NS_IMETHODIMP
-nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
+nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier) {
   RefPtr<nsDocShell> self = this;
   RefPtr<ChildProcessChannelListener> cpcl =
       ChildProcessChannelListener::GetSingleton();
 
   // Call into InternalLoad with the pending channel when it is received.
-  cpcl->RegisterCallback(
-      aIdentifier, [self, aHistoryIndex](nsIChildChannel* aChannel) {
-        RefPtr<nsDocShellLoadState> loadState;
-        nsresult rv = nsDocShellLoadState::CreateFromPendingChannel(
-            aChannel, getter_AddRefs(loadState));
-        if (NS_WARN_IF(NS_FAILED(rv))) {
-          return;
-        }
-
-        // If we're performing a history load, locate the correct history entry,
-        // and set the relevant bits on our loadState.
-        if (aHistoryIndex >= 0) {
-          nsCOMPtr<nsISHistory> legacySHistory =
-              self->mSessionHistory->LegacySHistory();
-
-          nsCOMPtr<nsISHEntry> entry;
-          rv = legacySHistory->GetEntryAtIndex(aHistoryIndex,
-                                               getter_AddRefs(entry));
-          if (NS_SUCCEEDED(rv)) {
-            legacySHistory->InternalSetRequestedIndex(aHistoryIndex);
-            loadState->SetLoadType(LOAD_HISTORY);
-            loadState->SetSHEntry(entry);
-          }
-        }
-
-        self->InternalLoad(loadState, nullptr, nullptr);
-      });
+  cpcl->RegisterCallback(aIdentifier, [self](nsIChildChannel* aChannel) {
+    RefPtr<nsDocShellLoadState> loadState;
+    nsresult rv = nsDocShellLoadState::CreateFromPendingChannel(
+        aChannel, getter_AddRefs(loadState));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return;
+    }
+    self->InternalLoad(loadState, nullptr, nullptr);
+  });
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
                                 JSContext* aCx) {
   OriginAttributes attrs;
   if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
--- a/docshell/base/nsIWebNavigation.idl
+++ b/docshell/base/nsIWebNavigation.idl
@@ -337,15 +337,11 @@ interface nsIWebNavigation : nsISupports
    * Set an OriginAttributes dictionary in the docShell. This can be done only
    * before loading any content.
    */
   [implicit_jscontext]
   void setOriginAttributesBeforeLoading(in jsval originAttributes);
 
   /**
    * Resume a load which has been redirected from another process.
-   *
-   * A negative |aHistoryIndex| value corresponds to a non-history load being
-   * resumed.
    */
-  void resumeRedirectedLoad(in unsigned long long aLoadIdentifier,
-                            in long aHistoryIndex);
+  void resumeRedirectedLoad(in unsigned long long aLoadIdentifier);
 };
--- a/docshell/shistory/nsISHistory.idl
+++ b/docshell/shistory/nsISHistory.idl
@@ -48,24 +48,16 @@ interface nsISHistory: nsISupports
    * A readonly property of the interface that returns
    * the index of the last document that started to load and
    * didn't finished yet. When document finishes the loading
    * value -1 is returned.
    */
   [infallible] readonly attribute long requestedIndex;
 
   /**
-   * Artifically set the |requestedIndex| for this nsISHEntry to the given
-   * index. This is used when resuming a cross-process load from a different
-   * process.
-   */
-  [noscript, notxpcom]
-  void internalSetRequestedIndex(in long aRequestedIndex);
-
-  /**
    * Get the history entry at a given index. Returns non-null on success.
    *
    * @param index             The index value whose entry is requested.
    *                          The oldest entry is located at index == 0.
    * @return                  The found entry; never null.
    */
   nsISHEntry getEntryAtIndex(in long aIndex);
 
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -621,22 +621,16 @@ nsSHistory::SetIndex(int32_t aIndex) {
 /* Get the requestedIndex */
 NS_IMETHODIMP
 nsSHistory::GetRequestedIndex(int32_t* aResult) {
   MOZ_ASSERT(aResult, "null out param?");
   *aResult = mRequestedIndex;
   return NS_OK;
 }
 
-NS_IMETHODIMP_(void)
-nsSHistory::InternalSetRequestedIndex(int32_t aRequestedIndex) {
-  MOZ_ASSERT(aRequestedIndex >= -1 && aRequestedIndex < Length());
-  mRequestedIndex = aRequestedIndex;
-}
-
 NS_IMETHODIMP
 nsSHistory::GetEntryAtIndex(int32_t aIndex, nsISHEntry** aResult) {
   NS_ENSURE_ARG_POINTER(aResult);
 
   if (aIndex < 0 || aIndex >= Length()) {
     return NS_ERROR_FAILURE;
   }
 
--- a/dom/ipc/WindowGlobalChild.h
+++ b/dom/ipc/WindowGlobalChild.h
@@ -15,17 +15,16 @@ class nsGlobalWindowInner;
 class nsDocShell;
 
 namespace mozilla {
 namespace dom {
 
 class BrowsingContext;
 class WindowGlobalParent;
 class JSWindowActorChild;
-class TabChild;
 
 /**
  * Actor for a single nsGlobalWindowInner. This actor is used to communicate
  * information to the parent process asynchronously.
  */
 class WindowGlobalChild : public nsWrapperCache, public PWindowGlobalChild {
   friend class PWindowGlobalChild;
 
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -472,17 +472,16 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadI
       aLoadInfo->GetVerifySignedContent(), aLoadInfo->GetEnforceSRI(),
       aLoadInfo->GetForceAllowDataURI(),
       aLoadInfo->GetAllowInsecureRedirectToDataURI(),
       aLoadInfo->GetSkipContentPolicyCheckForWebRequest(),
       aLoadInfo->GetForceInheritPrincipalDropped(),
       aLoadInfo->GetInnerWindowID(), aLoadInfo->GetOuterWindowID(),
       aLoadInfo->GetParentOuterWindowID(), aLoadInfo->GetTopOuterWindowID(),
       aLoadInfo->GetFrameOuterWindowID(), aLoadInfo->GetBrowsingContextID(),
-      aLoadInfo->GetFrameBrowsingContextID(),
       aLoadInfo->GetInitialSecurityCheckDone(),
       aLoadInfo->GetIsInThirdPartyContext(), aLoadInfo->GetIsDocshellReload(),
       aLoadInfo->GetSendCSPViolationEvents(), aLoadInfo->GetOriginAttributes(),
       redirectChainIncludingInternalRedirects, redirectChain,
       ancestorPrincipals, aLoadInfo->AncestorOuterWindowIDs(), ipcClientInfo,
       ipcReservedClientInfo, ipcInitialClientInfo, ipcController,
       aLoadInfo->CorsUnsafeHeaders(), aLoadInfo->GetForcePreflight(),
       aLoadInfo->GetIsPreflight(), aLoadInfo->GetLoadTriggeredFromExternal(),
@@ -630,18 +629,17 @@ nsresult LoadInfoArgsToLoadInfo(
       loadInfoArgs.browserWouldUpgradeInsecureRequests(),
       loadInfoArgs.verifySignedContent(), loadInfoArgs.enforceSRI(),
       loadInfoArgs.forceAllowDataURI(),
       loadInfoArgs.allowInsecureRedirectToDataURI(),
       loadInfoArgs.skipContentPolicyCheckForWebRequest(),
       loadInfoArgs.forceInheritPrincipalDropped(), loadInfoArgs.innerWindowID(),
       loadInfoArgs.outerWindowID(), loadInfoArgs.parentOuterWindowID(),
       loadInfoArgs.topOuterWindowID(), loadInfoArgs.frameOuterWindowID(),
-      loadInfoArgs.browsingContextID(), loadInfoArgs.frameBrowsingContextID(),
-      loadInfoArgs.initialSecurityCheckDone(),
+      loadInfoArgs.browsingContextID(), loadInfoArgs.initialSecurityCheckDone(),
       loadInfoArgs.isInThirdPartyContext(), loadInfoArgs.isDocshellReload(),
       loadInfoArgs.sendCSPViolationEvents(), loadInfoArgs.originAttributes(),
       redirectChainIncludingInternalRedirects, redirectChain,
       std::move(ancestorPrincipals), loadInfoArgs.ancestorOuterWindowIDs(),
       loadInfoArgs.corsUnsafeHeaders(), loadInfoArgs.forcePreflight(),
       loadInfoArgs.isPreflight(), loadInfoArgs.loadTriggeredFromExternal(),
       loadInfoArgs.serviceWorkerTaintingSynthesized(),
       loadInfoArgs.documentHasUserInteracted(),
--- a/netwerk/base/LoadInfo.cpp
+++ b/netwerk/base/LoadInfo.cpp
@@ -75,17 +75,16 @@ LoadInfo::LoadInfo(
       mOriginalFrameSrcLoad(false),
       mForceInheritPrincipalDropped(false),
       mInnerWindowID(0),
       mOuterWindowID(0),
       mParentOuterWindowID(0),
       mTopOuterWindowID(0),
       mFrameOuterWindowID(0),
       mBrowsingContextID(0),
-      mFrameBrowsingContextID(0),
       mInitialSecurityCheckDone(false),
       mIsThirdPartyContext(false),
       mIsDocshellReload(false),
       mSendCSPViolationEvents(true),
       mForcePreflight(false),
       mIsPreflight(false),
       mLoadTriggeredFromExternal(false),
       mServiceWorkerTaintingSynthesized(false),
@@ -226,19 +225,16 @@ LoadInfo::LoadInfo(
     RefPtr<nsFrameLoader> fl =
         frameLoaderOwner ? frameLoaderOwner->GetFrameLoader() : nullptr;
     if (fl) {
       nsCOMPtr<nsIDocShell> docShell = fl->GetDocShell(IgnoreErrors());
       if (docShell) {
         nsCOMPtr<nsPIDOMWindowOuter> outerWindow = do_GetInterface(docShell);
         if (outerWindow) {
           mFrameOuterWindowID = outerWindow->WindowID();
-
-          RefPtr<dom::BrowsingContext> bc = outerWindow->GetBrowsingContext();
-          mFrameBrowsingContextID = bc ? bc->Id() : 0;
         }
       }
     }
 
     // if the document forces all requests to be upgraded from http to https,
     // then we should do that for all requests. If it only forces preloads to be
     // upgraded then we should enforce upgrade insecure requests only for
     // preloads.
@@ -361,17 +357,16 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* a
       mOriginalFrameSrcLoad(false),
       mForceInheritPrincipalDropped(false),
       mInnerWindowID(0),
       mOuterWindowID(0),
       mParentOuterWindowID(0),
       mTopOuterWindowID(0),
       mFrameOuterWindowID(0),
       mBrowsingContextID(0),
-      mFrameBrowsingContextID(0),
       mInitialSecurityCheckDone(false),
       mIsThirdPartyContext(false),  // NB: TYPE_DOCUMENT implies !third-party.
       mIsDocshellReload(false),
       mSendCSPViolationEvents(true),
       mForcePreflight(false),
       mIsPreflight(false),
       mLoadTriggeredFromExternal(false),
       mServiceWorkerTaintingSynthesized(false),
@@ -500,17 +495,17 @@ LoadInfo::LoadInfo(
     bool aBrowserUpgradeInsecureRequests,
     bool aBrowserWouldUpgradeInsecureRequests, bool aVerifySignedContent,
     bool aEnforceSRI, bool aForceAllowDataURI,
     bool aAllowInsecureRedirectToDataURI,
     bool aSkipContentPolicyCheckForWebRequest,
     bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID,
     uint64_t aOuterWindowID, uint64_t aParentOuterWindowID,
     uint64_t aTopOuterWindowID, uint64_t aFrameOuterWindowID,
-    uint64_t aBrowsingContextID, uint64_t aFrameBrowsingContextID,
+    uint64_t aBrowsingContextID,
     bool aInitialSecurityCheckDone, bool aIsThirdPartyContext,
     bool aIsDocshellReload, bool aSendCSPViolationEvents,
     const OriginAttributes& aOriginAttributes,
     RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
     RedirectHistoryArray& aRedirectChain,
     nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
     const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
     const nsTArray<nsCString>& aCorsUnsafeHeaders, bool aForcePreflight,
@@ -543,17 +538,16 @@ LoadInfo::LoadInfo(
       mOriginalFrameSrcLoad(false),
       mForceInheritPrincipalDropped(aForceInheritPrincipalDropped),
       mInnerWindowID(aInnerWindowID),
       mOuterWindowID(aOuterWindowID),
       mParentOuterWindowID(aParentOuterWindowID),
       mTopOuterWindowID(aTopOuterWindowID),
       mFrameOuterWindowID(aFrameOuterWindowID),
       mBrowsingContextID(aBrowsingContextID),
-      mFrameBrowsingContextID(aFrameBrowsingContextID),
       mInitialSecurityCheckDone(aInitialSecurityCheckDone),
       mIsThirdPartyContext(aIsThirdPartyContext),
       mIsDocshellReload(aIsDocshellReload),
       mSendCSPViolationEvents(aSendCSPViolationEvents),
       mOriginAttributes(aOriginAttributes),
       mAncestorPrincipals(std::move(aAncestorPrincipals)),
       mAncestorOuterWindowIDs(aAncestorOuterWindowIDs),
       mCorsUnsafeHeaders(aCorsUnsafeHeaders),
@@ -995,34 +989,22 @@ LoadInfo::GetFrameOuterWindowID(uint64_t
 
 NS_IMETHODIMP
 LoadInfo::GetBrowsingContextID(uint64_t* aResult) {
   *aResult = mBrowsingContextID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-LoadInfo::GetFrameBrowsingContextID(uint64_t* aResult) {
-  *aResult = mFrameBrowsingContextID;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 LoadInfo::GetBrowsingContext(dom::BrowsingContext** aResult) {
   *aResult = BrowsingContext::Get(mBrowsingContextID).take();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-LoadInfo::GetFrameBrowsingContext(dom::BrowsingContext** aResult) {
-  *aResult = BrowsingContext::Get(mFrameBrowsingContextID).take();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 LoadInfo::GetScriptableOriginAttributes(
     JSContext* aCx, JS::MutableHandle<JS::Value> aOriginAttributes) {
   if (NS_WARN_IF(!ToJSValue(aCx, mOriginAttributes, aOriginAttributes))) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -106,17 +106,17 @@ class LoadInfo final : public nsILoadInf
            bool aUpgradeInsecureRequests, bool aBrowserUpgradeInsecureRequests,
            bool aBrowserWouldUpgradeInsecureRequests, bool aVerifySignedContent,
            bool aEnforceSRI, bool aForceAllowDataURI,
            bool aAllowInsecureRedirectToDataURI,
            bool aSkipContentPolicyCheckForWebRequest,
            bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID,
            uint64_t aOuterWindowID, uint64_t aParentOuterWindowID,
            uint64_t aTopOuterWindowID, uint64_t aFrameOuterWindowID,
-           uint64_t aBrowsingContextID, uint64_t aFrameBrowsingContextID,
+           uint64_t aBrowsingContextID,
            bool aInitialSecurityCheckDone, bool aIsThirdPartyRequest,
            bool aIsDocshellReload, bool aSendCSPViolationEvents,
            const OriginAttributes& aOriginAttributes,
            RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
            RedirectHistoryArray& aRedirectChain,
            nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
            const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
            const nsTArray<nsCString>& aUnsafeHeaders, bool aForcePreflight,
@@ -179,17 +179,16 @@ class LoadInfo final : public nsILoadInf
   bool mOriginalFrameSrcLoad;
   bool mForceInheritPrincipalDropped;
   uint64_t mInnerWindowID;
   uint64_t mOuterWindowID;
   uint64_t mParentOuterWindowID;
   uint64_t mTopOuterWindowID;
   uint64_t mFrameOuterWindowID;
   uint64_t mBrowsingContextID;
-  uint64_t mFrameBrowsingContextID;
   bool mInitialSecurityCheckDone;
   bool mIsThirdPartyContext;
   bool mIsDocshellReload;
   bool mSendCSPViolationEvents;
   OriginAttributes mOriginAttributes;
   RedirectHistoryArray mRedirectChainIncludingInternalRedirects;
   RedirectHistoryArray mRedirectChain;
   nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
--- a/netwerk/base/nsILoadInfo.idl
+++ b/netwerk/base/nsILoadInfo.idl
@@ -630,23 +630,16 @@ interface nsILoadInfo : nsISupports
 
   /**
    * The BrowsingContext performing the load for this nsILoadInfo object.
    */
   [infallible] readonly attribute unsigned long long browsingContextID;
   readonly attribute BrowsingContext browsingContext;
 
   /**
-   * Like `frameOuterWindowID`, however returning the BrowsingContextID
-   * instead.
-   */
-  [infallible] readonly attribute unsigned long long frameBrowsingContextID;
-  readonly attribute BrowsingContext frameBrowsingContext;
-
-  /**
    * Resets the PrincipalToInherit to a freshly created NullPrincipal
    * which inherits the origin attributes from the loadInfo.
    *
    * WARNING: Please only use that function if you know exactly what
    * you are doing!!!
    */
   void resetPrincipalToInheritToNullPrincipal();
 
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -59,17 +59,16 @@ struct LoadInfoArgs
   bool                        skipContentPolicyCheckForWebRequest;
   bool                        forceInheritPrincipalDropped;
   uint64_t                    innerWindowID;
   uint64_t                    outerWindowID;
   uint64_t                    parentOuterWindowID;
   uint64_t                    topOuterWindowID;
   uint64_t                    frameOuterWindowID;
   uint64_t                    browsingContextID;
-  uint64_t                    frameBrowsingContextID;
   bool                        initialSecurityCheckDone;
   bool                        isInThirdPartyContext;
   bool                        isDocshellReload;
   bool                        sendCSPViolationEvents;
   OriginAttributes            originAttributes;
   RedirectHistoryEntryInfo[]  redirectChainIncludingInternalRedirects;
   RedirectHistoryEntryInfo[]  redirectChain;
 
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2445,30 +2445,25 @@ nsresult nsHttpChannel::ContinueProcessR
     if (NS_FAILED(rv)) {
       LOG(("  Disconnect failed (%08x)", static_cast<uint32_t>(rv)));
     }
     mAuthProvider = nullptr;
     LOG(("  continuation state has been reset"));
   }
 
   rv = NS_OK;
-  if (!mCanceled) {
-    // notify "http-on-may-change-process" observers
-    gHttpHandler->OnMayChangeProcess(this);
-
-    if (mRedirectTabPromise) {
-      MOZ_ASSERT(!mOnStartRequestCalled);
-
-      PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
-      rv = StartCrossProcessRedirect();
-      if (NS_SUCCEEDED(rv)) {
-        return NS_OK;
-      }
-      PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
-    }
+  if (mRedirectTabPromise && !mCanceled) {
+    MOZ_ASSERT(!mOnStartRequestCalled);
+
+    PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
+    rv = StartCrossProcessRedirect();
+    if (NS_SUCCEEDED(rv)) {
+      return NS_OK;
+    }
+    PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
   }
 
   // No process switch needed, continue as normal.
   return ContinueProcessResponse2(rv);
 }
 
 nsresult nsHttpChannel::ContinueProcessResponse2(nsresult rv) {
   if (NS_FAILED(rv) && !mCanceled) {
@@ -7121,18 +7116,16 @@ NS_IMETHODIMP nsHttpChannel::SwitchProce
   mRedirectTabPromise = DomPromiseListener::Create(aTabPromise);
   mCrossProcessRedirectIdentifier = aIdentifier;
   return NS_OK;
 }
 
 nsresult nsHttpChannel::StartCrossProcessRedirect() {
   nsresult rv;
 
-  LOG(("nsHttpChannel::StartCrossProcessRedirect [this=%p]", this));
-
   rv = CheckRedirectLimit(nsIChannelEventSink::REDIRECT_INTERNAL);
   NS_ENSURE_SUCCESS(rv, rv);
 
   RefPtr<HttpChannelParentListener> listener = do_QueryObject(mCallbacks);
   MOZ_ASSERT(listener);
 
   nsCOMPtr<nsILoadInfo> redirectLoadInfo =
       CloneLoadInfoForRedirect(mURI, nsIChannelEventSink::REDIRECT_INTERNAL);
@@ -7259,28 +7252,23 @@ nsHttpChannel::OnStartRequest(nsIRequest
   if (!mListener) {
     MOZ_ASSERT_UNREACHABLE("mListener is null");
     return NS_OK;
   }
 
   // before we check for redirects, check if the load should be shifted into a
   // new process.
   rv = NS_OK;
-  if (!mCanceled) {
-    // notify "http-on-may-change-process" observers
-    gHttpHandler->OnMayChangeProcess(this);
-
-    if (mRedirectTabPromise) {
-      PushRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest1);
-      rv = StartCrossProcessRedirect();
-      if (NS_SUCCEEDED(rv)) {
-        return NS_OK;
-      }
-      PopRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest1);
-    }
+  if (mRedirectTabPromise && !mCanceled) {
+    PushRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest1);
+    rv = StartCrossProcessRedirect();
+    if (NS_SUCCEEDED(rv)) {
+      return NS_OK;
+    }
+    PopRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest1);
   }
 
   // No process change is needed, so continue on to ContinueOnStartRequest1.
   return ContinueOnStartRequest1(rv);
 }
 
 nsresult nsHttpChannel::ContinueOnStartRequest1(nsresult result) {
   nsresult rv;
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -363,20 +363,16 @@ class nsHttpHandler final : public nsIHt
       nsIEventTarget *mainThreadEventTarget = nullptr);
 
   // Called by the channel when the response is read from the cache without
   // communicating with the server.
   void OnExamineCachedResponse(nsIHttpChannel *chan) {
     NotifyObservers(chan, NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC);
   }
 
-  void OnMayChangeProcess(nsIHttpChannel *chan) {
-    NotifyObservers(chan, NS_HTTP_ON_MAY_CHANGE_PROCESS_TOPIC);
-  }
-
   // Generates the host:port string for use in the Host: header as well as the
   // CONNECT line for proxies. This handles IPv6 literals correctly.
   static MOZ_MUST_USE nsresult GenerateHostPort(const nsCString &host,
                                                 int32_t port,
                                                 nsACString &hostLine);
 
   SpdyInformation *SpdyInfo() { return &mSpdyInfo; }
   bool IsH2MandatorySuiteEnabled() { return mH2MandatorySuiteEnabled; }
--- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl
+++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl
@@ -119,24 +119,16 @@ interface nsIHttpProtocolHandler : nsIPr
 /**
  * The observer of this topic is notified before data is read from the cache.
  * The notification is sent if and only if there is no network communication
  * at all.
  */
 #define NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC "http-on-examine-cached-response"
 
 /**
- * The observer of this topic is notified before before the response for a HTTP
- * load is available. The "subject" of the notification is the nsIHttpChannel
- * instance. Observers may call "switchProcessTo" to perform a process switch
- * while this is being run.
- */
-#define NS_HTTP_ON_MAY_CHANGE_PROCESS_TOPIC "http-on-may-change-process"
-
-/**
  * Before an HTTP request corresponding to a channel with the LOAD_DOCUMENT_URI
  * flag is sent to the server, this observer topic is notified. The observer of
  * this topic can then choose to modify the user agent for this request before
  * the request is actually sent to the server. Additionally, the modified user
  * agent will be propagated to sub-resource requests from the same load group.
  */
 #define NS_HTTP_ON_USERAGENT_REQUEST_TOPIC "http-on-useragent-request"
 
--- a/netwerk/test/browser/browser_cross_process_redirect.js
+++ b/netwerk/test/browser/browser_cross_process_redirect.js
@@ -18,26 +18,30 @@ function _createProcessChooser(tabParent
 
 function ProcessChooser(tabParent, from, to, rejectPromise = false) {
   this.tabParent = tabParent;
   this.fromDomain = from;
   this.toDomain = to;
   this.rejectPromise = rejectPromise;
 
   this.registered = true;
-  Services.obs.addObserver(this, "http-on-may-change-process");
+  Services.obs.addObserver(this, "http-on-examine-response");
+  Services.obs.addObserver(this, "http-on-examine-merged-response");
+  Services.obs.addObserver(this, "http-on-examine-cached-response");
 }
 
 ProcessChooser.prototype = {
   unregister() {
     if (!this.registered) {
       return;
     }
     this.registered = false;
-    Services.obs.removeObserver(this, "http-on-may-change-process");
+    Services.obs.removeObserver(this, "http-on-examine-response");
+    Services.obs.removeObserver(this, "http-on-examine-merged-response");
+    Services.obs.removeObserver(this, "http-on-examine-cached-response");
   },
 
   examine(aChannel) {
     if (this.channel && this.channel != aChannel) {
       // Hack: this is just so we don't get redirected multiple times.
       info("same channel. give null");
       return;
     }
@@ -74,17 +78,19 @@ ProcessChooser.prototype = {
     });
 
     info("calling switchprocessto");
     aChannel.switchProcessTo(tabPromise, identifier);
   },
 
   observe(aSubject, aTopic, aData) {
     switch (aTopic) {
-      case "http-on-may-change-process":
+      case "http-on-examine-response":
+      case "http-on-examine-cached-response":
+      case "http-on-examine-merged-response":
         this.examine(aSubject.QueryInterface(Ci.nsIHttpChannel));
         break;
       default:
         ok(false, "Unexpected topic observed!");
         break;
     }
   },
 
--- a/testing/marionette/client/marionette_driver/expected.py
+++ b/testing/marionette/client/marionette_driver/expected.py
@@ -96,19 +96,17 @@ class element_stale(object):
     def __init__(self, element):
         self.el = element
 
     def __call__(self, marionette):
         try:
             # Calling any method forces a staleness check
             self.el.is_enabled()
             return False
-        except (errors.StaleElementException, errors.NoSuchElementException):
-            # StaleElementException is raised when the element is gone, and
-            # NoSuchElementException is raised after a process swap.
+        except errors.StaleElementException:
             return True
 
 
 class elements_present(object):
     """Checks that web elements are present in the DOM of the current
     context.  This does not necessarily mean that the elements are
     visible.
 
--- a/toolkit/components/browser/nsWebBrowser.cpp
+++ b/toolkit/components/browser/nsWebBrowser.cpp
@@ -574,19 +574,18 @@ nsWebBrowser::LoadURIFromScript(const ns
 NS_IMETHODIMP
 nsWebBrowser::SetOriginAttributesBeforeLoading(
     JS::Handle<JS::Value> aOriginAttributes, JSContext* aCx) {
   return mDocShellAsNav->SetOriginAttributesBeforeLoading(aOriginAttributes,
                                                           aCx);
 }
 
 NS_IMETHODIMP
-nsWebBrowser::ResumeRedirectedLoad(uint64_t aIdentifier,
-                                   int32_t aHistoryIndex) {
-  return mDocShellAsNav->ResumeRedirectedLoad(aIdentifier, aHistoryIndex);
+nsWebBrowser::ResumeRedirectedLoad(uint64_t aIdentifier) {
+  return mDocShellAsNav->ResumeRedirectedLoad(aIdentifier);
 }
 
 NS_IMETHODIMP
 nsWebBrowser::Reload(uint32_t aReloadFlags) {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->Reload(aReloadFlags);
 }
--- a/toolkit/components/remotebrowserutils/tests/browser/browser.ini
+++ b/toolkit/components/remotebrowserutils/tests/browser/browser.ini
@@ -1,11 +1,9 @@
 [DEFAULT]
 run-if = e10s
 support-files =
   dummy_page.html
   print_postdata.sjs
   307redirect.sjs
-  head.js
 
 [browser_RemoteWebNavigation.js]
 [browser_httpResponseProcessSelection.js]
-[browser_httpToFileHistory.js]
--- a/toolkit/components/remotebrowserutils/tests/browser/browser_httpResponseProcessSelection.js
+++ b/toolkit/components/remotebrowserutils/tests/browser/browser_httpResponseProcessSelection.js
@@ -1,12 +1,28 @@
 const {E10SUtils} = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
 
 let PREF_NAME = "browser.tabs.remote.useHTTPResponseProcessSelection";
 
+function fileURL(filename) {
+  let ifile = getChromeDir(getResolvedURI(gTestPath));
+  ifile.append(filename);
+  return Services.io.newFileURI(ifile).spec;
+}
+
+function httpURL(filename, host = "https://example.com/") {
+  let root = getRootDirectory(gTestPath)
+    .replace("chrome://mochitests/content/", host);
+  return root + filename;
+}
+
+function add307(url, host = "https://example.com/") {
+  return httpURL("307redirect.sjs?" + url, host);
+}
+
 async function performLoad(browser, opts, action) {
   let loadedPromise = BrowserTestUtils.browserLoaded(
     browser, false, opts.url, opts.maybeErrorPage);
   await action();
   await loadedPromise;
 }
 
 const EXTENSION_DATA = {
deleted file mode 100644
--- a/toolkit/components/remotebrowserutils/tests/browser/browser_httpToFileHistory.js
+++ /dev/null
@@ -1,99 +0,0 @@
-const {E10SUtils} = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
-
-const PREF_NAME = "browser.tabs.remote.useHTTPResponseProcessSelection";
-const HISTORY = [
-  {url: httpURL("dummy_page.html")},
-  {url: fileURL("dummy_page.html")},
-  {url: httpURL("dummy_page.html")},
-];
-
-function reversed(list) {
-  let copy = list.slice();
-  copy.reverse();
-  return copy;
-}
-
-function butLast(list) {
-  let copy = list.slice();
-  copy.pop();
-  return copy;
-}
-
-async function runTest() {
-  await BrowserTestUtils.withNewTab({gBrowser}, async function(aBrowser) {
-    // Perform initial load of each URL in the history.
-    let count = 0;
-    let index = -1;
-    for (let {url} of HISTORY) {
-      BrowserTestUtils.loadURI(aBrowser, url);
-      await BrowserTestUtils.browserLoaded(aBrowser, false, loaded => {
-        return Services.io.newURI(loaded).scheme == Services.io.newURI(url).scheme;
-      });
-
-      count++;
-      index++;
-      await ContentTask.spawn(aBrowser, {count, index, url}, async function({count, index, url}) {
-        docShell.QueryInterface(Ci.nsIWebNavigation);
-
-        is(docShell.sessionHistory.count, count, "Initial Navigation Count Match");
-        is(docShell.sessionHistory.index, index, "Initial Navigation Index Match");
-
-        let real = Services.io.newURI(content.location.href);
-        let expect = Services.io.newURI(url);
-        is(real.scheme, expect.scheme, "Initial Navigation URL Scheme");
-      });
-    }
-
-    // Go back to the first entry.
-    for (let {url} of reversed(HISTORY).slice(1)) {
-      ContentTask.spawn(aBrowser, {}, () => { content.history.back(); });
-      await BrowserTestUtils.browserLoaded(aBrowser, false, loaded => {
-        return Services.io.newURI(loaded).scheme == Services.io.newURI(url).scheme;
-      });
-
-      index--;
-      await ContentTask.spawn(aBrowser, {count, index, url}, async function({count, index, url}) {
-        docShell.QueryInterface(Ci.nsIWebNavigation);
-
-        is(docShell.sessionHistory.count, count, "Go Back Count Match");
-        is(docShell.sessionHistory.index, index, "Go Back Index Match");
-
-        let real = Services.io.newURI(content.location.href);
-        let expect = Services.io.newURI(url);
-        is(real.scheme, expect.scheme, "Go Back URL Scheme");
-      });
-    }
-
-    // Go forward to the last entry.
-    for (let {url} of HISTORY.slice(1)) {
-      ContentTask.spawn(aBrowser, {}, () => { content.history.forward(); });
-      await BrowserTestUtils.browserLoaded(aBrowser, false, loaded => {
-        return Services.io.newURI(loaded).scheme == Services.io.newURI(url).scheme;
-      });
-
-      index++;
-      await ContentTask.spawn(aBrowser, {count, index, url}, async function({count, index, url}) {
-        docShell.QueryInterface(Ci.nsIWebNavigation);
-
-        is(docShell.sessionHistory.count, count, "Go Forward Count Match");
-        is(docShell.sessionHistory.index, index, "Go Forward Index Match");
-
-        let real = Services.io.newURI(content.location.href);
-        let expect = Services.io.newURI(url);
-        is(real.scheme, expect.scheme, "Go Forward URL Scheme");
-      });
-    }
-  });
-}
-
-
-add_task(async function prefDisabled() {
-  await SpecialPowers.pushPrefEnv({set: [[PREF_NAME, false]]});
-  await runTest();
-});
-
-
-add_task(async function prefEnabled() {
-  await SpecialPowers.pushPrefEnv({set: [[PREF_NAME, true]]});
-  await runTest();
-});
deleted file mode 100644
--- a/toolkit/components/remotebrowserutils/tests/browser/head.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function fileURL(filename) {
-  let ifile = getChromeDir(getResolvedURI(gTestPath));
-  ifile.append(filename);
-  return Services.io.newFileURI(ifile).spec;
-}
-
-function httpURL(filename, host = "https://example.com/") {
-  let root = getRootDirectory(gTestPath)
-    .replace("chrome://mochitests/content/", host);
-  return root + filename;
-}
-
-function add307(url, host = "https://example.com/") {
-  return httpURL("307redirect.sjs?" + url, host);
-}
--- a/toolkit/modules/E10SUtils.jsm
+++ b/toolkit/modules/E10SUtils.jsm
@@ -318,30 +318,16 @@ var E10SUtils = {
   },
 
   shouldLoadURI(aDocShell, aURI, aReferrer, aHasPostData) {
     // Inner frames should always load in the current process
     if (aDocShell.sameTypeParent) {
       return true;
     }
 
-    let webNav = aDocShell.QueryInterface(Ci.nsIWebNavigation);
-    let sessionHistory = webNav.sessionHistory;
-    if (!aHasPostData &&
-        Services.appinfo.remoteType == WEB_REMOTE_TYPE &&
-        sessionHistory.count == 1 &&
-        webNav.currentURI.spec == "about:newtab") {
-      // This is possibly a preloaded browser and we're about to navigate away for
-      // the first time. On the child side there is no way to tell for sure if that
-      // is the case, so let's redirect this request to the parent to decide if a new
-      // process is needed. But we don't currently properly handle POST data in
-      // redirects (bug 1457520), so if there is POST data, don't return false here.
-      return false;
-    }
-
     // If we are performing HTTP response process selection, and are loading an
     // HTTP URI, we can start the load in the current process, and then perform
     // the switch later-on using the RedirectProcessChooser mechanism.
     //
     // We should never be sending a POST request from the parent process to a
     // http(s) uri, so make sure we switch if we're currently in that process.
     if (useHttpResponseProcessSelection &&
         (aURI.scheme == "http" || aURI.scheme == "https") &&
@@ -356,29 +342,43 @@ var E10SUtils = {
     if (!aHasPostData &&
         Services.appinfo.remoteType == LARGE_ALLOCATION_REMOTE_TYPE &&
         !aDocShell.awaitingLargeAlloc &&
         aDocShell.isOnlyToplevelInTabGroup) {
       return false;
     }
 
     // Allow history load if loaded in this process before.
+    let webNav = aDocShell.QueryInterface(Ci.nsIWebNavigation);
+    let sessionHistory = webNav.sessionHistory;
     let requestedIndex = sessionHistory.legacySHistory.requestedIndex;
     if (requestedIndex >= 0) {
       if (sessionHistory.legacySHistory.getEntryAtIndex(requestedIndex).loadedInThisProcess) {
         return true;
       }
 
       // If not originally loaded in this process allow it if the URI would
       // normally be allowed to load in this process by default.
       let remoteType = Services.appinfo.remoteType;
       return remoteType ==
         this.getRemoteTypeForURIObject(aURI, true, remoteType, webNav.currentURI);
     }
 
+    if (!aHasPostData &&
+        Services.appinfo.remoteType == WEB_REMOTE_TYPE &&
+        sessionHistory.count == 1 &&
+        webNav.currentURI.spec == "about:newtab") {
+      // This is possibly a preloaded browser and we're about to navigate away for
+      // the first time. On the child side there is no way to tell for sure if that
+      // is the case, so let's redirect this request to the parent to decide if a new
+      // process is needed. But we don't currently properly handle POST data in
+      // redirects (bug 1457520), so if there is POST data, don't return false here.
+      return false;
+    }
+
     // If the URI can be loaded in the current process then continue
     return this.shouldLoadURIInThisProcess(aURI);
   },
 
   redirectLoad(aDocShell, aURI, aReferrer, aTriggeringPrincipal, aFreshProcess, aFlags) {
     // Retarget the load to the correct process
     let messageManager = aDocShell.messageManager;
     let sessionHistory = aDocShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
--- a/toolkit/modules/sessionstore/SessionHistory.jsm
+++ b/toolkit/modules/sessionstore/SessionHistory.jsm
@@ -71,22 +71,17 @@ var SessionHistoryInternal = {
    *        The starting local index to collect the history from.
    * @return An object reprereseting a partial global history update.
    */
   collect(docShell, aFromIdx = -1) {
     let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
     let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
     let history = webNavigation.sessionHistory;
 
-    let data = {
-      entries: [],
-      userContextId: loadContext.originAttributes.userContextId,
-      requestedIndex: history.legacySHistory.requestedIndex + 1,
-    };
-
+    let data = {entries: [], userContextId: loadContext.originAttributes.userContextId };
     // We want to keep track how many entries we *could* have collected and
     // how many we skipped, so we can sanitiy-check the current history index
     // and also determine whether we need to get any fallback data or not.
     let skippedCount = 0, entryCount = 0;
 
     if (history && history.count > 0) {
       let shistory = history.legacySHistory.QueryInterface(Ci.nsISHistory);
       let count = shistory.count;