tor-browser

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

static-private-methods-proxy-default-handler-throws.js (722B)


      1 // Copyright (C) 2018 Rick Waldron. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-privatefieldget
      6 description: Static private methods not accessible via default Proxy handler
      7 info: |
      8  1. Assert: P is a Private Name value.
      9  2. If O is not an object, throw a TypeError exception.
     10  3. Let entry be PrivateFieldFind(P, O).
     11  4. If entry is empty, throw a TypeError exception.
     12 
     13 features: [class, class-static-methods-private]
     14 ---*/
     15 
     16 
     17 var C = class {
     18  static #x(value) {
     19    return 1;
     20  }
     21  static x() {
     22    return this.#x();
     23  }
     24 }
     25 
     26 var P = new Proxy(C, {});
     27 
     28 assert.sameValue(C.x(), 1);
     29 assert.throws(TypeError, function() {
     30  P.x();
     31 });
     32 
     33 reportCompare(0, 0);