@@ -56,7 +56,7 @@ class Chrome extends EventEmitter {
5656 this . useHostName = ! ! ( options . useHostName ) ;
5757 this . alterPath = options . alterPath || ( ( path ) => path ) ;
5858 this . protocol = options . protocol ;
59- this . local = ! ! ( options . local || options . process ) ;
59+ this . local = ! ! ( options . local ) ;
6060 this . target = options . target || defaultTarget ;
6161 this . connectOptions = options . connectOptions ;
6262 this . process = options . process ;
@@ -121,11 +121,10 @@ class Chrome extends EventEmitter {
121121 try {
122122 if ( this . process )
123123 {
124- const options = { local : this . local , cdp : this } ;
125124 // we first "connect" to stdio pipes, so that we can
126125 // first the protocol remotely via the pipe.
127126 await this . _connect ( ) ;
128- const protocol = await this . _fetchProtocol ( options ) ;
127+ const protocol = await this . _fetchProtocol ( { } ) ;
129128 api . prepare ( this , protocol ) ;
130129 }
131130 else
@@ -139,7 +138,7 @@ class Chrome extends EventEmitter {
139138 ...this . connectOptions ,
140139 } ;
141140 // fetch the WebSocket debugger URL
142- const url = await this . _fetchDebuggerURL ( options ) ;
141+ const url = await this . _fetchWsDebuggerURL ( options ) ;
143142 // allow the user to alter the URL
144143 const urlObject = parseUrl ( url ) ;
145144 urlObject . pathname = options . alterPath ( urlObject . pathname ) ;
@@ -166,7 +165,7 @@ class Chrome extends EventEmitter {
166165 }
167166
168167 // fetch the WebSocket URL according to 'target'
169- async _fetchDebuggerURL ( options ) {
168+ async _fetchWsDebuggerURL ( options ) {
170169 const userTarget = this . target ;
171170 switch ( typeof userTarget ) {
172171 case 'string' : {
@@ -211,6 +210,8 @@ class Chrome extends EventEmitter {
211210 // otherwise user either the local or the remote version
212211 else {
213212 options . local = this . local ;
213+ if ( this . process )
214+ options . cdp = this ;
214215 return await devtools . Protocol ( options ) ;
215216 }
216217 }
0 commit comments