@@ -167,9 +167,7 @@ class InspectorSession {
167
167
reject ( message . error ) ;
168
168
} else {
169
169
if ( message . method === 'Debugger.scriptParsed' ) {
170
- const script = message [ 'params' ] ;
171
- const scriptId = script [ 'scriptId' ] ;
172
- const url = script [ 'url' ] ;
170
+ const { scriptId, url } = message . params ;
173
171
this . _scriptsIdsByUrl . set ( scriptId , url ) ;
174
172
if ( url === _MAINSCRIPT )
175
173
this . mainScriptId = scriptId ;
@@ -188,12 +186,12 @@ class InspectorSession {
188
186
189
187
_sendMessage ( message ) {
190
188
const msg = JSON . parse ( JSON . stringify ( message ) ) ; // Clone!
191
- msg [ 'id' ] = this . _nextId ++ ;
189
+ msg . id = this . _nextId ++ ;
192
190
if ( DEBUG )
193
191
console . log ( '[sent]' , JSON . stringify ( msg ) ) ;
194
192
195
193
const responsePromise = new Promise ( ( resolve , reject ) => {
196
- this . _commandResponsePromises . set ( msg [ 'id' ] , { resolve, reject } ) ;
194
+ this . _commandResponsePromises . set ( msg . id , { resolve, reject } ) ;
197
195
} ) ;
198
196
199
197
return new Promise (
@@ -238,12 +236,15 @@ class InspectorSession {
238
236
return notification ;
239
237
}
240
238
241
- _isBreakOnLineNotification ( message , line , url ) {
242
- if ( 'Debugger.paused' === message [ 'method' ] ) {
243
- const callFrame = message [ 'params' ] [ 'callFrames' ] [ 0 ] ;
244
- const location = callFrame [ 'location' ] ;
245
- assert . strictEqual ( url , this . _scriptsIdsByUrl . get ( location [ 'scriptId' ] ) ) ;
246
- assert . strictEqual ( line , location [ 'lineNumber' ] ) ;
239
+ _isBreakOnLineNotification ( message , line , expectedScriptPath ) {
240
+ if ( 'Debugger.paused' === message . method ) {
241
+ const callFrame = message . params . callFrames [ 0 ] ;
242
+ const location = callFrame . location ;
243
+ const scriptPath = this . _scriptsIdsByUrl . get ( location . scriptId ) ;
244
+ assert . strictEqual ( scriptPath . toString ( ) ,
245
+ expectedScriptPath . toString ( ) ,
246
+ `${ scriptPath } !== ${ expectedScriptPath } ` ) ;
247
+ assert . strictEqual ( line , location . lineNumber ) ;
247
248
return true ;
248
249
}
249
250
}
@@ -259,12 +260,12 @@ class InspectorSession {
259
260
_matchesConsoleOutputNotification ( notification , type , values ) {
260
261
if ( ! Array . isArray ( values ) )
261
262
values = [ values ] ;
262
- if ( 'Runtime.consoleAPICalled' === notification [ ' method' ] ) {
263
- const params = notification [ ' params' ] ;
264
- if ( params [ ' type' ] === type ) {
263
+ if ( 'Runtime.consoleAPICalled' === notification . method ) {
264
+ const params = notification . params ;
265
+ if ( params . type === type ) {
265
266
let i = 0 ;
266
- for ( const value of params [ ' args' ] ) {
267
- if ( value [ ' value' ] !== values [ i ++ ] )
267
+ for ( const value of params . args ) {
268
+ if ( value . value !== values [ i ++ ] )
268
269
return false ;
269
270
}
270
271
return i === values . length ;
@@ -389,7 +390,7 @@ class NodeInstance {
389
390
async connectInspectorSession ( ) {
390
391
console . log ( '[test]' , 'Connecting to a child Node process' ) ;
391
392
const response = await this . httpGet ( null , '/json/list' ) ;
392
- const url = response [ 0 ] [ ' webSocketDebuggerUrl' ] ;
393
+ const url = response [ 0 ] . webSocketDebuggerUrl ;
393
394
return this . wsHandshake ( url ) ;
394
395
}
395
396
0 commit comments