tor-browser

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

property-traps-order-with-proxied-array.js (881B)


      1 // Copyright (C) 2018 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-object.keys
      6 description: >
      7  Ensure the correct property traps are called on a proxy of an array.
      8 info: |
      9  19.1.2.16 Object.keys ( O )
     10  ...
     11  2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
     12  ...
     13 
     14  7.3.21 EnumerableOwnPropertyNames ( O, kind )
     15  ...
     16  2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
     17  ...
     18  4. For each element key of ownKeys in List order, do
     19    a. If Type(key) is String, then
     20      i. Let desc be ? O.[[GetOwnProperty]](key).
     21      ...
     22 features: [Proxy]
     23 includes: [compareArray.js]
     24 ---*/
     25 
     26 var log = [];
     27 
     28 Object.keys(new Proxy([], new Proxy({},{
     29    get(t, pk, r) {
     30        log.push(pk);
     31    }
     32 })));
     33 
     34 assert.compareArray([
     35    "ownKeys",
     36    "getOwnPropertyDescriptor",
     37 ], log);
     38 
     39 reportCompare(0, 0);