Bug 686274 - Increase the limit on the maximum size of array initializers (r=bhackett)

--HG--
extra : rebase_source : 1c2cb231b8f7ea58089b353654efc886ad244ad0
This commit is contained in:
Luke Wagner 2013-05-20 17:18:23 -07:00
parent 029347447b
commit 472ecf4674
2 changed files with 12 additions and 1 deletions

View File

@ -6220,7 +6220,7 @@ Parser<ParseHandler>::primaryExpr(TokenKind tt)
bool spread = false, missingTrailingComma = false;
unsigned index = 0;
for (; ; index++) {
if (index == StackSpace::ARGS_LENGTH_MAX) {
if (index == JSObject::NELEMENTS_LIMIT) {
report(ParseError, false, null(), JSMSG_ARRAY_INIT_TOO_BIG);
return null();
}

View File

@ -0,0 +1,11 @@
function f(N) {
var body = "return [";
for (var i = 0; i < N-1; i++)
body += "1,";
body += "2]";
var f = new Function(body);
var arr = f();
assertEq(arr.length, N);
assertEq(arr[N-1], 2);
}
f(1000000);