Bug 918170 - Handle StopIteration in CPOWs (r=dvander)

This commit is contained in:
Bill McCloskey
2013-09-30 12:20:51 -07:00
parent 56c52ed386
commit 2942d62921
8 changed files with 67 additions and 19 deletions

View File

@@ -601,11 +601,14 @@ JavaScriptParent::ipcfail(JSContext *cx)
bool
JavaScriptParent::ok(JSContext *cx, const ReturnStatus &status)
{
if (status.ok())
if (status.type() == ReturnStatus::TReturnSuccess)
return true;
if (status.type() == ReturnStatus::TReturnStopIteration)
return JS_ThrowStopIteration(cx);
RootedValue exn(cx);
if (!toValue(cx, status.exn(), &exn))
if (!toValue(cx, status.get_ReturnException().exn(), &exn))
return false;
JS_SetPendingException(cx, exn);
@@ -657,7 +660,7 @@ JavaScriptParent::instanceOf(JSObject *obj, const nsID *id, bool *bp)
if (!CallInstanceOf(objId, iid, &status, bp))
return NS_ERROR_UNEXPECTED;
if (!status.ok())
if (status.type() != ReturnStatus::TReturnSuccess)
return NS_ERROR_UNEXPECTED;
return NS_OK;
@@ -678,7 +681,7 @@ JavaScriptParent::domInstanceOf(JSObject *obj, int prototypeID, int depth, bool
if (!CallDOMInstanceOf(objId, prototypeID, depth, &status, bp))
return false;
if (!status.ok())
if (status.type() != ReturnStatus::TReturnSuccess)
return false;
return true;