fix: pass sdkLanguage to service server (#26702)
This commit is contained in:
Родитель
77f4f4d5de
Коммит
70dcaabdee
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import type { WebSocket } from '../utilsBundle';
|
import type { WebSocket } from '../utilsBundle';
|
||||||
import type { DispatcherScope, Playwright } from '../server';
|
import type { DispatcherScope, Playwright } from '../server';
|
||||||
|
import type * as channels from '@protocol/channels';
|
||||||
import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server';
|
import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server';
|
||||||
import { Browser } from '../server/browser';
|
import { Browser } from '../server/browser';
|
||||||
import { serverSideCallMetadata } from '../server/instrumentation';
|
import { serverSideCallMetadata } from '../server/instrumentation';
|
||||||
|
@ -94,21 +95,21 @@ export class PlaywrightConnection {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._root = new RootDispatcher(this._dispatcherConnection, async scope => {
|
this._root = new RootDispatcher(this._dispatcherConnection, async (scope, options) => {
|
||||||
await startProfiling();
|
await startProfiling();
|
||||||
if (clientType === 'reuse-browser')
|
if (clientType === 'reuse-browser')
|
||||||
return await this._initReuseBrowsersMode(scope);
|
return await this._initReuseBrowsersMode(scope);
|
||||||
if (clientType === 'pre-launched-browser-or-android')
|
if (clientType === 'pre-launched-browser-or-android')
|
||||||
return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope);
|
return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope);
|
||||||
if (clientType === 'launch-browser')
|
if (clientType === 'launch-browser')
|
||||||
return await this._initLaunchBrowserMode(scope);
|
return await this._initLaunchBrowserMode(scope, options);
|
||||||
throw new Error('Unsupported client type: ' + clientType);
|
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}"`);
|
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 ownedSocksProxy = await this._createOwnedSocksProxy(playwright);
|
||||||
const browser = await playwright[this._options.browserName as 'chromium'].launch(serverSideCallMetadata(), this._options.launchOptions);
|
const browser = await playwright[this._options.browserName as 'chromium'].launch(serverSideCallMetadata(), this._options.launchOptions);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче