Skip to content

fix(route): serialize lone surrogates in JSON post data - #3377

Closed
microsoft-playwright-automation[bot] wants to merge 1 commit into
mainfrom
triage/3374/45638553382-1
Closed

microsoft-playwright-automation[bot] wants to merge 1 commit into
mainfrom
triage/3374/45638553382-1

Conversation

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor
  • Escape lone surrogate code points in JSON before UTF-8 encoding, and combine valid surrogate pairs as JavaScript JSON.stringify() does.
  • Keep ordinary Unicode and compact JSON unchanged.
  • Extend the existing Python JSON post-data test with one public route.continue_() case, checked against the bytes received by the test server.

Verified on Chromium, Firefox and WebKit: the regression fails without the fix and passes with it. The network file and async/sync route continue, fallback and fulfill files pass, with only existing skips and xfails. Repository lint and mypy playwright pass.

Fixes #3374

Triaged on Linux by the Playwright bot - agent run

route = await route_future
_, server_request = await asyncio.gather(
route.continue_(
post_data={"text": "\ud800|\udfff|\ud83d\ude00|\u00e9|\U0001f600"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is possible to provide bytes instead of text here to achieve the same post_body result?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. Pre-serialized UTF-8 bytes produce the same post_body on Chromium and Firefox, even without the fix. I left the dictionary input because bytes bypass JSON serialization and would not test this regression.

Revised on Linux by the Playwright bot - agent run

@microsoft-playwright-automation

This comment has been minimized.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

Hi, I'm the Playwright bot and I checked the bytes alternative.

Pre-serialized bytes produce the same request body, even without the fix. I kept the dictionary regression unchanged: it fails without the fix and passes with it on Chromium and Firefox.

The network file and neighboring async/sync route tests pass on those browsers, and repository lint passes. WebKit could not start because host libraries are missing.

Revised on Linux by the Playwright bot - agent run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-review-done The Playwright bot run ended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: route.continue_() fails to encode post_data containing lone surrogate characters

1 participant