tor-browser

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

private-accessor-is-visible-in-computed-properties.js (1161B)


      1 // Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: Private getter of a class is visible in its ComputetProperty scope
      6 esid: prod-ClassTail
      7 info: |
      8  ClassTail : ClassHeritage { ClassBody }
      9    1. Let lex be the LexicalEnvironment of the running execution context.
     10    2. Let classScope be NewDeclarativeEnvironment(lex).
     11    3. Let classScopeEnvRec be classScope's EnvironmentRecord.
     12    ...
     13    15. Set the running execution context's LexicalEnvironment to classScope.
     14    16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
     15    ...
     16    27. For each ClassElement e in order from elements
     17      a. If IsStatic of e is false, then
     18        i. Let field be the result of ClassElementEvaluation for e with arguments proto and false.
     19    ...
     20 features: [class-methods-private, class-fields-public, class]
     21 ---*/
     22 
     23 assert.throws(TypeError, function() {
     24  class C {
     25    get #f() {
     26      throw new Test262Error();
     27    }
     28 
     29    [this.#f] = 'Test262';
     30  }
     31 }, 'access to a private acessor from ordinary object');
     32 
     33 
     34 reportCompare(0, 0);