tor-browser

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

__proto__-permitted-dup.js (1225B)


      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-object-initializer
      5 description: Permitted duplicate `__proto__` property
      6 info: |
      7    Annex B defines an early error for duplicate PropertyName of `__proto__`,
      8    but this does not apply to properties created from other productions.
      9 
     10    B.3.1 __proto__ Property Names in Object Initializers
     11 
     12    It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains
     13    any duplicate entries for "__proto__" and at least two of those entries
     14    were obtained from productions of the form
     15    PropertyDefinition : PropertyName : AssignmentExpression .
     16 features: [generators, async-functions, async-iteration, __proto__]
     17 ---*/
     18 
     19 var obj = {
     20  __proto__: null,
     21  __proto_: null,
     22  __proto: null,
     23  _proto__: null,
     24  proto__: null,
     25  ['__proto__']: null,
     26  __proto__() {},
     27  * __proto__() {},
     28  async __proto__() {},
     29  async * __proto__() {},
     30  get __proto__() { return 33; },
     31  set __proto__(_) { return 44; }
     32 };
     33 
     34 var desc = Object.getOwnPropertyDescriptor(obj, '__proto__');
     35 
     36 assert.sameValue(desc.get(), 33);
     37 assert.sameValue(desc.set(), 44);
     38 
     39 reportCompare(0, 0);