Skip to content

feat(webview): implement cookie support#41393

Open
yury-s wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-webview-cookies
Open

feat(webview): implement cookie support#41393
yury-s wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-webview-cookies

Conversation

@yury-s

@yury-s yury-s commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Implement cookies()/addCookies()/clearCookies() for the iOS WebView context using the stock Web Inspector Page.getCookies/setCookie/deleteCookie commands.
  • Cookie access is scoped to the current page's domain (a limitation of the stock RDP protocol), not the whole context.
  • Clear cookies in the webview test fixture teardown so the single shared Mobile Safari cookie store doesn't leak state across tests.
  • Unskip the two now-passing cookie tests (navigation response when URL has cookies, should not override cookie header).

yury-s added 2 commits June 19, 2026 11:46
Wire up doGetCookies/addCookies/doClearCookies on WVBrowserContext using
the stock Web Inspector Page.getCookies/setCookie/deleteCookie commands.
These operate on the cookie store visible to the current page, so cookie
access is scoped to the current page's domain rather than the whole
context — a limitation of the iOS RDP protocol.

Also clear cookies in the webview test fixture teardown so the single
shared Mobile Safari cookie store doesn't leak state across tests.

Fixes the cookie API ("navigation response when URL has cookies") and the
cross-test cookie-leak failure ("should not override cookie header").
Keep only the non-obvious notes: the Page cookie commands are
domain-scoped, and the test fixture clears cookies while still on the
test's domain.
@yury-s yury-s requested review from dcrousso and pavelfeldman June 19, 2026 23:42
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7354 passed, 1122 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-ubuntu-22.04-node20

48911 passed, 1142 skipped


Merge workflow run.

@dcrousso dcrousso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol i was just working on this earlier today! i had a very similar PR 😛

session,
httpOnly: !!c.httpOnly,
secure: !!c.secure,
sameSite: c.sameSite ?? 'Lax',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this default to 'Lax' or 'None'?

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.

2 participants