Skip to content

Include partitioned cookies in export - #32

Open
wlritchi wants to merge 1 commit into
hrdl-github:mainfrom
wlritchi:include-partitioned-cookies
Open

Include partitioned cookies in export#32
wlritchi wants to merge 1 commit into
hrdl-github:mainfrom
wlritchi:include-partitioned-cookies

Conversation

@wlritchi

Copy link
Copy Markdown

Firefox 141 added support for partitioned cookies1. In order for extensions to retrieve these cookies, they need to pass a new partitionKey object2.

While we could consider adding options to filter which cookies are exported, for now the easy win is to select all partitions, so this commit just passes an empty object to select them all.

There's no support for partitions in the cookies.txt format or in any of the tools that consume it, but it can be useful to see the partition for debugging, so this commit includes it in a comment.

Footnotes

  1. https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies

  2. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies/getAll#partitionkey

@hrdl-github

Copy link
Copy Markdown
Owner

Would it be possible to make this behaviour conditional on the browser actually supporting it? There are some non-Firefox code paths (I don't test with chromium though) and your change breaks cookie export on the ESR, which is based on Firefox 140.

@wlritchi

Copy link
Copy Markdown
Author

Would it be possible to make this behaviour conditional on the browser actually supporting it? There are some non-Firefox code paths (I don't test with chromium though) and your change breaks cookie export on the ESR, which is based on Firefox 140.

I don't know of a way to directly query for support, but we could probably condition on browser version. But apparently I was mistaken about the support matrix - partitionKey itself was added all the way back in Firefox 94, it's just not used to segment cookies by default until 141.

My (brief) testing on the ESR seems to work, including partition comments - do you have a specific case I can test that wasn't working for you?

@hrdl-github

Copy link
Copy Markdown
Owner

I can't reproduce the issue I was experiencing when testing with Firefox 140.7.0. I'll merge your changes if you rebase them onto main.

Firefox 141 added support for partitioned cookies[^1] by default. In
order for extensions to retrieve these cookies, they need to pass a
`partitionKey` object, which has been supported since Firefox 94[^2].

While we could consider adding options to filter which cookies are
exported, for now the easy win is to select all partitions, so this
commit just passes an empty object to select them all.

There's no support for partitions in the cookies.txt format or in any of
the tools that consume it, but it can be useful to see the partition for
debugging, so this commit includes it in a comment.

[^1]: https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies
[^2]: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies/getAll#browser_compatibility
@wlritchi
wlritchi force-pushed the include-partitioned-cookies branch from 90a8624 to 7f66b8c Compare January 30, 2026 08:47
@wlritchi

Copy link
Copy Markdown
Author

Rebased, and tested working on both ESR and 147.

@webstrand

Copy link
Copy Markdown

Tested this in Firefox 150, it works and solves the issue for me

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.

3 participants