|
1071 | 1071 | // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
1072 | 1072 | if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;
|
1073 | 1073 | }
|
1074 |
| - // We need Promise#finally in the pure version for preventing prototype pollution |
1075 |
| - if (isPure && !PromiseConstructor.prototype['finally']) return true; |
1076 | 1074 | // We can't use @@species feature detection in V8 since it causes
|
1077 | 1075 | // deoptimization and performance degradation
|
1078 | 1076 | // https://github.com/zloirock/core-js/issues/679
|
|
1292 | 1290 | : newGenericPromiseCapability(C);
|
1293 | 1291 | };
|
1294 | 1292 |
|
1295 |
| - if (!isPure && typeof nativePromiseConstructor == 'function') { |
| 1293 | + if (typeof nativePromiseConstructor == 'function') { |
1296 | 1294 | nativeThen = nativePromiseConstructor.prototype.then;
|
1297 | 1295 |
|
1298 | 1296 | // wrap native Promise#then for native async functions
|
|
1334 | 1332 | }
|
1335 | 1333 | });
|
1336 | 1334 |
|
1337 |
| - _export({ target: PROMISE, stat: true, forced: isPure || FORCED }, { |
| 1335 | + _export({ target: PROMISE, stat: true, forced: FORCED }, { |
1338 | 1336 | // `Promise.resolve` method
|
1339 | 1337 | // https://tc39.github.io/ecma262/#sec-promise.resolve
|
1340 | 1338 | resolve: function resolve(x) {
|
1341 |
| - return promiseResolve(isPure && this === PromiseWrapper ? PromiseConstructor : this, x); |
| 1339 | + return promiseResolve(this, x); |
1342 | 1340 | }
|
1343 | 1341 | });
|
1344 | 1342 |
|
|
1799 | 1797 | return getInternalState$1(this).description;
|
1800 | 1798 | }
|
1801 | 1799 | });
|
1802 |
| - { |
| 1800 | + if (!isPure) { |
1803 | 1801 | redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
|
1804 | 1802 | }
|
1805 | 1803 | }
|
|
2162 | 2160 | if (anyNativeIterator) {
|
2163 | 2161 | CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
|
2164 | 2162 | if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
|
2165 |
| - if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) { |
| 2163 | + if (!isPure && objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) { |
2166 | 2164 | if (objectSetPrototypeOf) {
|
2167 | 2165 | objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
|
2168 | 2166 | } else if (typeof CurrentIteratorPrototype[ITERATOR$4] != 'function') {
|
|
2171 | 2169 | }
|
2172 | 2170 | // Set @@toStringTag to native iterators
|
2173 | 2171 | setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
| 2172 | + if (isPure) iterators[TO_STRING_TAG] = returnThis$2; |
2174 | 2173 | }
|
2175 | 2174 | }
|
2176 | 2175 |
|
|
2181 | 2180 | }
|
2182 | 2181 |
|
2183 | 2182 | // define iterator
|
2184 |
| - if (IterablePrototype[ITERATOR$4] !== defaultIterator) { |
| 2183 | + if ((!isPure || FORCED) && IterablePrototype[ITERATOR$4] !== defaultIterator) { |
2185 | 2184 | createNonEnumerableProperty(IterablePrototype, ITERATOR$4, defaultIterator);
|
2186 | 2185 | }
|
2187 | 2186 | iterators[NAME] = defaultIterator;
|
|
0 commit comments