Bug 1584479 - Part 1: Add flag for blocked social cookies in the content blocking log. r=Ehsan,droeh
authorNihanth Subramanya <nhnt11@gmail.com>
Fri, 01 Nov 2019 23:24:25 +0000
changeset 500279 3ff3e93332d0ead5eb222f7f64b890fbc936edc6
parent 500278 9fccb38453a4fc43b21784c850d4236fdea7d489
child 500280 d0f91ad7450c157ed94c5fd70b51f80d8ad3303b
push id99500
push usernhnt11@gmail.com
push dateSat, 02 Nov 2019 09:56:01 +0000
treeherderautoland@16aac90f6572 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, droeh
bugs1584479
milestone72.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 1584479 - Part 1: Add flag for blocked social cookies in the content blocking log. r=Ehsan,droeh Differential Revision: https://phabricator.services.mozilla.com/D47427
dom/base/ContentBlockingLog.cpp
dom/base/ContentBlockingLog.h
dom/base/Document.h
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/ipc/RemoteWebProgressRequest.cpp
mobile/android/geckoview/api.txt
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlockingController.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
netwerk/base/nsIClassifiedChannel.idl
netwerk/cookie/CookieServiceChild.cpp
netwerk/cookie/CookieServiceChild.h
netwerk/cookie/CookieServiceParent.cpp
netwerk/cookie/CookieServiceParent.h
netwerk/cookie/PCookieService.ipdl
netwerk/cookie/nsCookieService.cpp
netwerk/cookie/nsCookieService.h
netwerk/ipc/DocumentChannelChild.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/url-classifier/UrlClassifierCommon.cpp
netwerk/url-classifier/UrlClassifierCommon.h
security/manager/ssl/nsSecureBrowserUIImpl.cpp
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/antitracking/AntiTrackingCommon.h
toolkit/components/antitracking/StorageAccess.cpp
toolkit/components/antitracking/TrackingDBService.jsm
uriloader/base/nsIWebProgressListener.idl
--- a/dom/base/ContentBlockingLog.cpp
+++ b/dom/base/ContentBlockingLog.cpp
@@ -162,18 +162,20 @@ void ContentBlockingLog::ReportOrigins()
 
   nsTArray<HashNumber> lookupTable;
   for (const auto& originEntry : mLog) {
     if (!originEntry.mData) {
       continue;
     }
 
     for (const auto& logEntry : Reversed(originEntry.mData->mLogs)) {
-      if (logEntry.mType !=
-              nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
+      if ((logEntry.mType !=
+               nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER &&
+           logEntry.mType !=
+               nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) ||
           logEntry.mTrackingFullHashes.IsEmpty()) {
         continue;
       }
 
       const bool isBlocked = logEntry.mBlocked;
       Maybe<StorageAccessGrantedReason> reason = logEntry.mReason;
 
       metricId = testMode ? OriginMetricID::ContentBlocking_Blocked_TestOnly
--- a/dom/base/ContentBlockingLog.h
+++ b/dom/base/ContentBlockingLog.h
@@ -79,17 +79,18 @@ class ContentBlockingLog final {
   ContentBlockingLog() = default;
   ~ContentBlockingLog() = default;
 
   void RecordLog(
       const nsACString& aOrigin, uint32_t aType, bool aBlocked,
       const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason,
       const nsTArray<nsCString>& aTrackingFullHashes) {
     DebugOnly<bool> isCookiesBlockedTracker =
-        aType == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
+        aType == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
+        aType == nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER;
     MOZ_ASSERT_IF(aBlocked, aReason.isNothing());
     MOZ_ASSERT_IF(!isCookiesBlockedTracker, aReason.isNothing());
     MOZ_ASSERT_IF(isCookiesBlockedTracker && !aBlocked, aReason.isSome());
 
     if (aOrigin.IsVoid()) {
       return;
     }
     auto index = mLog.IndexOf(aOrigin, 0, Comparator());
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1161,16 +1161,24 @@ class Document : public nsINode,
    * Get tracking cookies blocked flag for this document.
    */
   bool GetHasTrackingCookiesBlocked() {
     return mContentBlockingLog.HasBlockedAnyOfType(
         nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER);
   }
 
   /**
+   * Get social tracking cookies blocked flag for this document.
+   */
+  bool GetHasSocialTrackingCookiesBlocked() {
+    return mContentBlockingLog.HasBlockedAnyOfType(
+        nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER);
+  }
+
+  /**
    * Get third-party cookies blocked flag for this document.
    */
   bool GetHasForeignCookiesBlocked() {
     return mContentBlockingLog.HasBlockedAnyOfType(
         nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
   }
 
   /**
@@ -1242,16 +1250,29 @@ class Document : public nsINode,
       const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason,
       const nsTArray<nsCString>& aTrackingFullHashes) {
     RecordContentBlockingLog(
         aOriginBlocked, nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
         aHasTrackingCookiesBlocked, aReason, aTrackingFullHashes);
   }
 
   /**
+   * Set the social tracking cookies blocked flag for this document.
+   */
+  void SetHasSocialTrackingCookiesBlocked(
+      bool aHasSocialTrackingCookiesBlocked, const nsACString& aOriginBlocked,
+      const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason,
+      const nsTArray<nsCString>& aTrackingFullHashes) {
+    RecordContentBlockingLog(
+        aOriginBlocked,
+        nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER,
+        aHasSocialTrackingCookiesBlocked, aReason, aTrackingFullHashes);
+  }
+
+  /**
    * Set the third-party cookies blocked flag for this document.
    */
   void SetHasForeignCookiesBlocked(bool aHasForeignCookiesBlocked,
                                    const nsACString& aOriginBlocked) {
     RecordContentBlockingLog(
         aOriginBlocked, nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN,
         aHasForeignCookiesBlocked);
   }
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -4473,17 +4473,18 @@ Storage* nsGlobalWindowInner::GetSession
     //
     // 2. Third-party cookies are limited via BEHAVIOR_REJECT_FOREIGN and
     // BEHAVIOR_LIMIT_FOREIGN and this is a third-party window. This will return
     // eDeny with a reason of STATE_COOKIES_BLOCKED_FOREIGN.
     //
     // 3. Tracking protection (BEHAVIOR_REJECT_TRACKER) is in effect and
     // IsThirdPartyTrackingResourceWindow() returned true and there wasn't a
     // permission that allows it. This will return ePartitionTrackersOrDeny with
-    // a reason of STATE_COOKIES_BLOCKED_TRACKER.
+    // a reason of STATE_COOKIES_BLOCKED_TRACKER or
+    // STATE_COOKIES_BLOCKED_SOCIALTRACKER.
     //
     // In the 1st case, the user has explicitly indicated that they don't want
     // to allow any storage to the origin or all origins and so we throw an
     // error and deny access to SessionStorage. In the 2nd case, a legacy
     // decision reasoned that there's no harm in providing SessionStorage
     // because the information is not durable and cannot escape the current tab.
     // The rationale is similar for the 3rd case.
     if (access == StorageAccess::eDeny &&
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5385,17 +5385,18 @@ void nsGlobalWindowOuter::FirePopupBlock
 
 void nsGlobalWindowOuter::NotifyContentBlockingEvent(
     unsigned aEvent, nsIChannel* aChannel, bool aBlocked, nsIURI* aURIHint,
     nsIChannel* aTrackingChannel,
     const mozilla::Maybe<AntiTrackingCommon::StorageAccessGrantedReason>&
         aReason) {
   MOZ_ASSERT(aURIHint);
   DebugOnly<bool> isCookiesBlockedTracker =
-      aEvent == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
+      aEvent == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
+      aEvent == nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER;
   MOZ_ASSERT_IF(aBlocked, aReason.isNothing());
   MOZ_ASSERT_IF(!isCookiesBlockedTracker, aReason.isNothing());
   MOZ_ASSERT_IF(isCookiesBlockedTracker && !aBlocked, aReason.isSome());
 
   nsCOMPtr<nsIDocShell> docShell = GetDocShell();
   if (!docShell) {
     return;
   }
@@ -5495,16 +5496,29 @@ void nsGlobalWindowOuter::NotifyContentB
                 trackingFullHashes);
           }
           doc->SetHasTrackingCookiesBlocked(aBlocked, origin, aReason,
                                             trackingFullHashes);
 
           if (!aBlocked) {
             unblocked = !doc->GetHasTrackingCookiesBlocked();
           }
+        } else if (aEvent == nsIWebProgressListener::
+                                 STATE_COOKIES_BLOCKED_SOCIALTRACKER) {
+          nsTArray<nsCString> trackingFullHashes;
+          if (trackingChannel) {
+            Unused << trackingChannel->GetMatchedTrackingFullHashes(
+                trackingFullHashes);
+          }
+          doc->SetHasSocialTrackingCookiesBlocked(aBlocked, origin, aReason,
+                                                  trackingFullHashes);
+
+          if (!aBlocked) {
+            unblocked = !doc->GetHasSocialTrackingCookiesBlocked();
+          }
         } else if (aEvent ==
                    nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL) {
           doc->SetHasAllCookiesBlocked(aBlocked, origin);
           if (!aBlocked) {
             unblocked = !doc->GetHasAllCookiesBlocked();
           }
         } else if (aEvent ==
                    nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN) {
--- a/dom/ipc/RemoteWebProgressRequest.cpp
+++ b/dom/ipc/RemoteWebProgressRequest.cpp
@@ -234,16 +234,22 @@ RemoteWebProgressRequest::IsTrackingReso
 
 NS_IMETHODIMP
 RemoteWebProgressRequest::IsThirdPartyTrackingResource(
     bool* aIsTrackingResource) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
+RemoteWebProgressRequest::IsSocialTrackingResource(
+    bool* aIsSocialTrackingResource) {
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
 RemoteWebProgressRequest::GetClassificationFlags(
     uint32_t* aClassificationFlags) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 RemoteWebProgressRequest::GetFirstPartyClassificationFlags(
     uint32_t* aClassificationFlags) {
--- a/mobile/android/geckoview/api.txt
+++ b/mobile/android/geckoview/api.txt
@@ -269,16 +269,17 @@ package org.mozilla.geckoview {
     field public static final int BLOCKED_CRYPTOMINING_CONTENT = 2048;
     field public static final int BLOCKED_FINGERPRINTING_CONTENT = 64;
     field public static final int BLOCKED_SOCIALTRACKING_CONTENT = 65536;
     field public static final int BLOCKED_TRACKING_CONTENT = 4096;
     field public static final int BLOCKED_UNSAFE_CONTENT = 16384;
     field public static final int COOKIES_BLOCKED_ALL = 1073741824;
     field public static final int COOKIES_BLOCKED_BY_PERMISSION = 268435456;
     field public static final int COOKIES_BLOCKED_FOREIGN = 128;
+    field public static final int COOKIES_BLOCKED_SOCIALTRACKER = 16777216;
     field public static final int COOKIES_BLOCKED_TRACKER = 536870912;
     field public static final int COOKIES_LOADED = 32768;
     field public static final int COOKIES_LOADED_SOCIALTRACKER = 524288;
     field public static final int COOKIES_LOADED_TRACKER = 262144;
     field public static final int COOKIES_PARTITIONED_FOREIGN = -2147483648;
     field public static final int LOADED_CRYPTOMINING_CONTENT = 2097152;
     field public static final int LOADED_FINGERPRINTING_CONTENT = 1024;
     field public static final int LOADED_SOCIALTRACKING_CONTENT = 131072;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java
@@ -822,23 +822,25 @@ public class ContentBlocking {
         return SafeBrowsing.NONE;
     }
 
     // Match flags with nsIWebProgressListener.idl.
     private static final long STATE_COOKIES_LOADED = 0x8000L;
     private static final long STATE_COOKIES_LOADED_TRACKER = 0x40000L;
     private static final long STATE_COOKIES_LOADED_SOCIALTRACKER = 0x80000L;
     private static final long STATE_COOKIES_BLOCKED_TRACKER = 0x20000000L;
+    private static final long STATE_COOKIES_BLOCKED_SOCIALTRACKER = 0x01000000L;
     private static final long STATE_COOKIES_BLOCKED_ALL = 0x40000000L;
     private static final long STATE_COOKIES_BLOCKED_FOREIGN = 0x80L;
 
     /* package */ static boolean isBlockingGeckoCbCat(final long geckoCat) {
         return
             (geckoCat &
                 (STATE_COOKIES_BLOCKED_TRACKER |
+                 STATE_COOKIES_BLOCKED_SOCIALTRACKER |
                  STATE_COOKIES_BLOCKED_ALL |
                  STATE_COOKIES_BLOCKED_FOREIGN))
             != 0;
     }
 
     /* package */ static @CBCookieBehavior int geckoCatToCbCat(
             final long geckoCat) {
         if ((geckoCat & STATE_COOKIES_LOADED) != 0) {
@@ -847,16 +849,17 @@ public class ContentBlocking {
             return CookieBehavior.ACCEPT_NONE;
         }
         if ((geckoCat & STATE_COOKIES_BLOCKED_FOREIGN) != 0) {
             return CookieBehavior.ACCEPT_FIRST_PARTY;
         }
         // If we receive STATE_COOKIES_LOADED_{SOCIAL,}TRACKER we know that this
         // setting would block this cookie.
         if ((geckoCat & (STATE_COOKIES_BLOCKED_TRACKER |
+                         STATE_COOKIES_BLOCKED_SOCIALTRACKER |
                          STATE_COOKIES_LOADED_TRACKER |
                          STATE_COOKIES_LOADED_SOCIALTRACKER)) != 0) {
             return CookieBehavior.ACCEPT_NON_TRACKERS;
         }
         if ((geckoCat & STATE_COOKIES_BLOCKED_ALL) != 0) {
             return CookieBehavior.ACCEPT_NONE;
         }
         // TODO: There are more reasons why cookies may be blocked.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlockingController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlockingController.java
@@ -271,16 +271,22 @@ public class ContentBlockingController {
 
         /**
          * Rejected because the resource is a tracker and cookie policy doesn't
          * allow its loading.
          */
         public static final int COOKIES_BLOCKED_TRACKER         = 0x20000000;
 
         /**
+         * Rejected because the resource is a tracker from a social origin and
+         * cookie policy doesn't allow its loading.
+         */
+        public static final int COOKIES_BLOCKED_SOCIALTRACKER   = 0x01000000;
+
+        /**
          * Rejected because cookie policy blocks all cookies.
          */
         public static final int COOKIES_BLOCKED_ALL             = 0x40000000;
 
         /**
          * Rejected because the resource is a third-party and cookie policy forces
          * third-party resources to be partitioned.
          */
@@ -315,19 +321,19 @@ public class ContentBlockingController {
         public static class BlockingData {
             @Retention(RetentionPolicy.SOURCE)
             @IntDef({ Event.BLOCKED_TRACKING_CONTENT, Event.LOADED_TRACKING_CONTENT,
                       Event.BLOCKED_FINGERPRINTING_CONTENT, Event.LOADED_FINGERPRINTING_CONTENT,
                       Event.BLOCKED_CRYPTOMINING_CONTENT, Event.LOADED_CRYPTOMINING_CONTENT,
                       Event.BLOCKED_UNSAFE_CONTENT, Event.COOKIES_LOADED,
                       Event.COOKIES_LOADED_TRACKER, Event.COOKIES_LOADED_SOCIALTRACKER,
                       Event.COOKIES_BLOCKED_BY_PERMISSION, Event.COOKIES_BLOCKED_TRACKER,
-                      Event.COOKIES_BLOCKED_ALL, Event.COOKIES_PARTITIONED_FOREIGN,
-                      Event.COOKIES_BLOCKED_FOREIGN, Event.BLOCKED_SOCIALTRACKING_CONTENT,
-                      Event.LOADED_SOCIALTRACKING_CONTENT })
+                      Event.COOKIES_BLOCKED_SOCIALTRACKER, Event.COOKIES_BLOCKED_ALL,
+                      Event.COOKIES_PARTITIONED_FOREIGN, Event.COOKIES_BLOCKED_FOREIGN,
+                      Event.BLOCKED_SOCIALTRACKING_CONTENT, Event.LOADED_SOCIALTRACKING_CONTENT })
             /* package */ @interface LogEvent {}
 
             /**
              * A category the entry falls under.
              */
             public final @LogEvent int category;
 
             /**
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
@@ -9,16 +9,18 @@ exclude: true
 {% capture javadoc_uri %}{{ site.url }}{{ site.baseurl}}/javadoc/mozilla-central/org/mozilla/geckoview{% endcapture %}
 {% capture bugzilla %}https://bugzilla.mozilla.org/show_bug.cgi?id={% endcapture %}
 
 # GeckoView API Changelog.
 
 ⚠️  breaking change
 
 ## v71
+- Added a content blocking flag for blocked social cookies to [`ContentBlocking`][70.17].
+  ([bug 1584479]({{bugzilla}}1584479))
 - Added [`onBooleanScalar`][71.1], [`onLongScalar`][71.2],
   [`onStringScalar`][71.3] to [`RuntimeTelemetry.Delegate`][70.12] to support
   scalars in streaming telemetry. ⚠️  As part of this change,
   `onTelemetryReceived` has been renamed to [`onHistogram`][71.4], and
   [`Metric`][71.5] now takes a type parameter.
   ([bug 1576730]({{bugzilla}}1576730))
 - Added overloads of [`GeckoSession.loadUri`][71.6] that accept a map of
   additional HTTP request headers.
@@ -397,9 +399,9 @@ exclude: true
 [65.19]: {{javadoc_uri}}/GeckoSession.NavigationDelegate.LoadRequest.html#isRedirect
 [65.20]: {{javadoc_uri}}/GeckoSession.html#LOAD_FLAGS_BYPASS_CLASSIFIER    
 [65.21]: {{javadoc_uri}}/GeckoSession.ContentDelegate.ContextElement.html
 [65.22]: {{javadoc_uri}}/GeckoSession.ContentDelegate.html#onContextMenu-org.mozilla.geckoview.GeckoSession-int-int-org.mozilla.geckoview.GeckoSession.ContentDelegate.ContextElement-
 [65.23]: {{javadoc_uri}}/GeckoSession.FinderResult.html
 [65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
 [65.25]: {{javadoc_uri}}/GeckoResult.html
 
-[api-version]: 6a71a9226b15eb40fb47f5da7400915f29fb4986
+[api-version]: 950568652bacb957f8af2a3cd68b4408eccbf78d
--- a/netwerk/base/nsIClassifiedChannel.idl
+++ b/netwerk/base/nsIClassifiedChannel.idl
@@ -146,17 +146,18 @@ interface nsIClassifiedChannel : nsISupp
       CLASSIFIED_SOCIALTRACKING_LINKEDIN | CLASSIFIED_SOCIALTRACKING_TWITTER,
   };
 
   /**
    * Returns true if the channel has loaded a resource that is classified as
    * tracker.
    * This is a helper attribute which returns the same value of
    * (classificationFlags & CLASSIFIED_ANY_BASIC_TRACKING) or
-   * (classificationFlags & CLASSIFIED_ANY_STRICT_TRACKING)
+   * (classificationFlags & CLASSIFIED_ANY_STRICT_TRACKING) or
+   * (classificationFlags & CLASSIFIED_ANY_SOCIAL_TRACKING)
    *
    * Note that top-level channels could be marked as tracking
    * resource. In order to identify third-party tracking resources
    * specifically, use isThirdPartyTrackingResource().
    */
   boolean isTrackingResource();
 
 %{ C++
@@ -166,29 +167,54 @@ interface nsIClassifiedChannel : nsISupp
     if (NS_SUCCEEDED(IsTrackingResource(&value)) && value) {
       return true;
     }
     return false;
   }
 %}
 
   /**
-   * Returns the classification flags if the channel has been processed by
-   * URL-Classifier features and is considered third-party with the top
-   * window URI.
+   * Returns true  if the channel has been processed by URL-Classifier features
+   * and is considered third-party with the top window URI, and if it has loaded
+   * a resource that is classified as a tracker.
    *
    * This is a helper attribute which returns the same value of
    * (thirdPartyClassificationFlags & CLASSIFIED_ANY_BASIC_TRACKING) or
-   * (thirdPartyClassificationFlags & CLASSIFIED_ANY_STRICT_TRACKING)
+   * (thirdPartyClassificationFlags & CLASSIFIED_ANY_STRICT_TRACKING) or
+   * (thirdPartyClassificationFlags & CLASSIFIED_ANY_SOCIAL_TRACKING)
    */
   boolean isThirdPartyTrackingResource();
 
 %{ C++
   inline bool IsThirdPartyTrackingResource()
   {
     bool value = false;
     if (NS_SUCCEEDED(IsThirdPartyTrackingResource(&value)) && value) {
       return true;
     }
     return false;
   }
 %}
+
+  /**
+   * Returns true if the channel has loaded a resource that is classified as
+   * a social tracker.
+   *
+   * This is a helper attribute which returns the same value of
+   * (classificationFlags & CLASSIFIED_ANY_SOCIAL_TRACKING)
+   *
+   * Note that top-level channels could be marked as tracking
+   * resources. In order to identify third-party social tracking resources
+   * specifically, check the flags manually or add a new helper here.
+   */
+  boolean isSocialTrackingResource();
+
+%{ C++
+  inline bool IsSocialTrackingResource()
+  {
+    bool value = false;
+    if (NS_SUCCEEDED(IsSocialTrackingResource(&value)) && value) {
+      return true;
+    }
+    return false;
+  }
+%}
 };
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -131,28 +131,30 @@ CookieServiceChild::~CookieServiceChild(
 
 void CookieServiceChild::TrackCookieLoad(nsIChannel* aChannel) {
   if (!CanSend()) {
     return;
   }
 
   bool isForeign = false;
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIURI> uri;
   aChannel->GetURI(getter_AddRefs(uri));
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
   if (RequireThirdPartyCheck(loadInfo)) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, uri, &isForeign);
   }
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (isForeign && AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
                          aChannel, uri, &rejectedReason)) {
       firstPartyStorageAccessGranted = true;
     }
 
@@ -167,16 +169,17 @@ void CookieServiceChild::TrackCookieLoad
   }
   mozilla::OriginAttributes attrs = loadInfo->GetOriginAttributes();
   StoragePrincipalHelper::PrepareOriginAttributes(aChannel, attrs);
   URIParams uriParams;
   SerializeURI(uri, uriParams);
   bool isSafeTopLevelNav = NS_IsSafeTopLevelNav(aChannel);
   bool isSameSiteForeign = NS_IsSameSiteForeign(aChannel, uri);
   SendPrepareCookieList(uriParams, isForeign, isTrackingResource,
+                        isSocialTrackingResource,
                         firstPartyStorageAccessGranted, rejectedReason,
                         isSafeTopLevelNav, isSameSiteForeign, attrs);
 }
 
 mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveAll() {
   mCookiesMap.Clear();
   return IPC_OK();
 }
@@ -260,19 +263,19 @@ void CookieServiceChild::PrefChanged(nsI
     if (mCookieTimer) {
       mCookieTimer->SetDelay(gMoveCookiesIntervalSeconds * 1000);
     }
   }
 }
 
 void CookieServiceChild::GetCookieStringFromCookieHashTable(
     nsIURI* aHostURI, bool aIsForeign, bool aIsTrackingResource,
-    bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
-    bool aIsSafeTopLevelNav, bool aIsSameSiteForeign, nsIChannel* aChannel,
-    nsACString& aCookieString) {
+    bool aIsSocialTrackingResource, bool aFirstPartyStorageAccessGranted,
+    uint32_t aRejectedReason, bool aIsSafeTopLevelNav, bool aIsSameSiteForeign,
+    nsIChannel* aChannel, nsACString& aCookieString) {
   nsCOMPtr<nsIEffectiveTLDService> TLDService =
       do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
   NS_ASSERTION(TLDService, "Can't get TLDService");
   bool requireHostMatch;
   nsAutoCString baseDomain;
 
   nsCOMPtr<nsILoadInfo> loadInfo;
   mozilla::OriginAttributes attrs;
@@ -299,17 +302,17 @@ void CookieServiceChild::GetCookieString
   int64_t currentTimeInUsec = PR_Now();
   int64_t currentTime = currentTimeInUsec / PR_USEC_PER_SEC;
 
   nsCOMPtr<nsICookieSettings> cookieSettings =
       nsCookieService::GetCookieSettings(aChannel);
 
   CookieStatus cookieStatus = nsCookieService::CheckPrefs(
       cookieSettings, aHostURI, aIsForeign, aIsTrackingResource,
-      aFirstPartyStorageAccessGranted, VoidCString(),
+      aIsSocialTrackingResource, aFirstPartyStorageAccessGranted, VoidCString(),
       CountCookiesFromHashTable(baseDomain, attrs), attrs, &aRejectedReason);
 
   if (cookieStatus != STATUS_ACCEPTED &&
       cookieStatus != STATUS_ACCEPT_SESSION) {
     return;
   }
 
   cookiesList->Sort(CompareCookiesForSending());
@@ -466,38 +469,40 @@ nsresult CookieServiceChild::GetCookieSt
   // Asynchronously call the parent.
   bool isForeign = true;
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel ? aChannel->LoadInfo() : nullptr;
   if (RequireThirdPartyCheck(loadInfo)) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
   }
 
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (isForeign && AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
                          aChannel, aHostURI, &rejectedReason)) {
       firstPartyStorageAccessGranted = true;
     }
   }
 
   bool isSafeTopLevelNav = NS_IsSafeTopLevelNav(aChannel);
   bool isSameSiteForeign = NS_IsSameSiteForeign(aChannel, aHostURI);
 
   GetCookieStringFromCookieHashTable(
-      aHostURI, isForeign, isTrackingResource, firstPartyStorageAccessGranted,
-      rejectedReason, isSafeTopLevelNav, isSameSiteForeign, aChannel,
-      aCookieString);
+      aHostURI, isForeign, isTrackingResource, isSocialTrackingResource,
+      firstPartyStorageAccessGranted, rejectedReason, isSafeTopLevelNav,
+      isSameSiteForeign, aChannel, aCookieString);
 
   return NS_OK;
 }
 
 nsresult CookieServiceChild::SetCookieStringInternal(
     nsIURI* aHostURI, nsIChannel* aChannel, const nsACString& aCookieString,
     const nsACString& aServerTime, bool aFromHttp) {
   NS_ENSURE_ARG(aHostURI);
@@ -511,22 +516,24 @@ nsresult CookieServiceChild::SetCookieSt
   // Determine whether the request is foreign. Failure is acceptable.
   bool isForeign = true;
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel ? aChannel->LoadInfo() : nullptr;
   if (RequireThirdPartyCheck(loadInfo)) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
   }
 
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (isForeign && AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
                          aChannel, aHostURI, &rejectedReason)) {
       firstPartyStorageAccessGranted = true;
     }
   }
