Bug 1038756: Callsites creating a channel in /modules/ (r=mwu)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Sun, 21 Sep 2014 09:44:56 -0700
changeset 206526 5b066ef38ccfc4d837a2096f15f281f781873509
parent 206525 49775ca3647ff7cfdc0beede30afd3820ede559a
child 206527 d6bd6192791b1fb8cda878bfa248b3827802eac5
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)
reviewersmwu
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 /modules/ (r=mwu)
modules/libjar/nsJARChannel.cpp
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -9,16 +9,17 @@
 #include "nsJARProtocolHandler.h"
 #include "nsMimeTypes.h"
 #include "nsNetUtil.h"
 #include "nsEscape.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIViewSourceChannel.h"
 #include "nsChannelProperties.h"
+#include "nsContentUtils.h"
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsIFileURL.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/net/RemoteOpenFileChild.h"
 #include "nsITabChild.h"
@@ -851,20 +852,41 @@ nsJARChannel::AsyncOpen(nsIStreamListene
     mListener = listener;
     mListenerContext = ctx;
     mIsPending = true;
 
     if (!mJarFile) {
         // Not a local file...
         // kick off an async download of the base URI...
         rv = NS_NewDownloader(getter_AddRefs(mDownloader), this);
-        if (NS_SUCCEEDED(rv))
-            rv = NS_OpenURI(mDownloader, nullptr, mJarBaseURI, nullptr,
-                            mLoadGroup, mCallbacks,
-                            mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS));
+        if (NS_SUCCEEDED(rv)) {
+            // Since we might not have a loadinfo on all channels yet
+            // we have to provide default arguments in case mLoadInfo is null;
+            if (mLoadInfo) {
+              rv = NS_OpenURIInternal(mDownloader,
+                                      nullptr,   // aContext
+                                      mJarBaseURI,
+                                      mLoadInfo,
+                                      mLoadGroup,
+                                      mCallbacks,
+                                      mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS));
+            }
+            else {
+              rv = NS_OpenURIInternal(mDownloader,
+                                      nullptr,   // aContext
+                                      mJarBaseURI,
+                                      nullptr, // aRequestingNode,
+                                      nsContentUtils::GetSystemPrincipal(),
+                                      nsILoadInfo::SEC_NORMAL,
+                                      nsIContentPolicy::TYPE_OTHER,
+                                      mLoadGroup,
+                                      mCallbacks,
+                                      mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS));
+            }
+        }
     } else if (mOpeningRemote) {
         // nothing to do: already asked parent to open file.
     } else {
         rv = OpenLocalFile();
     }
 
     if (NS_FAILED(rv)) {
         mIsPending = false;