mirror of https://github.com/tc39/test262.git
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
|
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||
|
|
||
|
/*---
|
||
|
description: >
|
||
|
Error retrieving the constructor's `resolve` method (closing iterator)
|
||
|
esid: sec-promise.allsettled
|
||
|
info: |
|
||
|
6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
|
||
|
7. If result is an abrupt completion, then
|
||
|
a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
|
||
|
b. IfAbruptRejectPromise(result, promiseCapability).
|
||
|
|
||
|
Runtime Semantics: PerformPromiseAllSettled
|
||
|
|
||
|
6. Repeat
|
||
|
...
|
||
|
i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
|
||
|
features: [Promise.allSettled, Symbol.iterator]
|
||
|
---*/
|
||
|
|
||
|
var iter = {};
|
||
|
var returnCount = 0;
|
||
|
iter[Symbol.iterator] = function() {
|
||
|
return {
|
||
|
next() {
|
||
|
return {
|
||
|
done: false
|
||
|
};
|
||
|
},
|
||
|
return() {
|
||
|
returnCount += 1;
|
||
|
return {};
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
Object.defineProperty(Promise, 'resolve', {
|
||
|
get() {
|
||
|
throw new Test262Error();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Promise.allSettled(iter);
|
||
|
|
||
|
assert.sameValue(returnCount, 1);
|