Debian Codegraph @

js/src/tests/test262/built-ins/Promise/all/iter-next-val-err-no-close.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-promise.all
6 description: >
7 Error when accessing an iterator result's `value` property (not closing
8 iterator)
9 info: |
10 11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
11 12. If result is an abrupt completion,
12 a. If iteratorRecord.[[done]] is false, let result be
13 IteratorClose(iterator, result).
14 b. IfAbruptRejectPromise(result, promiseCapability).
15
16 [...]
17
18 25.4.4.1.1 Runtime Semantics: PerformPromiseAll
19
20 [...]
21 6. Repeat
22 [...]
23 e. Let nextValue be IteratorValue(next).
24 f. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
25 true.
26 g. ReturnIfAbrupt(nextValue).
27 features: [Symbol.iterator]
28 ---*/
29
30 var iterNextValThrows = {};
31 var returnCount = 0;
32 var poisonedVal = {
33 done: false
34 };
35 var error = new Test262Error();
36 Object.defineProperty(poisonedVal, 'value', {
37 get: function() {
38 throw error;
39 }
40 });
41 iterNextValThrows[Symbol.iterator] = function() {
42 return {
43 next: function() {
44 return poisonedVal;
45 },
46 return: function() {
47 returnCount += 1;
48 return {};
49 }
50 };
51 };
52
53 Promise.all(iterNextValThrows);
54
55 assert.sameValue(returnCount, 0);
56
57 reportCompare(0, 0);