1 description( 2 'Tests to ensure that activations are built correctly in the face of duplicate parameter names and do not cause crashes.' 3 ); 4 5 function gc() 6 { 7 if (this.GCController) 8 GCController.collect(); 9 else 10 for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC. 11 ({}); 12 } 13 14 function eatRegisters(param) 15 { 16 if (param > 10) 17 return; 18 eatRegisters(param + 1); 19 } 20 21 function test1(a, b, b, b, b, b, b) { 22 return function() { 23 return a[0]; 24 } 25 } 26 27 var test1Closure = test1(["success"]); 28 29 var extra = test1("success"); 30 eatRegisters(0); 31 gc(); 32 33 shouldBe('test1Closure()', '"success"'); 34 35 function test2(a, a, a, a, a, a, b) { 36 return function() { 37 return b[0]; 38 } 39 } 40 41 var test2Closure = test2("success", "success", "success", "success", "success", "success", ["success"]); 42 extra = test2("success", "success", "success", "success", "success", "success", ["success"]); 43 44 eatRegisters(0); 45 gc(); 46 47 shouldBe('test2Closure()', '"success"'); 48