tor-browser

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

asyncitems-function.js (565B)


      1 // |reftest| async
      2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-array.fromasync
      7 description: >
      8  Array.fromAsync treats a function as an array-like, reading elements up to fn.length
      9 includes: [asyncHelpers.js, compareArray.js]
     10 flags: [async]
     11 features: [Array.fromAsync]
     12 ---*/
     13 
     14 asyncTest(async function () {
     15  const fn = function(a, b) {};
     16  fn[0] = 1;
     17  fn[1] = 2;
     18  fn[2] = 3;
     19 
     20  const result = await Array.fromAsync(fn);
     21  assert.compareArray(result, [1, 2]);
     22 });