Bug 614070 - Fix Array.prototype.unshift to always set the new length on this. r=jwalden

This commit is contained in:
Jan de Mooij
2010-11-24 23:22:44 +01:00
parent c2d86f2bc4
commit c466d9bb5d
3 changed files with 44 additions and 2 deletions

View File

@@ -2222,9 +2222,9 @@ array_unshift(JSContext *cx, uintN argc, Value *vp)
return JS_FALSE;
newlen += argc;
if (!js_SetLengthProperty(cx, obj, newlen))
return JS_FALSE;
}
if (!js_SetLengthProperty(cx, obj, newlen))
return JS_FALSE;
/* Follow Perl by returning the new array length. */
vp->setNumber(newlen);