summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/throw-apply-too-many-args.js
blob: 21569c28956d8717a036ef3dcc54ff47fb9ec326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function g(a, b, c, d) {}
function f(a, b, c)
{
  arguments.length = getMaxArgs() + 1;
  g.apply(this, arr);
}
let x = [];
x.length = getMaxArgs() + 1;
var args = [[5], [5], [5], [5], [5], [5], [5], [5], [5], [5], [5], x]
try
{
  for (var i = 0; i < args.length; i++) { arr = args[i]; f(); }
  throw new Error("didn't throw");
}
catch (e)
{
  assertEq(e instanceof RangeError, true, "wrong exception: " + e);
}
try
{
  for (var i = 0; i < args.length; i++) { arr = args[i]; f(); }
  throw new Error("didn't throw");
}
catch (e)
{
  assertEq(e instanceof RangeError, true, "wrong exception: " + e);
}