Commit 9a1836a
fix: filter targetFilter to page-level targets only to prevent connection timeouts
When connecting to a browser with many tabs, Puppeteer attaches to every
target (iframes, service workers, shared workers, webviews, background
pages) and sends CDP initialization commands (Network.enable, Page.enable,
Runtime.enable, etc.) to each one. Frozen or suspended targets don't
respond to these commands, causing the connection to hang until the
protocol timeout is reached.
With a typical browsing session of ~60 targets (but only ~7 actual pages),
this makes the MCP server unusable without first closing most tabs.
The fix restricts targetFilter to only attach to 'page' and 'other' type
targets. Iframes within pages remain accessible via page.frames(), and
network/console events still work through the page-level CDP session.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent bdbbc84 commit 9a1836a
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| |||
0 commit comments