Skip to content

feat(iframe): support auto-attached iframe network capture#163

Open
nmsbnmsb1 wants to merge 1 commit intoepiral:mainfrom
nmsbnmsb1:feat-iframe
Open

feat(iframe): support auto-attached iframe network capture#163
nmsbnmsb1 wants to merge 1 commit intoepiral:mainfrom
nmsbnmsb1:feat-iframe

Conversation

@nmsbnmsb1
Copy link
Copy Markdown

Description

This PR enables network request monitoring for cross-origin iframes by leveraging CDP's auto-attach mechanism.

Key changes:

  • Enabled Target.setAutoAttach on page targets to automatically intercept child iframe targets.
  • Implemented target ownership tracking (ownerPageTargetByTarget) to map iframe events back to their parent tab.
  • Automatically enables the Network domain on new iframe targets and routes their events to the TabStateManager.

Why?

Many modern sites (like video platforms) embed players or critical content inside cross-origin iframes. Previously, bb-browser could only see main-frame requests, missing important traffic like m3u8 playlist segments or XHR calls within those iframes.

Test Result

Verified using a test case with a cross-origin iframe (httpbin.org embedded in example.com). All network requests (including the iframe's initial load and sub-requests) were successfully captured in the CLI output.

Add iframe target ownership tracking in the daemon CDP connection so auto-attached child iframe targets are mapped back to their owning page tab.

Enable Network on iframe child targets, route iframe network events into the owning page tab, and fetch response bodies from the originating target to preserve --with-body support.

Update tab network state to scope requests by origin target plus requestId, add coverage for iframe target routing, and allow open --tab to accept short tab IDs in the CLI.
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