debugger: Clean ups, bug fixes
This commit is contained in:
parent
866201bd74
commit
0946474b5c
@ -140,8 +140,10 @@ var natives = process.binding('natives');
|
|||||||
|
|
||||||
Client.prototype._addScript = function(desc) {
|
Client.prototype._addScript = function(desc) {
|
||||||
this.scripts[desc.id] = desc;
|
this.scripts[desc.id] = desc;
|
||||||
desc.isNative = (desc.name.replace('.js', '') in natives) ||
|
if (desc.name) {
|
||||||
desc.name == 'node.js';
|
desc.isNative = (desc.name.replace('.js', '') in natives) ||
|
||||||
|
desc.name == 'node.js';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -153,33 +155,40 @@ Client.prototype._removeScript = function(desc) {
|
|||||||
Client.prototype._onResponse = function(res) {
|
Client.prototype._onResponse = function(res) {
|
||||||
for (var i = 0; i < this._reqCallbacks.length; i++) {
|
for (var i = 0; i < this._reqCallbacks.length; i++) {
|
||||||
var cb = this._reqCallbacks[i];
|
var cb = this._reqCallbacks[i];
|
||||||
if (this._reqCallbacks[i].request_seq == cb.request_seq) break;
|
if (this._reqCallbacks[i].request_seq == res.body.request_seq) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var handled = false;
|
||||||
|
|
||||||
if (res.headers.Type == 'connect') {
|
if (res.headers.Type == 'connect') {
|
||||||
// Request a list of scripts for our own storage.
|
// Request a list of scripts for our own storage.
|
||||||
self.reqScripts();
|
self.reqScripts();
|
||||||
self.emit('ready');
|
self.emit('ready');
|
||||||
|
handled = true;
|
||||||
|
|
||||||
} else if (res.body && res.body.event == 'break') {
|
} else if (res.body && res.body.event == 'break') {
|
||||||
this.emit('break', res.body);
|
this.emit('break', res.body);
|
||||||
|
handled = true;
|
||||||
|
|
||||||
} else if (res.body && res.body.event == 'afterCompile') {
|
} else if (res.body && res.body.event == 'afterCompile') {
|
||||||
this._addHandle(res.body.body.script);
|
this._addHandle(res.body.body.script);
|
||||||
|
handled = true;
|
||||||
|
|
||||||
} else if (res.body && res.body.event == 'scriptCollected') {
|
} else if (res.body && res.body.event == 'scriptCollected') {
|
||||||
// ???
|
// ???
|
||||||
this._removeScript(res.body.body.script);
|
this._removeScript(res.body.body.script);
|
||||||
|
handled = true;
|
||||||
|
|
||||||
} else if (cb) {
|
|
||||||
this._reqCallbacks.splice(i, 1);
|
|
||||||
cb(res.body);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.emit('unhandledResponse', res.body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cb) {
|
||||||
|
this._reqCallbacks.splice(i, 1);
|
||||||
|
handled = true;
|
||||||
|
cb(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled) this.emit('unhandledResponse', res.body);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -418,6 +427,7 @@ Interface.prototype.handleCommand = function(cmd) {
|
|||||||
self.tryQuit();
|
self.tryQuit();
|
||||||
|
|
||||||
} else if (/^r(un)?/.test(cmd)) {
|
} else if (/^r(un)?/.test(cmd)) {
|
||||||
|
self._lastCommand = null;
|
||||||
if (self.child) {
|
if (self.child) {
|
||||||
self.restartQuestion(function (yes) {
|
self.restartQuestion(function (yes) {
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
@ -497,6 +507,10 @@ Interface.prototype.handleCommand = function(cmd) {
|
|||||||
client.reqContinue();
|
client.reqContinue();
|
||||||
|
|
||||||
} else if (/^k(ill)?/.test(cmd)) {
|
} else if (/^k(ill)?/.test(cmd)) {
|
||||||
|
if (!client) {
|
||||||
|
self.printNotConnected();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// kill
|
// kill
|
||||||
if (self.child) {
|
if (self.child) {
|
||||||
self.killQuestion(function (yes) {
|
self.killQuestion(function (yes) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user