tor-browser

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

getter-removing-future-key.js (687B)


      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.values
      6 description: Object.values does not see an element removed by a getter that is hit during iteration
      7 author: Jordan Harband
      8 ---*/
      9 
     10 var bDeletesC = {
     11  a: 'A',
     12  get b() {
     13    delete this.c;
     14    return 'B';
     15  },
     16  c: 'C'
     17 };
     18 
     19 var result = Object.values(bDeletesC);
     20 
     21 assert.sameValue(Array.isArray(result), true, 'result is an array');
     22 assert.sameValue(result.length, 2, 'result has 2 items');
     23 
     24 assert.sameValue(result[0], 'A', 'first value is "A"');
     25 assert.sameValue(result[1], 'B', 'second value is "B"');
     26 
     27 reportCompare(0, 0);