Repository navigation
fix(chromium): honor CHROME_CONFIG_HOME and XDG_CONFIG_HOME for channel user data dirs - #43885
Closed
riccardofa (rickardof) wants to merge 1 commit into
Closed
riccardofa (rickardof) wants to merge 1 commit into
riccardofa (rickardof) wants to merge 1 commit into
Conversation
…el user data dirs
On Linux, connectOverCDP('chrome') and 'playwright-cli attach' looked for
DevToolsActivePort in a hardcoded ~/.config/<product> directory, while
Chromium resolves its config dir from $CHROME_CONFIG_HOME, then
$XDG_CONFIG_HOME, then ~/.config.
Also use the websocket path from the second line of DevToolsActivePort
when present, since Chrome started with --remote-debugging-port rejects
/devtools/browser without the browser id.
Fixes microsoft#43880
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43880
On Linux,
connectOverCDP('chrome'),playwright-cli attachand the MCP extension look for the channel's user data dir in a hardcoded~/.config/<product>. Chromium resolves it from$CHROME_CONFIG_HOME, then$XDG_CONFIG_HOME, then~/.config, so with either variable set Playwright never findsDevToolsActivePort.chromiumChannels.tsandchannelSessions.ts: resolve the Linux config home the same way Chromium does. The two tables stay separate, as the "keep in sync" comment asks.resolveChannelEndpoint: use the websocket path from the second line ofDevToolsActivePortwhen present, and keep/devtools/browseras the fallback for port-only files. Without this, the right file is found but Chrome started with--remote-debugging-portanswers404.Test.
CD-054launches a persistent context under<configHome>/google-chromeand connects from a child process, once withXDG_CONFIG_HOMEand once withCHROME_CONFIG_HOMEtaking precedence. It is a new test rather than an extension of an existing one because it needs both a persistent context at a specific path and a fresh process, since the tables are built when the module loads. It fails without the change and passes with it.Checked locally on Linux:
npm run ctest -- connect-over-cdp: 36 passed, 1 skipped, 1 failed. The failure isCD-004, which needs a Chromium executable I don't have installed; it fails the same way onmain.playwright-cli list --all --jsonwithXDG_CONFIG_HOMEset: finds the profile and its endpoint.tsc: clean. I could not run the fullnpm run lint, because the doclint step needs network access that failed on my machine.Not tested: macOS and Windows (the change only affects the Linux entries), and Chrome's
chrome://inspecttoggle flow, only--remote-debugging-port.I reported this in #43880 and said I would wait for the assignment before opening a PR. I'm opening it now because the automated draft #43884 appeared for the same issue. I'd like to carry this one through and will address review comments; if you prefer the draft, that's your call and I'll close this.