@@ -551,32 +558,32 @@ nsresult CookieServiceChild::SetCookieSt
   }
 
   Maybe<LoadInfoArgs> optionalLoadInfoArgs;
   LoadInfoToLoadInfoArgs(loadInfo, &optionalLoadInfoArgs);
 
   // Asynchronously call the parent.
   if (CanSend()) {
     SendSetCookieString(hostURIParams, channelURIParams, optionalLoadInfoArgs,
-                        isForeign, isTrackingResource,
+                        isForeign, isTrackingResource, isSocialTrackingResource,
                         firstPartyStorageAccessGranted, rejectedReason, attrs,
                         cookieString, nsCString(aServerTime), aFromHttp);
   }
 
   bool requireHostMatch;
   nsCString baseDomain;
   nsCookieService::GetBaseDomain(mTLDService, aHostURI, baseDomain,
                                  requireHostMatch);
 
   nsCOMPtr<nsICookieSettings> cookieSettings =
       nsCookieService::GetCookieSettings(aChannel);
 
   CookieStatus cookieStatus = nsCookieService::CheckPrefs(
       cookieSettings, aHostURI, isForeign, isTrackingResource,
-      firstPartyStorageAccessGranted, aCookieString,
+      isSocialTrackingResource, firstPartyStorageAccessGranted, aCookieString,
       CountCookiesFromHashTable(baseDomain, attrs), attrs, &rejectedReason);
 
   if (cookieStatus != STATUS_ACCEPTED &&
       cookieStatus != STATUS_ACCEPT_SESSION) {
     return NS_OK;
   }
 
   nsCookieKey key(baseDomain, attrs);
