@@ -167,9 +167,7 @@ class InspectorSession {
167167 reject ( message . error ) ;
168168 } else {
169169 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 ;
173171 this . _scriptsIdsByUrl . set ( scriptId , url ) ;
174172 if ( url === _MAINSCRIPT )
175173 this . mainScriptId = scriptId ;
@@ -188,12 +186,12 @@ class InspectorSession {
188186
189187 _sendMessage ( message ) {
190188 const msg = JSON . parse ( JSON . stringify ( message ) ) ; // Clone!
191- msg [ 'id' ] = this . _nextId ++ ;
189+ msg . id = this . _nextId ++ ;
192190 if ( DEBUG )
193191 console . log ( '[sent]' , JSON . stringify ( msg ) ) ;
194192
195193 const responsePromise = new Promise ( ( resolve , reject ) => {
196- this . _commandResponsePromises . set ( msg [ 'id' ] , { resolve, reject } ) ;
194+ this . _commandResponsePromises . set ( msg . id , { resolve, reject } ) ;
197195 } ) ;
198196
199197 return new Promise (
@@ -238,12 +236,15 @@ class InspectorSession {
238236 return notification ;
239237 }
240238
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 ) ;
247248 return true ;
248249 }
249250 }
@@ -259,12 +260,12 @@ class InspectorSession {
259260 _matchesConsoleOutputNotification ( notification , type , values ) {
260261 if ( ! Array . isArray ( values ) )
261262 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 ) {
265266 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 ++ ] )
268269 return false ;
269270 }
270271 return i === values . length ;
@@ -389,7 +390,7 @@ class NodeInstance {
389390 async connectInspectorSession ( ) {
390391 console . log ( '[test]' , 'Connecting to a child Node process' ) ;
391392 const response = await this . httpGet ( null , '/json/list' ) ;
392- const url = response [ 0 ] [ ' webSocketDebuggerUrl' ] ;
393+ const url = response [ 0 ] . webSocketDebuggerUrl ;
393394 return this . wsHandshake ( url ) ;
394395 }
395396
0 commit comments