Bug 676936 - Rewrite InitStopIterationClass to be much clearer and simpler. r=luke

This commit is contained in:
Jeff Walden 2011-05-04 16:54:23 -04:00
parent 9e604da3b5
commit 65b635c946

View File

@ -1450,10 +1450,16 @@ InitGeneratorClass(JSContext *cx, GlobalObject *global)
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;
}