tor-browser

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

unscopables-not-referenced-for-undef.js (1092B)


      1 // Copyright 2015 Mike Pennisi. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-getidentifierreference
      6 es6id: 8.1.2.1
      7 description: >
      8  `Symbol.unscopables` is not referenced when environment record does not have
      9  requested property
     10 info: |
     11  [...]
     12  2. Let envRec be lex's EnvironmentRecord.
     13  3. Let exists be ? envRec.HasBinding(name).
     14 
     15  8.1.1.2.1 HasBinding
     16 
     17  1. Let envRec be the object Environment Record for which the method was
     18     invoked.
     19  2. Let bindings be the binding object for envRec.
     20  3. Let foundBinding be ? HasProperty(bindings, N).
     21  4. If foundBinding is false, return false.
     22 
     23  13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
     24 
     25  [...]
     26  5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
     27  [...]
     28 flags: [noStrict]
     29 features: [Symbol.unscopables]
     30 ---*/
     31 
     32 var x = 0;
     33 var env = {};
     34 var callCount = 0;
     35 Object.defineProperty(env, Symbol.unscopables, {
     36  get: function() {
     37    callCount += 1;
     38  }
     39 });
     40 
     41 with (env) {
     42  x;
     43 }
     44 
     45 assert.sameValue(callCount, 0);
     46 
     47 reportCompare(0, 0);