Don't reuse native iterators if delete mutated them (bug 633409, r=dvander).
This commit is contained in:
@@ -468,7 +468,7 @@ RegisterEnumerator(JSContext *cx, JSObject *iterobj, NativeIterator *ni)
|
||||
cx->enumerators = iterobj;
|
||||
|
||||
JS_ASSERT(!(ni->flags & JSITER_ACTIVE));
|
||||
ni->flags |= JSITER_ACTIVE;
|
||||
ni->flags |= (JSITER_ACTIVE | JSITER_REUSABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ js_CloseIterator(JSContext *cx, JSObject *obj)
|
||||
/* Remove enumerators from the active list, which is a stack. */
|
||||
NativeIterator *ni = obj->getNativeIterator();
|
||||
|
||||
if (ni->flags & JSITER_ENUMERATE) {
|
||||
if (ni->flags & JSITER_REUSABLE) {
|
||||
JS_ASSERT(cx->enumerators == obj);
|
||||
cx->enumerators = ni->next;
|
||||
|
||||
@@ -882,6 +882,10 @@ SuppressDeletedPropertyHelper(JSContext *cx, JSObject *obj, IdPredicate predicat
|
||||
memmove(idp, idp + 1, (props_end - (idp + 1)) * sizeof(jsid));
|
||||
ni->props_end = ni->end() - 1;
|
||||
}
|
||||
|
||||
/* Don't reuse modified native iterators. */
|
||||
ni->flags &= (~JSITER_REUSABLE);
|
||||
|
||||
if (predicate.matchesAtMostOne())
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user