tor-browser

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

source-non-enum.js (903B)


      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: 19.1.2.1
      5 description: Does not assign non-enumerable source properties
      6 info: |
      7    [...]
      8    5. For each element nextSource of sources, in ascending index order,
      9       c. Repeat for each element nextKey of keys in List order,
     10          i. Let desc be from.[[GetOwnProperty]](nextKey).
     11          ii. ReturnIfAbrupt(desc).
     12          iii. if desc is not undefined and desc.[[Enumerable]] is true, then
     13 ---*/
     14 
     15 var target = {};
     16 var source = Object.defineProperty({}, 'attr', {
     17  value: 1,
     18  enumerable: false
     19 });
     20 var result;
     21 
     22 result = Object.assign(target, source);
     23 
     24 assert(
     25  !Object.prototype.hasOwnProperty.call(target, 'attr'),
     26  "Non-enumerable property 'attr' does not get copied to target"
     27 );
     28 assert.sameValue(result, target);
     29 
     30 reportCompare(0, 0);