Bug 1291652 - Part 1: Return origin attributes from nsILoadInfo in NS_GetOriginAttributes. r=sicking
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 22 Aug 2016 08:42:00 -0400
changeset 311000 2e78bdf4f0225f46dab2c362f7621cd06d7c5203
parent 310999 fa4d738b6664ed3f4ffde80a8538d3994bead884
child 311001 8001a9bfcf429b31fcfc80b95fd476464b9e80cb
push id20386
push userryanvm@gmail.com
push dateThu, 25 Aug 2016 12:13:22 +0000
treeherderfx-team@9467a563a01b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1291652
milestone51.0a1
Bug 1291652 - Part 1: Return origin attributes from nsILoadInfo in NS_GetOriginAttributes. r=sicking
netwerk/base/nsNetUtil.cpp
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -1246,35 +1246,22 @@ NS_UsePrivateBrowsing(nsIChannel *channe
     NS_QueryNotificationCallbacks(channel, loadContext);
     return loadContext && loadContext->UsePrivateBrowsing();
 }
 
 bool
 NS_GetOriginAttributes(nsIChannel *aChannel,
                        mozilla::NeckoOriginAttributes &aAttributes)
 {
-    nsCOMPtr<nsILoadContext> loadContext;
     nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
-    NS_QueryNotificationCallbacks(aChannel, loadContext);
-
-    if (!loadContext && !loadInfo) {
+    if (!loadInfo) {
         return false;
     }
 
-    // Bug 1270678 - By default, we would acquire the originAttributes from
-    // the loadContext. But in some cases, say, loading the favicon, that the
-    // loadContext is not available. We would use the loadInfo to get
-    // originAttributes instead.
-    if (loadContext) {
-        DocShellOriginAttributes doa;
-        loadContext->GetOriginAttributes(doa);
-        aAttributes.InheritFromDocShellToNecko(doa);
-    } else {
-        loadInfo->GetOriginAttributes(&aAttributes);
-    }
+    loadInfo->GetOriginAttributes(&aAttributes);
     aAttributes.SyncAttributesWithPrivateBrowsing(NS_UsePrivateBrowsing(aChannel));
     return true;
 }
 
 bool
 NS_GetAppInfo(nsIChannel *aChannel,
               uint32_t *aAppID,
               bool *aIsInIsolatedMozBrowserElement)