--- a/netwerk/cookie/CookieServiceChild.h
+++ b/netwerk/cookie/CookieServiceChild.h
@@ -56,19 +56,19 @@ class CookieServiceChild : public PCooki
                      nsCString& aOriginatingSpec,
                      nsCString& aOriginatingCharset);
 
   nsresult GetCookieStringInternal(nsIURI* aHostURI, nsIChannel* aChannel,
                                    nsACString& aCookieString);
 
   void GetCookieStringFromCookieHashTable(
       nsIURI* aHostURI, bool aIsForeign, bool aIsTrackingResource,
-      bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
-      bool aIsSafeTopLevelNav, bool aIsSameSiteForeign, nsIChannel* aChannel,
-      nsACString& aCookieString);
+      bool aIsSocialTrackingResource, bool aFirstPartyStorageAccessGranted,
+      uint32_t aRejectedReason, bool aIsSafeTopLevelNav,
+      bool aIsSameSiteForeign, nsIChannel* aChannel, nsACString& aCookieString);
 
   nsresult SetCookieStringInternal(nsIURI* aHostURI, nsIChannel* aChannel,
                                    const nsACString& aCookieString,
                                    const nsACString& aServerTime,
                                    bool aFromHttp);
 
   void RecordDocumentCookie(nsCookie* aCookie, const OriginAttributes& aAttrs);
 
