Bug 1554781 - Part 4: Make the assertions after performing the checks not before. CLOSED TREE
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 29 May 2019 01:11:59 +0300
changeset 475980 1cc6b0c301281edc68ebefedc359645bf2921ccf
parent 475979 d4da7ac0f74c4c013bf01dec72411a8d36d65901
child 475981 6f75ea6173eb7f3e0e1a75e3da7e2d05471081d9
push id86570
push userrmaries@mozilla.com
push dateTue, 28 May 2019 22:39:06 +0000
treeherderautoland@1cc6b0c30128 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1554781
milestone69.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 1554781 - Part 4: Make the assertions after performing the checks not before. CLOSED TREE Pushed on a CLOSED TREE to fix bustage Differential Revision: https://phabricator.services.mozilla.com//D32901
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -778,29 +778,29 @@ AntiTrackingCommon::AddFirstPartyStorage
 
   Document* parentDoc = aParentWindow->GetExtantDoc();
   if (!parentDoc) {
     LOG(("Parent window has no doc"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
   int32_t behavior = parentDoc->CookieSettings()->GetCookieBehavior();
 
-  MOZ_ASSERT(
-      behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER ||
-      behavior ==
-          nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN);
-
   if (!parentDoc->CookieSettings()->GetRejectThirdPartyTrackers()) {
     LOG(
         ("Disabled by network.cookie.cookieBehavior pref (%d), bailing out "
          "early",
          behavior));
     return StorageAccessGrantPromise::CreateAndResolve(true, __func__);
   }
 
+  MOZ_ASSERT(
+      behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER ||
+      behavior ==
+          nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN);
+
   if (CheckContentBlockingAllowList(aParentWindow)) {
     return StorageAccessGrantPromise::CreateAndResolve(true, __func__);
   }
 
   nsCOMPtr<nsIPrincipal> topLevelStoragePrincipal;
   nsCOMPtr<nsIURI> trackingURI;
   nsAutoCString trackingOrigin;
   nsCOMPtr<nsIPrincipal> trackingPrincipal;