Bug 1367581 - don't bail out if the channel doesn't have loadInfo. r=valentin
authorYoshi Huang <allstars.chh@mozilla.com>
Fri, 26 May 2017 16:20:26 +0800
changeset 410767 1e31507a93b2a73a4b67a78bbe1bb9acf41f408b
parent 410766 59fa04c67e41e197fd16ff2f30fc92758564460b
child 410768 1253a062332e18fbd03b97918874df64d8e2a58b
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1367581
milestone55.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 1367581 - don't bail out if the channel doesn't have loadInfo. r=valentin
netwerk/base/nsNetUtil.cpp
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -1580,22 +1580,21 @@ NS_UsePrivateBrowsing(nsIChannel *channe
     return attrs.mPrivateBrowsingId > 0;
 }
 
 bool
 NS_GetOriginAttributes(nsIChannel *aChannel,
                        mozilla::OriginAttributes &aAttributes)
 {
     nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
-    if (!loadInfo) {
-        return false;
+    // For some channels, they might not have loadInfo, like ExternalHelperAppParent..
+    if (loadInfo) {
+        loadInfo->GetOriginAttributes(&aAttributes);
     }
 
-    loadInfo->GetOriginAttributes(&aAttributes);
-
     bool isPrivate = false;
     nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(aChannel);
     if (pbChannel) {
         nsresult rv = pbChannel->GetIsChannelPrivate(&isPrivate);
         NS_ENSURE_SUCCESS(rv, false);
     } else {
         // Some channels may not implement nsIPrivateBrowsingChannel
         nsCOMPtr<nsILoadContext> loadContext;