Bug 1588412 - (part 2) moz:// documents should use documentchannel r=mattwoodrow

the URL moz://a redirects to mozilla's website, Because it redirects to
https we want to use documentchannel.

Depends on D49100

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Bone 2019-10-31 18:36:56 +00:00
Родитель ed9e37bf0c
Коммит cf2f204b52
1 изменённых файлов: 4 добавлений и 3 удалений

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

@ -9599,8 +9599,9 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
return aTriggeringPrincipal->Equals(tmpResultPrincipal);
}
static bool HasHttpScheme(nsIURI* aURI) {
return aURI && (aURI->SchemeIs("http") || aURI->SchemeIs("https"));
static bool SchemeUsesDocChannel(nsIURI* aURI) {
return aURI && (aURI->SchemeIs("http") || aURI->SchemeIs("https") ||
aURI->SchemeIs("moz"));
}
/* static */ bool nsDocShell::CreateChannelForLoadState(
@ -9610,7 +9611,7 @@ static bool HasHttpScheme(nsIURI* aURI) {
uint32_t aCacheKey, bool aIsActive, bool aIsTopLevelDoc,
bool aHasNonEmptySandboxingFlags, nsresult& aRv, nsIChannel** aChannel) {
if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
HasHttpScheme(aLoadState->URI())) {
SchemeUsesDocChannel(aLoadState->URI())) {
RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);