]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/new-array-with-size-throw-exception-and-tear-off-arguments.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / new-array-with-size-throw-exception-and-tear-off-arguments.js
CommitLineData
81345200
A
1function foo() {
2 var a = arguments;
3 return new Array(a[0]);
4}
5
6function bar(x) {
7 return foo(x);
8}
9
10noInline(bar);
11
12for (var i = 0; i < 10000; ++i) {
13 var result = bar(42);
14 if (result.length != 42)
15 throw "Error: bad result length: " + result;
16}
17
18var didThrow = false;
19try {
20 bar(-1);
21} catch (e) {
22 didThrow = e;
23}
24
25if (("" + didThrow).indexOf("RangeError") != 0)
26 throw "Error: did not throw right exception: " + didThrow;