Repository navigation
Conversation
|
Thank you for your contribution. Please submit an issue describing your use case before we can act on your PR. Specifically let us know if you think you are addressing a bug or implementing a new feature. |
|
Thanks. I believe this PR is fixing a bug rather than adding a new feature. Extension-related behavior already exists in the server, and The result is that extension pages/service workers are not exposed consistently when attaching to an existing Chrome instance via I think #1072 is the closest existing issue for this area. My use case is attaching to an already-running Chrome profile and inspecting extension contexts there, rather than launching a separate isolated browser. If you’d prefer a dedicated bug issue for this narrower case, I can open one and link it here. |
|
Follow-up: I think #1072 is only adjacent context and not the exact issue this PR addresses. I opened #1173 to track the specific bug here: I think #1173 is the better issue to associate with this PR. |
|
Follow-up: I updated #1173 to reflect the maintainer guidance that the current behavior is intentional and that this should be discussed as a feature request rather than a bug. With that framing, this PR should be read as a prototype for a narrower feature: exposing extension pages/service workers in attached-browser mode, not enabling the full extension-management toolset over WebSocket-based attach flows. If that narrower direction is acceptable, I can rework the PR around that supported subset. |
|
Thanks for the PR but we already have extension implementation in progress. Stay tuned! |
…romeDevTools#3047) Fixes ChromeDevTools#3046. Split out of ChromeDevTools#3041 at the reviewer's request. This is the target-filter half; ChromeDevTools#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 ChromeDevTools#1922, whose attach call site didn't pass the flag (see ChromeDevTools#1171 and ChromeDevTools#1173). ChromeDevTools#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 (ChromeDevTools#2989, lifted in ChromeDevTools#3041). So this path can't be reached from the command line on `main` until ChromeDevTools#3041 lands. The unit tests reach it directly. Landing this first means ChromeDevTools#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](https://claude.com/claude-code) --------- Co-authored-by: Nicholas Roscino <[email protected]>
Summary
enableExtensionsthrough the connected-browser path for--browserUrl,--wsEndpoint, and--autoConnect--category-extensionsapplies when connecting to an existing Chrome instanceTesting