Bug 457920 - regexp-dna.js and generality want JSOP_GETELEM(dense array, "0") (r=mrbkap/gal).

This commit is contained in:
Brendan Eich
2008-10-06 22:30:36 -07:00
parent 8e95510025
commit 24a9ca408b
6 changed files with 102 additions and 51 deletions

View File

@@ -797,15 +797,18 @@ array_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
JSProperty **propp)
{
uint32 i;
JSBool isIndex;
if (id == ATOM_TO_JSID(cx->runtime->atomState.lengthAtom))
return JS_TRUE;
if (!js_IdIsIndex(ID_TO_VALUE(id), &i) || attrs != JSPROP_ENUMERATE) {
isIndex = js_IdIsIndex(ID_TO_VALUE(id), &i);
if (!isIndex || attrs != JSPROP_ENUMERATE) {
if (!ENSURE_SLOW_ARRAY(cx, obj))
return JS_FALSE;
return js_DefineProperty(cx, obj, id, value, getter, setter, attrs,
propp);
if (isIndex && STOBJ_IS_DELEGATE(obj))
cx->runtime->anyArrayProtoHasElement = JS_TRUE;
return js_DefineProperty(cx, obj, id, value, getter, setter, attrs, propp);
}
return array_setProperty(cx, obj, id, &value);