Skip to content

[Bug]: response.allHeaders() hangs for Worker script loaded inside an iframe (Chromium only) #39948

@adi-benz

Description

@adi-benz

Version

1.58.2

Steps to reproduce

Reproduction is also available in https://try.playwright.tech/?l=javascript&s=m9zi4si

  1. Clone the repo: git clone https://github.com/adi-benz/playwright-ww-iframe-hang-bug.git
  2. npm install
  3. npx playwright install chromium
  4. node repro.js
  5. Observe that response.allHeaders() hangs indefinitely on the /worker.js request
    The bug requires the combination of an iframe + Web Worker

Expected behavior

I expect the call to response.allHeaders() on line 38 to return the headers, but it's stuck indefinitely.
I expect to be able to read the headers after I get a callback from page.on('requestfinished').

I noticed that to reproduce this bug there needs to be a combination of an iframe + Web Worker, two additional scripts are provided in the Git repo to show that:

  1. working-no-iframe.js - same setup but Worker is created in the main page (no iframe) → no hang (https://try.playwright.tech/?l=javascript&s=br8eaks)
  2. working-firefox.js - same setup but using Firefox instead of Chromium → no hang

Actual behavior

The call to response.allHeaders() hangs on Chromium, output shows:

HUNG after 5s on: http://localhost:39145/worker.js
ERROR: response.allHeaders: Target page, context or browser has been closed

Additional context

No response

Environment

System:
  OS: macOS 26.4
  CPU: (16) arm64 Apple M4 Max
  Memory: 644.53 MB / 64.00 GB
Binaries:
  Node: 25.8.1 - /opt/homebrew/bin/node
  npm: 11.11.0 - /opt/homebrew/bin/npm
  pnpm: 10.33.0 - /opt/homebrew/bin/pnpm
IDEs:
  Claude Code: 2.1.72 - /opt/homebrew/bin/claude
  opencode: 1.3.0 - /opt/homebrew/bin/opencode
Languages:
  Bash: 5.3.3 - /opt/homebrew/bin/bash
npmPackages:
  playwright: ^1.58.2 => 1.58.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions