[INFER] DefineConstructorAndPrototype should update types before adding global property, bug 647464.
authorBrian Hackett <bhackett1024@gmail.com>
Sun, 03 Apr 2011 11:34:31 -0700
changeset 74888 ecac9d9248324c4110498c2500facb52e3adb483
parent 74887 1b6abbd8e1efaaf6d739632064c3d3fb49313672
child 74889 df76ed3fb8750944f0c15d78b68b460bc1c891d5
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs647464
milestone2.2a1pre
[INFER] DefineConstructorAndPrototype should update types before adding global property, bug 647464.
js/src/jsobjinlines.h
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -1403,16 +1403,19 @@ DefineConstructorAndPrototype(JSContext 
     JS_ASSERT(global->isGlobal());
     JS_ASSERT(!global->nativeEmpty()); /* reserved slots already allocated */
     JS_ASSERT(ctor);
     JS_ASSERT(proto);
 
     jsid id = ATOM_TO_JSID(cx->runtime->atomState.classAtoms[key]);
     JS_ASSERT(!global->nativeLookup(id));
 
+    if (!cx->addTypePropertyId(global->getType(), id, ObjectValue(*ctor)))
+        return false;
+
     if (!global->addDataProperty(cx, id, key + JSProto_LIMIT * 2, 0))
         return false;
 
     global->setSlot(key, ObjectValue(*ctor));
     global->setSlot(key + JSProto_LIMIT, ObjectValue(*proto));
     global->setSlot(key + JSProto_LIMIT * 2, ObjectValue(*ctor));
     return true;
 }