tor-browser

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

super-property-null-base.js (1123B)


      1 // Copyright (C) 2021 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-delete-operator-runtime-semantics-evaluation
      5 description: The restriction on the base of a super property must not be enforced before the delete expression is evaluated.
      6 info: |
      7  # 13.3.7.3 MakeSuperPropertyReference ( actualThis, propertyKey, strict )
      8 
      9  1. Let env be GetThisEnvironment().
     10  2. Assert: env.HasSuperBinding() is true.
     11  3. Let baseValue be ? env.GetSuperBase().
     12  4. Let bv be ? RequireObjectCoercible(baseValue).
     13 
     14  # 13.5.1.2 Runtime Semantics: Evaluation
     15  UnaryExpression : delete UnaryExpression
     16 
     17  1. Let ref be the result of evaluating UnaryExpression.
     18  2. ReturnIfAbrupt(ref).
     19  [...]
     20  5. If IsPropertyReference(ref) is true, then
     21    a. Assert: ! IsPrivateReference(ref) is false.
     22    b. If IsSuperReference(ref) is true, throw a ReferenceError exception.
     23 features: [class]
     24 ---*/
     25 
     26 class C {
     27  static m() {
     28    delete super.x;
     29  }
     30 }
     31 
     32 Object.setPrototypeOf(C, null);
     33 
     34 assert.throws(ReferenceError, () => {
     35  C.m();
     36 });
     37 
     38 reportCompare(0, 0);