Bug 951282 - Wrap the pending exception lazily; r=luke
This commit is contained in:
@@ -978,7 +978,8 @@ js::CloseIterator(JSContext *cx, HandleObject obj)
|
||||
bool
|
||||
js::UnwindIteratorForException(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedValue v(cx, cx->getPendingException());
|
||||
RootedValue v(cx);
|
||||
cx->getPendingException(&v);
|
||||
cx->clearPendingException();
|
||||
if (!CloseIterator(cx, obj))
|
||||
return false;
|
||||
@@ -1195,7 +1196,12 @@ js_IteratorMore(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
|
||||
return false;
|
||||
if (!Invoke(cx, ObjectValue(*iterobj), rval, 0, nullptr, rval)) {
|
||||
/* Check for StopIteration. */
|
||||
if (!cx->isExceptionPending() || !JS_IsStopIteration(cx->getPendingException()))
|
||||
if (!cx->isExceptionPending())
|
||||
return false;
|
||||
RootedValue exception(cx);
|
||||
if (!cx->getPendingException(&exception))
|
||||
return false;
|
||||
if (!JS_IsStopIteration(exception))
|
||||
return false;
|
||||
|
||||
cx->clearPendingException();
|
||||
|
||||
Reference in New Issue
Block a user