Bug 509047 - Defining a property that forces a dense array to become sparse shouldn't call a setter. r=brendan.

This commit is contained in:
Jason Orendorff
2009-08-07 18:31:54 -05:00
parent b38c0240a9
commit 9fc33378ef

View File

@@ -970,7 +970,7 @@ array_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
return JS_TRUE;
isIndex = js_IdIsIndex(ID_TO_VALUE(id), &i);
if (!isIndex || attrs != JSPROP_ENUMERATE) {
if (!isIndex || attrs != JSPROP_ENUMERATE || !OBJ_IS_DENSE_ARRAY(cx, obj) || INDEX_TOO_SPARSE(obj, i)) {
if (!ENSURE_SLOW_ARRAY(cx, obj))
return JS_FALSE;
return js_DefineProperty(cx, obj, id, value, getter, setter, attrs, propp);