Bug 1063197 - Callsites of NS_NewInputStreamChannel in /extensions/ (r=karlt)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Thu, 16 Oct 2014 11:15:21 -0700
changeset 210807 eabbbfc948650f076dc00ed72ca240a541dca8cf
parent 210806 7921e44f3544d21d1d3e688fa9762467f589e816
child 210808 dff13898998d9516fef0bbb460937a148d972aa0
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskarlt
bugs1063197
milestone36.0a1
Bug 1063197 - Callsites of NS_NewInputStreamChannel in /extensions/ (r=karlt)
extensions/gio/nsGIOProtocolHandler.cpp
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -12,16 +12,17 @@
 #include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
 #include "nsMimeTypes.h"
 #include "nsNetUtil.h"
+#include "nsNullPrincipal.h"
 #include "mozilla/Monitor.h"
 #include <gio/gio.h>
 #include <algorithm>
 
 #define MOZ_GIO_SCHEME              "moz-gio"
 #define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols"
 
 //-----------------------------------------------------------------------------
@@ -1057,21 +1058,28 @@ nsGIOProtocolHandler::NewChannel(nsIURI 
 
   nsRefPtr<nsGIOInputStream> stream = new nsGIOInputStream(spec);
   if (!stream)
   {
     rv = NS_ERROR_OUT_OF_MEMORY;
   }
   else
   {
+    nsCOMPtr<nsIPrincipal> nullPrincipal =
+      do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+
     // start out assuming an unknown content-type.  we'll set the content-type
     // to something better once we open the URI.
     rv = NS_NewInputStreamChannel(aResult,
                                   aURI,
                                   stream,
+                                  nullPrincipal,
+                                  nsILoadInfo::SEC_NORMAL,
+                                  nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE));
     if (NS_SUCCEEDED(rv))
       stream->SetChannel(*aResult);
   }
   return rv;
 }
 
 NS_IMETHODIMP