Bug 880041 (part 5) - Use JSObject::{is,as} for ElementIteratorObject. r=sfink.

This commit is contained in:
Nicholas Nethercote
2013-06-16 17:24:34 -07:00
parent 17fdcb20b4
commit d2158363c5
3 changed files with 6 additions and 7 deletions

View File

@@ -863,7 +863,7 @@ ElementIteratorObject::create(JSContext *cx, Handle<Value> target)
RootedObject proto(cx, cx->global()->getOrCreateElementIteratorPrototype(cx));
if (!proto)
return NULL;
RootedObject iterobj(cx, NewObjectWithGivenProto(cx, &ElementIteratorClass, proto, cx->global()));
RootedObject iterobj(cx, NewObjectWithGivenProto(cx, &class_, proto, cx->global()));
if (iterobj) {
iterobj->setReservedSlot(TargetSlot, target);
iterobj->setReservedSlot(IndexSlot, Int32Value(0));
@@ -874,7 +874,7 @@ ElementIteratorObject::create(JSContext *cx, Handle<Value> target)
static bool
IsElementIterator(const Value &v)
{
return v.isObject() && v.toObject().isElementIterator();
return v.isObject() && v.toObject().is<ElementIteratorObject>();
}
JSBool
@@ -934,7 +934,7 @@ ElementIteratorObject::next_impl(JSContext *cx, CallArgs args)
return false;
}
Class js::ElementIteratorClass = {
Class ElementIteratorObject::class_ = {
"Array Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(ElementIteratorObject::NumSlots),
@@ -1785,7 +1785,7 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle<GlobalObject *> global)
RootedObject proto(cx);
if (global->getSlot(ELEMENT_ITERATOR_PROTO).isUndefined()) {
Class *cls = &ElementIteratorClass;
Class *cls = &ElementIteratorObject::class_;
proto = global->createBlankPrototypeInheriting(cx, cls, *iteratorProto);
if (!proto || !DefinePropertiesAndBrand(cx, proto, NULL, ElementIteratorObject::methods))
return false;