Skip to content

Commit

Permalink
add detection correctness of iteration to `Promise.{ allSettled, any …
Browse files Browse the repository at this point in the history
…}` feature detection, Hermes issue
  • Loading branch information
zloirock committed Jan 13, 2023
1 parent fcd5af4 commit 7f8fce9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Added one more workaround of a `webpack` dev server bug on IE global methods, [#1161](https://github.com/zloirock/core-js/issues/1161)
- Fixed possible `String.{ raw, cooked }` error with empty template array
- Used non-standard V8 `Error.captureStackTrace` instead of stack parsing in new error classes / wrappers where it's possible
- Added detection correctness of iteration to `Promise.{ allSettled, any }` feature detection, Hermes issue
- Compat data improvements:
- [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy) marked as supported from V8 ~ Chrome 110
- Added Samsung Internet 20 compat data mapping
Expand Down
3 changes: 2 additions & 1 deletion packages/core-js/modules/es.promise.all-settled.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ var aCallable = require('../internals/a-callable');
var newPromiseCapabilityModule = require('../internals/new-promise-capability');
var perform = require('../internals/perform');
var iterate = require('../internals/iterate');
var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');

// `Promise.allSettled` method
// https://tc39.es/ecma262/#sec-promise.allsettled
$({ target: 'Promise', stat: true }, {
$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
allSettled: function allSettled(iterable) {
var C = this;
var capability = newPromiseCapabilityModule.f(C);
Expand Down
3 changes: 2 additions & 1 deletion packages/core-js/modules/es.promise.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ var getBuiltIn = require('../internals/get-built-in');
var newPromiseCapabilityModule = require('../internals/new-promise-capability');
var perform = require('../internals/perform');
var iterate = require('../internals/iterate');
var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');

var PROMISE_ANY_ERROR = 'No one promise resolved';

// `Promise.any` method
// https://tc39.es/ecma262/#sec-promise.any
$({ target: 'Promise', stat: true }, {
$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
any: function any(iterable) {
var C = this;
var AggregateError = getBuiltIn('AggregateError');
Expand Down
8 changes: 4 additions & 4 deletions tests/compat/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,12 @@ GLOBAL.tests = {
'es.promise.all': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () {
return Promise.all;
}],
'es.promise.all-settled': function () {
'es.promise.all-settled': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () {
return Promise.allSettled;
},
'es.promise.any': function () {
}],
'es.promise.any': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () {
return Promise.any;
},
}],
'es.promise.catch': PROMISES_SUPPORT,
'es.promise.finally': [PROMISES_SUPPORT, function () {
// eslint-disable-next-line unicorn/no-thenable -- required for testing
Expand Down

0 comments on commit 7f8fce9

Please sign in to comment.