Bug 1038756: Callsites creating a channel in /intl/ (r=smontagu)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Sun, 21 Sep 2014 09:43:27 -0700
changeset 206520 da34da9570d26b7ec1d469f4e5f88b2bd11ff09b
parent 206519 3910656e0a2c47d7a16a0c2cea43c67c68095ffb
child 206521 5ea42524c416f1d27e83e6a8abff9647cae88f95
push id27529
push userryanvm@gmail.com
push dateMon, 22 Sep 2014 19:49:52 +0000
treeherdermozilla-central@f4037194394e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1038756
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1038756: Callsites creating a channel in /intl/ (r=smontagu)
intl/hyphenation/hnjstdio.cpp
intl/strres/nsStringBundle.cpp
intl/strres/nsStringBundleTextOverride.cpp
--- a/intl/hyphenation/hnjstdio.cpp
+++ b/intl/hyphenation/hnjstdio.cpp
@@ -6,16 +6,17 @@
 // This file provides substitutes for the basic stdio routines used by hyphen.c
 // to read its dictionary files. We #define the stdio names to these versions
 // in hnjalloc.h, so that we can use nsIURI and nsIInputStream to specify and
 // access the dictionary resources.
 
 #include "hnjalloc.h"
 #undef FILE // Undo the damage done in hnjalloc.h
 #include "nsNetUtil.h"
+#include "nsContentUtils.h"
 
 #define BUFSIZE 1024
 
 struct hnjFile_ {
     nsCOMPtr<nsIInputStream> mStream;
     char                     mBuffer[BUFSIZE];
     uint32_t                 mCurPos;
     uint32_t                 mLimit;
@@ -31,17 +32,22 @@ hnjFopen(const char* aURISpec, const cha
 
     nsCOMPtr<nsIURI> uri;
     nsresult rv = NS_NewURI(getter_AddRefs(uri), aURISpec);
     if (NS_FAILED(rv)) {
         return nullptr;
     }
 
     nsCOMPtr<nsIInputStream> instream;
-    rv = NS_OpenURI(getter_AddRefs(instream), uri);
+    rv = NS_OpenURI(getter_AddRefs(instream),
+                    uri,
+                    nsContentUtils::GetSystemPrincipal(),
+                    nsILoadInfo::SEC_NORMAL,
+                    nsIContentPolicy::TYPE_OTHER);
+
     if (NS_FAILED(rv)) {
         return nullptr;
     }
 
     hnjFile *f = new hnjFile;
     f->mStream = instream;
     f->mCurPos = 0;
     f->mLimit = 0;
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -15,16 +15,17 @@
 #include "nscore.h"
 #include "nsMemory.h"
 #include "nsNetUtil.h"
 #include "nsIObserverService.h"
 #include "nsCOMArray.h"
 #include "nsTextFormatter.h"
 #include "nsIErrorService.h"
 #include "nsICategoryManager.h"
+#include "nsContentUtils.h"
 
 // for async loading
 #ifdef ASYNC_LOADING
 #include "nsIBinaryInputStream.h"
 #include "nsIStringStream.h"
 #endif
 
 using namespace mozilla;
@@ -65,17 +66,22 @@ nsStringBundle::LoadProperties()
 
   // do it synchronously
   nsCOMPtr<nsIURI> uri;
   rv = NS_NewURI(getter_AddRefs(uri), mPropertiesURL);
   if (NS_FAILED(rv)) return rv;
 
   // We don't use NS_OpenURI because we want to tweak the channel
   nsCOMPtr<nsIChannel> channel;
-  rv = NS_NewChannel(getter_AddRefs(channel), uri);
+  rv = NS_NewChannel(getter_AddRefs(channel),
+                     uri,
+                     nsContentUtils::GetSystemPrincipal(),
+                     nsILoadInfo::SEC_NORMAL,
+                     nsIContentPolicy::TYPE_OTHER);
+
   if (NS_FAILED(rv)) return rv;
 
   // It's a string bundle.  We expect a text/plain type, so set that as hint
   channel->SetContentType(NS_LITERAL_CSTRING("text/plain"));
 
   nsCOMPtr<nsIInputStream> in;
   rv = channel->Open(getter_AddRefs(in));
   if (NS_FAILED(rv)) return rv;
--- a/intl/strres/nsStringBundleTextOverride.cpp
+++ b/intl/strres/nsStringBundleTextOverride.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "nsStringBundleTextOverride.h"
 #include "nsString.h"
 
 #include "nsNetUtil.h"
 #include "nsAppDirectoryServiceDefs.h"
+#include "nsContentUtils.h"
 
 // first we need a simple class which wraps a nsIPropertyElement and
 // cuts out the leading URL from the key
 class URLPropertyElement : public nsIPropertyElement
 {
 public:
     URLPropertyElement(nsIPropertyElement *aRealElement, uint32_t aURLLength) :
         mRealElement(aRealElement),
@@ -143,17 +144,22 @@ nsStringBundleTextOverride::Init()
     rv = NS_GetURLSpecFromFile(customStringsFile, customStringsURLSpec);
     if (NS_FAILED(rv)) return rv;
     
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), customStringsURLSpec);
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsIInputStream> in;
-    rv = NS_OpenURI(getter_AddRefs(in), uri);
+    rv = NS_OpenURI(getter_AddRefs(in),
+                    uri,
+                    nsContentUtils::GetSystemPrincipal(),
+                    nsILoadInfo::SEC_NORMAL,
+                    nsIContentPolicy::TYPE_OTHER);
+
     if (NS_FAILED(rv)) return rv;
 
     static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID);
     mValues = do_CreateInstance(kPersistentPropertiesCID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     rv = mValues->Load(in);