Skip to content

fix: pass categoryExtensions to the target filter when connecting - #3047

Open
paviad wants to merge 1 commit into
ChromeDevTools:mainfrom
paviad:fix/connect-target-filter-extensions
Open

paviad wants to merge 1 commit into
ChromeDevTools:mainfrom
paviad:fix/connect-target-filter-extensions

Conversation

@paviad

@paviad paviad commented Oct 9, 2026

Copy link
Copy Markdown

Fixes #3046.

Split out of #3041 at the reviewer's request. This is the target-filter half; #3041 keeps the config change.

BrowserManager#connect(), used for --browserUrl, --wsEndpoint and --autoConnect, built Puppeteer's target filter with makeTargetFilter() and no argument. So Puppeteer dropped every chrome-extension:// target at connect time, and list_pages never showed extension pages or service workers when attached, even with --categoryExtensions. #launch() already passes the flag. This passes it the same way in #connect().

The omission dates from #1922, whose attach call site didn't pass the flag (see #1171 and #1173). #2787 carried it into BrowserManager.

Changes

  • src/BrowserManager.ts: read categoryExtensions from the server args in #connect() and pass it to makeTargetFilter().
  • tests/browser.test.ts: two tests that connect with browserUrl and check the targetFilter handed to puppeteer.connect. A chrome-extension:// target is kept only when categoryExtensions is set. The true case fails without the BrowserManager change.

With the flag off, behaviour is unchanged: undefined falls back to makeTargetFilter's false default.

Note on reachability

On main, --categoryExtensions with an attach flag is currently rejected at startup (#2989, lifted in #3041). So this path can't be reached from the command line on main until #3041 lands. The unit tests reach it directly. Landing this first means #3041 doesn't expose an attach mode with hidden extension pages.

Testing

  • npm run gen (no changes) and npm run check-format: clean.
  • node scripts/test.js tests/browser.test.ts tests/cli.test.ts: all pass.
  • Manual, on Windows with Chrome 154.0.8037.98, a tab open on an unpacked MV3 extension's page: the same change applied on top of 1.10.1, started with --browserUrl http://127.0.0.1:<port> --categoryExtensions=true. list_pages lists the tab under ## Extension Pages. Unpatched 1.10.1 and 1.9.0 list no extension pages.

🤖 Generated with Claude Code

BrowserManager#connect() (--browserUrl, --wsEndpoint, --autoConnect) built
Puppeteer's target filter with makeTargetFilter() and no argument, so
chrome-extension:// targets were dropped at connect time and list_pages
never showed extension pages or service workers when attached. #launch()
already passes the flag; do the same here.

Fixes ChromeDevTools#3046
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.

Extension pages and service workers are hidden when attaching with --browserUrl, --wsEndpoint or --autoConnect

1 participant