fix: pass sdkLanguage to service server (#26702)

This commit is contained in:
Max Schmitt 2023-08-25 17:40:26 +02:00 committed by GitHub
parent 77f4f4d5de
commit 70dcaabdee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);