tor-browser

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

obj-prop-__proto__dup.js (1185B)


      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-destructuring-assignment
      5 es6id: 12.14.5
      6 description: Duplicate __proto__ property names
      7 info: |
      8    Annex B defines an early error for duplicate PropertyName of `__proto__`,
      9    in object initializers, but this does not apply to Object Assignment
     10    patterns
     11 ---*/
     12 
     13 // Explicitly define an "own" property to avoid Annex B "__proto__ Property
     14 // Names in Object Initializers" semantics (in environments which implement
     15 // that extension)
     16 var value = Object.defineProperty({}, '__proto__', { value: 123 });
     17 var result, x, y;
     18 
     19 result = { __proto__: x, __proto__: y } = value;
     20 
     21 assert.sameValue(result, value);
     22 assert.sameValue(x, 123, 'first AssignmentProperty');
     23 assert.sameValue(y, 123, 'second AssignmentProperty');
     24 
     25 result = x = y = null;
     26 
     27 // CoverParenthesizedExpressionAndArrowParameterList
     28 result = ({ __proto__: x, __proto__: y } = value);
     29 
     30 assert.sameValue(result, value);
     31 assert.sameValue(x, 123, 'first AssignmentProperty (CPEAAPL)');
     32 assert.sameValue(y, 123, 'second AssignmentProperty (CPEAAPL)');
     33 
     34 reportCompare(0, 0);