Bug 1530132 - Consider the cookie permission for the current request, ignoring the top-level one, r=Ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 07 Mar 2019 17:51:18 +0000
changeset 523862 12d0f0ba867ac82759ad8f21e8cc99b815e35300
parent 523861 e038e06397ad7ad63e52bda514979d7dfc3f6133
child 523863 8e68d1422ad6ad99e8b0b602c549ef4115ffa067
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1530132
milestone67.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 1530132 - Consider the cookie permission for the current request, ignoring the top-level one, r=Ehsan 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
@@ -1078,33 +1078,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;
@@ -1320,38 +1304,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;