@@ -26,7 +26,7 @@ import * as validatorPrimitives from './protocol/validatorPrimitives';
2626import { ProgressController } from './server/progress' ;
2727
2828import type { BrowserServer , BrowserServerLauncher } from './client/browserType' ;
29- import type { LaunchServerOptions , Logger , Env } from './client/types' ;
29+ import type { LaunchOptions , LaunchServerOptions , Logger , Env } from './client/types' ;
3030import type { ProtocolLogger } from './server/types' ;
3131import type { WebSocketEventEmitter } from './utilsBundle' ;
3232import type { Browser } from './server/browser' ;
@@ -38,7 +38,7 @@ export class BrowserServerLauncherImpl implements BrowserServerLauncher {
3838 this . _browserName = browserName ;
3939 }
4040
41- async launchServer ( options : LaunchServerOptions & { _sharedBrowser ?: boolean , _userDataDir ?: string } = { } ) : Promise < BrowserServer > {
41+ async launchServer ( options : LaunchOptions & LaunchServerOptions & { _userDataDir ?: string } = { } ) : Promise < BrowserServer > {
4242 const playwright = createPlaywright ( { sdkLanguage : 'javascript' , isServer : true } ) ;
4343 // 1. Pre-launch the browser
4444 const metadata = { id : '' , startTime : 0 , endTime : 0 , type : 'Internal' , method : '' , params : { } , log : [ ] , internal : true } ;
@@ -78,10 +78,14 @@ export class BrowserServerLauncherImpl implements BrowserServerLauncher {
7878 throw e ;
7979 }
8080
81+ return this . launchServerOnExistingBrowser ( browser , options ) ;
82+ }
83+
84+ async launchServerOnExistingBrowser ( browser : Browser , options : LaunchServerOptions ) : Promise < BrowserServer > {
8185 const path = options . wsPath ? ( options . wsPath . startsWith ( '/' ) ? options . wsPath : `/${ options . wsPath } ` ) : `/${ createGuid ( ) } ` ;
8286
8387 // 2. Start the server
84- const server = new PlaywrightServer ( { mode : options . _sharedBrowser ? 'launchServerShared' : 'launchServer' , path, maxConnections : Infinity , preLaunchedBrowser : browser } ) ;
88+ const server = new PlaywrightServer ( { mode : options . _sharedBrowser ? 'launchServerShared' : 'launchServer' , path, maxConnections : Infinity , preLaunchedBrowser : browser , debugController : options . _debugController } ) ;
8589 const wsEndpoint = await server . listen ( options . port , options . host ) ;
8690
8791 // 3. Return the BrowserServer interface
0 commit comments