@@ -20,9 +20,9 @@ import * as path from 'path';
2020import * as util from 'util' ;
2121import { BrowserContext , normalizeProxySettings , validateBrowserContextOptions } from './browserContext' ;
2222import * as browserPaths from '../utils/browserPaths' ;
23- import { ConnectionTransport , WebSocketTransport } from './transport' ;
23+ import { ConnectionTransport } from './transport' ;
2424import { BrowserOptions , Browser , BrowserProcess } from './browser' ;
25- import { launchProcess , Env , waitForLine , envArrayToObject } from './processLauncher' ;
25+ import { launchProcess , Env , envArrayToObject } from './processLauncher' ;
2626import { PipeTransport } from './pipeTransport' ;
2727import { Progress , ProgressController } from './progress' ;
2828import * as types from './types' ;
@@ -35,22 +35,18 @@ const mkdtempAsync = util.promisify(fs.mkdtemp);
3535const existsAsync = ( path : string ) : Promise < boolean > => new Promise ( resolve => fs . stat ( path , err => resolve ( ! err ) ) ) ;
3636const DOWNLOADS_FOLDER = path . join ( os . tmpdir ( ) , 'playwright_downloads-' ) ;
3737
38- type WebSocketNotPipe = { webSocketRegex : RegExp , stream : 'stdout' | 'stderr' } ;
39-
4038export abstract class BrowserType {
4139 private _name : string ;
4240 private _executablePath : string ;
43- private _webSocketNotPipe : WebSocketNotPipe | null ;
4441 private _browserDescriptor : browserPaths . BrowserDescriptor ;
4542 readonly _browserPath : string ;
4643
47- constructor ( packagePath : string , browser : browserPaths . BrowserDescriptor , webSocketOrPipe : WebSocketNotPipe | null ) {
44+ constructor ( packagePath : string , browser : browserPaths . BrowserDescriptor ) {
4845 this . _name = browser . name ;
4946 const browsersPath = browserPaths . browsersPath ( packagePath ) ;
5047 this . _browserDescriptor = browser ;
5148 this . _browserPath = browserPaths . browserDirectory ( browsersPath , browser ) ;
5249 this . _executablePath = browserPaths . executablePath ( this . _browserPath , browser ) || '' ;
53- this . _webSocketNotPipe = webSocketOrPipe ;
5450 }
5551
5652 executablePath ( ) : string {
@@ -175,7 +171,6 @@ export abstract class BrowserType {
175171 handleSIGTERM,
176172 handleSIGHUP,
177173 progress,
178- pipe : ! this . _webSocketNotPipe ,
179174 tempDirectories,
180175 attemptToGracefullyClose : async ( ) => {
181176 if ( ( options as any ) . __testHookGracefullyClose )
@@ -198,14 +193,8 @@ export abstract class BrowserType {
198193 } ;
199194 progress . cleanupWhenAborted ( ( ) => browserProcess && closeOrKill ( browserProcess , progress . timeUntilDeadline ( ) ) ) ;
200195
201- if ( this . _webSocketNotPipe ) {
202- const match = await waitForLine ( progress , launchedProcess , this . _webSocketNotPipe . stream === 'stdout' ? launchedProcess . stdout : launchedProcess . stderr , this . _webSocketNotPipe . webSocketRegex ) ;
203- const innerEndpoint = match [ 1 ] ;
204- transport = await WebSocketTransport . connect ( progress , innerEndpoint ) ;
205- } else {
206- const stdio = launchedProcess . stdio as unknown as [ NodeJS . ReadableStream , NodeJS . WritableStream , NodeJS . WritableStream , NodeJS . WritableStream , NodeJS . ReadableStream ] ;
207- transport = new PipeTransport ( stdio [ 3 ] , stdio [ 4 ] ) ;
208- }
196+ const stdio = launchedProcess . stdio as unknown as [ NodeJS . ReadableStream , NodeJS . WritableStream , NodeJS . WritableStream , NodeJS . WritableStream , NodeJS . ReadableStream ] ;
197+ transport = new PipeTransport ( stdio [ 3 ] , stdio [ 4 ] ) ;
209198 return { browserProcess, downloadsPath, transport } ;
210199 }
211200
0 commit comments