Store persistent Partitioned cookies in the SQLite table.
Cookies are only stored with a top_frame_site_key if partitioned cookies
are enabled. If a cookie has a top_frame_site_key and the feature is
disabled, the cookie should not be saved.
Likewise, if a cookie in the database has a top_frame_site_key when the
feature is disabled, that cookie is not loaded and all cookies with that
top_frame_site_key are deleted. We can also conveniently reuse this
logic to delete cookies when deserializing the top_frame_site_key fails.
Bug: 1225444
Change-Id: Ia09679863a334abc67bce841cb9bc595750dbca3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3153340
Commit-Queue: Dylan Cutler <[email protected]>
Reviewed-by: Steven Bingler <[email protected]>
Reviewed-by: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#921886}
diff --git a/net/cookies/cookie_partition_key.cc b/net/cookies/cookie_partition_key.cc
index 0558668..f97421f8 100644
--- a/net/cookies/cookie_partition_key.cc
+++ b/net/cookies/cookie_partition_key.cc
@@ -46,6 +46,8 @@
out = kEmptyCookiePartitionKey;
return true;
}
+ if (!base::FeatureList::IsEnabled(features::kPartitionedCookies))
+ return false;
if (in->site_.GetURL().SchemeIsFile()) {
out = in->site_.SerializeFileSiteWithHost();
return true;
@@ -63,6 +65,8 @@
out = absl::nullopt;
return true;
}
+ if (!base::FeatureList::IsEnabled(features::kPartitionedCookies))
+ return false;
auto schemeful_site = SchemefulSite::Deserialize(in);
// SchemfulSite is opaque if the input is invalid.
if (schemeful_site.opaque())