Skip to content

Commit

Permalink
fix internal slots check in methods of some more built-in types
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 3, 2021
1 parent 4a29d1f commit 325ee1e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Changelog
##### Unreleased
- Fixed requirements of internal slots in `Observable` / `Subscription` / `SubscriptionObserver`, [#1017](https://github.com/zloirock/core-js/issues/1017)
- Fixed internal slots check in methods of some built-in types, [#1017](https://github.com/zloirock/core-js/issues/1017)
- Fixed `URLSearchParams` iterator `.next` that should be enumerable [by the spec](https://webidl.spec.whatwg.org/#es-iterator-prototype-object)
- Added NodeJS 17.2 compat data mapping

Expand Down
4 changes: 3 additions & 1 deletion packages/core-js/internals/async-from-sync-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');

var Promise = getBuiltIn('Promise');

var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.get;
var getInternalState = InternalStateModule.getterFor(ASYNC_FROM_SYNC_ITERATOR);

var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
var done = result.done;
Expand All @@ -22,6 +23,7 @@ var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {

var AsyncFromSyncIterator = function AsyncIterator(iterator) {
setInternalState(this, {
type: ASYNC_FROM_SYNC_ITERATOR,
iterator: anObject(iterator),
next: iterator.next
});
Expand Down
4 changes: 3 additions & 1 deletion packages/core-js/internals/async-iterator-create-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');

var Promise = getBuiltIn('Promise');

var ASYNC_ITERATOR_PROXY = 'AsyncIteratorProxy';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.get;
var getInternalState = InternalStateModule.getterFor(ASYNC_ITERATOR_PROXY);

var TO_STRING_TAG = wellKnownSymbol('toStringTag');

module.exports = function (nextHandler, IS_ITERATOR) {
var AsyncIteratorProxy = function AsyncIterator(state) {
state.type = ASYNC_ITERATOR_PROXY;
state.next = aCallable(state.iterator.next);
state.done = false;
state.ignoreArgument = !IS_ITERATOR;
Expand Down
4 changes: 3 additions & 1 deletion packages/core-js/internals/iterator-create-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ var InternalStateModule = require('../internals/internal-state');
var getMethod = require('../internals/get-method');
var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;

var ITERATOR_PROXY = 'IteratorProxy';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.get;
var getInternalState = InternalStateModule.getterFor(ITERATOR_PROXY);

var TO_STRING_TAG = wellKnownSymbol('toStringTag');

module.exports = function (nextHandler, IS_ITERATOR) {
var IteratorProxy = function Iterator(state) {
state.type = ITERATOR_PROXY;
state.next = aCallable(state.iterator.next);
state.done = false;
state.ignoreArg = !IS_ITERATOR;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/es.promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var V8_VERSION = require('../internals/engine-v8-version');
var SPECIES = wellKnownSymbol('species');
var PROMISE = 'Promise';

var getInternalState = InternalStateModule.get;
var getInternalState = InternalStateModule.getterFor(PROMISE);
var setInternalState = InternalStateModule.set;
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
var NativePromisePrototype = NativePromise && NativePromise.prototype;
Expand Down

0 comments on commit 325ee1e

Please sign in to comment.