core-js-pure 3.11.2 → 3.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/internals/shared.js +1 -1
- package/modules/es.promise.finally.js +6 -3
- package/modules/es.promise.js +18 -11
- package/package.json +2 -2
package/internals/shared.js
CHANGED
|
@@ -4,7 +4,7 @@ var store = require('../internals/shared-store');
|
|
|
4
4
|
(module.exports = function (key, value) {
|
|
5
5
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
6
6
|
})('versions', []).push({
|
|
7
|
-
version: '3.11.
|
|
7
|
+
version: '3.11.3',
|
|
8
8
|
mode: IS_PURE ? 'pure' : 'global',
|
|
9
9
|
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
10
10
|
});
|
|
@@ -30,7 +30,10 @@ $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
//
|
|
34
|
-
if (!IS_PURE && typeof NativePromise == 'function'
|
|
35
|
-
|
|
33
|
+
// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
|
|
34
|
+
if (!IS_PURE && typeof NativePromise == 'function') {
|
|
35
|
+
var method = getBuiltIn('Promise').prototype['finally'];
|
|
36
|
+
if (NativePromise.prototype['finally'] !== method) {
|
|
37
|
+
redefine(NativePromise.prototype, 'finally', method, { unsafe: true });
|
|
38
|
+
}
|
|
36
39
|
}
|
package/modules/es.promise.js
CHANGED
|
@@ -36,6 +36,7 @@ var setInternalState = InternalStateModule.set;
|
|
|
36
36
|
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
|
|
37
37
|
var NativePromisePrototype = NativePromise && NativePromise.prototype;
|
|
38
38
|
var PromiseConstructor = NativePromise;
|
|
39
|
+
var PromiseConstructorPrototype = NativePromisePrototype;
|
|
39
40
|
var TypeError = global.TypeError;
|
|
40
41
|
var document = global.document;
|
|
41
42
|
var process = global.process;
|
|
@@ -60,7 +61,7 @@ var FORCED = isForced(PROMISE, function () {
|
|
|
60
61
|
// We can't detect it synchronously, so just check versions
|
|
61
62
|
if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
|
|
62
63
|
// We need Promise#finally in the pure version for preventing prototype pollution
|
|
63
|
-
if (IS_PURE && !
|
|
64
|
+
if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
|
|
64
65
|
// We can't use @@species feature detection in V8 since it causes
|
|
65
66
|
// deoptimization and performance degradation
|
|
66
67
|
// https://github.com/zloirock/core-js/issues/679
|
|
@@ -239,6 +240,7 @@ if (FORCED) {
|
|
|
239
240
|
internalReject(state, error);
|
|
240
241
|
}
|
|
241
242
|
};
|
|
243
|
+
PromiseConstructorPrototype = PromiseConstructor.prototype;
|
|
242
244
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
243
245
|
Internal = function Promise(executor) {
|
|
244
246
|
setInternalState(this, {
|
|
@@ -252,7 +254,7 @@ if (FORCED) {
|
|
|
252
254
|
value: undefined
|
|
253
255
|
});
|
|
254
256
|
};
|
|
255
|
-
Internal.prototype = redefineAll(
|
|
257
|
+
Internal.prototype = redefineAll(PromiseConstructorPrototype, {
|
|
256
258
|
// `Promise.prototype.then` method
|
|
257
259
|
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
258
260
|
then: function then(onFulfilled, onRejected) {
|
|
@@ -288,14 +290,19 @@ if (FORCED) {
|
|
|
288
290
|
if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) {
|
|
289
291
|
nativeThen = NativePromisePrototype.then;
|
|
290
292
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
293
|
+
if (!SUBCLASSING) {
|
|
294
|
+
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
295
|
+
redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
296
|
+
var that = this;
|
|
297
|
+
return new PromiseConstructor(function (resolve, reject) {
|
|
298
|
+
nativeThen.call(that, resolve, reject);
|
|
299
|
+
}).then(onFulfilled, onRejected);
|
|
300
|
+
// https://github.com/zloirock/core-js/issues/640
|
|
301
|
+
}, { unsafe: true });
|
|
302
|
+
|
|
303
|
+
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
304
|
+
redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
|
|
305
|
+
}
|
|
299
306
|
|
|
300
307
|
// make `.constructor === Promise` work for native promise-based APIs
|
|
301
308
|
try {
|
|
@@ -304,7 +311,7 @@ if (FORCED) {
|
|
|
304
311
|
|
|
305
312
|
// make `instanceof Promise` work for native promise-based APIs
|
|
306
313
|
if (setPrototypeOf) {
|
|
307
|
-
setPrototypeOf(NativePromisePrototype,
|
|
314
|
+
setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
|
|
308
315
|
}
|
|
309
316
|
}
|
|
310
317
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-js-pure",
|
|
3
3
|
"description": "Standard library",
|
|
4
|
-
"version": "3.11.
|
|
4
|
+
"version": "3.11.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/zloirock/core-js.git",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"scripts": {
|
|
56
56
|
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "bfe345ad3db933bdf1d5fd934c57959f83d30a91"
|
|
59
59
|
}
|