tor-browser

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

results-object-has-no-undefined-iterables-properties.js (1038B)


      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  Undefined properties from the "iterables" object are not present in the results object
      8 info: |
      9  Iterator.zipKeyed ( iterables [ , options ] )
     10    ...
     11    12. For each element key of allKeys, do
     12      a. Let desc be Completion(iterables.[[GetOwnProperty]](key)).
     13      b. IfAbruptCloseIterators(desc, iters).
     14      c. If desc is not undefined and desc.[[Enumerable]] is true, then
     15        ...
     16 features: [joint-iteration]
     17 ---*/
     18 
     19 var iterables = {
     20  a: ["A"],
     21  b: undefined,
     22  c: ["C"],
     23 };
     24 
     25 var it = Iterator.zipKeyed(iterables);
     26 
     27 var results = it.next().value;
     28 
     29 assert.sameValue("a" in results, true, "property 'a' is present");
     30 assert.sameValue("b" in results, false, "property 'b' is not present");
     31 assert.sameValue("c" in results, true, "property 'c' is present");
     32 
     33 assert.sameValue(it.next().done, true, "iterator is exhausted");
     34 
     35 reportCompare(0, 0);