Bug 924059. Give ArrayIterator and its prototype different JSClasses so we can't confuse them for each other. r=waldo

This commit is contained in:
Boris Zbarsky
2014-12-13 22:05:46 -05:00
parent ff2fc3bb9a
commit dfaf46b2f4
5 changed files with 25 additions and 4 deletions

View File

@@ -926,6 +926,11 @@ const Class PropertyIteratorObject::class_ = {
trace
};
static const Class ArrayIteratorPrototypeClass = {
"Array Iterator",
JSCLASS_IMPLEMENTS_BARRIERS
};
enum {
ArrayIteratorSlotIteratedObject,
ArrayIteratorSlotNextIndex,
@@ -1335,7 +1340,7 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle<GlobalObject *> global)
RootedObject proto(cx);
if (global->getSlot(ARRAY_ITERATOR_PROTO).isUndefined()) {
const Class *cls = &ArrayIteratorObject::class_;
const Class *cls = &ArrayIteratorPrototypeClass;
proto = global->createBlankPrototypeInheriting(cx, cls, *iteratorProto);
if (!proto || !DefinePropertiesAndFunctions(cx, proto, nullptr, array_iterator_methods))
return false;