Bug 1493211 - Make the doubly nested iframe checks specific to requests coming from trackers r=baku a=pascalc
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 25 Sep 2018 22:20:19 +0000
changeset 490089 d72ddbe9798884935ea974e963c5c9e1d1a135b0
parent 490088 92308e03be8333fdc9cb8b48aa6ffd8e90d10564
child 490090 b404112c2f6ce82c177d5337cd99daf79bf51a37
push id9901
push userebalazs@mozilla.com
push dateThu, 27 Sep 2018 11:50:27 +0000
treeherdermozilla-beta@b404112c2f6c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, pascalc
bugs1493211
milestone63.0
Bug 1493211 - Make the doubly nested iframe checks specific to requests coming from trackers r=baku a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D6853
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -706,16 +706,22 @@ AntiTrackingCommon::IsFirstPartyStorageA
          "pretending our channel isn't a tracking channel"));
     return true;
   }
 
   if (CheckContentBlockingAllowList(aChannel)) {
     return true;
   }
 
+  // Not a tracker.
+  if (!aChannel->GetIsTrackingResource()) {
+    LOG(("Our channel isn't a tracking channel"));
+    return true;
+  }
+
   nsIPrincipal* parentPrincipal = loadInfo->TopLevelStorageAreaPrincipal();
   if (!parentPrincipal) {
     LOG(("No top-level storage area principal at hand"));
 
     // parentPrincipal can be null if the parent window is not the top-level
     // window.
     if (loadInfo->TopLevelPrincipal()) {
       LOG(("Parent window is the top-level window, bail out early"));
@@ -725,22 +731,16 @@ AntiTrackingCommon::IsFirstPartyStorageA
     parentPrincipal = toplevelPrincipal;
     if (NS_WARN_IF(!parentPrincipal)) {
       LOG(("No triggering principal, this shouldn't be happening! Bail out early"));
       // Why we are here?!?
       return true;
     }
   }
 
-  // Not a tracker.
-  if (!aChannel->GetIsTrackingResource()) {
-    LOG(("Our channel isn't a tracking channel"));
-    return true;
-  }
-
   // Let's see if we have to grant the access for this particular channel.
 
   nsCOMPtr<nsIURI> trackingURI;
   rv = aChannel->GetURI(getter_AddRefs(trackingURI));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     LOG(("Failed to get the channel URI"));
     return true;
   }