Skip to content

Comments

Fix CookiePartitionKey serialization and add partition key test#3144

Merged
kblok merged 7 commits intomasterfrom
fix/cookie-partition-key-2826
Feb 18, 2026
Merged

Fix CookiePartitionKey serialization and add partition key test#3144
kblok merged 7 commits intomasterfrom
fix/cookie-partition-key-2826

Conversation

@kblok
Copy link
Member

@kblok kblok commented Feb 16, 2026

Summary

  • Fixed CookiePartitionKeyConverter to serialize PartitionKey as a {topLevelSite, hasCrossSiteAncestor} object instead of a plain string, which caused "Invalid cookie fields" errors
  • Added the missing ShouldSetACookieWithAPartitionKey test from upstream

Supersedes #2826

Test plan

  • All 27 cookie tests pass (Chrome/CDP)

🤖 Generated with Claude Code

The CookiePartitionKeyConverter was writing PartitionKey as a plain string,
but Chrome expects an object with topLevelSite and hasCrossSiteAncestor
properties. This caused "Invalid cookie fields" errors when setting cookies
with a partition key. Also adds the missing ShouldSetACookieWithAPartitionKey
test from upstream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kblok and others added 6 commits February 16, 2026 20:19
The converter now serializes PartitionKey as {topLevelSite, hasCrossSiteAncestor}
object, so the test assertion needs to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove the "BiDi only allows domain partition keys" exception for
  string partition keys, matching upstream Puppeteer behavior
- Use StorageKeyPartitionDescriptor with sourceOrigin when a partition
  key is provided, BrowsingContextPartitionDescriptor otherwise
- Extract goog:partitionKey and goog:sourceScheme from BiDi cookie
  extension data when reading cookies back
- Make SourceScheme assertion Chrome-only since Firefox native BiDi
  doesn't include goog: extension properties
- Add local test expectation to mark partition key test as FAIL on
  Firefox (native BiDi lacks goog:partitionKey)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant