Bug 676936 - Rewrite InitStopIterationClass to be much clearer and simpler. r=luke
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -1445,20 +1445,26 @@ InitGeneratorClass(JSContext *cx, Global
#else
return true;
#endif
}
static JSObject *
InitStopIterationClass(JSContext *cx, GlobalObject *global)
{
- JSObject *proto = js_InitClass(cx, global, NULL, &js_StopIterationClass, NULL, 0,
- NULL, NULL, NULL, NULL);
- if (proto)
- MarkStandardClassInitializedNoProto(global, &js_StopIterationClass);
+ JSObject *proto = global->createBlankPrototype(cx, &js_StopIterationClass);
+ if (!proto || !proto->freeze(cx))
+ return NULL;
+
+ /* This should use a non-JSProtoKey'd slot, but this is easier for now. */
+ if (!DefineConstructorAndPrototype(cx, global, JSProto_StopIteration, proto, proto))
+ return NULL;
+
+ MarkStandardClassInitializedNoProto(global, &js_StopIterationClass);
+
return proto;
}
JSObject *
js_InitIteratorClasses(JSContext *cx, JSObject *obj)
{
JS_ASSERT(obj->isNative());