Bug 1063197 - Callsites of NS_NewInputStreamChannel in /content/base (r=jst)

This commit is contained in:
Christoph Kerschbaumer 2014-10-16 11:14:42 -07:00
parent 3ee3159b25
commit 554d4eeea3
2 changed files with 12 additions and 17 deletions

View File

@ -238,18 +238,15 @@ DOMParser::ParseFromStream(nsIInputStream *stream,
// Create a fake channel
nsCOMPtr<nsIChannel> parserChannel;
NS_NewInputStreamChannel(getter_AddRefs(parserChannel), mDocumentURI, nullptr,
nsDependentCString(contentType), nullptr);
NS_NewInputStreamChannel(getter_AddRefs(parserChannel),
mDocumentURI,
nullptr, // aStream
mOriginalPrincipal,
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER,
nsDependentCString(contentType));
NS_ENSURE_STATE(parserChannel);
// More principal-faking here
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(mOriginalPrincipal,
nullptr,
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER);
parserChannel->SetLoadInfo(loadInfo);
if (charset) {
parserChannel->SetContentCharset(nsDependentCString(charset));
}

View File

@ -519,7 +519,11 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
nsCOMPtr<nsIChannel> channel;
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
uri,
stream);
stream,
info->mPrincipal,
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER);
NS_ENSURE_SUCCESS(rv, rv);
nsString type;
@ -537,12 +541,6 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
return error.ErrorCode();
}
nsCOMPtr<nsILoadInfo> loadInfo =
new mozilla::LoadInfo(info->mPrincipal,
nullptr,
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER);
channel->SetLoadInfo(loadInfo);
channel->SetOriginalURI(uri);
channel->SetContentType(NS_ConvertUTF16toUTF8(type));
channel->SetContentLength(size);