Source code

Revision control

Copy as Markdown

Other Tools

// |reftest| shell-option(--enable-promise-allkeyed) skip-if(!Promise.allKeyed||!xulRuntime.shell) async -- await-dictionary is not enabled unconditionally, requires shell-options
// Copyright (C) 2026 Danial Asaria (Bloomberg LP). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-promise.allkeyed
description: >
Rejects when resolving the final result throws
info: |
Promise.allKeyed ( promises )
...
6. Let result be Completion(PerformPromiseAllKeyed(...)).
7. IfAbruptRejectPromise(result, promiseCapability).
PerformPromiseAllKeyed ( variant, promises, ctor, resultCapability, promiseResolve )
...
Set remainingElementsCount.[[Value]] to remainingElementsCount.[[Value]] - 1.
If remainingElementsCount.[[Value]] = 0, then
Let result be CreateKeyedPromiseCombinatorResultObject(entries).
Perform ? Call(resultCapability.[[Resolve]], undefined, « result »).
includes: [asyncHelpers.js]
flags: [async]
features: [await-dictionary]
---*/
var error = new Test262Error();
function Constructor(executor) {
return new Promise(function(_, reject) {
executor(function() {
throw error;
}, reject);
});
}
Constructor.resolve = Promise.resolve;
asyncTest(function() {
return Promise.allKeyed.call(Constructor, {}).then(function() {
throw new Test262Error("The promise should be rejected.");
}, function(reason) {
assert.sameValue(reason, error);
});
});