зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1597154 - pt 3. Defer to documentchannel for process switching for all schemes r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D58899 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c31347cc28
Коммит
6557402e10
|
@ -9374,6 +9374,8 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Changes here should also be made in
|
||||||
|
// E10SUtils.documentChannelPermittedForURI().
|
||||||
static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||||
if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) {
|
if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -137,7 +137,22 @@ const kSafeSchemes = [
|
||||||
"xmpp",
|
"xmpp",
|
||||||
];
|
];
|
||||||
|
|
||||||
const kDocumentChannelAllowedSchemes = ["http", "https", "ftp", "data"];
|
const kDocumentChannelDeniedSchemes = ["javascript"];
|
||||||
|
const kDocumentChannelDeniedURIs = [
|
||||||
|
"about:blank",
|
||||||
|
"about:printpreview",
|
||||||
|
"about:privatebrowsing",
|
||||||
|
"about:crashcontent",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Changes here should also be made in SchemeUsesDocChannel 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
|
||||||
|
@ -724,9 +739,10 @@ 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) &&
|
||||||
kDocumentChannelAllowedSchemes.includes(uriObject.scheme)
|
documentChannelPermittedForURI(uriObject)
|
||||||
) {
|
) {
|
||||||
mustChangeProcess = false;
|
mustChangeProcess = false;
|
||||||
}
|
}
|
||||||
|
@ -788,18 +804,6 @@ var E10SUtils = {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are using DocumentChannel or remote subframes (fission), and
|
|
||||||
// are loading a HTTP URI, we can start the load in the current
|
|
||||||
// process, and then perform the switch later-on using the
|
|
||||||
// RedirectProcessChooser mechanism.
|
|
||||||
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,
|
||||||
|
@ -841,6 +845,25 @@ 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);
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче