tor-browser

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

iterables-iteration-deleted.js (1095B)


      1 // Copyright (C) 2025 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-iterator.zipkeyed
      6 description: >
      7  Deleted properties are skipped in "iterables" iteration.
      8 info: |
      9  Iterator.zipKeyed ( iterables [ , options ] )
     10    ...
     11    10. Let allKeys be ? iterables.[[OwnPropertyKeys]]().
     12    11. Let keys be a new empty List.
     13    12. For each element key of allKeys, do
     14      a. Let desc be Completion(iterables.[[GetOwnProperty]](key)).
     15      ...
     16      c. If desc is not undefined and desc.[[Enumerable]] is true, then
     17        ...
     18 includes: [compareArray.js]
     19 features: [joint-iteration]
     20 ---*/
     21 
     22 var log = [];
     23 
     24 var iterables = {
     25  get a() {
     26    log.push("get a");
     27 
     28    // Delete property "b".
     29    delete iterables.b;
     30 
     31    return [];
     32  },
     33  get b() {
     34    throw new Test262Error("unexpected get b");
     35  },
     36  get c() {
     37    log.push("get c");
     38 
     39    // Add new property "d".
     40    iterables.d = null;
     41 
     42    return [];
     43  },
     44 };
     45 
     46 Iterator.zipKeyed(iterables);
     47 
     48 assert.compareArray(log, [
     49  "get a",
     50  "get c",
     51 ]);
     52 
     53 reportCompare(0, 0);