tor-browser

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

order-after-define-property-with-function.js (1020B)


      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 /*---
      5 esid: sec-object.keys
      6 description: >
      7  Property names are returned in ascending chronological order of creation
      8  that is unaffected by [[DefineOwnProperty]].
      9 info: |
     10  Object.keys ( O )
     11 
     12  [...]
     13  2. Let nameList be ? EnumerableOwnPropertyNames(obj, key).
     14  3. Return CreateArrayFromList(nameList).
     15 
     16  EnumerableOwnPropertyNames ( O, kind )
     17 
     18  [...]
     19  2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
     20  [...]
     21 
     22  OrdinaryOwnPropertyKeys ( O )
     23 
     24  [...]
     25  3. For each own property key P of O that is a String but is not an array index,
     26  in ascending chronological order of property creation, do
     27    a. Add P as the last element of keys.
     28  [...]
     29  5. Return keys.
     30 features: [arrow-function]
     31 includes: [compareArray.js]
     32 ---*/
     33 
     34 var fn = () => {};
     35 fn.a = 1;
     36 Object.defineProperty(fn, "length", {enumerable: true});
     37 assert.compareArray(Object.keys(fn), ["length", "a"]);
     38 
     39 reportCompare(0, 0);