Skip to content

Commit 776bda4

Browse files
committed
fix(mcp): support moz-firefox BiDi channels via --browser
playwright-core already registers the `moz-firefox`, `moz-firefox-beta` and `moz-firefox-nightly` channels and routes them through WebDriver BiDi (Firefox.launch branches on `channel.startsWith('moz-')`), but the MCP layer never plumbed them through: - resolveBrowserParam() did not recognize the moz-firefox* values, so `--browser moz-firefox` resolved to no channel. - mergeConfig() dropped the channel for any non-chromium browser, which also discarded a valid Firefox BiDi channel coming from a config file. Recognize the moz-firefox* channels in resolveBrowserParam(), and keep moz-* channels in mergeConfig() instead of stripping them.
1 parent 5dd0a9b commit 776bda4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • packages/playwright-core/src/tools/mcp

packages/playwright-core/src/tools/mcp/config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ function resolveBrowserParam(browserOption: string | undefined): { browserName?:
264264
return { browserName: 'chromium', channel: 'chrome-for-testing' };
265265
case 'firefox':
266266
return { browserName: 'firefox' };
267+
case 'moz-firefox':
268+
case 'moz-firefox-beta':
269+
case 'moz-firefox-nightly':
270+
return { browserName: 'firefox', channel: browserOption };
267271
case 'webkit':
268272
return { browserName: 'webkit' };
269273
default:
@@ -465,7 +469,9 @@ function mergeConfig(base: MergedConfig, overrides: Config): MergedConfig {
465469
},
466470
};
467471

468-
if (browser.browserName !== 'chromium' && browser.launchOptions)
472+
// Firefox supports the `moz-firefox*` channels via WebDriver BiDi, so keep
473+
// those; otherwise channels are a Chromium-only concept and should be dropped.
474+
if (browser.browserName !== 'chromium' && browser.launchOptions && !browser.launchOptions.channel?.startsWith('moz-'))
469475
delete browser.launchOptions.channel;
470476

471477
return {

0 commit comments

Comments
 (0)