blob: 132f8e80f793f3b19c6eab5a00e4822e684c7d8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// |reftest| async
// Copyright (C) 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-asyncfromsynciteratorcontinuation
description: >
Reject promise when PromiseResolve in AsyncFromSyncIteratorContinuation throws.
info: |
25.1.4.4 AsyncFromSyncIteratorContinuation ( result, promiseCapability )
...
5. Let valueWrapper be PromiseResolve(%Promise%, « value »).
6. IfAbruptRejectPromise(valueWrapper, promiseCapability).
...
includes: [compareArray.js]
flags: [async]
features: [async-iteration]
---*/
var expected = [
"start",
// `valueWrapper` promise rejected.
"tick 1",
// `Await(nextResult)` in 13.7.5.13 done.
"tick 2",
// catch handler executed.
"catch",
];
var actual = [];
async function f() {
var p = Promise.resolve(0);
Object.defineProperty(p, "constructor", {
get() {
throw new Error();
}
});
actual.push("start");
for await (var x of [p]);
actual.push("never reached");
}
Promise.resolve(0)
.then(() => actual.push("tick 1"))
.then(() => actual.push("tick 2"))
.then(() => {
assert.compareArray(actual, expected);
}).then($DONE, $DONE);
f().catch(() => actual.push("catch"));
|