Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / ecma_5 / Function / Function-arguments-gc.js
1 /*
2  * Any copyright is dedicated to the Public Domain.
3  * http://creativecommons.org/licenses/publicdomain/
4  * Contributor:
5  *   Christian Holler <decoder@own-hero.net>
6  */
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 623301;
10 var summary = "Properly root argument names during Function()";
11 print(BUGNUMBER + ": " + summary);
12
13 /**************
14  * BEGIN TEST *
15  **************/
16
17 if (typeof gczeal === "function")
18   gczeal(2);
19
20 function crashMe(n)
21 {
22   var nasty = [];
23   while (n--)
24     nasty.push("a" + n);
25   return Function.apply(null, nasty);
26 }
27
28 var count = 64; // exact value not important
29 assertEq(crashMe(count + 1).length, count);
30
31 if (typeof gczeal === "function")
32     gczeal(0); // reset
33
34 /******************************************************************************/
35
36 if (typeof reportCompare === "function")
37   reportCompare(true, true);
38
39 print("All tests passed!");