--- a/netwerk/cookie/CookieServiceParent.cpp
+++ b/netwerk/cookie/CookieServiceParent.cpp
@@ -115,36 +115,38 @@ void CookieServiceParent::TrackCookieLoa
 
   // Send matching cookies to Child.
   nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil;
   thirdPartyUtil = do_GetService(THIRDPARTYUTIL_CONTRACTID);
   bool isForeign = true;
   thirdPartyUtil->IsThirdPartyChannel(aChannel, uri, &isForeign);
 
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool storageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
             aChannel, uri, &rejectedReason)) {
       storageAccessGranted = true;
     }
   }
 
   nsTArray<nsCookie*> foundCookieList;
-  mCookieService->GetCookiesForURI(uri, aChannel, isForeign, isTrackingResource,
-                                   storageAccessGranted, rejectedReason,
-                                   isSafeTopLevelNav, aIsSameSiteForeign, false,
-                                   attrs, foundCookieList);
+  mCookieService->GetCookiesForURI(
+      uri, aChannel, isForeign, isTrackingResource, isSocialTrackingResource,
+      storageAccessGranted, rejectedReason, isSafeTopLevelNav,
+      aIsSameSiteForeign, false, attrs, foundCookieList);
   nsTArray<CookieStruct> matchingCookiesList;
   SerialializeCookieList(foundCookieList, matchingCookiesList, uri);
   Unused << SendTrackCookiesLoad(matchingCookiesList, attrs);
 }
 
 void CookieServiceParent::SerialializeCookieList(
     const nsTArray<nsCookie*>& aFoundCookieList,
     nsTArray<CookieStruct>& aCookiesList, nsIURI* aHostURI) {
@@ -156,46 +158,47 @@ void CookieServiceParent::SerialializeCo
       // Value only needs to exist if an HttpOnly cookie exists.
       cookieStruct->value() = "";
     }
   }
 }
 
 mozilla::ipc::IPCResult CookieServiceParent::RecvPrepareCookieList(
     const URIParams& aHost, const bool& aIsForeign,
-    const bool& aIsTrackingResource,
+    const bool& aIsTrackingResource, const bool& aIsSocialTrackingResource,
     const bool& aFirstPartyStorageAccessGranted,
     const uint32_t& aRejectedReason, const bool& aIsSafeTopLevelNav,
     const bool& aIsSameSiteForeign, const OriginAttributes& aAttrs) {
   nsCOMPtr<nsIURI> hostURI = DeserializeURI(aHost);
 
   // Send matching cookies to Child.
   nsTArray<nsCookie*> foundCookieList;
   // Note: passing nullptr as aChannel to GetCookiesForURI() here is fine since
   // this argument is only used for proper reporting of cookie loads, but the
   // child process already does the necessary reporting in this case for us.
   mCookieService->GetCookiesForURI(
       hostURI, nullptr, aIsForeign, aIsTrackingResource,
-      aFirstPartyStorageAccessGranted, aRejectedReason, aIsSafeTopLevelNav,
-      aIsSameSiteForeign, false, aAttrs, foundCookieList);
+      aIsSocialTrackingResource, aFirstPartyStorageAccessGranted,
+      aRejectedReason, aIsSafeTopLevelNav, aIsSameSiteForeign, false, aAttrs,
+      foundCookieList);
   nsTArray<CookieStruct> matchingCookiesList;
   SerialializeCookieList(foundCookieList, matchingCookiesList, hostURI);
   Unused << SendTrackCookiesLoad(matchingCookiesList, aAttrs);
   return IPC_OK();
 }
 
 void CookieServiceParent::ActorDestroy(ActorDestroyReason aWhy) {
   // Nothing needed here. Called right before destructor since this is a
   // non-refcounted class.
 }
 
 mozilla::ipc::IPCResult CookieServiceParent::RecvSetCookieString(
     const URIParams& aHost, const Maybe<URIParams>& aChannelURI,
     const Maybe<LoadInfoArgs>& aLoadInfoArgs, const bool& aIsForeign,
-    const bool& aIsTrackingResource,
+    const bool& aIsTrackingResource, const bool& aIsSocialTrackingResource,
     const bool& aFirstPartyStorageAccessGranted,
     const uint32_t& aRejectedReason, const OriginAttributes& aAttrs,
     const nsCString& aCookieString, const nsCString& aServerTime,
     const bool& aFromHttp) {
   if (!mCookieService) return IPC_OK();
 
   // Deserialize URI. Having a host URI is mandatory and should always be
   // provided by the child; thus we consider failure fatal.
@@ -225,17 +228,17 @@ mozilla::ipc::IPCResult CookieServicePar
 
   // NB: dummyChannel could be null if something failed in CreateDummyChannel.
   nsDependentCString cookieString(aCookieString, 0);
 
   // We set this to true while processing this cookie update, to make sure
   // we don't send it back to the same content process.
   mProcessingCookie = true;
   mCookieService->SetCookieStringInternal(
-      hostURI, aIsForeign, aIsTrackingResource, aFirstPartyStorageAccessGranted,
-      aRejectedReason, cookieString, aServerTime, aFromHttp, aAttrs,
-      dummyChannel);
+      hostURI, aIsForeign, aIsTrackingResource, aIsSocialTrackingResource,
+      aFirstPartyStorageAccessGranted, aRejectedReason, cookieString,
+      aServerTime, aFromHttp, aAttrs, dummyChannel);
   mProcessingCookie = false;
   return IPC_OK();
 }
 
 }  // namespace net
 }  // namespace mozilla
--- a/netwerk/cookie/CookieServiceParent.h
+++ b/netwerk/cookie/CookieServiceParent.h
@@ -42,25 +42,25 @@ class CookieServiceParent : public PCook
   bool ProcessingCookie() { return mProcessingCookie; }
 
  protected:
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   mozilla::ipc::IPCResult RecvSetCookieString(
       const URIParams& aHost, const Maybe<URIParams>& aChannelURI,
       const Maybe<LoadInfoArgs>& aLoadInfoArgs, const bool& aIsForeign,
-      const bool& aIsTrackingResource,
+      const bool& aIsTrackingResource, const bool& aIsSocialTrackingResource,
       const bool& aFirstPartyStorageAccessGranted,
       const uint32_t& aRejectedReason, const OriginAttributes& aAttrs,
       const nsCString& aCookieString, const nsCString& aServerTime,
       const bool& aFromHttp);
 
   mozilla::ipc::IPCResult RecvPrepareCookieList(
       const URIParams& aHost, const bool& aIsForeign,
-      const bool& aIsTrackingResource,
+      const bool& aIsTrackingResource, const bool& aIsSocialTrackingResource,
       const bool& aFirstPartyStorageAccessGranted,
       const uint32_t& aRejectedReason, const bool& aIsSafeTopLevelNav,
       const bool& aIsSameSiteForeign, const OriginAttributes& aAttrs);
 
   void SerialializeCookieList(const nsTArray<nsCookie*>& aFoundCookieList,
                               nsTArray<CookieStruct>& aCookiesList,
                               nsIURI* aHostURI);
 
