[INFER] Set standard class slots before updating type info, bug 649439.

This commit is contained in:
Brian Hackett 2011-04-13 07:09:21 -07:00
parent d8c95f63d9
commit b42d909b23
2 changed files with 12 additions and 6 deletions

View File

@ -0,0 +1,3 @@
var o1 = new String("abc");
var o2 = o1[1];
o2[1];

View File

@ -1489,14 +1489,17 @@ DefineConstructorAndPrototype(JSContext *cx, JSObject *global,
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;
/* Set these first in case addTypePropertyId looks for this class. */
global->setSlot(key, ObjectValue(*ctor));
global->setSlot(key + JSProto_LIMIT, ObjectValue(*proto));
if (!cx->addTypePropertyId(global->getType(), id, ObjectValue(*ctor)) ||
!global->addDataProperty(cx, id, key + JSProto_LIMIT * 2, 0)) {
global->setSlot(key, UndefinedValue());
global->setSlot(key + JSProto_LIMIT, UndefinedValue());
return false;
}
global->setSlot(key + JSProto_LIMIT * 2, ObjectValue(*ctor));
return true;
}