tor-browser

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

inherited-properties-omitted.js (1010B)


      1 // Copyright (C) 2015 Jordan Harband. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-object.entries
      6 description: Object.entries does not see inherited properties.
      7 author: Jordan Harband
      8 ---*/
      9 
     10 var F = function G() {};
     11 F.prototype.a = {};
     12 F.prototype.b = {};
     13 
     14 var f = new F();
     15 f.b = {}; // shadow the prototype
     16 f.c = {}; // solely an own property
     17 
     18 var result = Object.entries(f);
     19 
     20 assert.sameValue(Array.isArray(result), true, 'result is an array');
     21 assert.sameValue(result.length, 2, 'result has 2 items');
     22 
     23 assert.sameValue(Array.isArray(result[0]), true, 'first entry is an array');
     24 assert.sameValue(Array.isArray(result[1]), true, 'second entry is an array');
     25 
     26 assert.sameValue(result[0][0], 'b', 'first entry has key "b"');
     27 assert.sameValue(result[0][1], f.b, 'first entry has value f.b');
     28 assert.sameValue(result[1][0], 'c', 'second entry has key "c"');
     29 assert.sameValue(result[1][1], f.c, 'second entry has value f.c');
     30 
     31 reportCompare(0, 0);