From 92c6b4b38d09cb3eda5a5ea2f9e41577e861c5bb Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Sun, 21 Sep 2014 09:44:12 -0700 Subject: [PATCH] Bug 1038756: Callsites creating a channel in /uriloader/ (r=honzab) --- uriloader/prefetch/nsOfflineCacheUpdate.cpp | 18 +++++++++++++++--- uriloader/prefetch/nsPrefetchService.cpp | 9 ++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index dad8159679ee..305296309206 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -40,6 +40,7 @@ #include "nsIAsyncVerifyRedirectCallback.h" #include "mozilla/Preferences.h" #include "mozilla/Attributes.h" +#include "nsContentUtils.h" #include "nsXULAppAPI.h" @@ -179,11 +180,16 @@ nsManifestCheck::Begin() rv = mManifestHash->Init(nsICryptoHash::MD5); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewChannel(getter_AddRefs(mChannel), mURI, - nullptr, nullptr, nullptr, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER, + nullptr, // aChannelPolicy + nullptr, // loadGroup + nullptr, // aCallbacks nsIRequest::LOAD_BYPASS_CACHE); + NS_ENSURE_SUCCESS(rv, rv); // configure HTTP specific stuff @@ -374,8 +380,14 @@ nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate) rv = NS_NewChannel(getter_AddRefs(mChannel), mURI, - nullptr, nullptr, this, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER, + nullptr, // aChannelPolicy + nullptr, // aLoadGroup + this, // aCallbacks flags); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr appCacheChannel = diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 89339500c1e1..ec5a601dd002 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -28,6 +28,7 @@ #include "nsIDOMNode.h" #include "nsINode.h" #include "nsIDocument.h" +#include "nsContentUtils.h" using namespace mozilla; @@ -188,9 +189,15 @@ nsPrefetchNode::OpenChannel() nsCOMPtr loadGroup = source->OwnerDoc()->GetDocumentLoadGroup(); nsresult rv = NS_NewChannel(getter_AddRefs(mChannel), mURI, - nullptr, loadGroup, this, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER, + nullptr, // aChannelPolicy + loadGroup, // aLoadGroup + this, // aCallbacks nsIRequest::LOAD_BACKGROUND | nsICachingChannel::LOAD_ONLY_IF_MODIFIED); + NS_ENSURE_SUCCESS(rv, rv); // configure HTTP specific stuff