--- a/netwerk/cookie/PCookieService.ipdl
+++ b/netwerk/cookie/PCookieService.ipdl
@@ -69,26 +69,28 @@ parent:
    * @see nsICookieService.setCookieStringFromHttp
    * @see mozIThirdPartyUtil.isThirdPartyChannel
    */
   nested(inside_cpow) async SetCookieString(URIParams host,
                                             URIParams? channelURI,
                                             LoadInfoArgs? loadInfoArgs,
                                             bool isForeign,
                                             bool isTrackingResource,
+                                            bool isSocialTrackingResource,
                                             bool firstPartyStorageAccessGranted,
                                             uint32_t rejectedReason,
                                             OriginAttributes aStoragePrincipalAttrs,
                                             nsCString cookieString,
                                             nsCString serverTime,
                                             bool aFromHttp);
 
   async PrepareCookieList(URIParams host,
                           bool isForeign,
                           bool isTrackingResource,
+                          bool isSocialTrackingResource,
                           bool firstPartyStorageAccessGranted,
                           uint32_t rejectedReason,
                           bool isSafeTopLevelNav,
                           bool isSameSiteForeign,
                           OriginAttributes attrs);
 
   async __delete__();
 
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -2006,22 +2006,24 @@ nsresult nsCookieService::GetCookieStrin
   // Determine whether the request is foreign. Failure is acceptable.
   bool isForeign = true;
 
   if (aChannel) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
   }
 
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
 
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
             aChannel, aHostURI, &rejectedReason)) {
       firstPartyStorageAccessGranted = true;
     }
@@ -2030,20 +2032,20 @@ nsresult nsCookieService::GetCookieStrin
   OriginAttributes attrs;
   if (aChannel) {
     NS_GetOriginAttributes(aChannel, attrs,
                            true /* considering storage principal */);
   }
 
   bool isSafeTopLevelNav = NS_IsSafeTopLevelNav(aChannel);
   bool isSameSiteForeign = NS_IsSameSiteForeign(aChannel, aHostURI);
-  GetCookieStringInternal(aHostURI, aChannel, isForeign, isTrackingResource,
-                          firstPartyStorageAccessGranted, rejectedReason,
-                          isSafeTopLevelNav, isSameSiteForeign, aHttpBound,
-                          attrs, aCookie);
+  GetCookieStringInternal(
+      aHostURI, aChannel, isForeign, isTrackingResource,
+      isSocialTrackingResource, firstPartyStorageAccessGranted, rejectedReason,
+      isSafeTopLevelNav, isSameSiteForeign, aHttpBound, attrs, aCookie);
   return NS_OK;
 }
 
 // static
 already_AddRefed<nsICookieSettings> nsCookieService::GetCookieSettings(
     nsIChannel* aChannel) {
   nsCOMPtr<nsICookieSettings> cookieSettings;
   if (aChannel) {
@@ -2129,22 +2131,24 @@ nsresult nsCookieService::SetCookieStrin
   // Determine whether the request is foreign. Failure is acceptable.
   bool isForeign = true;
 
   if (aChannel) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
   }
 
   bool isTrackingResource = false;
+  bool isSocialTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   uint32_t rejectedReason = 0;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (classifiedChannel) {
     isTrackingResource = classifiedChannel->IsTrackingResource();
+    isSocialTrackingResource = classifiedChannel->IsSocialTrackingResource();
 
     // Check first-party storage access even for non-tracking resources, since
     // we will need the result when computing the access rights for the reject
     // foreign cookie behavior mode.
     if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
             aChannel, aHostURI, &rejectedReason)) {
       firstPartyStorageAccessGranted = true;
     }
