Bug 677371 - [jsdbg2] Assertion failure: throwing, at jscntxt.h:1274. r=jimb

This commit is contained in:
Jason Orendorff 2011-08-09 18:01:38 -05:00
parent d8123ebf1c
commit bd42d5ffc4
2 changed files with 39 additions and 22 deletions

View File

@ -0,0 +1,15 @@
// Unwinding due to uncatchable errors does not trigger onExceptionUnwind.
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
var hits = 0;
dbg.onExceptionUnwind = function (frame, value) { hits = 'BAD'; };
dbg.onDebuggerStatement = function (frame) {
if (hits++ === 0)
assertEq(frame.eval("debugger;"), null);
else
return null;
}
assertEq(g.eval("debugger; 2"), 2);
assertEq(hits, 2);

View File

@ -466,32 +466,34 @@ js_InternalThrow(VMFrame &f)
jsbytecode *pc = NULL;
for (;;) {
// Call the throw hook if necessary
JSThrowHook handler = cx->debugHooks->throwHook;
if (handler || !cx->compartment->getDebuggees().empty()) {
Value rval;
JSTrapStatus st = Debugger::onExceptionUnwind(cx, &rval);
if (st == JSTRAP_CONTINUE && handler) {
st = handler(cx, cx->fp()->script(), cx->regs().pc, Jsvalify(&rval),
cx->debugHooks->throwHookData);
}
if (cx->isExceptionPending()) {
// Call the throw hook if necessary
JSThrowHook handler = cx->debugHooks->throwHook;
if (handler || !cx->compartment->getDebuggees().empty()) {
Value rval;
JSTrapStatus st = Debugger::onExceptionUnwind(cx, &rval);
if (st == JSTRAP_CONTINUE && handler) {
st = handler(cx, cx->fp()->script(), cx->regs().pc, Jsvalify(&rval),
cx->debugHooks->throwHookData);
}
switch (st) {
case JSTRAP_ERROR:
cx->clearPendingException();
return NULL;
switch (st) {
case JSTRAP_ERROR:
cx->clearPendingException();
return NULL;
case JSTRAP_RETURN:
cx->clearPendingException();
cx->fp()->setReturnValue(rval);
return cx->jaegerCompartment()->forceReturnFromExternC();
case JSTRAP_RETURN:
cx->clearPendingException();
cx->fp()->setReturnValue(rval);
return cx->jaegerCompartment()->forceReturnFromExternC();
case JSTRAP_THROW:
cx->setPendingException(rval);
break;
case JSTRAP_THROW:
cx->setPendingException(rval);
break;
default:
break;
default:
break;
}
}
}