@@ -168,9 +168,7 @@ class InspectorSession {
168
168
reject ( message . error ) ;
169
169
} else {
170
170
if ( message . method === 'Debugger.scriptParsed' ) {
171
- const script = message [ 'params' ] ;
172
- const scriptId = script [ 'scriptId' ] ;
173
- const url = script [ 'url' ] ;
171
+ const { scriptId, url } = message . params ;
174
172
this . _scriptsIdsByUrl . set ( scriptId , url ) ;
175
173
const fileUrl = url . startsWith ( 'file:' ) ?
176
174
url : getURLFromFilePath ( url ) . toString ( ) ;
@@ -192,12 +190,12 @@ class InspectorSession {
192
190
193
191
_sendMessage ( message ) {
194
192
const msg = JSON . parse ( JSON . stringify ( message ) ) ; // Clone!
195
- msg [ 'id' ] = this . _nextId ++ ;
193
+ msg . id = this . _nextId ++ ;
196
194
if ( DEBUG )
197
195
console . log ( '[sent]' , JSON . stringify ( msg ) ) ;
198
196
199
197
const responsePromise = new Promise ( ( resolve , reject ) => {
200
- this . _commandResponsePromises . set ( msg [ 'id' ] , { resolve, reject } ) ;
198
+ this . _commandResponsePromises . set ( msg . id , { resolve, reject } ) ;
201
199
} ) ;
202
200
203
201
return new Promise (
@@ -243,14 +241,14 @@ class InspectorSession {
243
241
}
244
242
245
243
_isBreakOnLineNotification ( message , line , expectedScriptPath ) {
246
- if ( 'Debugger.paused' === message [ ' method' ] ) {
247
- const callFrame = message [ ' params' ] [ ' callFrames' ] [ 0 ] ;
248
- const location = callFrame [ ' location' ] ;
249
- const scriptPath = this . _scriptsIdsByUrl . get ( location [ ' scriptId' ] ) ;
244
+ if ( 'Debugger.paused' === message . method ) {
245
+ const callFrame = message . params . callFrames [ 0 ] ;
246
+ const location = callFrame . location ;
247
+ const scriptPath = this . _scriptsIdsByUrl . get ( location . scriptId ) ;
250
248
assert . strictEqual ( scriptPath . toString ( ) ,
251
249
expectedScriptPath . toString ( ) ,
252
250
`${ scriptPath } !== ${ expectedScriptPath } ` ) ;
253
- assert . strictEqual ( line , location [ ' lineNumber' ] ) ;
251
+ assert . strictEqual ( line , location . lineNumber ) ;
254
252
return true ;
255
253
}
256
254
}
@@ -266,12 +264,12 @@ class InspectorSession {
266
264
_matchesConsoleOutputNotification ( notification , type , values ) {
267
265
if ( ! Array . isArray ( values ) )
268
266
values = [ values ] ;
269
- if ( 'Runtime.consoleAPICalled' === notification [ ' method' ] ) {
270
- const params = notification [ ' params' ] ;
271
- if ( params [ ' type' ] === type ) {
267
+ if ( 'Runtime.consoleAPICalled' === notification . method ) {
268
+ const params = notification . params ;
269
+ if ( params . type === type ) {
272
270
let i = 0 ;
273
- for ( const value of params [ ' args' ] ) {
274
- if ( value [ ' value' ] !== values [ i ++ ] )
271
+ for ( const value of params . args ) {
272
+ if ( value . value !== values [ i ++ ] )
275
273
return false ;
276
274
}
277
275
return i === values . length ;
@@ -392,7 +390,7 @@ class NodeInstance {
392
390
393
391
async sendUpgradeRequest ( ) {
394
392
const response = await this . httpGet ( null , '/json/list' ) ;
395
- const devtoolsUrl = response [ 0 ] [ ' webSocketDebuggerUrl' ] ;
393
+ const devtoolsUrl = response [ 0 ] . webSocketDebuggerUrl ;
396
394
const port = await this . portPromise ;
397
395
return http . get ( {
398
396
port,
0 commit comments