Bug 614915: set return value correctly when sorting a list containing only undefined values, r=cdleary

This commit is contained in:
David Mandelin 2010-11-30 10:25:07 -08:00
parent dcc8dc67e2
commit bf0a0f2c33
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,2 @@
var s = [undefined, undefined].sort();
assertEq(s.length, 2);

View File

@ -1843,8 +1843,10 @@ js::array_sort(JSContext *cx, uintN argc, Value *vp)
++newlen;
}
if (newlen == 0)
if (newlen == 0) {
vp->setObject(*obj);
return true; /* The array has only holes and undefs. */
}
/*
* The first newlen elements of vec are copied from the array object