@@ -2153,25 +2157,27 @@ nsresult nsCookieService::SetCookieStrin
   OriginAttributes attrs;
   if (aChannel) {
     NS_GetOriginAttributes(aChannel, attrs,
                            true /* considering storage principal */);
   }
 
   nsCString cookieString(aCookieHeader);
   SetCookieStringInternal(
-      aHostURI, isForeign, isTrackingResource, firstPartyStorageAccessGranted,
-      rejectedReason, cookieString, aServerTime, aFromHttp, attrs, aChannel);
+      aHostURI, isForeign, isTrackingResource, isSocialTrackingResource,
+      firstPartyStorageAccessGranted, rejectedReason, cookieString, aServerTime,
+      aFromHttp, attrs, aChannel);
   return NS_OK;
 }
 
 void nsCookieService::SetCookieStringInternal(
     nsIURI* aHostURI, bool aIsForeign, bool aIsTrackingResource,
-    bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
-    nsCString& aCookieHeader, const nsACString& aServerTime, bool aFromHttp,
+    bool aIsSocialTrackingResource, bool aFirstPartyStorageAccessGranted,
+    uint32_t aRejectedReason, nsCString& aCookieHeader,
+    const nsACString& aServerTime, bool aFromHttp,
     const OriginAttributes& aOriginAttrs, nsIChannel* aChannel) {
   NS_ASSERTION(aHostURI, "null host!");
 
   if (!mDBState) {
     NS_WARNING("No DBState! Profile already closed?");
     return;
   }
 
@@ -2200,20 +2206,20 @@ void nsCookieService::SetCookieStringInt
   nsCOMPtr<nsICookieSettings> cookieSettings = GetCookieSettings(aChannel);
 
   // check default prefs
   uint32_t priorCookieCount = 0;
   uint32_t rejectedReason = aRejectedReason;
   nsAutoCString hostFromURI;
   aHostURI->GetHost(hostFromURI);
   CountCookiesFromHost(hostFromURI, &priorCookieCount);
-  CookieStatus cookieStatus =
-      CheckPrefs(cookieSettings, aHostURI, aIsForeign, aIsTrackingResource,
-                 aFirstPartyStorageAccessGranted, aCookieHeader,
-                 priorCookieCount, aOriginAttrs, &rejectedReason);
+  CookieStatus cookieStatus = CheckPrefs(
+      cookieSettings, aHostURI, aIsForeign, aIsTrackingResource,
+      aIsSocialTrackingResource, aFirstPartyStorageAccessGranted, aCookieHeader,
+      priorCookieCount, aOriginAttrs, &rejectedReason);
 
   MOZ_ASSERT_IF(rejectedReason, cookieStatus == STATUS_REJECTED);
 
   // fire a notification if third party or if cookie was rejected
   // (but not if there was an error)
   switch (cookieStatus) {
     case STATUS_REJECTED:
       NotifyRejected(aHostURI, aChannel, rejectedReason, OPERATION_WRITE);
@@ -2961,20 +2967,20 @@ bool nsCookieService::PathMatches(nsCook
   uint32_t cookiePathLen = cookiePath.Length();
   if (isPrefix && aPath[cookiePathLen] == '/') return true;
 
   return false;
 }
 
 void nsCookieService::GetCookiesForURI(
     nsIURI* aHostURI, nsIChannel* aChannel, bool aIsForeign,
-    bool aIsTrackingResource, bool aFirstPartyStorageAccessGranted,
-    uint32_t aRejectedReason, bool aIsSafeTopLevelNav, bool aIsSameSiteForeign,
-    bool aHttpBound, const OriginAttributes& aOriginAttrs,
-    nsTArray<nsCookie*>& aCookieList) {
+    bool aIsTrackingResource, bool aIsSocialTrackingResource,
+    bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
+    bool aIsSafeTopLevelNav, bool aIsSameSiteForeign, bool aHttpBound,
+    const OriginAttributes& aOriginAttrs, nsTArray<nsCookie*>& aCookieList) {
   NS_ASSERTION(aHostURI, "null host!");
 
   if (!mDBState) {
     NS_WARNING("No DBState! Profile already closed?");
     return;
   }
 
   EnsureReadComplete(true);
@@ -3001,20 +3007,20 @@ void nsCookieService::GetCookiesForURI(
   }
 
   nsCOMPtr<nsICookieSettings> cookieSettings = GetCookieSettings(aChannel);
 
   // check default prefs
   uint32_t rejectedReason = aRejectedReason;
   uint32_t priorCookieCount = 0;
   CountCookiesFromHost(hostFromURI, &priorCookieCount);
-  CookieStatus cookieStatus =
-      CheckPrefs(cookieSettings, aHostURI, aIsForeign, aIsTrackingResource,
-                 aFirstPartyStorageAccessGranted, VoidCString(),
-                 priorCookieCount, aOriginAttrs, &rejectedReason);
+  CookieStatus cookieStatus = CheckPrefs(
+      cookieSettings, aHostURI, aIsForeign, aIsTrackingResource,
+      aIsSocialTrackingResource, aFirstPartyStorageAccessGranted, VoidCString(),
+      priorCookieCount, aOriginAttrs, &rejectedReason);
 
   MOZ_ASSERT_IF(rejectedReason, cookieStatus == STATUS_REJECTED);
 
   // for GetCookie(), we only fire acceptance/rejection notifications
   // (but not if there was an error)
   switch (cookieStatus) {
     case STATUS_REJECTED:
       // If we don't have any cookies from this host, fail silently.
@@ -3136,25 +3142,25 @@ void nsCookieService::GetCookiesForURI(
   // return cookies in order of path length; longest to shortest.
   // this is required per RFC2109.  if cookies match in length,
   // then sort by creation time (see bug 236772).
   aCookieList.Sort(CompareCookiesForSending());
 }
 
 void nsCookieService::GetCookieStringInternal(
     nsIURI* aHostURI, nsIChannel* aChannel, bool aIsForeign,
-    bool aIsTrackingResource, bool aFirstPartyStorageAccessGranted,
-    uint32_t aRejectedReason, bool aIsSafeTopLevelNav, bool aIsSameSiteForeign,
-    bool aHttpBound, const OriginAttributes& aOriginAttrs,
-    nsACString& aCookieString) {
+    bool aIsTrackingResource, bool aIsSocialTrackingResource,
+    bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
+    bool aIsSafeTopLevelNav, bool aIsSameSiteForeign, bool aHttpBound,
+    const OriginAttributes& aOriginAttrs, nsACString& aCookieString) {
   AutoTArray<nsCookie*, 8> foundCookieList;
   GetCookiesForURI(aHostURI, aChannel, aIsForeign, aIsTrackingResource,
-                   aFirstPartyStorageAccessGranted, aRejectedReason,
-                   aIsSafeTopLevelNav, aIsSameSiteForeign, aHttpBound,
-                   aOriginAttrs, foundCookieList);
+                   aIsSocialTrackingResource, aFirstPartyStorageAccessGranted,
+                   aRejectedReason, aIsSafeTopLevelNav, aIsSameSiteForeign,
+                   aHttpBound, aOriginAttrs, foundCookieList);
 
   nsCookie* cookie;
   for (uint32_t i = 0; i < foundCookieList.Length(); ++i) {
     cookie = foundCookieList.ElementAt(i);
 
     // check if we have anything to write
     if (!cookie->Name().IsEmpty() || !cookie->Value().IsEmpty()) {
       // if we've already added a cookie to the return list, append a "; " so
@@ -3960,19 +3966,20 @@ static inline bool IsSubdomainOf(const n
   if (a == b) return true;
   if (a.Length() > b.Length())
     return a[a.Length() - b.Length() - 1] == '.' && StringEndsWith(a, b);
   return false;
 }
 
 CookieStatus nsCookieService::CheckPrefs(
     nsICookieSettings* aCookieSettings, nsIURI* aHostURI, bool aIsForeign,
-    bool aIsTrackingResource, bool aFirstPartyStorageAccessGranted,
-    const nsACString& aCookieHeader, const int aNumOfCookies,
-    const OriginAttributes& aOriginAttrs, uint32_t* aRejectedReason) {
+    bool aIsTrackingResource, bool aIsSocialTrackingResource,
+    bool aFirstPartyStorageAccessGranted, const nsACString& aCookieHeader,
+    const int aNumOfCookies, const OriginAttributes& aOriginAttrs,
+    uint32_t* aRejectedReason) {
   nsresult rv;
 
   MOZ_ASSERT(aRejectedReason);
 
   *aRejectedReason = 0;
 
   // don't let ftp sites get/set cookies (could be a security issue)
   if (aHostURI->SchemeIs("ftp")) {
@@ -4026,17 +4033,22 @@ CookieStatus nsCookieService::CheckPrefs
       MOZ_ASSERT(!aOriginAttrs.mFirstPartyDomain.IsEmpty(),
                  "We must have a StoragePrincipal here!");
       return STATUS_ACCEPTED;
     }
 
     COOKIE_LOGFAILURE(aCookieHeader.IsVoid() ? GET_COOKIE : SET_COOKIE,
                       aHostURI, aCookieHeader,
                       "cookies are disabled in trackers");
-    *aRejectedReason = nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
+    if (aIsSocialTrackingResource) {
+      *aRejectedReason =
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER;
+    } else {
+      *aRejectedReason = nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
+    }
     return STATUS_REJECTED;
   }
 
   // check default prefs.
   // Check aFirstPartyStorageAccessGranted when checking aCookieBehavior
   // so that we take things such as the content blocking allow list into
   // account.
   if (aCookieSettings->GetCookieBehavior() ==
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -209,26 +209,28 @@ class nsCookieService final : public nsI
                            mozilla::net::CookieStruct& aCookieData,
                            bool aRequireHostMatch, CookieStatus aStatus,
                            nsCString& aCookieHeader, int64_t aServerTime,
                            bool aFromHttp, nsIChannel* aChannel,
                            bool& aSetCookie,
                            mozIThirdPartyUtil* aThirdPartyUtil);
   static CookieStatus CheckPrefs(
       nsICookieSettings* aCookieSettings, nsIURI* aHostURI, bool aIsForeign,
-      bool aIsTrackingResource, bool aIsFirstPartyStorageAccessGranted,
-      const nsACString& aCookieHeader, const int aNumOfCookies,
-      const OriginAttributes& aOriginAttrs, uint32_t* aRejectedReason);
+      bool aIsTrackingResource, bool aIsSocialTrackingResource,
+      bool aIsFirstPartyStorageAccessGranted, const nsACString& aCookieHeader,
+      const int aNumOfCookies, const OriginAttributes& aOriginAttrs,
+      uint32_t* aRejectedReason);
   static int64_t ParseServerTime(const nsACString& aServerTime);
 
   static already_AddRefed<nsICookieSettings> GetCookieSettings(
       nsIChannel* aChannel);
 
   void GetCookiesForURI(nsIURI* aHostURI, nsIChannel* aChannel, bool aIsForeign,
                         bool aIsTrackingResource,
+                        bool aIsSocialTrackingResource,
                         bool aFirstPartyStorageAccessGranted,
                         uint32_t aRejectedReason, bool aIsSafeTopLevelNav,
                         bool aIsSameSiteForeign, bool aHttpBound,
                         const OriginAttributes& aOriginAttrs,
                         nsTArray<nsCookie*>& aCookieList);
 
  protected:
   virtual ~nsCookieService();
@@ -251,32 +253,31 @@ class nsCookieService final : public nsI
   void RebuildCorruptDB(DBState* aDBState);
   OpenDBResult Read();
   mozilla::UniquePtr<mozilla::net::CookieStruct> GetCookieFromRow(
       mozIStorageStatement* aRow);
   void EnsureReadComplete(bool aInitDBConn);
   nsresult NormalizeHost(nsCString& aHost);
   nsresult GetCookieStringCommon(nsIURI* aHostURI, nsIChannel* aChannel,
                                  bool aHttpBound, nsACString& aCookie);
-  void GetCookieStringInternal(nsIURI* aHostURI, nsIChannel* aChannel,
-                               bool aIsForeign, bool aIsTrackingResource,
-                               bool aFirstPartyStorageAccessGranted,
-                               uint32_t aRejectedReason,
-                               bool aIsSafeTopLevelNav, bool aIsSameSiteForeign,
-                               bool aHttpBound,
-                               const OriginAttributes& aOriginAttrs,
-                               nsACString& aCookie);
+  void GetCookieStringInternal(
+      nsIURI* aHostURI, nsIChannel* aChannel, bool aIsForeign,
+      bool aIsTrackingResource, bool aIsSocialTrackingResource,
+      bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
+      bool aIsSafeTopLevelNav, bool aIsSameSiteForeign, bool aHttpBound,
+      const OriginAttributes& aOriginAttrs, nsACString& aCookie);
   nsresult SetCookieStringCommon(nsIURI* aHostURI,
                                  const nsACString& aCookieHeader,
                                  const nsACString& aServerTime,
                                  nsIChannel* aChannel, bool aFromHttp);
   void SetCookieStringInternal(
       nsIURI* aHostURI, bool aIsForeign, bool aIsTrackingResource,
-      bool aFirstPartyStorageAccessGranted, uint32_t aRejectedReason,
-      nsCString& aCookieHeader, const nsACString& aServerTime, bool aFromHttp,
+      bool aIsSocialTrackingResource, bool aFirstPartyStorageAccessGranted,
+      uint32_t aRejectedReason, nsCString& aCookieHeader,
+      const nsACString& aServerTime, bool aFromHttp,
       const OriginAttributes& aOriginAttrs, nsIChannel* aChannel);
   bool SetCookieInternal(nsIURI* aHostURI, const nsCookieKey& aKey,
                          bool aRequireHostMatch, CookieStatus aStatus,
                          nsCString& aCookieHeader, int64_t aServerTime,
                          bool aFromHttp, nsIChannel* aChannel);
   void AddInternal(const nsCookieKey& aKey, nsCookie* aCookie,
                    int64_t aCurrentTimeInUsec, nsIURI* aHostURI,
                    const nsACString& aCookieHeader, bool aFromHttp);
--- a/netwerk/ipc/DocumentChannelChild.cpp
+++ b/netwerk/ipc/DocumentChannelChild.cpp
@@ -612,16 +612,29 @@ DocumentChannelChild::IsThirdPartyTracki
   MOZ_ASSERT(
       !(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
   *aIsTrackingResource = UrlClassifierCommon::IsTrackingClassificationFlag(
       mThirdPartyClassificationFlags);
   return NS_OK;
 }
 
 NS_IMETHODIMP
+DocumentChannelChild::IsSocialTrackingResource(
+    bool* aIsSocialTrackingResource) {
+  MOZ_ASSERT(!mFirstPartyClassificationFlags ||
+             !mThirdPartyClassificationFlags);
+  *aIsSocialTrackingResource =
+      UrlClassifierCommon::IsSocialTrackingClassificationFlag(
+          mThirdPartyClassificationFlags) ||
+      UrlClassifierCommon::IsSocialTrackingClassificationFlag(
+          mFirstPartyClassificationFlags);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 DocumentChannelChild::GetClassificationFlags(uint32_t* aClassificationFlags) {
   MOZ_ASSERT(aClassificationFlags);
   if (mThirdPartyClassificationFlags) {
     *aClassificationFlags = mThirdPartyClassificationFlags;
   } else {
     *aClassificationFlags = mFirstPartyClassificationFlags;
   }
   return NS_OK;
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1492,16 +1492,28 @@ HttpBaseChannel::IsThirdPartyTrackingRes
   MOZ_ASSERT(
       !(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
   *aIsTrackingResource = UrlClassifierCommon::IsTrackingClassificationFlag(
       mThirdPartyClassificationFlags);
   return NS_OK;
 }
 
 NS_IMETHODIMP
+HttpBaseChannel::IsSocialTrackingResource(bool* aIsSocialTrackingResource) {
+  MOZ_ASSERT(!mFirstPartyClassificationFlags ||
+             !mThirdPartyClassificationFlags);
+  *aIsSocialTrackingResource =
+      UrlClassifierCommon::IsSocialTrackingClassificationFlag(
+          mThirdPartyClassificationFlags) ||
+      UrlClassifierCommon::IsSocialTrackingClassificationFlag(
+          mFirstPartyClassificationFlags);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 HttpBaseChannel::GetClassificationFlags(uint32_t* aFlags) {
   if (mThirdPartyClassificationFlags) {
     *aFlags = mThirdPartyClassificationFlags;
   } else {
     *aFlags = mFirstPartyClassificationFlags;
   }
   return NS_OK;
 }
--- a/netwerk/url-classifier/UrlClassifierCommon.cpp
+++ b/netwerk/url-classifier/UrlClassifierCommon.cpp
@@ -549,27 +549,36 @@ bool UrlClassifierCommon::IsAllowListed(
 bool UrlClassifierCommon::IsTrackingClassificationFlag(uint32_t aFlag) {
   if (StaticPrefs::privacy_annotate_channels_strict_list_enabled() &&
       (aFlag & nsIClassifiedChannel::ClassificationFlags::
                    CLASSIFIED_ANY_STRICT_TRACKING)) {
     return true;
   }
 
   if (StaticPrefs::privacy_socialtracking_block_cookies_enabled() &&
-      (aFlag & nsIClassifiedChannel::ClassificationFlags::
-                   CLASSIFIED_ANY_SOCIAL_TRACKING)) {
+      IsSocialTrackingClassificationFlag(aFlag)) {
     return true;
   }
 
   return (
       aFlag &
       nsIClassifiedChannel::ClassificationFlags::CLASSIFIED_ANY_BASIC_TRACKING);
 }
 
 // static
+bool UrlClassifierCommon::IsSocialTrackingClassificationFlag(uint32_t aFlag) {
+  if (aFlag & nsIClassifiedChannel::ClassificationFlags::
+                  CLASSIFIED_ANY_SOCIAL_TRACKING) {
+    return true;
+  }
+
+  return false;
+}
+
+// static
 bool UrlClassifierCommon::IsCryptominingClassificationFlag(uint32_t aFlag) {
   if (aFlag &
       nsIClassifiedChannel::ClassificationFlags::CLASSIFIED_CRYPTOMINING) {
     return true;
   }
 
   if (StaticPrefs::privacy_annotate_channels_strict_list_enabled() &&
       (aFlag & nsIClassifiedChannel::ClassificationFlags::
--- a/netwerk/url-classifier/UrlClassifierCommon.h
+++ b/netwerk/url-classifier/UrlClassifierCommon.h
@@ -55,16 +55,18 @@ class UrlClassifierCommon final {
   static void AnnotateChannel(nsIChannel* aChannel,
                               uint32_t aClassificationFlags,
                               uint32_t aLoadingState);
 
   static bool IsAllowListed(nsIChannel* aChannel);
 
   static bool IsTrackingClassificationFlag(uint32_t aFlag);
 
+  static bool IsSocialTrackingClassificationFlag(uint32_t aFlag);
+
   static bool IsCryptominingClassificationFlag(uint32_t aFlag);
 
   // Join the table names in 1 single string.
   static void TablesToString(const nsTArray<nsCString>& aList,
                              nsACString& aString);
 
   struct ClassificationData {
     nsCString mPrefix;
--- a/security/manager/ssl/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/ssl/nsSecureBrowserUIImpl.cpp
@@ -220,16 +220,20 @@ void nsSecureBrowserUIImpl::CheckForCont
   if (doc->GetHasCookiesBlockedByPermission()) {
     mEvent |= STATE_COOKIES_BLOCKED_BY_PERMISSION;
   }
 
   if (doc->GetHasTrackingCookiesBlocked()) {
     mEvent |= STATE_COOKIES_BLOCKED_TRACKER;
   }
 
+  if (doc->GetHasSocialTrackingCookiesBlocked()) {
+    mEvent |= STATE_COOKIES_BLOCKED_SOCIALTRACKER;
+  }
+
   if (doc->GetHasForeignCookiesBlocked()) {
     mEvent |= STATE_COOKIES_BLOCKED_FOREIGN;
   }
 
   if (doc->GetHasAllCookiesBlocked()) {
     mEvent |= STATE_COOKIES_BLOCKED_ALL;
   }
 
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -389,16 +389,18 @@ void ReportBlockingToConsole(nsPIDOMWind
   MOZ_ASSERT(aWindow && aURI);
   MOZ_ASSERT(
       aRejectedReason == 0 ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
       aRejectedReason ==
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
+      aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
 
   nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
   if (NS_WARN_IF(!docShell)) {
     return;
   }
@@ -1443,16 +1445,28 @@ bool AntiTrackingCommon::IsFirstPartySto
   uint32_t blockedReason =
       nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
 
   if (behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER) {
     if (!nsContentUtils::IsThirdPartyTrackingResourceWindow(aWindow)) {
       LOG(("Our window isn't a third-party tracking window"));
       return true;
     }
+
+    nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
+        do_QueryInterface(document->GetChannel());
+    if (classifiedChannel) {
+      uint32_t classificationFlags =
+          classifiedChannel->GetThirdPartyClassificationFlags();
+      if (classificationFlags & nsIClassifiedChannel::ClassificationFlags::
+                                    CLASSIFIED_SOCIALTRACKING) {
+        blockedReason =
+            nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER;
+      }
+    }
   } else {
     MOZ_ASSERT(behavior ==
                nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN);
     if (nsContentUtils::IsThirdPartyTrackingResourceWindow(aWindow)) {
       // fall through
     } else if (nsContentUtils::IsThirdPartyWindowOrChannel(aWindow, nullptr,
                                                            aURI)) {
       LOG(("We're in the third-party context, storage should be partitioned"));
@@ -1684,20 +1698,29 @@ bool AntiTrackingCommon::IsFirstPartySto
 
   uint32_t blockedReason =
       nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
 
   // Not a tracker.
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
       do_QueryInterface(aChannel);
   if (behavior == nsICookieService::BEHAVIOR_REJECT_TRACKER) {
-    if (classifiedChannel &&
-        !classifiedChannel->IsThirdPartyTrackingResource()) {
-      LOG(("Our channel isn't a third-party tracking channel"));
-      return true;
+    if (classifiedChannel) {
+      if (!classifiedChannel->IsThirdPartyTrackingResource()) {
+        LOG(("Our channel isn't a third-party tracking channel"));
+        return true;
+      }
+
+      uint32_t classificationFlags =
+          classifiedChannel->GetThirdPartyClassificationFlags();
+      if (classificationFlags & nsIClassifiedChannel::ClassificationFlags::
+                                    CLASSIFIED_SOCIALTRACKING) {
+        blockedReason =
+            nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER;
+      }
     }
   } else {
     MOZ_ASSERT(behavior ==
                nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN);
     if (classifiedChannel &&
         classifiedChannel->IsThirdPartyTrackingResource()) {
       // fall through
     } else if (nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel,
@@ -2025,16 +2048,18 @@ void AntiTrackingCommon::NotifyBlockingD
                                                 uint32_t aRejectedReason) {
   MOZ_ASSERT(
       aRejectedReason == 0 ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
       aRejectedReason ==
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
+      aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
   MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
              aDecision == BlockingDecision::eAllow);
 
   if (!aChannel) {
     return;
@@ -2088,16 +2113,18 @@ void AntiTrackingCommon::NotifyBlockingD
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(
       aRejectedReason == 0 ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION ||
       aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
       aRejectedReason ==
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
+      aRejectedReason ==
           nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL ||
       aRejectedReason == nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
   MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
              aDecision == BlockingDecision::eAllow);
 
   nsCOMPtr<nsPIDOMWindowOuter> pwin = GetTopWindow(aWindow);
   if (!pwin) {
--- a/toolkit/components/antitracking/AntiTrackingCommon.h
+++ b/toolkit/components/antitracking/AntiTrackingCommon.h
@@ -37,16 +37,17 @@ class AntiTrackingCommon final {
   // loaded inside the passed 3rd party context tracking resource window.
   // If the window is first party context, please use
   // MaybeIsFirstPartyStorageAccessGrantedFor();
   //
   // aRejectedReason could be set to one of these values if passed and if the
   // storage permission is not granted:
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER
+  //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN
   static bool IsFirstPartyStorageAccessGrantedFor(
       nsPIDOMWindowInner* a3rdPartyTrackingWindow, nsIURI* aURI,
       uint32_t* aRejectedReason);
 
   // Note: you should use IsFirstPartyStorageAccessGrantedFor() passing the
   // nsIChannel! Use this method _only_ if the channel is not available.
@@ -157,16 +158,17 @@ class AntiTrackingCommon final {
   // channel proxy.
   //
   // aDecision can be eBlock if we have decided to block some content, or eAllow
   // if we have decided to allow the content through.
   //
   // aRejectedReason must be one of these values:
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER
+  //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL
   //  * nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN
   static void NotifyBlockingDecision(nsIChannel* aChannel,
                                      BlockingDecision aDecision,
                                      uint32_t aRejectedReason);
 
   static void NotifyBlockingDecision(nsPIDOMWindowInner* aWindow,
                                      BlockingDecision aDecision,
--- a/toolkit/components/antitracking/StorageAccess.cpp
+++ b/toolkit/components/antitracking/StorageAccess.cpp
@@ -140,17 +140,19 @@ static StorageAccess InternalStorageAllo
 
   if (!StorageDisabledByAntiTracking(aWindow, aChannel, aPrincipal, aURI,
                                      aRejectedReason)) {
     return access;
   }
 
   // We want to have a partitioned storage only for trackers.
   if (aRejectedReason ==
-      nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) {
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
+      aRejectedReason ==
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) {
     return StorageAccess::ePartitionTrackersOrDeny;
   }
 
   // We want to have a partitioned storage for all third parties.
   if (aRejectedReason ==
       nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) {
     return StorageAccess::ePartitionForeignOrDeny;
   }
@@ -316,16 +318,18 @@ bool ShouldPartitionStorage(StorageAcces
   return aAccess == StorageAccess::ePartitionTrackersOrDeny ||
          aAccess == StorageAccess::ePartitionForeignOrDeny;
 }
 
 bool ShouldPartitionStorage(uint32_t aRejectedReason) {
   return aRejectedReason ==
              nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
          aRejectedReason ==
+             nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
+         aRejectedReason ==
              nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN;
 }
 
 bool StoragePartitioningEnabled(StorageAccess aAccess,
                                 nsICookieSettings* aCookieSettings) {
   if (aAccess == StorageAccess::ePartitionTrackersOrDeny) {
     return aCookieSettings->GetCookieBehavior() ==
                nsICookieService::BEHAVIOR_REJECT_TRACKER &&
@@ -336,17 +340,19 @@ bool StoragePartitioningEnabled(StorageA
            nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN;
   }
   return false;
 }
 
 bool StoragePartitioningEnabled(uint32_t aRejectedReason,
                                 nsICookieSettings* aCookieSettings) {
   if (aRejectedReason ==
-      nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) {
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER ||
+      aRejectedReason ==
+          nsIWebProgressListener::STATE_COOKIES_BLOCKED_SOCIALTRACKER) {
     return aCookieSettings->GetCookieBehavior() ==
                nsICookieService::BEHAVIOR_REJECT_TRACKER &&
            StaticPrefs::privacy_storagePrincipal_enabledForTrackers();
   }
   if (aRejectedReason ==
       nsIWebProgressListener::STATE_COOKIES_PARTITIONED_FOREIGN) {
     return aCookieSettings->GetCookieBehavior() ==
            nsICookieService::BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN;
--- a/toolkit/components/antitracking/TrackingDBService.jsm
+++ b/toolkit/components/antitracking/TrackingDBService.jsm
@@ -173,51 +173,45 @@ TrackingDBService.prototype = {
     /* import-globals-from AsyncStreamReader.jsm */
     let json = await readAsyncStream(inputStream);
     requestIdleCallback(this.saveEvents.bind(this, json));
   },
 
   identifyType(events) {
     let result = null;
     let isTracker = false;
-    let isSocialTracker = false;
     for (let [state, blocked] of events) {
       if (state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) {
         isTracker = true;
       }
-      if (
-        state & Ci.nsIWebProgressListener.STATE_LOADED_SOCIALTRACKING_CONTENT
-      ) {
-        isSocialTracker = true;
-      }
       if (blocked) {
         if (
           state & Ci.nsIWebProgressListener.STATE_BLOCKED_FINGERPRINTING_CONTENT
         ) {
           result = Ci.nsITrackingDBService.FINGERPRINTERS_ID;
         } else if (
-          // If STP is enabled and either a social tracker is blocked,
-          // or a cookie was blocked with a social tracking event
+          // If STP is enabled and either a social tracker or cookie is blocked.
           social_enabled &&
-          ((isSocialTracker &&
-            state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER) ||
+          (state &
+            Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_SOCIALTRACKER ||
             state &
               Ci.nsIWebProgressListener.STATE_BLOCKED_SOCIALTRACKING_CONTENT)
         ) {
           result = Ci.nsITrackingDBService.SOCIAL_ID;
         } else if (
           // If there is a tracker blocked. If there is a social tracker blocked, but STP is not enabled.
           state & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT ||
           state & Ci.nsIWebProgressListener.STATE_BLOCKED_SOCIALTRACKING_CONTENT
         ) {
           result = Ci.nsITrackingDBService.TRACKERS_ID;
         } else if (
-          // If a tracking cookie was blocked attribute it to tracking cookies. Possible social tracking content,
-          // but STP is not enabled.
-          state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER
+          // If a tracking cookie was blocked attribute it to tracking cookies.
+          // This includes social tracking cookies since STP is not enabled.
+          state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER ||
+          state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_SOCIALTRACKER
         ) {
           result = Ci.nsITrackingDBService.TRACKING_COOKIES_ID;
         } else if (
           state &
             Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_BY_PERMISSION ||
           state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_ALL ||
           state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_FOREIGN
         ) {
--- a/uriloader/base/nsIWebProgressListener.idl
+++ b/uriloader/base/nsIWebProgressListener.idl
@@ -305,16 +305,20 @@ interface nsIWebProgressListener : nsISu
    *
    * STATE_COOKIES_BLOCKED_BY_PERMISSION
    *   Rejected for custom site permission.
    *
    * STATE_COOKIES_BLOCKED_TRACKER
    *   Rejected because the resource is a tracker and cookie policy doesn't
    *   allow its loading.
    *
+   * STATE_COOKIES_BLOCKED_SOCIALTRACKER
+   *   Rejected because the resource is a tracker from a social origin and
+   *   cookie policy doesn't allow its loading.
+   *
    * STATE_COOKIES_PARTITIONED_FOREIGN
    *   Rejected because the resource is a third-party and cookie policy forces
    *   third-party resources to be partitioned.
    *
    * STATE_COOKIES_BLOCKED_ALL
    *   Rejected because cookie policy blocks all cookies.
    *
    * STATE_COOKIES_BLOCKED_FOREIGN
@@ -333,16 +337,17 @@ interface nsIWebProgressListener : nsISu
   const unsigned long STATE_BLOCKED_CRYPTOMINING_CONTENT   = 0x00000800;
   const unsigned long STATE_LOADED_CRYPTOMINING_CONTENT    = 0x00200000;
   const unsigned long STATE_BLOCKED_UNSAFE_CONTENT         = 0x00004000;
   const unsigned long STATE_COOKIES_LOADED                 = 0x00008000;
   const unsigned long STATE_COOKIES_LOADED_TRACKER         = 0x00040000;
   const unsigned long STATE_COOKIES_LOADED_SOCIALTRACKER   = 0x00080000;
   const unsigned long STATE_COOKIES_BLOCKED_BY_PERMISSION  = 0x10000000;
   const unsigned long STATE_COOKIES_BLOCKED_TRACKER        = 0x20000000;
+  const unsigned long STATE_COOKIES_BLOCKED_SOCIALTRACKER  = 0x01000000;
   const unsigned long STATE_COOKIES_BLOCKED_ALL            = 0x40000000;
   const unsigned long STATE_COOKIES_PARTITIONED_FOREIGN    = 0x80000000;
   const unsigned long STATE_COOKIES_BLOCKED_FOREIGN        = 0x00000080;
   const unsigned long STATE_BLOCKED_SOCIALTRACKING_CONTENT = 0x00010000;
   const unsigned long STATE_LOADED_SOCIALTRACKING_CONTENT  = 0x00020000;
 
   /**
    * Notification indicating the state has changed for one of the requests