From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: fgei Date: Sat, 15 Apr 2023 04:04:47 +0000 Subject: [PATCH] Block partitioned third party cookies as well when blocking third party cookies --- services/network/cookie_settings.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/network/cookie_settings.cc b/services/network/cookie_settings.cc index d5299ee0a680d..3145460067cf1 100644 --- a/services/network/cookie_settings.cc +++ b/services/network/cookie_settings.cc @@ -35,6 +35,11 @@ bool IsExplicitSetting(const ContentSettingPatternSource& setting) { !setting.secondary_pattern.MatchesAllHosts(); } +bool IsThirdPartyAllowed(const ContentSettingPatternSource& setting) { + return setting.primary_pattern.MatchesAllHosts() && + !setting.secondary_pattern.MatchesAllHosts(); +} + const ContentSettingPatternSource* FindMatchingSetting( const GURL& primary_url, const GURL& secondary_url, @@ -197,7 +202,8 @@ CookieSettings::GetThirdPartyBlockingScope(const GURL& first_party_url) const { // partitioned cross-site cookies. if (const ContentSettingPatternSource* match = FindMatchingSetting( first_party_url, first_party_url, content_settings_); - !match || match->GetContentSetting() == CONTENT_SETTING_ALLOW) { + match && IsThirdPartyAllowed(*match) && + match->GetContentSetting() == CONTENT_SETTING_ALLOW) { return ThirdPartyBlockingScope::kUnpartitionedOnly; } return ThirdPartyBlockingScope::kUnpartitionedAndPartitioned;