tor-browser

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

regress-369666-02.js (1216B)


      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 = 369666;
      8 var summary = 'inner function declaration in let-induced outer ' +
      9  'function body gets wrong scope.';
     10 var actual = 'No Crash';
     11 var expect = 'No Crash';
     12 
     13 
     14 //-----------------------------------------------------------------------------
     15 test();
     16 //-----------------------------------------------------------------------------
     17 
     18 function test()
     19 {
     20  printBugNumber(BUGNUMBER);
     21  printStatus (summary);
     22 
     23  function foo() {
     24    let x = 42
     25 
     26      function bar() {
     27      return x;
     28    }
     29 
     30    return bar;
     31  }
     32 
     33  print(foo()());
     34 
     35  baz = false;
     36 
     37  function foo2() {
     38    let x = 42
     39 
     40      function bar() {
     41      return x;
     42    }
     43 
     44    function bletch() {
     45      return x * x;
     46    }
     47 
     48    try {
     49      if (baz)
     50        return bar;
     51    } finally {
     52      print('finally', x);
     53    }
     54    return bletch;
     55  }
     56 
     57  print(foo2()());
     58 
     59  reportCompare(expect, actual, summary);
     60 }