tor-browser

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

private-field-presence-accessor.js (943B)


      1 // Copyright 2021 the V8 project authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: Value when private name describes an accessor method
      6 info: |
      7  7. Let privateName be ? GetValue(privateNameBinding).
      8  8. Assert: privateName is a Private Name.
      9  [...]
     10  10. Else,
     11      a. Assert: privateName.[[Kind]] is "method" or "accessor".
     12      b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion,
     13         then return true.
     14  11. Return false.
     15 esid: sec-relational-operators-runtime-semantics-evaluation
     16 features: [class-static-methods-private, class-fields-private-in]
     17 ---*/
     18 
     19 let count = 0;
     20 
     21 class Class {
     22  get #accessor() {
     23    count += 1;
     24  }
     25 
     26  static isNameIn(value) {
     27    return #accessor in value;
     28  }
     29 }
     30 
     31 assert.sameValue(Class.isNameIn({}), false);
     32 assert.sameValue(Class.isNameIn(new Class()), true);
     33 assert.sameValue(count, 0);
     34 
     35 reportCompare(0, 0);