Bug 1001547 - Fix a bug in typed array element-setting. r=sfink

This commit is contained in:
Jeff Walden
2014-04-25 12:26:56 -07:00
parent 47b3b9a371
commit 1f850df315
2 changed files with 8 additions and 1 deletions

View File

@@ -4991,7 +4991,12 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits<mode>::ContextType cxArg
return false;
}
TypedArrayObject::setElement(obj->as<TypedArrayObject>(), index, d);
// Silently do nothing for out-of-bounds sets, for consistency with
// current behavior. (ES6 currently says to throw for this in
// strict mode code, so we may eventually need to change.)
TypedArrayObject &tarray = obj->as<TypedArrayObject>();
if (index < tarray.length())
TypedArrayObject::setElement(tarray, index, d);
return true;
}