Skip to content

[Bug]: page.route() handler leads to stalling/pending fetch requests when dialog is triggered #38731

@dsine-de

Description

@dsine-de

Version

1.57.0

Steps to reproduce

  1. Clone my repo at https://github.com/dsine-de/playwright-page-route-multiple-fetch
  2. npm i
  3. npm run server (this keeps an simple express server in the background, listening on http://localhost:8000/ simply serving the contents in the public/ directory and serving a get route /test which sends a status code 204)
  4. npm run test (while the server is running)
  5. The first test stalls after 3 seconds / 3 successful requests.
    The seconds test succeeds after 10 successful requests.

Expected behavior

When the server task is running and you open http://localhost:8000/ in the browser (e.g. Chrome), the client JavaScript will start to make 10 successive requests, one every second (through setTimeout()). The response status codes (204) are added to the page.

When you click somewhere on the page while these requests are running (to make the browser handle the beforeunload event) and then try to reload or close the tab, the dialog preventing it is shown. If you now dismiss this dialog, the pending requests will be resumed until 10 of them have been executed.

So browsers seem to halt the execution of the pending requests, but resume it after the dialog is dismissed.

Actual behavior

In the Playwright test, as soon as the beforeunload dialog is shown and there is a page.route() handler active, all requests repeated by timers or recursive functions will stall. They show as pending in the Dev Tools network tab.

When there is no page.route() set up, the requests are resumed after the dialog is dismissed correctly.

Additional context

No response

Environment

System:
    OS: Windows 11 10.0.26200
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700KF
    Memory: 19.10 GB / 31.87 GB
  Binaries:
    Node: 25.2.1 - C:\Program Files\nodejs\node.EXE
    npm: 11.6.2 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.108.0 - C:\Users\denni\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.2.21 - C:\Windows\system32\bash.EXE
  npmPackages:
    @playwright/test: ^1.57.0 => 1.57.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions