Bug 1063197 - Callsites of NS_NewInputStreamChannel in /docshell/ (r=bz)

This commit is contained in:
Christoph Kerschbaumer 2014-10-16 11:17:29 -07:00
parent 54f91e7d05
commit cb8e0f1b25

View File

@ -1655,12 +1655,25 @@ nsDocShell::LoadStream(nsIInputStream *aStream, nsIURI * aURI,
mLoadType = loadType;
nsCOMPtr<nsISupports> owner;
aLoadInfo->GetOwner(getter_AddRefs(owner));
nsCOMPtr<nsIPrincipal> requestingPrincipal = do_QueryInterface(owner);
if (!requestingPrincipal) {
requestingPrincipal = nsContentUtils::GetSystemPrincipal();
}
// build up a channel for this stream.
nsCOMPtr<nsIChannel> channel;
NS_ENSURE_SUCCESS(NS_NewInputStreamChannel
(getter_AddRefs(channel), uri, aStream,
aContentType, aContentCharset),
NS_ERROR_FAILURE);
nsresult rv =
NS_NewInputStreamChannel(getter_AddRefs(channel),
uri,
aStream,
requestingPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER,
aContentType,
aContentCharset);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIURILoader>
uriLoader(do_GetService(NS_URI_LOADER_CONTRACTID));
@ -10266,19 +10279,6 @@ nsDocShell::DoURILoad(nsIURI * aURI,
rv = vsh->NewSrcdocChannel(aURI, aSrcdoc, aBaseURI,
getter_AddRefs(channel));
NS_ENSURE_SUCCESS(rv, rv);
}
else {
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),aURI,
aSrcdoc,
NS_LITERAL_CSTRING("text/html"),
true);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(channel);
MOZ_ASSERT(isc);
isc->SetBaseURI(aBaseURI);
}
// NS_NewInputStreamChannel does not yet attach the loadInfo in nsNetutil.h,
// hence we have to manually attach the loadInfo for that channel.
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(requestingPrincipal,
requestingNode,
@ -10286,6 +10286,22 @@ nsDocShell::DoURILoad(nsIURI * aURI,
aContentPolicyType);
channel->SetLoadInfo(loadInfo);
}
else {
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
aURI,
aSrcdoc,
NS_LITERAL_CSTRING("text/html"),
requestingNode,
requestingPrincipal,
securityFlags,
aContentPolicyType,
true);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(channel);
MOZ_ASSERT(isc);
isc->SetBaseURI(aBaseURI);
}
}
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(channel);