Backed out 5 changesets (bug 1597154) for Mochitest error in docshell/test/mochitest/test_bug529119-2.html. CLOSED TREE

Backed out changeset 051d6f3a237c (bug 1597154)
Backed out changeset 8f8a663e3118 (bug 1597154)
Backed out changeset 1638767d4977 (bug 1597154)
Backed out changeset cc9c332c22a6 (bug 1597154)
Backed out changeset 9580b0a08782 (bug 1597154)
This commit is contained in:
Dorel Luca
2020-01-16 07:44:40 +02:00
parent 0bca8615d3
commit 58ecbd79df
3 changed files with 21 additions and 43 deletions

View File

@@ -8994,10 +8994,9 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
} }
// Check if the webbrowser chrome wants the load to proceed; this can be // Check if the webbrowser chrome wants the load to proceed; this can be
// used to cancel attempts to load URIs in the wrong process. use // used to cancel attempts to load URIs in the wrong process.
// GetPendingRedirectedChannel() to avoid revisiting a redirect decision.
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner); nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
if (browserChrome3 && !aLoadState->GetPendingRedirectedChannel()) { if (browserChrome3) {
bool shouldLoad; bool shouldLoad;
rv = browserChrome3->ShouldLoadURI( rv = browserChrome3->ShouldLoadURI(
this, aLoadState->URI(), aLoadState->GetReferrerInfo(), this, aLoadState->URI(), aLoadState->GetReferrerInfo(),
@@ -9374,9 +9373,7 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
return NS_OK; return NS_OK;
} }
// Changes here should also be made in static bool SchemeUsesDocChannel(nsIURI* aURI) {
// E10SUtils.documentChannelPermittedForURI().
static bool URIUsesDocChannel(nsIURI* aURI) {
if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) { if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) {
return false; return false;
} }
@@ -9985,7 +9982,7 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
bool canUseDocumentChannel = bool canUseDocumentChannel =
aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC) aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC)
? (sandboxFlags & SANDBOXED_ORIGIN) ? (sandboxFlags & SANDBOXED_ORIGIN)
: URIUsesDocChannel(aLoadState->URI()); : SchemeUsesDocChannel(aLoadState->URI());
if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() && if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
canUseDocumentChannel) { canUseDocumentChannel) {

View File

@@ -137,21 +137,7 @@ const kSafeSchemes = [
"xmpp", "xmpp",
]; ];
const kDocumentChannelDeniedSchemes = ["javascript"]; const kDocumentChannelAllowedSchemes = ["http", "https", "ftp", "data"];
const kDocumentChannelDeniedURIs = [
"about:blank",
"about:printpreview",
"about:privatebrowsing",
"about:crashcontent",
];
// Changes here should also be made in URIUsesDocChannel in nsDocShell.cpp.
function documentChannelPermittedForURI(aURI) {
return (
!kDocumentChannelDeniedSchemes.includes(aURI.scheme) &&
!kDocumentChannelDeniedURIs.includes(aURI.spec)
);
}
// Note that even if the scheme fits the criteria for a web-handled scheme // Note that even if the scheme fits the criteria for a web-handled scheme
// (ie it is compatible with the checks registerProtocolHandler uses), it may // (ie it is compatible with the checks registerProtocolHandler uses), it may
@@ -738,10 +724,9 @@ var E10SUtils = {
// for now, and let DocumentChannel do it during the response. // for now, and let DocumentChannel do it during the response.
if ( if (
currentRemoteType != NOT_REMOTE && currentRemoteType != NOT_REMOTE &&
requiredRemoteType != NOT_REMOTE &&
uriObject && uriObject &&
(remoteSubframes || documentChannel) && (remoteSubframes || documentChannel) &&
documentChannelPermittedForURI(uriObject) kDocumentChannelAllowedSchemes.includes(uriObject.scheme)
) { ) {
mustChangeProcess = false; mustChangeProcess = false;
} }
@@ -803,6 +788,20 @@ var E10SUtils = {
return false; 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 (
Services.appinfo.remoteType != NOT_REMOTE &&
(useRemoteSubframes || documentChannel) &&
kDocumentChannelAllowedSchemes.includes(aURI.scheme)
) {
return true;
}
// If we are in a Large-Allocation process, and it wouldn't be content visible // If we are in a Large-Allocation process, and it wouldn't be content visible
// to change processes, we want to load into a new process so that we can throw // to change processes, we want to load into a new process so that we can throw
// this one out. We don't want to move into a new process if we have post data, // this one out. We don't want to move into a new process if we have post data,
@@ -844,25 +843,6 @@ var E10SUtils = {
); );
} }
// If we are using DocumentChannel or remote subframes (fission), we
// can start the load in the current process, and then perform the
// switch later-on using the nsIProcessSwitchRequestor mechanism.
let wantRemoteType = this.getRemoteTypeForURIObject(
aURI,
true,
useRemoteSubframes,
Services.appinfo.remoteType,
webNav.currentURI
);
if (
(useRemoteSubframes || documentChannel) &&
Services.appinfo.remoteType != NOT_REMOTE &&
wantRemoteType != NOT_REMOTE &&
documentChannelPermittedForURI(aURI)
) {
return true;
}
// If the URI can be loaded in the current process then continue // If the URI can be loaded in the current process then continue
return this.shouldLoadURIInThisProcess(aURI, useRemoteSubframes); return this.shouldLoadURIInThisProcess(aURI, useRemoteSubframes);
}, },

View File

@@ -12,5 +12,6 @@ support-files =
[browser_download_always_ask_preferred_app.js] [browser_download_always_ask_preferred_app.js]
[browser_download_privatebrowsing.js] [browser_download_privatebrowsing.js]
[browser_protocolhandler_loop.js] [browser_protocolhandler_loop.js]
skip-if = fission # Bug 1597154
[browser_remember_download_option.js] [browser_remember_download_option.js]
[browser_web_protocol_handlers.js] [browser_web_protocol_handlers.js]