Index: src/js/promise.js |
diff --git a/src/js/promise.js b/src/js/promise.js |
index 48ed821373063185c2c288881bb3296a22facfcc..dd921ced46c0ad78d4261abdd634ca1f07b6ce99 100644 |
--- a/src/js/promise.js |
+++ b/src/js/promise.js |
@@ -23,10 +23,12 @@ var promiseOnResolveSymbol = |
var promiseRawSymbol = utils.ImportNow("promise_raw_symbol"); |
var promiseStatusSymbol = utils.ImportNow("promise_status_symbol"); |
var promiseValueSymbol = utils.ImportNow("promise_value_symbol"); |
+var SpeciesConstructor; |
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
utils.Import(function(from) { |
MakeTypeError = from.MakeTypeError; |
+ SpeciesConstructor = from.SpeciesConstructor; |
}); |
// ------------------------------------------------------------------- |
@@ -281,7 +283,7 @@ function PromiseThen(onResolve, onReject) { |
throw MakeTypeError(kNotAPromise, this); |
} |
- var constructor = this.constructor; |
+ var constructor = SpeciesConstructor(this, GlobalPromise); |
onResolve = IS_CALLABLE(onResolve) ? onResolve : PromiseIdResolveHandler; |
onReject = IS_CALLABLE(onReject) ? onReject : PromiseIdRejectHandler; |
var deferred = NewPromiseCapability(constructor); |