debugger: assert test before accessing this.binding
PR-URL: https://github.com/nodejs/node/pull/5145 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
4e46931406
commit
826844e27e
@ -48,6 +48,7 @@ function Agent() {
|
|||||||
|
|
||||||
this.first = true;
|
this.first = true;
|
||||||
this.binding = process._debugAPI;
|
this.binding = process._debugAPI;
|
||||||
|
assert(this.binding, 'Debugger agent running without bindings!');
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.binding.onmessage = function(msg) {
|
this.binding.onmessage = function(msg) {
|
||||||
@ -57,7 +58,6 @@ function Agent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.clients = [];
|
this.clients = [];
|
||||||
assert(this.binding, 'Debugger agent running without bindings!');
|
|
||||||
}
|
}
|
||||||
util.inherits(Agent, net.Server);
|
util.inherits(Agent, net.Server);
|
||||||
|
|
||||||
|
6
test/parallel/test-debug-agent.js
Normal file
6
test/parallel/test-debug-agent.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
assert.throws(() => { require('_debug_agent').start(); },
|
||||||
|
assert.AssertionError);
|
Loading…
x
Reference in New Issue
Block a user