| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ var spawn = require('child_process').spawn; | |||
| 5 | 5 | ||
| 6 | 6 | exports.port = 5858; | |
| 7 | 7 | ||
| 8 | - exports.start = function () { | ||
| 8 | + exports.start = function() { | ||
| 9 | 9 | var interface = new Interface(); | |
| 10 | 10 | }; | |
| 11 | 11 | ||
@@ -22,12 +22,12 @@ args.unshift('--debug-brk'); | |||
| 22 | 22 | // Usage: | |
| 23 | 23 | // p = new Protocol(); | |
| 24 | 24 | // | |
| 25 | - // p.onResponse = function (res) { | ||
| 25 | + // p.onResponse = function(res) { | ||
| 26 | 26 | // // do stuff with response from V8 | |
| 27 | 27 | // }; | |
| 28 | 28 | // | |
| 29 | 29 | // socket.setEncoding('utf8'); | |
| 30 | - // socket.on('data', function (s) { | ||
| 30 | + // socket.on('data', function(s) { | ||
| 31 | 31 | // // Pass strings into the protocol | |
| 32 | 32 | // p.execute(s); | |
| 33 | 33 | // }); | |
@@ -86,7 +86,7 @@ Protocol.prototype.execute = function(d) { | |||
| 86 | 86 | break; | |
| 87 | 87 | ||
| 88 | 88 | default: | |
| 89 | - throw new Error("Unknown state"); | ||
| 89 | + throw new Error('Unknown state'); | ||
| 90 | 90 | break; | |
| 91 | 91 | } | |
| 92 | 92 | }; | |
@@ -121,13 +121,13 @@ function Client() { | |||
| 121 | 121 | }); | |
| 122 | 122 | ||
| 123 | 123 | protocol.onResponse = this._onResponse.bind(this); | |
| 124 | - }; | ||
| 124 | + } | ||
| 125 | 125 | inherits(Client, net.Stream); | |
| 126 | 126 | exports.Client = Client; | |
| 127 | 127 | ||
| 128 | 128 | ||
| 129 | 129 | Client.prototype._addHandle = function(desc) { | |
| 130 | - if (typeof desc != 'object' || !desc.handle) throw new Error("bad type"); | ||
| 130 | + if (typeof desc != 'object' || !desc.handle) throw new Error('bad type'); | ||
| 131 | 131 | this.handles[desc.handle] = desc; | |
| 132 | 132 | ||
| 133 | 133 | if (desc.type == 'script') { | |
@@ -201,7 +201,7 @@ Client.prototype.req = function(req, cb) { | |||
| 201 | 201 | ||
| 202 | 202 | ||
| 203 | 203 | Client.prototype.reqVersion = function(cb) { | |
| 204 | - this.req({ command: 'version' } , function (res) { | ||
| 204 | + this.req({ command: 'version' } , function(res) { | ||
| 205 | 205 | if (cb) cb(res.body.V8Version, res.running); | |
| 206 | 206 | }); | |
| 207 | 207 | }; | |
@@ -221,7 +221,7 @@ Client.prototype.reqEval = function(expression, cb) { | |||
| 221 | 221 | req.arguments.frame = this.currentFrame; | |
| 222 | 222 | } | |
| 223 | 223 | ||
| 224 | - this.req(req, function (res) { | ||
| 224 | + this.req(req, function(res) { | ||
| 225 | 225 | console.error('reqEval res ', res.body); | |
| 226 | 226 | self._addHandle(res.body); | |
| 227 | 227 | if (cb) cb(res.body); | |
@@ -232,7 +232,7 @@ Client.prototype.reqEval = function(expression, cb) { | |||
| 232 | 232 | // reqBacktrace(cb) | |
| 233 | 233 | // TODO: from, to, bottom | |
| 234 | 234 | Client.prototype.reqBacktrace = function(cb) { | |
| 235 | - this.req({ command: 'backtrace' } , function (res) { | ||
| 235 | + this.req({ command: 'backtrace' } , function(res) { | ||
| 236 | 236 | if (cb) cb(res.body); | |
| 237 | 237 | }); | |
| 238 | 238 | }; | |
@@ -256,7 +256,7 @@ Client.prototype.reqBacktrace = function(cb) { | |||
| 256 | 256 | // | |
| 257 | 257 | Client.prototype.reqScripts = function(cb) { | |
| 258 | 258 | var self = this; | |
| 259 | - this.req({ command: 'scripts' } , function (res) { | ||
| 259 | + this.req({ command: 'scripts' } , function(res) { | ||
| 260 | 260 | for (var i = 0; i < res.body.length; i++) { | |
| 261 | 261 | self._addHandle(res.body[i]); | |
| 262 | 262 | } | |
@@ -266,13 +266,13 @@ Client.prototype.reqScripts = function(cb) { | |||
| 266 | 266 | ||
| 267 | 267 | ||
| 268 | 268 | Client.prototype.reqContinue = function(cb) { | |
| 269 | - this.req({ command: 'continue' }, function (res) { | ||
| 269 | + this.req({ command: 'continue' }, function(res) { | ||
| 270 | 270 | if (cb) cb(res); | |
| 271 | 271 | }); | |
| 272 | 272 | }; | |
| 273 | 273 | ||
| 274 | 274 | Client.prototype.listbreakpoints = function(cb) { | |
| 275 | - this.req({ command: 'listbreakpoints' }, function (res) { | ||
| 275 | + this.req({ command: 'listbreakpoints' }, function(res) { | ||
| 276 | 276 | if (cb) cb(res); | |
| 277 | 277 | }); | |
| 278 | 278 | }; | |
@@ -284,16 +284,16 @@ Client.prototype.step = function(action, count, cb) { | |||
| 284 | 284 | arguments: { stepaction: action, stepcount: count } | |
| 285 | 285 | }; | |
| 286 | 286 | ||
| 287 | - this.req(req, function (res) { | ||
| 287 | + this.req(req, function(res) { | ||
| 288 | 288 | if (cb) cb(res); | |
| 289 | 289 | }); | |
| 290 | 290 | }; | |
| 291 | 291 | ||
| 292 | 292 | ||
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | - var helpMessage = "Commands: run, kill, print, step, next, " + | ||
| 296 | - "continue, scripts, backtrace, version, quit"; | ||
| 295 | + var helpMessage = 'Commands: run, kill, print, step, next, ' + | ||
| 296 | + 'continue, scripts, backtrace, version, quit'; | ||
| 297 | 297 | ||
| 298 | 298 | function SourceUnderline(sourceText, position) { | |
| 299 | 299 | if (!sourceText) return; | |
@@ -342,7 +342,7 @@ function Interface() { | |||
| 342 | 342 | var client; | |
| 343 | 343 | var term; | |
| 344 | 344 | ||
| 345 | - process.on('exit', function () { | ||
| 345 | + process.on('exit', function() { | ||
| 346 | 346 | self.killChild(); | |
| 347 | 347 | }); | |
| 348 | 348 | ||
@@ -356,15 +356,15 @@ function Interface() { | |||
| 356 | 356 | ||
| 357 | 357 | this.quitting = false; | |
| 358 | 358 | ||
| 359 | - process.on('SIGINT', function () { | ||
| 359 | + process.on('SIGINT', function() { | ||
| 360 | 360 | self.handleSIGINT(); | |
| 361 | 361 | }); | |
| 362 | 362 | ||
| 363 | - term.on('SIGINT', function () { | ||
| 363 | + term.on('SIGINT', function() { | ||
| 364 | 364 | self.handleSIGINT(); | |
| 365 | 365 | }); | |
| 366 | 366 | ||
| 367 | - term.on('close', function () { | ||
| 367 | + term.on('close', function() { | ||
| 368 | 368 | self.tryQuit(); | |
| 369 | 369 | }); | |
| 370 | 370 | ||
@@ -404,7 +404,7 @@ Interface.prototype.tryQuit = function() { | |||
| 404 | 404 | var self = this; | |
| 405 | 405 | ||
| 406 | 406 | if (self.child) { | |
| 407 | - self.quitQuestion(function (yes) { | ||
| 407 | + self.quitQuestion(function(yes) { | ||
| 408 | 408 | if (yes) { | |
| 409 | 409 | self.quit(); | |
| 410 | 410 | } else { | |
@@ -425,7 +425,7 @@ Interface.prototype.pause = function() { | |||
| 425 | 425 | ||
| 426 | 426 | ||
| 427 | 427 | Interface.prototype.resume = function() { | |
| 428 | - if (!this.paused) return false | ||
| 428 | + if (!this.paused) return false; | ||
| 429 | 429 | this.paused = false; | |
| 430 | 430 | this.stdin.resume(); | |
| 431 | 431 | this.term.resume(); | |
@@ -464,7 +464,7 @@ Interface.prototype.handleBreak = function(r) { | |||
| 464 | 464 | ||
| 465 | 465 | console.log(result); | |
| 466 | 466 | ||
| 467 | - if(!this.resume()) this.term.prompt(); | ||
| 467 | + if (!this.resume()) this.term.prompt(); | ||
| 468 | 468 | }; | |
| 469 | 469 | ||
| 470 | 470 | ||
@@ -481,15 +481,15 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 481 | 481 | } else if (/^r(un)?/.test(cmd)) { | |
| 482 | 482 | self._lastCommand = null; | |
| 483 | 483 | if (self.child) { | |
| 484 | - self.restartQuestion(function (yes) { | ||
| 484 | + self.restartQuestion(function(yes) { | ||
| 485 | 485 | if (!yes) { | |
| 486 | 486 | self._lastCommand = null; | |
| 487 | 487 | term.prompt(); | |
| 488 | 488 | } else { | |
| 489 | - console.log("restarting..."); | ||
| 489 | + console.log('restarting...'); | ||
| 490 | 490 | self.killChild(); | |
| 491 | 491 | // XXX need to wait a little bit for the restart to work? | |
| 492 | - setTimeout(function () { | ||
| 492 | + setTimeout(function() { | ||
| 493 | 493 | self.trySpawn(); | |
| 494 | 494 | }, 1000); | |
| 495 | 495 | } | |
@@ -507,7 +507,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 507 | 507 | self.printNotConnected(); | |
| 508 | 508 | return; | |
| 509 | 509 | } | |
| 510 | - client.reqVersion(function (v) { | ||
| 510 | + client.reqVersion(function(v) { | ||
| 511 | 511 | console.log(v); | |
| 512 | 512 | term.prompt(); | |
| 513 | 513 | }); | |
@@ -517,7 +517,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 517 | 517 | self.printNotConnected(); | |
| 518 | 518 | return; | |
| 519 | 519 | } | |
| 520 | - client.listbreakpoints(function (res) { | ||
| 520 | + client.listbreakpoints(function(res) { | ||
| 521 | 521 | console.log(res); | |
| 522 | 522 | term.prompt(); | |
| 523 | 523 | }); | |
@@ -527,7 +527,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 527 | 527 | self.printNotConnected(); | |
| 528 | 528 | return; | |
| 529 | 529 | } | |
| 530 | - client.reqBacktrace(function (bt) { | ||
| 530 | + client.reqBacktrace(function(bt) { | ||
| 531 | 531 | if (/full/.test(cmd)) { | |
| 532 | 532 | console.log(bt); | |
| 533 | 533 | } else if (bt.totalFrames == 0) { | |
@@ -558,7 +558,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 558 | 558 | } | |
| 559 | 559 | ||
| 560 | 560 | self.pause(); | |
| 561 | - client.reqContinue(function () { | ||
| 561 | + client.reqContinue(function() { | ||
| 562 | 562 | self.resume(); | |
| 563 | 563 | }); | |
| 564 | 564 | ||
@@ -569,7 +569,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 569 | 569 | } | |
| 570 | 570 | // kill | |
| 571 | 571 | if (self.child) { | |
| 572 | - self.killQuestion(function (yes) { | ||
| 572 | + self.killQuestion(function(yes) { | ||
| 573 | 573 | if (yes) { | |
| 574 | 574 | self.killChild(); | |
| 575 | 575 | } else { | |
@@ -585,7 +585,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 585 | 585 | self.printNotConnected(); | |
| 586 | 586 | return; | |
| 587 | 587 | } | |
| 588 | - client.step('next', 1, function (res) { | ||
| 588 | + client.step('next', 1, function(res) { | ||
| 589 | 589 | // Wait for break point. (disable raw mode?) | |
| 590 | 590 | }); | |
| 591 | 591 | ||
@@ -594,7 +594,7 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 594 | 594 | self.printNotConnected(); | |
| 595 | 595 | return; | |
| 596 | 596 | } | |
| 597 | - client.step('in', 1, function (res) { | ||
| 597 | + client.step('in', 1, function(res) { | ||
| 598 | 598 | // Wait for break point. (disable raw mode?) | |
| 599 | 599 | }); | |
| 600 | 600 | ||
@@ -605,11 +605,11 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 605 | 605 | } | |
| 606 | 606 | var i = cmd.indexOf(' '); | |
| 607 | 607 | if (i < 0) { | |
| 608 | - console.log("print [expression]"); | ||
| 608 | + console.log('print [expression]'); | ||
| 609 | 609 | term.prompt(); | |
| 610 | 610 | } else { | |
| 611 | 611 | cmd = cmd.slice(i); | |
| 612 | - client.reqEval(cmd, function (res) { | ||
| 612 | + client.reqEval(cmd, function(res) { | ||
| 613 | 613 | if (res) { | |
| 614 | 614 | console.log(res.text); | |
| 615 | 615 | } else { | |
@@ -633,32 +633,32 @@ Interface.prototype.handleCommand = function(cmd) { | |||
| 633 | 633 | Interface.prototype.yesNoQuestion = function(prompt, cb) { | |
| 634 | 634 | var self = this; | |
| 635 | 635 | self.resume(); | |
| 636 | - this.term.question(prompt, function (answer) { | ||
| 636 | + this.term.question(prompt, function(answer) { | ||
| 637 | 637 | if (/^y(es)?$/i.test(answer)) { | |
| 638 | 638 | cb(true); | |
| 639 | 639 | } else if (/^n(o)?$/i.test(answer)) { | |
| 640 | 640 | cb(false); | |
| 641 | 641 | } else { | |
| 642 | - console.log("Please answer y or n."); | ||
| 642 | + console.log('Please answer y or n.'); | ||
| 643 | 643 | self.restartQuestion(cb); | |
| 644 | 644 | } | |
| 645 | 645 | }); | |
| 646 | 646 | }; | |
| 647 | 647 | ||
| 648 | 648 | ||
| 649 | 649 | Interface.prototype.restartQuestion = function(cb) { | |
| 650 | - this.yesNoQuestion("The program being debugged has been started already.\n" + | ||
| 651 | - "Start it from the beginning? (y or n) ", cb); | ||
| 650 | + this.yesNoQuestion('The program being debugged has been started already.\n' + | ||
| 651 | + 'Start it from the beginning? (y or n) ', cb); | ||
| 652 | 652 | }; | |
| 653 | 653 | ||
| 654 | 654 | ||
| 655 | 655 | Interface.prototype.killQuestion = function(cb) { | |
| 656 | - this.yesNoQuestion("Kill the program being debugged? (y or n) ", cb); | ||
| 656 | + this.yesNoQuestion('Kill the program being debugged? (y or n) ', cb); | ||
| 657 | 657 | }; | |
| 658 | 658 | ||
| 659 | 659 | ||
| 660 | 660 | Interface.prototype.quitQuestion = function(cb) { | |
| 661 | - this.yesNoQuestion("A debugging session is active. Quit anyway? (y or n) ", | ||
| 661 | + this.yesNoQuestion('A debugging session is active. Quit anyway? (y or n) ', | ||
| 662 | 662 | cb); | |
| 663 | 663 | }; | |
| 664 | 664 | ||
@@ -688,35 +688,35 @@ Interface.prototype.trySpawn = function(cb) { | |||
| 688 | 688 | ||
| 689 | 689 | this.pause(); | |
| 690 | 690 | ||
| 691 | - setTimeout(function () { | ||
| 692 | - process.stdout.write("connecting..."); | ||
| 691 | + setTimeout(function() { | ||
| 692 | + process.stdout.write('connecting...'); | ||
| 693 | 693 | var client = self.client = new Client(); | |
| 694 | 694 | client.connect(exports.port); | |
| 695 | 695 | ||
| 696 | - client.once('ready', function () { | ||
| 697 | - process.stdout.write("ok\r\n"); | ||
| 696 | + client.once('ready', function() { | ||
| 697 | + process.stdout.write('ok\r\n'); | ||
| 698 | 698 | ||
| 699 | 699 | // since we did debug-brk, we're hitting a break point immediately | |
| 700 | 700 | // continue before anything else. | |
| 701 | - client.reqContinue(function () { | ||
| 701 | + client.reqContinue(function() { | ||
| 702 | 702 | if (cb) cb(); | |
| 703 | 703 | }); | |
| 704 | 704 | }); | |
| 705 | 705 | ||
| 706 | - client.on('close', function () { | ||
| 707 | - console.log("\nprogram terminated"); | ||
| 706 | + client.on('close', function() { | ||
| 707 | + console.log('\nprogram terminated'); | ||
| 708 | 708 | self.client = null; | |
| 709 | 709 | self.killChild(); | |
| 710 | 710 | if (!self.quitting) self.term.prompt(); | |
| 711 | 711 | }); | |
| 712 | 712 | ||
| 713 | - client.on('unhandledResponse', function (res) { | ||
| 714 | - console.log("\r\nunhandled res:"); | ||
| 713 | + client.on('unhandledResponse', function(res) { | ||
| 714 | + console.log('\r\nunhandled res:'); | ||
| 715 | 715 | console.log(res); | |
| 716 | 716 | self.term.prompt(); | |
| 717 | 717 | }); | |
| 718 | 718 | ||
| 719 | - client.on('break', function (res) { | ||
| 719 | + client.on('break', function(res) { | ||
| 720 | 720 | self.handleBreak(res.body); | |
| 721 | 721 | }); | |
| 722 | 722 | }, 100); | |
@@ -736,7 +736,9 @@ Interface.prototype.printScripts = function(displayNatives) { | |||
| 736 | 736 | for (var id in client.scripts) { | |
| 737 | 737 | var script = client.scripts[id]; | |
| 738 | 738 | if (typeof script == 'object' && script.name) { | |
| 739 | - if (displayNatives || script.name == client.currentScript || !script.isNative) { | ||
| 739 | + if (displayNatives || | ||
| 740 | + script.name == client.currentScript || | ||
| 741 | + !script.isNative) { | ||
| 740 | 742 | text += script.name == client.currentScript ? '* ' : ' '; | |
| 741 | 743 | var n = require('path').split(script.name); | |
| 742 | 744 | text += n[n.length - 1] + '\n'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -249,7 +249,7 @@ function expectedException(actual, expected) { | |||
| 249 | 249 | return expected.test(actual); | |
| 250 | 250 | } else if (actual instanceof expected) { | |
| 251 | 251 | return true; | |
| 252 | - } else if ( expected.call({}, actual) === true ) { | ||
| 252 | + } else if (expected.call({}, actual) === true) { | ||
| 253 | 253 | return true; | |
| 254 | 254 | } | |
| 255 | 255 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments