fix: pass sdkLanguage to service server (#26702)

This commit is contained in:
Max Schmitt 2023-08-25 17:40:26 +02:00 коммит произвёл GitHub
Родитель 77f4f4d5de
Коммит 70dcaabdee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -16,6 +16,7 @@
import type { WebSocket } from '../utilsBundle';
import type { DispatcherScope, Playwright } from '../server';
import type * as channels from '@protocol/channels';
import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server';
import { Browser } from '../server/browser';
import { serverSideCallMetadata } from '../server/instrumentation';
@ -94,21 +95,21 @@ export class PlaywrightConnection {
return;
}
this._root = new RootDispatcher(this._dispatcherConnection, async scope => {
this._root = new RootDispatcher(this._dispatcherConnection, async (scope, options) => {
await startProfiling();
if (clientType === 'reuse-browser')
return await this._initReuseBrowsersMode(scope);
if (clientType === 'pre-launched-browser-or-android')
return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope);
if (clientType === 'launch-browser')
return await this._initLaunchBrowserMode(scope);
return await this._initLaunchBrowserMode(scope, options);
throw new Error('Unsupported client type: ' + clientType);
});
}
private async _initLaunchBrowserMode(scope: RootDispatcher) {
private async _initLaunchBrowserMode(scope: RootDispatcher, options: channels.RootInitializeParams) {
debugLogger.log('server', `[${this._id}] engaged launch mode for "${this._options.browserName}"`);
const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true });
const playwright = createPlaywright({ sdkLanguage: options.sdkLanguage, isServer: true });
const ownedSocksProxy = await this._createOwnedSocksProxy(playwright);
const browser = await playwright[this._options.browserName as 'chromium'].launch(serverSideCallMetadata(), this._options.launchOptions);