Bug 1589102 - Part 3: Enable about:blank loads to take place via DocumentChannel, r=mattwoodrow

In process selection logic, ensure that we don't use the original URI for
about:blank and instead use the result principal. If the about:blank load has a
null principal, then revert to using the original URI.

Also, remove an extra about:blank load when an nsFrameLoaderOwner is changing
remoteness to prevent races.

Differential Revision: https://phabricator.services.mozilla.com/D85081
This commit is contained in:
Anny Gakhokidze 2020-08-05 16:44:11 +00:00
Родитель 05b0ef78c2
Коммит 1f4b006e42
3 изменённых файлов: 11 добавлений и 19 удалений

Просмотреть файл

@ -248,14 +248,6 @@ void nsFrameLoaderOwner::ChangeRemotenessToProcess(
aContentParent);
}
// FIXME(bug 1644779): We'd like to stop triggering a load here, as this
// reads the attributes, such as `src`, on the <browser> element, and could
// start another load which will be clobbered shortly.
//
// This is OK for now, as we're mimicing the existing process switching
// behaviour, and <browser> elements created by tabbrowser don't have the
// `src` attribute specified.
mFrameLoader->LoadFrame(false);
};
auto shouldPreserve =

Просмотреть файл

@ -151,7 +151,7 @@ nsDocShell* DocumentChannel::GetDocShell() {
// Changes here should also be made in
// E10SUtils.documentChannelPermittedForURI().
static bool URIUsesDocChannel(nsIURI* aURI) {
if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) {
if (SchemeIsJavascript(aURI)) {
return false;
}

Просмотреть файл

@ -126,11 +126,7 @@ const kSafeSchemes = [
];
const kDocumentChannelDeniedSchemes = ["javascript"];
const kDocumentChannelDeniedURIs = [
"about:blank",
"about:crashcontent",
"about:printpreview",
];
const kDocumentChannelDeniedURIs = ["about:crashcontent", "about:printpreview"];
// Changes here should also be made in URIUsesDocChannel in DocumentChannel.cpp.
function documentChannelPermittedForURI(aURI) {
@ -581,12 +577,14 @@ var E10SUtils = {
return NOT_REMOTE;
}
// We want to use the original URI for "about:" (except for "about:srcdoc")
// and "chrome://" scheme, so that we can properly determine
// the remote type.
// We want to use the original URI for "about:" (except for "about:srcdoc"
// and "about:blank") and "chrome://" scheme, so that we can properly
// determine the remote type.
let useOriginalURI;
if (aOriginalURI.scheme == "about") {
useOriginalURI = !["srcdoc"].includes(aOriginalURI.spec);
useOriginalURI = !["about:srcdoc", "about:blank"].includes(
aOriginalURI.spec
);
} else {
useOriginalURI = aOriginalURI.scheme == "chrome";
}
@ -602,7 +600,9 @@ var E10SUtils = {
// using fission we add the option to force them into the default
// web process for better test coverage.
if (aPrincipal.isNullPrincipal) {
if (
if (aOriginalURI.spec == "about:blank") {
useOriginalURI = true;
} else if (
(aRemoteSubframes && useSeparateDataUriProcess) ||
aPreferredRemoteType == NOT_REMOTE
) {