Properly handle terminated scripts in the debugger (bug 814683). r=fitzgen

--HG--
extra : rebase_source : 7df6a8e87642d40bf69e50d65aa0b358a5f1955b
This commit is contained in:
Panos Astithas 2014-07-15 19:20:38 +03:00
parent 8e114cf26f
commit 53af163c72
2 changed files with 10 additions and 13 deletions

View File

@ -860,11 +860,7 @@ StackFrames.prototype = {
this.activeThread.addOneTimeListener("paused", (aEvent, aPacket) => {
let { type, frameFinished } = aPacket.why;
if (type == "clientEvaluated") {
if (!("terminated" in frameFinished)) {
deferred.resolve(frameFinished);
} else {
deferred.reject(new Error("The execution was abruptly terminated."));
}
deferred.resolve(frameFinished);
} else {
deferred.reject(new Error("Active thread paused unexpectedly."));
}
@ -975,10 +971,11 @@ StackFrames.prototype = {
yield this.evaluate(watchExpressions, evaluationOptions);
this._currentFrameDescription = FRAME_TYPE.NORMAL;
// If an error was thrown during the evaluation of the watch expressions,
// then at least one expression evaluation could not be performed. So
// remove the most recent watch expression and try again.
if (this._currentEvaluation.throw) {
// If an error was thrown during the evaluation of the watch expressions
// or the evaluation was terminated from the slow script dialog, then at
// least one expression evaluation could not be performed. So remove the
// most recent watch expression and try again.
if (this._currentEvaluation.throw || this._currentEvaluation.terminated) {
DebuggerView.WatchExpressions.removeAt(0);
yield DebuggerController.StackFrames.syncWatchExpressions();
}

View File

@ -2051,14 +2051,14 @@ ThreadActor.prototype = {
*/
createProtocolCompletionValue: function (aCompletion) {
let protoValue = {};
if ("return" in aCompletion) {
if (aCompletion == null) {
protoValue.terminated = true;
} else if ("return" in aCompletion) {
protoValue.return = this.createValueGrip(aCompletion.return);
} else if ("yield" in aCompletion) {
protoValue.return = this.createValueGrip(aCompletion.yield);
} else if ("throw" in aCompletion) {
protoValue.throw = this.createValueGrip(aCompletion.throw);
} else {
protoValue.terminated = true;
protoValue.return = this.createValueGrip(aCompletion.yield);
}
return protoValue;
},