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

@@ -1198,12 +1198,6 @@ js_SuppressDeletedElements(JSContext *cx, HandleObject obj, uint32_t begin, uint
return SuppressDeletedPropertyHelper(cx, obj, IndexRangePredicate(begin, end));
}
static inline bool
IsStopIteration(const js::Value &v)
{
return v.isObject() && v.toObject().is<StopIterationObject>();
}
bool
js_IteratorMore(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
{
@@ -1247,7 +1241,7 @@ js_IteratorMore(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
return false;
if (!Invoke(cx, ObjectValue(*iterobj), rval, 0, NULL, rval)) {
/* Check for StopIteration. */
if (!cx->isExceptionPending() || !IsStopIteration(cx->getPendingException()))
if (!cx->isExceptionPending() || !JS_IsStopIteration(cx->getPendingException()))
return false;
cx->clearPendingException();
@@ -1292,7 +1286,7 @@ js_IteratorNext(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
static bool
stopiter_hasInstance(JSContext *cx, HandleObject obj, MutableHandleValue v, bool *bp)
{
*bp = IsStopIteration(v);
*bp = JS_IsStopIteration(v);
return true;
}