From 554d4eeea35c17c842bf78181a18aaca0bba758c Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Thu, 16 Oct 2014 11:14:42 -0700 Subject: [PATCH] Bug 1063197 - Callsites of NS_NewInputStreamChannel in /content/base (r=jst) --- content/base/src/DOMParser.cpp | 17 +++++++---------- .../base/src/nsHostObjectProtocolHandler.cpp | 12 +++++------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/content/base/src/DOMParser.cpp b/content/base/src/DOMParser.cpp index 04d169424ce..b9bec3e69b6 100644 --- a/content/base/src/DOMParser.cpp +++ b/content/base/src/DOMParser.cpp @@ -238,18 +238,15 @@ DOMParser::ParseFromStream(nsIInputStream *stream, // Create a fake channel nsCOMPtr 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 loadInfo = - new LoadInfo(mOriginalPrincipal, - nullptr, - nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL, - nsIContentPolicy::TYPE_OTHER); - parserChannel->SetLoadInfo(loadInfo); - if (charset) { parserChannel->SetContentCharset(nsDependentCString(charset)); } diff --git a/content/base/src/nsHostObjectProtocolHandler.cpp b/content/base/src/nsHostObjectProtocolHandler.cpp index bf04e2d533f..0a7ed3a4661 100644 --- a/content/base/src/nsHostObjectProtocolHandler.cpp +++ b/content/base/src/nsHostObjectProtocolHandler.cpp @@ -519,7 +519,11 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result) nsCOMPtr 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 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);