Bug 1530132 - Consider the cookie permission for the current request, ignoring the top-level one, r=Ehsan a=lizzard
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 07 Mar 2019 17:51:18 +0000
changeset 516331 9374f09f9b175e8cb258106e46d8392e3793949e
parent 516330 e8fd50fb1d542b3d357d9c67616ce59f63c8f9f9
child 516332 c6246eb414a5e174d8afdbd3c269845ec83c7a67
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, lizzard
bugs1530132
milestone66.0
Bug 1530132 - Consider the cookie permission for the current request, ignoring the top-level one, r=Ehsan a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D22456
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -889,33 +889,17 @@ bool AntiTrackingCommon::IsFirstPartySto
     LOG(
         ("Our inner window lacks a top-level principal, use the window's "
          "principal instead"));
     toplevelPrincipal = windowPrincipal;
   }
 
   MOZ_ASSERT(toplevelPrincipal);
 
-  nsCookieAccess access = CheckCookiePermissionForPrincipal(toplevelPrincipal);
-  if (access != nsICookiePermission::ACCESS_DEFAULT) {
-    LOG(
-        ("CheckCookiePermissionForPrincipal() returned a non-default access "
-         "code (%d) for top-level window's principal, returning %s",
-         int(access),
-         access != nsICookiePermission::ACCESS_DENY ? "success" : "failure"));
-    if (access != nsICookiePermission::ACCESS_DENY) {
-      return true;
-    }
-
-    *aRejectedReason =
-        nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION;
-    return false;
-  }
-
-  access = CheckCookiePermissionForPrincipal(windowPrincipal);
+  nsCookieAccess access = CheckCookiePermissionForPrincipal(windowPrincipal);
   if (access != nsICookiePermission::ACCESS_DEFAULT) {
     LOG(
         ("CheckCookiePermissionForPrincipal() returned a non-default access "
          "code (%d) for window's principal, returning %s",
          int(access),
          access != nsICookiePermission::ACCESS_DENY ? "success" : "failure"));
     if (access != nsICookiePermission::ACCESS_DENY) {
       return true;
@@ -1135,38 +1119,22 @@ bool AntiTrackingCommon::IsFirstPartySto
     toplevelPrincipal = loadInfo->TriggeringPrincipal();
   }
 
   if (NS_WARN_IF(!toplevelPrincipal)) {
     LOG(("No top-level principal! Bail out early"));
     return false;
   }
 
-  nsCookieAccess access = CheckCookiePermissionForPrincipal(toplevelPrincipal);
-  if (access != nsICookiePermission::ACCESS_DEFAULT) {
-    LOG(
-        ("CheckCookiePermissionForPrincipal() returned a non-default access "
-         "code (%d) for top-level window's principal, returning %s",
-         int(access),
-         access != nsICookiePermission::ACCESS_DENY ? "success" : "failure"));
-    if (access != nsICookiePermission::ACCESS_DENY) {
-      return true;
-    }
-
-    *aRejectedReason =
-        nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION;
-    return false;
-  }
-
   if (NS_WARN_IF(NS_FAILED(rv) || !channelURI)) {
     LOG(("No channel principal, bail out early"));
     return false;
   }
 
-  access = CheckCookiePermissionForURI(channelURI);
+  nsCookieAccess access = CheckCookiePermissionForURI(channelURI);
   if (access != nsICookiePermission::ACCESS_DEFAULT) {
     LOG(
         ("CheckCookiePermissionForPrincipal() returned a non-default access "
          "code (%d) for channel's principal, returning %s",
          int(access),
          access != nsICookiePermission::ACCESS_DENY ? "success" : "failure"));
     if (access != nsICookiePermission::ACCESS_DENY) {
       return true;