Bug 1063197 - Callsites of NS_NewInputStreamChannel in /rdf/ (r=bsmedberg)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Thu, 16 Oct 2014 11:17:14 -0700
changeset 210811 3de863f08848a5dce83576e01ddc323005d4d17a
parent 210810 547202c856b4fe2893b637603a217af8449eec78
child 210812 9eeedb28b328098a331eaf49101c87f6bef74d5b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbsmedberg
bugs1063197
milestone36.0a1
Bug 1063197 - Callsites of NS_NewInputStreamChannel in /rdf/ (r=bsmedberg)
rdf/base/nsRDFXMLParser.cpp
--- a/rdf/base/nsRDFXMLParser.cpp
+++ b/rdf/base/nsRDFXMLParser.cpp
@@ -8,16 +8,17 @@
 
 #include "nsIComponentManager.h"
 #include "nsIParser.h"
 #include "nsCharsetSource.h"
 #include "nsIRDFContentSink.h"
 #include "nsParserCIID.h"
 #include "nsStringStream.h"
 #include "nsNetUtil.h"
+#include "nsNullPrincipal.h"
 
 static NS_DEFINE_CID(kParserCID, NS_PARSER_CID);
 
 NS_IMPL_ISUPPORTS(nsRDFXMLParser, nsIRDFXMLParser)
 
 nsresult
 nsRDFXMLParser::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
 {
@@ -109,18 +110,27 @@ nsRDFXMLParser::ParseString(nsIRDFDataSo
 
     if (! listener)
         return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIInputStream> stream;
     rv = NS_NewCStringInputStream(getter_AddRefs(stream), aString);
     if (NS_FAILED(rv)) return rv;
 
+    nsCOMPtr<nsIPrincipal> nullPrincipal =
+      do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+
     nsCOMPtr<nsIChannel> channel;
-    rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aBaseURI, stream,
+    rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
+                                  aBaseURI,
+                                  stream,
+                                  nullPrincipal,
+                                  nsILoadInfo::SEC_NORMAL,
+                                  nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING("text/xml"));
     if (NS_FAILED(rv)) return rv;
 
     listener->OnStartRequest(channel, nullptr);
     listener->OnDataAvailable(channel, nullptr, stream, 0, aString.Length());
     listener->OnStopRequest(channel, nullptr, NS_OK);
 
     return NS_OK;