tor-browser

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

setter-super-prop.js (772B)


      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 setters
      7 ---*/
      8 var proto = {
      9  _x: 0,
     10  set x(v) {
     11    return this._x = v;
     12  }
     13 };
     14 
     15 var object = {
     16  set x(v) {
     17    super.x = v;
     18  }
     19 };
     20 
     21 Object.setPrototypeOf(object, proto);
     22 
     23 assert.sameValue(object.x = 1, 1, "`object.x = 1` is `1`, after executing `Object.setPrototypeOf(object, proto);`");
     24 assert.sameValue(object._x, 1, "The value of `object._x` is `1`, after executing `Object.setPrototypeOf(object, proto);`");
     25 assert.sameValue(
     26  Object.getPrototypeOf(object)._x,
     27  0,
     28  "The value of `Object.getPrototypeOf(object)._x` is `0`"
     29 );
     30 
     31 reportCompare(0, 0);