Bug 918170 - Handle StopIteration in CPOWs (r=dvander)
This commit is contained in:
@@ -112,7 +112,7 @@ JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs)
|
||||
{
|
||||
// By default, we set |undefined| unless we can get a more meaningful
|
||||
// exception.
|
||||
*rs = ReturnStatus(false, JSVariant(void_t()));
|
||||
*rs = ReturnStatus(ReturnException(JSVariant(void_t())));
|
||||
|
||||
// Note we always return true from this function, since this propagates
|
||||
// to the IPC code, and we don't want a JS failure to cause the death
|
||||
@@ -127,7 +127,12 @@ JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs)
|
||||
// that would crash.
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
if (!toVariant(cx, exn, &rs->exn()))
|
||||
if (JS_IsStopIteration(exn)) {
|
||||
*rs = ReturnStatus(ReturnStopIteration());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!toVariant(cx, exn, &rs->get_ReturnException().exn()))
|
||||
return true;
|
||||
|
||||
return true;
|
||||
@@ -136,7 +141,7 @@ JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs)
|
||||
bool
|
||||
JavaScriptChild::ok(ReturnStatus *rs)
|
||||
{
|
||||
*rs = ReturnStatus(true, JSVariant(void_t()));
|
||||
*rs = ReturnStatus(ReturnSuccess());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user