cleanup DevtoolsProtocol.js

pull/483/head
nightwing 2018-02-11 23:31:32 +04:00
rodzic 6fd7bb1981
commit a89660aac1
1 zmienionych plików z 27 dodań i 29 usunięć

Wyświetl plik

@ -41,34 +41,32 @@ var DevtoolsProtocol = module.exports = function(socket) {
return this.callbacks[message.id](message.result, message.error); return this.callbacks[message.id](message.result, message.error);
} else { } else {
var params = message.params; var params = message.params;
if (message.method == "Debugger.scriptParsed") { switch (message.method) {
this.$scripts[params.scriptId] = params; case "Debugger.scriptParsed":
this._signal("afterCompile", params); this.$scripts[params.scriptId] = params;
} this._signal("afterCompile", params);
else if (message.method == "Runtime.executionContextCreated") { break;
console.log(message.params); case "Runtime.executionContextCreated":
} // TODO add support for threads
else if (message.method == "Runtime.executionContextDestroyed") { break;
console.log(message.params); case "Runtime.executionContextDestroyed":
this.detachDebugger(); console.log(message.params);
} this.detachDebugger();
else if (message.method == "Debugger.resumed") { break;
this.$callstack = null; case "Debugger.resumed":
this._signal("changeRunning", params); this.$callstack = null;
console.warn(message); this._signal("changeRunning", params);
} break;
else if (message.method == "Debugger.paused") { case "Debugger.paused":
this.$callstack = params; this.$callstack = params;
this._signal("changeRunning", params); this._signal("changeRunning", params);
console.warn(message); if (params.reason == "exception")
if (params.reason == "exception") { this._signal("exception", params);
this._signal("exception", params); else
} else { this._signal("break", params);
this._signal("break", params); break;
} case "Runtime.consoleAPICalled":
} break;
else {
console.warn(message);
} }
} }
}; };
@ -233,7 +231,7 @@ var DevtoolsProtocol = module.exports = function(socket) {
this.changelive = function(scriptId, newSource, previewOnly, callback, $retry) { this.changelive = function(scriptId, newSource, previewOnly, callback, $retry) {
that.$send("Debugger.setScriptSource", { this.$send("Debugger.setScriptSource", {
scriptId: scriptId, scriptId: scriptId,
scriptSource: newSource, scriptSource: newSource,
dryRun: !!previewOnly dryRun: !!previewOnly