Merge autoland to mozilla-central. a=merge
authorCosmin Sabou <csabou@mozilla.com>
Fri, 15 Feb 2019 20:36:32 +0200
changeset 459441 0e2ab35d382d2bcb9ebaee2a9eac3c1541f861d7
parent 459440 45aaded7cf63b11145f86083e08aca4a21710cff (current diff)
parent 459383 57ab0251343c3162086a39f7b9d7ae679c063e05 (diff)
child 459543 8961019ee4c6fe27e6319d9cf9ea6867b4f3c7bb
push id35561
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:37:54 +0000
treeherdermozilla-central@0e2ab35d382d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone67.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
Merge autoland to mozilla-central. a=merge
browser/components/sessionstore/SessionStore.jsm
docshell/base/nsDocShell.cpp
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
toolkit/components/remotebrowserutils/tests/browser/browser.ini
toolkit/components/remotebrowserutils/tests/browser/browser_httpToFileHistory.js
toolkit/components/remotebrowserutils/tests/browser/head.js
toolkit/modules/E10SUtils.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/browser.js
+++ b/browser/base/content/browser.js
@@ -2169,17 +2169,17 @@ function BrowserReloadSkipCache() {
   BrowserReloadWithFlags(reloadFlags);
 }
 
 function BrowserHome(aEvent) {
   if (aEvent && "button" in aEvent &&
       aEvent.button == 2) // right-click: do nothing
     return;
 
-  var homePage = HomePage.get(window);
+  var homePage = HomePage.get();
   var where = whereToOpenLink(aEvent, false, true);
   var urls;
   var notifyObservers;
 
   // Home page should open in a new tab when current tab is an app tab
   if (where == "current" &&
       gBrowser &&
       gBrowser.selectedTab.pinned)
--- 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/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -19,29 +19,20 @@ XPCOMUtils.defineLazyModuleGetters(this,
 
 XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
                                    "@mozilla.org/browser/aboutnewtab-service;1",
                                    "nsIAboutNewTabService");
 
 Object.defineProperty(this, "BROWSER_NEW_TAB_URL", {
   enumerable: true,
   get() {
-    if (PrivateBrowsingUtils.isWindowPrivate(window)) {
-      if (!PrivateBrowsingUtils.permanentPrivateBrowsing &&
-          !aboutNewTabService.overridden) {
-        return "about:privatebrowsing";
-      }
-      // If the extension does not have private browsing permission,
-      // use about:privatebrowsing.
-      if (aboutNewTabService.newTabURL.startsWith("moz-extension")) {
-        let url = new URL(aboutNewTabService.newTabURL);
-        if (!WebExtensionPolicy.getByHostname(url.hostname).privateBrowsingAllowed) {
-          return "about:privatebrowsing";
-        }
-      }
+    if (PrivateBrowsingUtils.isWindowPrivate(window) &&
+        !PrivateBrowsingUtils.permanentPrivateBrowsing &&
+        !aboutNewTabService.overridden) {
+      return "about:privatebrowsing";
     }
     return aboutNewTabService.newTabURL;
   },
 });
 
 var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
 
 var gBidiUI = false;
--- a/browser/components/extensions/ExtensionControlledPopup.jsm
+++ b/browser/components/extensions/ExtensionControlledPopup.jsm
@@ -26,18 +26,16 @@ const {XPCOMUtils} = ChromeUtils.import(
 ChromeUtils.defineModuleGetter(this, "AddonManager",
                                "resource://gre/modules/AddonManager.jsm");
 ChromeUtils.defineModuleGetter(this, "BrowserUtils",
                                "resource://gre/modules/BrowserUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "CustomizableUI",
                                "resource:///modules/CustomizableUI.jsm");
 ChromeUtils.defineModuleGetter(this, "ExtensionSettingsStore",
                                "resource://gre/modules/ExtensionSettingsStore.jsm");
-ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
-                               "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 let {
   makeWidgetId,
 } = ExtensionCommon;
 
 XPCOMUtils.defineLazyGetter(this, "strBundle", function() {
   return Services.strings.createBundle("chrome://global/locale/extensions.properties");
 });
@@ -192,30 +190,25 @@ class ExtensionControlledPopup {
     this.removeObserver();
 
     if (!extensionId) {
       let item = ExtensionSettingsStore.getSetting(
         this.settingType, this.settingKey);
       extensionId = item && item.id;
     }
 
-    let win = targetWindow || this.topWindow;
-    let isPrivate = PrivateBrowsingUtils.isWindowPrivate(win);
-    if (isPrivate && extensionId && !WebExtensionPolicy.getByID(extensionId).privateBrowsingAllowed) {
-      return;
-    }
-
     // The item should have an extension and the user shouldn't have confirmed
     // the change here, but just to be sure check that it is still controlled
     // and the user hasn't already confirmed the change.
     // If there is no id, then the extension is no longer in control.
     if (!extensionId || this.userHasConfirmed(extensionId)) {
       return;
     }
 
+    let win = targetWindow || this.topWindow;
     // If the window closes while waiting for focus, this might reject/throw,
     // and we should stop trying to show the popup.
     try {
       await this._ensureWindowReady(win);
     } catch (ex) {
       return;
     }
 
--- a/browser/components/extensions/parent/ext-windows.js
+++ b/browser/components/extensions/parent/ext-windows.js
@@ -186,23 +186,18 @@ this.windows = class extends ExtensionAP
               for (let url of createData.url) {
                 array.appendElement(mkstr(url));
               }
               args.appendElement(array);
             } else {
               args.appendElement(mkstr(createData.url));
             }
           } else {
-            let url;
-            if (createData.incognito) {
-              url = PrivateBrowsingUtils.permanentPrivateBrowsing ?
-                HomePage.getPrivate().split("|", 1)[0] : "about:privatebrowsing";
-            } else {
-              url = HomePage.get().split("|", 1)[0];
-            }
+            let url = createData.incognito && !PrivateBrowsingUtils.permanentPrivateBrowsing ?
+              "about:privatebrowsing" : HomePage.get().split("|", 1)[0];
             args.appendElement(mkstr(url));
 
             if (url.startsWith("about:") &&
                 !context.checkLoadURL(url, {dontReportErrors: true})) {
               // The extension principal cannot directly load about:-URLs,
               // except for about:blank. So use the system principal instead.
               principal = Services.scriptSecurityManager.getSystemPrincipal();
             }
--- a/browser/components/extensions/test/browser/browser_ext_chrome_settings_overrides_home.js
+++ b/browser/components/extensions/test/browser/browser_ext_chrome_settings_overrides_home.js
@@ -417,124 +417,8 @@ add_task(async function test_doorhanger_
   ok(getHomePageURL().endsWith("ext1.html"), "The homepage is still the set");
 
   await BrowserTestUtils.closeWindow(win);
   await ext1.unload();
   await ext2.unload();
 
   ok(!isConfirmed(ext1Id), "The confirmation is cleaned up on uninstall");
 });
-
-add_task(async function test_overriding_home_page_incognito_not_allowed() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      chrome_settings_overrides: {"homepage": "home.html"},
-      name: "extension",
-    },
-    background() {
-      browser.test.sendMessage("url", browser.runtime.getURL("home.html"));
-    },
-    files: {"home.html": "<h1>1</h1>"},
-    useAddonManager: "temporary",
-  });
-
-  await extension.startup();
-  let url = await extension.awaitMessage("url");
-
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow({url});
-  let win = OpenBrowserWindow();
-  await windowOpenedPromise;
-  let doc = win.document;
-  let description = doc.getElementById("extension-homepage-notification-description");
-  let panel = doc.getElementById("extension-notification-panel");
-  await promisePopupShown(panel);
-
-  let popupnotification = description.closest("popupnotification");
-  is(description.textContent,
-     "An extension,  extension, changed what you see when you open your homepage and new windows.Learn more",
-     "The extension name is in the popup");
-  is(popupnotification.hidden, false, "The expected popup notification is visible");
-
-  ok(win.gURLBar.value.endsWith("home.html"), "extension is in control");
-  await BrowserTestUtils.closeWindow(win);
-
-  // Verify a private window does not open the extension page.
-  windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-  win.BrowserHome();
-  await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-
-  is(win.gURLBar.value, "", "home page not used in private window");
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function test_overriding_home_page_incognito_not_allowed_bypass() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      name: "extension",
-    },
-    background() {
-      browser.test.sendMessage("url", browser.runtime.getURL("home.html"));
-    },
-    files: {"home.html": "<h1>1</h1>"},
-    useAddonManager: "temporary",
-  });
-
-  await extension.startup();
-  let url = await extension.awaitMessage("url");
-
-  // Verify manually setting the pref to the extension page does not work.
-  let changed = promisePrefChangeObserved(HOMEPAGE_URL_PREF);
-  Services.prefs.setStringPref(HOMEPAGE_URL_PREF, url);
-  await changed;
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  let win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-  win.BrowserHome();
-  await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-
-  is(win.gURLBar.value, "", "home page not used in private window");
-  changed = promisePrefChangeObserved(HOMEPAGE_URL_PREF);
-  Services.prefs.clearUserPref(HOMEPAGE_URL_PREF);
-  await changed;
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function test_overriding_home_page_incognito_spanning() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      chrome_settings_overrides: {"homepage": "home.html"},
-      name: "private extension",
-      applications: {
-        gecko: {id: "@spanning-home"},
-      },
-    },
-    files: {"home.html": "<h1>1</h1>"},
-    useAddonManager: "permanent",
-    incognitoOverride: "spanning",
-  });
-
-  await extension.startup();
-
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  let win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-  let doc = win.document;
-  let panel = doc.getElementById("extension-notification-panel");
-  win.BrowserHome();
-  await promisePopupShown(panel);
-
-  ok(win.gURLBar.value.endsWith("home.html"), "extension is in control in private window");
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
--- a/browser/components/extensions/test/browser/browser_ext_url_overrides_newtab.js
+++ b/browser/components/extensions/test/browser/browser_ext_url_overrides_newtab.js
@@ -1,18 +1,15 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 
 "use strict";
 
 ChromeUtils.defineModuleGetter(this, "ExtensionSettingsStore",
                                "resource://gre/modules/ExtensionSettingsStore.jsm");
-XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
-                                   "@mozilla.org/browser/aboutnewtab-service;1",
-                                   "nsIAboutNewTabService");
 
 const NEWTAB_URI_1 = "webext-newtab-1.html";
 
 function getNotificationSetting(extensionId) {
   return ExtensionSettingsStore.getSetting("newTabNotification", extensionId);
 }
 
 function getNewTabDoorhanger() {
@@ -520,194 +517,8 @@ add_task(async function dontTemporarilyS
   is(gURLBar.value, "", "URL bar value should be empty.");
   ContentTask.spawn(tab.linkedBrowser, null, function() {
     is(content.document.body.textContent, "New tab!", "New tab page is loaded.");
   });
 
   BrowserTestUtils.removeTab(tab);
   await extension.unload();
 });
-
-add_task(async function test_overriding_newtab_incognito_not_allowed() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let panel = getNewTabDoorhanger().closest("panel");
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      chrome_url_overrides: {"newtab": "newtab.html"},
-      name: "extension",
-      applications: {
-        gecko: {id: "@not-allowed-newtab"},
-      },
-    },
-    files: {
-      "newtab.html": `
-        <!DOCTYPE html>
-        <head>
-          <meta charset="utf-8"/></head>
-        <html>
-          <body>
-            <script src="newtab.js"></script>
-          </body>
-        </html>
-      `,
-
-      "newtab.js": function() {
-        window.onload = () => {
-          browser.test.sendMessage("from-newtab-page", window.location.href);
-        };
-      },
-    },
-    useAddonManager: "permanent",
-  });
-
-  await extension.startup();
-
-  let popupShown = promisePopupShown(panel);
-  BrowserOpenTab();
-  await popupShown;
-
-  let url = await extension.awaitMessage("from-newtab-page");
-  ok(url.endsWith("newtab.html"),
-     "Newtab url is overridden by the extension.");
-
-  // This will show a confirmation doorhanger, make sure we don't leave it open.
-  let popupHidden = promisePopupHidden(panel);
-  panel.hidePopup();
-  await popupHidden;
-
-  BrowserTestUtils.removeTab(gBrowser.selectedTab);
-
-  // Verify a private window does not open the extension page.  We would
-  // get an extra notification that we don't listen for if it gets loaded.
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  let win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-
-  let newTabOpened = waitForNewTab();
-  win.BrowserOpenTab();
-  await newTabOpened;
-
-  is(win.gURLBar.value, "", "newtab not used in private window");
-
-  // Verify setting the pref directly doesn't bypass permissions.
-  let origUrl = aboutNewTabService.newTabURL;
-  aboutNewTabService.newTabURL = url;
-  newTabOpened = waitForNewTab();
-  win.BrowserOpenTab();
-  await newTabOpened;
-
-  is(win.gURLBar.value, "", "directly set newtab not used in private window");
-
-  aboutNewTabService.newTabURL = origUrl;
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function test_overriding_newtab_incognito_not_allowed_bypass() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      name: "extension",
-      applications: {
-        gecko: {id: "@not-allowed-newtab"},
-      },
-    },
-    background() {
-      browser.test.sendMessage("url", browser.runtime.getURL("newtab.html"));
-    },
-    files: {
-      "newtab.html": `
-        <!DOCTYPE html>
-        <head>
-          <meta charset="utf-8"/></head>
-        <html>
-          <body>
-          </body>
-        </html>
-      `,
-    },
-    useAddonManager: "permanent",
-  });
-
-  await extension.startup();
-  let url = await extension.awaitMessage("url");
-
-  // Verify setting the pref directly doesn't bypass permissions.
-  let origUrl = aboutNewTabService.newTabURL;
-  aboutNewTabService.newTabURL = url;
-
-  // Verify a private window does not open the extension page.  We would
-  // get an extra notification that we don't listen for if it gets loaded.
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  let win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-
-  let newTabOpened = waitForNewTab();
-  win.BrowserOpenTab();
-  await newTabOpened;
-
-  is(win.gURLBar.value, "", "directly set newtab not used in private window");
-
-  aboutNewTabService.newTabURL = origUrl;
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function test_overriding_newtab_incognito_spanning() {
-  await SpecialPowers.pushPrefEnv({set: [["extensions.allowPrivateBrowsingByDefault", false]]});
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      chrome_url_overrides: {"newtab": "newtab.html"},
-      name: "extension",
-      applications: {
-        gecko: {id: "@spanning-newtab"},
-      },
-    },
-    files: {
-      "newtab.html": `
-        <!DOCTYPE html>
-        <head>
-          <meta charset="utf-8"/></head>
-        <html>
-          <body>
-            <script src="newtab.js"></script>
-          </body>
-        </html>
-      `,
-
-      "newtab.js": function() {
-        window.onload = () => {
-          browser.test.sendMessage("from-newtab-page", window.location.href);
-        };
-      },
-    },
-    useAddonManager: "permanent",
-    incognitoOverride: "spanning",
-  });
-
-  await extension.startup();
-
-  let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
-  let win = OpenBrowserWindow({private: true});
-  await windowOpenedPromise;
-  let panel = win.document.getElementById("extension-new-tab-notification").closest("panel");
-  let popupShown = promisePopupShown(panel);
-  win.BrowserOpenTab();
-  await popupShown;
-
-  let url = await extension.awaitMessage("from-newtab-page");
-  ok(url.endsWith("newtab.html"),
-     "Newtab url is overridden by the extension.");
-
-  // This will show a confirmation doorhanger, make sure we don't leave it open.
-  let popupHidden = promisePopupHidden(panel);
-  panel.hidePopup();
-  await popupHidden;
-
-  await extension.unload();
-  await BrowserTestUtils.closeWindow(win);
-});
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -202,17 +202,17 @@ function getPostUpdateOverridePage(defau
  */
 function openBrowserWindow(cmdLine, triggeringPrincipal, urlOrUrlList, postData = null,
                            forcePrivate = false) {
   let chromeURL = AppConstants.BROWSER_CHROME_URL;
 
   let args;
   if (!urlOrUrlList) {
     // Just pass in the defaultArgs directly. We'll use system principal on the other end.
-    args = [gBrowserContentHandler.getDefaultArgs(forcePrivate)];
+    args = [gBrowserContentHandler.defaultArgs];
   } else {
     let pService = Cc["@mozilla.org/toolkit/profile-service;1"].
                   getService(Ci.nsIToolkitProfileService);
     if (cmdLine && cmdLine.state == Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
         pService.createdAlternateProfile) {
       let url = getNewInstallPage();
       if (Array.isArray(urlOrUrlList)) {
         urlOrUrlList.unshift(url);
@@ -517,17 +517,17 @@ nsBrowserContentHandler.prototype = {
     info += "  --window-size width[,height] Width and optionally height of screenshot.\n";
     info += "  --search <term>    Search <term> with your default search engine.\n";
     info += "  --setDefaultBrowser Set this app as the default browser.\n";
     return info;
   },
 
   /* nsIBrowserHandler */
 
-  getDefaultArgs(forcePrivate = false) {
+  get defaultArgs() {
     var prefb = Services.prefs;
 
     if (!gFirstWindow) {
       gFirstWindow = true;
       if (PrivateBrowsingUtils.isInTemporaryAutoStartMode) {
         return "about:privatebrowsing";
       }
     }
@@ -602,17 +602,17 @@ nsBrowserContentHandler.prototype = {
         overridePage = additionalPage;
       }
     }
 
     var startPage = "";
     try {
       var choice = prefb.getIntPref("browser.startup.page");
       if (choice == 1 || choice == 3)
-        startPage = forcePrivate ? HomePage.getPrivate() : HomePage.get();
+        startPage = HomePage.get();
     } catch (e) {
       Cu.reportError(e);
     }
 
     if (startPage == "about:blank")
       startPage = "";
 
     let skipStartPage = ((override == OVERRIDE_NEW_PROFILE) || (override == OVERRIDE_ALTERNATE_PROFILE)) &&
@@ -620,20 +620,16 @@ nsBrowserContentHandler.prototype = {
     // Only show the startPage if we're not restoring an update session and are
     // not set to skip the start page on this profile
     if (overridePage && startPage && !willRestoreSession && !skipStartPage)
       return overridePage + "|" + startPage;
 
     return overridePage || startPage || "about:blank";
   },
 
-  get defaultArgs() {
-    return this.getDefaultArgs(PrivateBrowsingUtils.permanentPrivateBrowsing);
-  },
-
   mFeatures: null,
 
   getFeatures: function bch_features(cmdLine) {
     if (this.mFeatures === null) {
       this.mFeatures = "";
 
       if (cmdLine) {
         try {
--- 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.
@@ -3336,17 +3294,17 @@ var SessionStoreInternal = {
     // home pages then we'll end up overwriting all of them. Otherwise we'll
     // just close the tabs that match home pages. Tabs with the about:blank
     // URI will always be overwritten.
     let homePages = ["about:blank"];
     let removableTabs = [];
     let tabbrowser = aWindow.gBrowser;
     let startupPref = this._prefBranch.getIntPref("startup.page");
     if (startupPref == 1)
-      homePages = homePages.concat(HomePage.get(aWindow).split("|"));
+      homePages = homePages.concat(HomePage.get().split("|"));
 
     for (let i = tabbrowser._numPinnedTabs; i < tabbrowser.tabs.length; i++) {
       let tab = tabbrowser.tabs[i];
       if (homePages.includes(tab.linkedBrowser.currentURI.spec)) {
         removableTabs.push(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/browser/modules/HomePage.jsm
+++ b/browser/modules/HomePage.jsm
@@ -5,18 +5,16 @@
 /* globals ChromeUtils, Services */
 /* exported HomePage */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["HomePage"];
 
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
-                               "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 const kPrefName = "browser.startup.homepage";
 
 function getHomepagePref(useDefault) {
   let homePage;
   let prefs = Services.prefs;
   if (useDefault) {
     prefs = prefs.getDefaultBranch(null);
@@ -40,46 +38,24 @@ function getHomepagePref(useDefault) {
     Services.prefs.clearUserPref(kPrefName);
     homePage = getHomepagePref(true);
   }
 
   return homePage;
 }
 
 let HomePage = {
-  get(aWindow) {
-    if (PrivateBrowsingUtils.permanentPrivateBrowsing ||
-        (aWindow && PrivateBrowsingUtils.isWindowPrivate(aWindow))) {
-      return this.getPrivate();
-    }
+  get() {
     return getHomepagePref();
   },
 
   getDefault() {
     return getHomepagePref(true);
   },
 
-  getPrivate() {
-    let homePages = getHomepagePref();
-    if (!homePages.includes("moz-extension")) {
-      return homePages;
-    }
-    // Verify private access and build a new list.
-    let privateHomePages = homePages.split("|").filter(page => {
-      let url = new URL(page);
-      if (url.protocol !== "moz-extension:") {
-        return true;
-      }
-      let policy = WebExtensionPolicy.getByHostname(url.hostname);
-      return policy && policy.privateBrowsingAllowed;
-    });
-    // Extensions may not be ready on startup, fallback to defaults.
-    return privateHomePages.join("|") || this.getDefault();
-  },
-
   get overridden() {
     return Services.prefs.prefHasUserValue(kPrefName);
   },
 
   set(value) {
     Services.prefs.setStringPref(kPrefName, value);
   },
 
--- a/build/mozconfig.no-compile
+++ b/build/mozconfig.no-compile
@@ -30,8 +30,9 @@ unset VC_PATH
 unset WINDOWSSDKDIR
 
 unset MOZ_STDCXX_COMPAT
 unset MOZ_NO_PIE_COMPAT
 
 unset AR
 unset NM
 unset RANLIB
+unset NASM
--- 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) {
@@ -7120,18 +7115,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);
@@ -7258,28 +7251,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;