tor-browser

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

scope-param-elem-var-open.js (964B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-functiondeclarationinstantiation
      5 description: >
      6    sloppy direct evals in params introduce vars
      7 info: |
      8    [...]
      9    20. Else,
     10      a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
     11      b. Let calleeEnv be the LexicalEnvironment of calleeContext.
     12      c. Let env be NewDeclarativeEnvironment(calleeEnv).
     13      d. Let envRec be env's EnvironmentRecord.
     14    [...]
     15 flags: [noStrict]
     16 ---*/
     17 
     18 var x = 'outside';
     19 var probe1, probe2;
     20 
     21 (function(
     22    _ = probe1 = function() { return x; },
     23    __ = (eval('var x = "inside";'), probe2 = function() { return x; })
     24  ) {
     25 }());
     26 
     27 assert.sameValue(probe1(), 'inside');
     28 assert.sameValue(probe2(), 'inside');
     29 
     30 reportCompare(0, 0);