tor-browser

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

method.js (852B)


      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 method
      7 ---*/
      8 var proto = {
      9  method(x) {
     10    return 'proto' + x;
     11  }
     12 };
     13 
     14 var object = {
     15  method(x) {
     16    return super.method(x);
     17  }
     18 };
     19 
     20 Object.setPrototypeOf(object, proto);
     21 
     22 assert.sameValue(object.method(42), 'proto42', "`object.method(42)` returns `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`");
     23 assert.sameValue(proto.method(42), 'proto42', "`proto.method(42)` returns `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`");
     24 assert.sameValue(
     25  Object.getPrototypeOf(object).method(42),
     26  'proto42',
     27  "`Object.getPrototypeOf(object).method(42)` returns `'proto42'`"
     28 );
     29 
     30 reportCompare(0, 0);