new Array("string") should be ["string"], not silent failure (14545, r=brendan)

git-svn-id: svn://10.0.0.236/trunk@48781 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shaver%netscape.com 1999-09-22 04:36:28 +00:00
parent 4eff9ae16a
commit 4ae847a467

View File

@ -1318,9 +1318,13 @@ Array(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
vector = argv;
}
else {
if (!ValueIsLength(cx, argv[0], &length))
return JS_FALSE;
vector = NULL;
if (!ValueIsLength(cx, argv[0], &length)) {
vector = argv;
length = 1;
} else {
vector = NULL;
}
}
}
return InitArrayObject(cx, obj, length, vector);