Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Unified Diff: src/js/promise.js

Issue 1577223002: Add @@species/better subclassing support to Promises (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/promise-species.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | test/mjsunit/harmony/promise-species.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698