regress-252892.js (1586B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 252892; 8 var summary = 'for (var i in o) in heavyweight function f should define i in f\'s activation'; 9 var actual = ''; 10 var expect = ''; 11 12 printBugNumber(BUGNUMBER); 13 printStatus (summary); 14 15 var status; 16 17 var dodis; 18 19 function f1(o){for(var x in o)printStatus(o[x]); return x} 20 function f2(o){with(this)for(var x in o)printStatus(o[x]); return x} 21 function f2novar(o){with(this)for(x in o)printStatus(o[x]); return x} 22 function f3(i,o){for(var x in o)printStatus(o[x]); return x} 23 function f4(i,o){with(this)for(var x in o)printStatus(o[x]); return x} 24 25 var t=0; 26 function assert(c) 27 { 28 ++t; 29 30 status = summary + ' ' + inSection(t); 31 expect = true; 32 actual = c; 33 34 if (!c) 35 { 36 printStatus(t + " FAILED!"); 37 } 38 reportCompare(expect, actual, summary); 39 } 40 41 assertEq(f1([]), undefined); 42 43 assertEq(f1(['first']), "0"); 44 45 assertEq(f2([]), undefined); 46 47 assertEq(f2(['first']), "0"); 48 49 assertEq(f3(42, []), undefined); 50 51 assertEq(f3(42, ['first']), "0"); 52 53 assertEq(f4(42, []), undefined); 54 55 assertEq(f4(42, ['first']), "0"); 56 57 this.x = 41; 58 59 assertEq(f2([]), undefined); 60 61 assertEq(f2novar([]), 41); 62 63 assertEq(f2(['first']), undefined); 64 65 assertEq(f2novar(['first']), "0"); 66 67 if (typeof reportCompare === "function") 68 reportCompare(true, true);