aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/es6.promise.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/modules/es6.promise.js')
-rw-r--r--node_modules/core-js/modules/es6.promise.js21
1 files changed, 3 insertions, 18 deletions
diff --git a/node_modules/core-js/modules/es6.promise.js b/node_modules/core-js/modules/es6.promise.js
index 78e9791d7..88bf65d4c 100644
--- a/node_modules/core-js/modules/es6.promise.js
+++ b/node_modules/core-js/modules/es6.promise.js
@@ -36,12 +36,6 @@ var USE_NATIVE = !!function () {
}();
// helpers
-var sameConstructor = LIBRARY ? function (a, b) {
- // with library wrapper special case
- return a === b || a === $Promise && b === Wrapper;
-} : function (a, b) {
- return a === b;
-};
var isThenable = function (it) {
var then;
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
@@ -110,14 +104,7 @@ var onUnhandled = function (promise) {
});
};
var isUnhandled = function (promise) {
- if (promise._h == 1) return false;
- var chain = promise._a || promise._c;
- var i = 0;
- var reaction;
- while (chain.length > i) {
- reaction = chain[i++];
- if (reaction.fail || !isUnhandled(reaction.promise)) return false;
- } return true;
+ return promise._h !== 1 && (promise._a || promise._c).length === 0;
};
var onHandleUnhandled = function (promise) {
task.call(global, function () {
@@ -213,7 +200,7 @@ if (!USE_NATIVE) {
this.reject = ctx($reject, promise, 1);
};
newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
- return sameConstructor($Promise, C)
+ return C === $Promise || C === Wrapper
? new OwnPromiseCapability(C)
: newGenericPromiseCapability(C);
};
@@ -237,9 +224,7 @@ $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x) {
- // instanceof instead of internal slot check because we should fix it without replacement native Promise core
- if (x instanceof $Promise && sameConstructor(x.constructor, this)) return x;
- return promiseResolve(this, x);
+ return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
}
});
$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {