Skip to content

Don't leave the request hanging when a route handler throws - #185

Draft
kbond wants to merge 3 commits into
playwright-php:mainfrom
kbond:fix-route-handler-exceptions
Draft

kbond wants to merge 3 commits into
playwright-php:mainfrom
kbond:fix-route-handler-exceptions

Conversation

@kbond

@kbond kbond commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

When a route handler throws, the exception unwinds out of the command in flight (a goto() or click) while its request stays pending in the browser. From Playwright 1.63, navigating to the same URL again then fails with net::ERR_ABORTED (see zenstruck/browser#215).

The route is now aborted unless the handler already handled it, using aborted so the navigation is cancelled without committing an error page. The client keeps waiting for the command in flight before throwing the handler's exception, so the browser is settled by the time the caller sees it.

Depends on #186. Its commits show here until it's merged, and I'll rebase after.

From 1.64, an action whose navigation ends in the redirect's 204 never settles.
kbond added 2 commits October 10, 2026 10:20
Racing it let a `goto()` to the same url start before the previous one settled, which fails with `net::ERR_ABORTED`.
From Playwright 1.63, navigating again to a URL whose request was left pending fails with `net::ERR_ABORTED`.
@kbond
kbond marked this pull request as draft October 10, 2026 14:26
@kbond
kbond force-pushed the fix-route-handler-exceptions branch from 8644301 to 0913b0d Compare October 10, 2026 14:26
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Transport/JsonRpc/ProcessJsonRpcClient.php 0.00% 9 Missing ⚠️
src/Network/Route.php 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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