chore: prefer executablePath for page.pause() (#31985)

Motivation: For scenarios where
[`findChromiumChannel`](f17de8222f/packages/playwright-core/src/server/registry/index.ts (L1016))
throws (no branded browser and no normal browser is installed) we were
[silently
catching](f17de8222f/packages/playwright-core/src/server/recorder.ts (L79))
when calling `page.pause()`.

This patch does not invoke `findChromiumChannel` when the
inspectedContext is Chromium based and has an `executablePath`
specified.

Note this was already fixed by #6214, but regressed since then.

Fixes https://github.com/microsoft/playwright/issues/31967
This commit is contained in:
Max Schmitt 2024-08-02 11:18:51 +02:00 committed by GitHub
parent f17de8222f
commit 878a6a499b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -43,7 +43,7 @@ export async function launchApp(browserType: BrowserType, options: {
} }
const context = await browserType.launchPersistentContext(serverSideCallMetadata(), '', { const context = await browserType.launchPersistentContext(serverSideCallMetadata(), '', {
channel: findChromiumChannel(options.sdkLanguage), channel: !options.persistentContextOptions?.executablePath ? findChromiumChannel(options.sdkLanguage) : undefined,
noDefaultViewport: true, noDefaultViewport: true,
ignoreDefaultArgs: ['--enable-automation'], ignoreDefaultArgs: ['--enable-automation'],
colorScheme: 'no-override', colorScheme: 'no-override',

View File

@ -127,6 +127,7 @@ export class RecorderApp extends EventEmitter implements IRecorderApp {
useWebSocket: !!process.env.PWTEST_RECORDER_PORT, useWebSocket: !!process.env.PWTEST_RECORDER_PORT,
handleSIGINT, handleSIGINT,
args: process.env.PWTEST_RECORDER_PORT ? [`--remote-debugging-port=${process.env.PWTEST_RECORDER_PORT}`] : [], args: process.env.PWTEST_RECORDER_PORT ? [`--remote-debugging-port=${process.env.PWTEST_RECORDER_PORT}`] : [],
executablePath: inspectedContext._browser.options.isChromium ? inspectedContext._browser.options.customExecutablePath : undefined,
} }
}); });
const controller = new ProgressController(serverSideCallMetadata(), context._browser); const controller = new ProgressController(serverSideCallMetadata(), context._browser);