Skip to content

Back the BrowserKit CookieJar with the browser context - #52

Open
kbond wants to merge 1 commit into
playwright-php:mainfrom
kbond:cookie-jar-proxy
Open

Back the BrowserKit CookieJar with the browser context#52
kbond wants to merge 1 commit into
playwright-php:mainfrom
kbond:cookie-jar-proxy

Conversation

@kbond

@kbond kbond commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

getCookieJar() returns a copy of the browser's cookies that CookieJarSync refills at three points: construction, after a navigation, and after setCookie(). Between them it is stale, so a cookie set by javascript or by a fetch response is invisible until the next navigation. Writes are worse, since nothing propagates the other way: set() and expire() change the copy while the browser keeps sending exactly what it sent before.

This replaces the syncing with a BrowserKit jar backed by the context, in the spirit of Symfony\Component\Panther\Cookie\CookieJar. Both clients hand it to parent::__construct(), so getCookieJar() is live, and CookieJarSync is gone.

One BC break, noted in the changelog: cookies in a CookieJar passed to PlaywrightClient were overwritten by the context's own and never sent, so pre-seeding it did nothing. They are now written into the context.

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