Skip to content

Commit

Permalink
Bug 1598516 - Enable DocumentChannel for all protocols, except for li…
Browse files Browse the repository at this point in the history
…st of known issues. r=kmag

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
mattwoodrow committed Nov 25, 2019
1 parent 63a154b commit 25f90b1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9523,9 +9523,9 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
}

static bool SchemeUsesDocChannel(nsIURI* aURI) {
return SchemeIsHTTP(aURI) || SchemeIsHTTPS(aURI) || aURI->SchemeIs("moz") ||
SchemeIsData(aURI) || SchemeIsFile(aURI) || SchemeIsFTP(aURI) ||
SchemeIsBlob(aURI);
return !SchemeIsJavascript(aURI) && !SchemeIsViewSource(aURI) &&
!NS_IsAboutBlank(aURI) &&
!aURI->GetSpecOrDefault().EqualsLiteral("about:printpreview");
}

/* static */ bool nsDocShell::CreateChannelForLoadState(
Expand All @@ -9534,8 +9534,16 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
uint32_t aCacheKey, bool aIsActive, bool aIsTopLevelDoc,
bool aHasNonEmptySandboxingFlags, nsresult& aRv, nsIChannel** aChannel) {
nsAutoString srcdoc;
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
if (isSrcdoc) {
srcdoc = aLoadState->SrcdocData();
} else {
srcdoc = VoidString();
}

if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
SchemeUsesDocChannel(aLoadState->URI())) {
SchemeUsesDocChannel(aLoadState->URI()) && !isSrcdoc) {
RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);
Expand All @@ -9546,14 +9554,6 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
}

nsCOMPtr<nsIChannel> channel;
nsAutoString srcdoc;
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
if (isSrcdoc) {
srcdoc = aLoadState->SrcdocData();
} else {
srcdoc = VoidString();
}

nsIURI* baseURI = aLoadState->BaseURI();
if (!isSrcdoc) {
aRv = NS_NewChannelInternal(getter_AddRefs(channel), aLoadState->URI(),
Expand Down

0 comments on commit 25f90b1

Please sign in to comment.