tor-browser

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

__proto__-permitted-dup-shorthand.js (884B)


      1 // Copyright (C) 2020 Alexey Shvayka. 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 (shorthand)
      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 ---*/
     17 
     18 var __proto__ = 2;
     19 var obj = {
     20  __proto__,
     21  __proto__,
     22 };
     23 
     24 assert(obj.hasOwnProperty("__proto__"));
     25 assert.sameValue(obj.__proto__, 2);
     26 
     27 reportCompare(0, 0);