tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-458838.js (1016B)


      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 = 458838;
      8 var summary = 'TM: do not fall off trace when nested function accesses var of outer function';
      9 var actual = '';
     10 var expect = '';
     11 
     12 //-----------------------------------------------------------------------------
     13 test();
     14 //-----------------------------------------------------------------------------
     15 
     16 function test()
     17 {
     18  printBugNumber(BUGNUMBER);
     19  printStatus (summary);
     20 
     21 
     22  function f() {
     23    var a = 1;
     24    function g() {
     25      var b = 0
     26        for (var i = 0; i < 10; ++i) {
     27          b += a;
     28        }
     29      return b;
     30    }
     31 
     32    return g();
     33  }
     34 
     35  expect = 10;
     36  actual  = f();
     37 
     38  reportCompare(expect, actual, summary + ': return value 10');
     39 }