@ -25,8 +25,8 @@ exports.start = function(argv, stdin, stdout) {
stdin = stdin || process . stdin ;
stdin = stdin || process . stdin ;
stdout = stdout || process . stdout ;
stdout = stdout || process . stdout ;
var args = [ '--debug-brk' ] . concat ( argv ) ,
const args = [ '--debug-brk' ] . concat ( argv ) ;
interface_ = new Interface ( stdin , stdout , args ) ;
const interface_ = new Interface ( stdin , stdout , args ) ;
stdin . resume ( ) ;
stdin . resume ( ) ;
@ -197,8 +197,8 @@ Client.prototype._removeScript = function(desc) {
Client . prototype . _ onResponse = function ( res ) {
Client . prototype . _ onResponse = function ( res ) {
var cb ,
var cb ;
index = - 1 ;
var index = - 1 ;
this . _ reqCallbacks . some ( function ( fn , i ) {
this . _ reqCallbacks . some ( function ( fn , i ) {
if ( fn . request_seq == res . body . request_seq ) {
if ( fn . request_seq == res . body . request_seq ) {
@ -295,11 +295,11 @@ Client.prototype.reqLookup = function(refs, cb) {
} ;
} ;
Client . prototype . reqScopes = function ( cb ) {
Client . prototype . reqScopes = function ( cb ) {
var self = this ,
const self = this ;
req = {
const req = {
command : 'scopes' ,
command : 'scopes' ,
arguments : { }
arguments : { }
} ;
} ;
cb = cb || function ( ) { } ;
cb = cb || function ( ) { } ;
this . req ( req , function ( err , res ) {
this . req ( req , function ( err , res ) {
@ -525,8 +525,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
return ;
return ;
}
}
var mirror ,
var mirror ;
waiting = 1 ;
var waiting = 1 ;
if ( handle . className == 'Array' ) {
if ( handle . className == 'Array' ) {
mirror = [ ] ;
mirror = [ ] ;
@ -676,8 +676,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
function SourceUnderline ( sourceText , position , repl ) {
function SourceUnderline ( sourceText , position , repl ) {
if ( ! sourceText ) return '' ;
if ( ! sourceText ) return '' ;
var head = sourceText . slice ( 0 , position ) ,
const head = sourceText . slice ( 0 , position ) ;
tail = sourceText . slice ( position ) ;
var tail = sourceText . slice ( position ) ;
// Colourize char if stdout supports colours
// Colourize char if stdout supports colours
if ( repl . useColors ) {
if ( repl . useColors ) {
@ -697,8 +697,8 @@ function SourceInfo(body) {
if ( body . script ) {
if ( body . script ) {
if ( body . script . name ) {
if ( body . script . name ) {
var name = body . script . name ,
var name = body . script . name ;
dir = path . resolve ( ) + '/' ;
const dir = path . resolve ( ) + '/' ;
// Change path to relative, if possible
// Change path to relative, if possible
if ( name . indexOf ( dir ) === 0 ) {
if ( name . indexOf ( dir ) === 0 ) {
@ -969,8 +969,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
Interface . prototype . debugEval = function ( code , context , filename , callback ) {
Interface . prototype . debugEval = function ( code , context , filename , callback ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
const self = this ;
client = this . client ;
const client = this . client ;
// Repl asked for scope variables
// Repl asked for scope variables
if ( code === '.scope' ) {
if ( code === '.scope' ) {
@ -1004,9 +1004,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
// Adds spaces and prefix to number
// Adds spaces and prefix to number
// maxN is a maximum number we should have space for
// maxN is a maximum number we should have space for
function leftPad ( n , prefix , maxN ) {
function leftPad ( n , prefix , maxN ) {
var s = n . toString ( ) ,
const s = n . toString ( ) ;
nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ,
const nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ;
nspaces = nchars - s . length - 1 ;
const nspaces = nchars - s . length - 1 ;
for ( var i = 0 ; i < nspaces ; i ++ ) {
for ( var i = 0 ; i < nspaces ; i ++ ) {
prefix += ' ' ;
prefix += ' ' ;
@ -1078,10 +1078,10 @@ Interface.prototype.list = function(delta) {
delta || ( delta = 5 ) ;
delta || ( delta = 5 ) ;
var self = this ,
const self = this ;
client = this . client ,
const client = this . client ;
from = client . currentSourceLine - delta + 1 ,
const from = client . currentSourceLine - delta + 1 ;
to = client . currentSourceLine + delta + 1 ;
const to = client . currentSourceLine + delta + 1 ;
self . pause ( ) ;
self . pause ( ) ;
client . reqSource ( from , to , function ( err , res ) {
client . reqSource ( from , to , function ( err , res ) {
@ -1096,12 +1096,12 @@ Interface.prototype.list = function(delta) {
var lineno = res . fromLine + i + 1 ;
var lineno = res . fromLine + i + 1 ;
if ( lineno < from || lineno > to ) continue ;
if ( lineno < from || lineno > to ) continue ;
var current = lineno == 1 + client . currentSourceLine ,
const current = lineno == 1 + client . currentSourceLine ;
breakpoint = client . breakpoints . some ( function ( bp ) {
const breakpoint = client . breakpoints . some ( function ( bp ) {
return ( bp . scriptReq === client . currentScript ||
return ( bp . scriptReq === client . currentScript ||
bp . script === client . currentScript ) &&
bp . script === client . currentScript ) &&
bp . line == lineno ;
bp . line == lineno ;
} ) ;
} ) ;
if ( lineno == 1 ) {
if ( lineno == 1 ) {
// The first line needs to have the module wrapper filtered out of
// The first line needs to have the module wrapper filtered out of
@ -1139,8 +1139,8 @@ Interface.prototype.list = function(delta) {
Interface . prototype . backtrace = function ( ) {
Interface . prototype . backtrace = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
const self = this ;
client = this . client ;
const client = this . client ;
self . pause ( ) ;
self . pause ( ) ;
client . fullTrace ( function ( err , bt ) {
client . fullTrace ( function ( err , bt ) {
@ -1153,8 +1153,8 @@ Interface.prototype.backtrace = function() {
if ( bt . totalFrames == 0 ) {
if ( bt . totalFrames == 0 ) {
self . print ( '(empty stack)' ) ;
self . print ( '(empty stack)' ) ;
} else {
} else {
var trace = [ ] ,
const trace = [ ] ;
firstFrameNative = bt . frames [ 0 ] . script . isNative ;
const firstFrameNative = bt . frames [ 0 ] . script . isNative ;
for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
var frame = bt . frames [ i ] ;
var frame = bt . frames [ i ] ;
@ -1183,9 +1183,9 @@ Interface.prototype.backtrace = function() {
Interface . prototype . scripts = function ( ) {
Interface . prototype . scripts = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var client = this . client ,
const client = this . client ;
displayNatives = arguments [ 0 ] || false ,
const displayNatives = arguments [ 0 ] || false ;
scripts = [ ] ;
const scripts = [ ] ;
this . pause ( ) ;
this . pause ( ) ;
for ( var id in client . scripts ) {
for ( var id in client . scripts ) {
@ -1323,9 +1323,9 @@ Interface.prototype.setBreakpoint = function(script, line,
condition , silent ) {
condition , silent ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
const self = this ;
scriptId ,
var scriptId ;
ambiguous ;
var ambiguous ;
// setBreakpoint() should insert breakpoint on current line
// setBreakpoint() should insert breakpoint on current line
if ( script === undefined ) {
if ( script === undefined ) {
@ -1429,10 +1429,10 @@ Interface.prototype.setBreakpoint = function(script, line,
Interface . prototype . clearBreakpoint = function ( script , line ) {
Interface . prototype . clearBreakpoint = function ( script , line ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var ambiguous ,
var ambiguous ;
breakpoint ,
var breakpoint ;
scriptId ,
var scriptId ;
index ;
var index ;
this . client . breakpoints . some ( function ( bp , i ) {
this . client . breakpoints . some ( function ( bp , i ) {
if ( bp . scriptId === script ||
if ( bp . scriptId === script ||
@ -1474,10 +1474,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
return this . error ( 'Breakpoint not found on line ' + line ) ;
return this . error ( 'Breakpoint not found on line ' + line ) ;
}
}
var self = this ,
var self = this ;
req = {
const req = { breakpoint } ;
breakpoint : breakpoint
} ;
self . pause ( ) ;
self . pause ( ) ;
self . client . clearBreakpoint ( req , function ( err , res ) {
self . client . clearBreakpoint ( req , function ( err , res ) {
@ -1513,8 +1511,8 @@ Interface.prototype.breakpoints = function() {
Interface . prototype . pause_ = function ( ) {
Interface . prototype . pause_ = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
const self = this ;
cmd = 'process._debugPause();' ;
const cmd = 'process._debugPause();' ;
this . pause ( ) ;
this . pause ( ) ;
this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
@ -1621,11 +1619,11 @@ Interface.prototype.killChild = function() {
// Spawns child process (and restores breakpoints)
// Spawns child process (and restores breakpoints)
Interface . prototype . trySpawn = function ( cb ) {
Interface . prototype . trySpawn = function ( cb ) {
var self = this ,
const self = this ;
breakpoints = this . breakpoints || [ ] ,
const breakpoints = this . breakpoints || [ ] ;
port = exports . port ,
var port = exports . port ;
host = '127.0.0.1' ,
var host = '127.0.0.1' ;
childArgs = this . args ;
var childArgs = this . args ;
this . killChild ( ) ;
this . killChild ( ) ;
assert ( ! this . child ) ;
assert ( ! this . child ) ;
@ -1676,8 +1674,8 @@ Interface.prototype.trySpawn = function(cb) {
this . pause ( ) ;
this . pause ( ) ;
var client = self . client = new Client ( ) ,
const client = self . client = new Client ( ) ;
connectionAttempts = 0 ;
var connectionAttempts = 0 ;
client . once ( 'ready' , function ( ) {
client . once ( 'ready' , function ( ) {
self . stdout . write ( ' ok\n' ) ;
self . stdout . write ( ' ok\n' ) ;