tor-browser

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

getter-super-prop.js (804B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 12.2.5
      5 description: >
      6    super method calls in object literal getter
      7 ---*/
      8 var proto = {
      9  _x: 42,
     10  get x() {
     11    return 'proto' + this._x;
     12  }
     13 };
     14 
     15 var object = {
     16  get x() {
     17    return super.x;
     18  }
     19 };
     20 
     21 Object.setPrototypeOf(object, proto);
     22 
     23 assert.sameValue(object.x, 'proto42', "The value of `object.x` is `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`");
     24 assert.sameValue(object._x, 42, "The value of `object._x` is `42`, after executing `Object.setPrototypeOf(object, proto);`");
     25 assert.sameValue(
     26  Object.getPrototypeOf(object)._x,
     27  42,
     28  "The value of `Object.getPrototypeOf(object)._x` is `42`"
     29 );
     30 
     31 reportCompare(0, 0);