Bug 1270680 - Part 3 - Get origin attributes from loadInfo in LoadImageWithChannel(). r=tanvi
authorJonathan Hao <jhao@mozilla.com>
Thu, 02 Jun 2016 20:50:00 +0200
changeset 300842 518708a725d51167927dc6f502115c031952a3bb
parent 300841 20ab9d3966135fb8e3b37660a8c85bf394ebdbda
child 300843 4ffe615e05a8e86b4a42d65b20701eeef7329791
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstanvi
bugs1270680
milestone50.0a1
Bug 1270680 - Part 3 - Get origin attributes from loadInfo in LoadImageWithChannel(). r=tanvi
image/imgLoader.cpp
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -2337,22 +2337,18 @@ imgLoader::LoadImageWithChannel(nsIChann
   nsCOMPtr<nsIURI> uri;
   channel->GetURI(getter_AddRefs(uri));
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(aCX);
 
   NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);
   nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
   NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
 
-  nsCOMPtr<nsIPrincipal> principal;
-  loadInfo->GetLoadingPrincipal(getter_AddRefs(principal));
-  NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
-
-  const PrincipalOriginAttributes& attrs =
-    BasePrincipal::Cast(principal)->OriginAttributesRef();
+  PrincipalOriginAttributes attrs;
+  attrs.InheritFromNecko(loadInfo->GetOriginAttributes());
 
   ImageCacheKey key(uri, attrs, doc);
 
   nsLoadFlags requestFlags = nsIRequest::LOAD_NORMAL;
   channel->GetLoadFlags(&requestFlags);
 
   RefPtr<imgCacheEntry> entry;