From 8d7903c6630afe8536ce93905f95bb9aaa0397db Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Wed, 4 May 2011 16:54:23 -0400 Subject: [PATCH] Bug 676936 - Rewrite InitStopIterationClass to be much clearer and simpler. r=luke --- js/src/jsiter.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index b94894e5bb5..08321b179fb 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -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; }