Skip to content

fix(contexts): look up an iframe's parent among pages and iframes only (#640) - #643

Merged
route merged 3 commits into
mainfrom
fix/640-iframe-worker-lookup
Oct 12, 2026
Merged

route merged 3 commits into
mainfrom
fix/640-iframe-worker-lookup

Conversation

@route

@route route commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #640.

When an iframe target is created, Contexts looks for the page that owns its frame. The lookup accepted any connected target, including dedicated workers, so it called target.page on a worker, which sent Page.enable to the worker session and raised BrowserError: 'Page.enable' wasn't found inside the Target.targetCreated handler:

A worker is reached whenever no earlier target owns the frame. As the reporter found, the common trigger is Chrome's built-in PDF viewer: an embedded PDF creates out-of-process iframe targets even with site isolation disabled, and the PDF frame nested in the viewer is unknown to the page, so the lookup falls through to the workers. A page with a web worker that embeds a PDF reproduces it with Ferrum's default flags; site isolation (e.g. a remote Chrome launched without Ferrum's flags) is another trigger.

The lookup now only considers page and iframe targets, so Page is never built for a worker. Iframes without an owner are still registered through auto-attach.

No spec is included. Verified manually by embedding a PDF in a page with web workers on Ferrum's default flags: main warns with the error above, this branch doesn't.

route added 3 commits October 5, 2026 14:34
#640)

A connected worker passed the lookup, so Ferrum built a Page on the worker's session and Page.enable raised in the
Target.targetCreated handler. That killed the event thread on 0.18.0 and left the iframe unregistered with its parent.
@route
route merged commit e5030c0 into main Oct 12, 2026
7 checks passed
@route
route deleted the fix/640-iframe-worker-lookup branch October 12, 2026 19:20
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.

Event thread dies when an iframe target appears while a web worker is connected ('Page.enable' wasn't found)

1 participant