Backed out 2 changesets (bug 1908320) for causing wr failures on align-items-baseline...
[gecko.git] / js / src / tests / test262 / built-ins / Array / fromAsync / asyncitems-arraylike-length-accessor-throws.js
blob81932ec791096a6838adba3a998444c9fcde745e
1 // |reftest| async
2 // Copyright (C) 2023 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-array.fromasync
7 description: Rejects on array-like object whose length cannot be gotten
8 info: |
9   3.k.iii. Let _len_ be ? LengthOfArrayLike(_arrayLike_).
10 features: [Array.fromAsync]
11 flags: [async]
12 includes: [asyncHelpers.js]
13 ---*/
15 asyncTest(async function () {
16   await assert.throwsAsync(Test262Error, () => Array.fromAsync({
17     get length() {
18       throw new Test262Error('accessing length property fails');
19     }
20   }), "Promise should be rejected if array-like length getter throws");
22   await assert.throwsAsync(TypeError, () => Array.fromAsync({
23     length: 1n,
24     0: 0
25   }), "Promise should be rejected if array-like length can't be converted to a number");
26 });