js/src/tests/js1_5/Regress/regress-252892.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
     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 = '';
    12 printBugNumber(BUGNUMBER);
    13 printStatus (summary);
    15 var status; 
    17 var dodis;
    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=i in o)printStatus(o[x]); return x}
    23 function f4(i,o){with(this)for(var x=i in o)printStatus(o[x]); return x}
    25 var t=0;
    26 function assert(c)
    27 {
    28   ++t;
    30   status = summary + ' ' + inSection(t);
    31   expect = true;
    32   actual = c;
    34   if (!c)
    35   {
    36     printStatus(t + " FAILED!");
    37   }
    38   reportCompare(expect, actual, summary);
    39 }
    41 assert(f1([]) == undefined);
    43 assert(f1(['first']) == 0);
    45 assert(f2([]) == undefined);
    47 assert(f2(['first']) == 0);
    49 assert(f3(42, []) == 42);
    51 assert(f3(42, ['first']) == 0);
    53 assert(f4(42, []) == 42);
    55 assert(f4(42, ['first']) == 0);
    57 this.x = 41;
    59 assert(f2([]) == undefined);
    61 assert(f2novar([]) == 41);
    63 assert(f2(['first']) == undefined);
    65 assert(f2novar(['first']) == 0);

mercurial