Bug 1522637 - Part 8: Perform the preloaded document swap before checking for HTTP loads, r=mconley

For HTTP loads from the preloaded document, no process swap was occuring
if the preloaded document was loaded in a 'web' process. This caused
test failures, and has potentially undesireable behaviour.

This patch just moves the check for preloaded document swaps to before
the check for http parent process interception, forcing a swap like
normal.

Depends on D19691

Differential Revision: https://phabricator.services.mozilla.com/D19692

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-02-14 15:14:10 +00:00
parent 1b032ecafb
commit ffb42b3322

View File

@ -323,6 +323,20 @@ var E10SUtils = {
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.
@ -347,8 +361,6 @@ var E10SUtils = {
}
// 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) {
@ -362,18 +374,6 @@ var E10SUtils = {
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);
},