| Index: src/js/promise.js
|
| diff --git a/src/js/promise.js b/src/js/promise.js
|
| index 7cd789295644f8be560f8c85346fd9c279720024..4a6821de3fe8cfbce357ad8b9474f84f826e53e0 100644
|
| --- a/src/js/promise.js
|
| +++ b/src/js/promise.js
|
| @@ -89,47 +89,6 @@ function DoRejectPromise(promise, reason) {
|
| %PromiseReject(promise, reason, true);
|
| }
|
|
|
| -// The resultCapability.promise is only ever fulfilled internally,
|
| -// so we don't need the closures to protect against accidentally
|
| -// calling them multiple times.
|
| -function CreateInternalPromiseCapability(parent) {
|
| - return {
|
| - promise: %promise_internal_constructor(parent),
|
| - resolve: UNDEFINED,
|
| - reject: UNDEFINED
|
| - };
|
| -}
|
| -
|
| -// ES#sec-newpromisecapability
|
| -// NewPromiseCapability ( C )
|
| -function NewPromiseCapability(C, debugEvent) {
|
| - if (C === GlobalPromise) {
|
| - // Optimized case, avoid extra closure.
|
| - var promise = %promise_internal_constructor(UNDEFINED);
|
| - // TODO(gsathya): Remove container for callbacks when this is
|
| - // moved to CPP/TF.
|
| - var callbacks = %create_resolving_functions(promise, debugEvent);
|
| - return {
|
| - promise: promise,
|
| - resolve: callbacks[kResolveCallback],
|
| - reject: callbacks[kRejectCallback]
|
| - };
|
| - }
|
| -
|
| - var result = {promise: UNDEFINED, resolve: UNDEFINED, reject: UNDEFINED };
|
| - result.promise = new C((resolve, reject) => {
|
| - if (!IS_UNDEFINED(result.resolve) || !IS_UNDEFINED(result.reject))
|
| - throw %make_type_error(kPromiseExecutorAlreadyInvoked);
|
| - result.resolve = resolve;
|
| - result.reject = reject;
|
| - });
|
| -
|
| - if (!IS_CALLABLE(result.resolve) || !IS_CALLABLE(result.reject))
|
| - throw %make_type_error(kPromiseNonCallable);
|
| -
|
| - return result;
|
| -}
|
| -
|
| // ES#sec-promise.reject
|
| // Promise.reject ( x )
|
| function PromiseReject(r) {
|
| @@ -144,7 +103,7 @@ function PromiseReject(r) {
|
| %PromiseRejectEventFromStack(promise, r);
|
| return promise;
|
| } else {
|
| - var promiseCapability = NewPromiseCapability(this, true);
|
| + var promiseCapability = %new_promise_capability(this, true);
|
| %_Call(promiseCapability.reject, UNDEFINED, r);
|
| return promiseCapability.promise;
|
| }
|
| @@ -174,7 +133,7 @@ function PromiseResolve(x) {
|
| }
|
|
|
| // debugEvent is not so meaningful here as it will be resolved
|
| - var promiseCapability = NewPromiseCapability(this, true);
|
| + var promiseCapability = %new_promise_capability(this, true);
|
| %_Call(promiseCapability.resolve, UNDEFINED, x);
|
| return promiseCapability.promise;
|
| }
|
| @@ -188,7 +147,7 @@ function PromiseAll(iterable) {
|
|
|
| // false debugEvent so that forwarding the rejection through all does not
|
| // trigger redundant ExceptionEvents
|
| - var deferred = NewPromiseCapability(this, false);
|
| + var deferred = %new_promise_capability(this, false);
|
| var resolutions = new InternalArray();
|
| var count;
|
|
|
| @@ -252,7 +211,7 @@ function PromiseRace(iterable) {
|
|
|
| // false debugEvent so that forwarding the rejection through race does not
|
| // trigger redundant ExceptionEvents
|
| - var deferred = NewPromiseCapability(this, false);
|
| + var deferred = %new_promise_capability(this, false);
|
|
|
| // For catch prediction, don't treat the .then calls as handling it;
|
| // instead, recurse outwards.
|
| @@ -370,8 +329,6 @@ utils.InstallGetter(GlobalPromise, speciesSymbol, PromiseSpecies);
|
| // TODO(gsathya): Remove this once we update the promise builtin.
|
| "promise_internal_reject", RejectPromise,
|
| "promise_debug_get_info", PromiseDebugGetInfo,
|
| - "new_promise_capability", NewPromiseCapability,
|
| - "internal_promise_capability", CreateInternalPromiseCapability,
|
| "promise_id_resolve_handler", PromiseIdResolveHandler,
|
| "promise_id_reject_handler", PromiseIdRejectHandler
|
| ]);
|
| @@ -388,8 +345,6 @@ utils.InstallFunctions(extrasUtils, 0, [
|
| utils.Export(function(to) {
|
| to.PromiseCreate = PromiseCreate;
|
| to.PromiseThen = PromiseThen;
|
| -
|
| - to.CreateInternalPromiseCapability = CreateInternalPromiseCapability;
|
| to.RejectPromise = RejectPromise;
|
| });
|
|
|
|
|