Bug 917915 - Don't leave an exception pending in JS_ReportPendingException. r=jorendorff

This commit is contained in:
Bobby Holley 2013-09-24 08:03:22 -07:00
parent d5328610cb
commit bcd6892931
2 changed files with 7 additions and 7 deletions

View File

@ -5946,7 +5946,10 @@ JS_ReportPendingException(JSContext *cx)
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return js_ReportUncaughtException(cx);
// This can only fail due to oom.
bool ok = js_ReportUncaughtException(cx);
JS_ASSERT(!cx->isExceptionPending());
return ok;
}
struct JSExceptionState {

View File

@ -1016,13 +1016,10 @@ js_ReportUncaughtException(JSContext *cx)
{
JSErrorReport *reportp, report;
if (!JS_IsExceptionPending(cx))
if (!cx->isExceptionPending())
return true;
RootedValue exn(cx);
if (!JS_GetPendingException(cx, &exn))
return false;
RootedValue exn(cx, cx->getPendingException());
AutoValueVector roots(cx);
roots.resize(6);
@ -1126,9 +1123,9 @@ js_ReportUncaughtException(JSContext *cx)
/* Pass the exception object. */
JS_SetPendingException(cx, exn);
js_ReportErrorAgain(cx, bytes, reportp);
JS_ClearPendingException(cx);
}
JS_ClearPendingException(cx);
return true;
}