tor-browser

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

call-bind-this-value.js (721B)


      1 // Copyright (C) 2016 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-super-keyword
      5 es6id: 12.3.5
      6 description: Binds the "this" value to value returned by "parent" constructor
      7 info: |
      8  [...]
      9  6. Let result be ? Construct(func, argList, newTarget).
     10  7. Let thisER be GetThisEnvironment( ).
     11  8. Return ? thisER.BindThisValue(result).
     12 features: [class]
     13 ---*/
     14 
     15 var customThisValue = {};
     16 var boundThisValue;
     17 function Parent() {
     18  return customThisValue;
     19 }
     20 
     21 class Child extends Parent {
     22  constructor() {
     23    super();
     24    boundThisValue = this;
     25  }
     26 }
     27 
     28 new Child();
     29 
     30 assert.sameValue(boundThisValue, customThisValue);
     31 
     32 reportCompare(0, 0);