From 397b9d93e8614795cbb18fdebb1e67d19f27a3dd Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 1 Jul 2020 16:10:09 -0700 Subject: [PATCH] Editorial: add PromiseCapability Record assertions (#2050) --- spec.html | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/spec.html b/spec.html index 1a32d1cbdd..298d3b771f 100644 --- a/spec.html +++ b/spec.html @@ -24102,7 +24102,7 @@

Runtime Semantics: HostImportModuleDynamically ( _referencingScriptOrModule_

Runtime Semantics: FinishDynamicImport ( _referencingScriptOrModule_, _specifier_, _promiseCapability_, _completion_ )

-

The abstract operation FinishDynamicImport takes arguments _referencingScriptOrModule_, _specifier_, _promiseCapability_, and _completion_. FinishDynamicImport completes the process of a dynamic import originally started by an `import()` call, resolving or rejecting the promise returned by that call as appropriate according to _completion_. It is performed by host environments as part of HostImportModuleDynamically. It performs the following steps when called:

+

The abstract operation FinishDynamicImport takes arguments _referencingScriptOrModule_, _specifier_, _promiseCapability_ (a PromiseCapability Record), and _completion_. FinishDynamicImport completes the process of a dynamic import originally started by an `import()` call, resolving or rejecting the promise returned by that call as appropriate according to _completion_. It is performed by host environments as part of HostImportModuleDynamically. It performs the following steps when called:

1. If _completion_ is an abrupt completion, then perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _completion_.[[Value]] »). @@ -39019,7 +39019,7 @@

Properties of Async-from-Sync Iterator Instances

AsyncFromSyncIteratorContinuation ( _result_, _promiseCapability_ )

-

The abstract operation AsyncFromSyncIteratorContinuation takes arguments _result_ and _promiseCapability_. It performs the following steps when called:

+

The abstract operation AsyncFromSyncIteratorContinuation takes arguments _result_ and _promiseCapability_ (a PromiseCapability Record). It performs the following steps when called:

1. Let _done_ be IteratorComplete(_result_). @@ -39572,7 +39572,7 @@

AsyncGeneratorRequest Records

[[Capability]] - A PromiseCapability record + A PromiseCapability Record The promise capabilities associated with this request. @@ -39780,7 +39780,7 @@

Promise Abstract Operations

PromiseCapability Records

-

A PromiseCapability is a Record value used to encapsulate a promise object along with the functions that are capable of resolving or rejecting that promise object. PromiseCapability Records are produced by the NewPromiseCapability abstract operation.

+

A PromiseCapability Record is a Record value used to encapsulate a promise object along with the functions that are capable of resolving or rejecting that promise object. PromiseCapability Records are produced by the NewPromiseCapability abstract operation.

PromiseCapability Records have the fields listed in .

@@ -39987,7 +39987,7 @@

NewPromiseCapability ( _C_ )

1. If IsConstructor(_C_) is *false*, throw a *TypeError* exception. 1. NOTE: _C_ is assumed to be a constructor function that supports the parameter conventions of the Promise constructor (see ). - 1. Let _promiseCapability_ be the PromiseCapability { [[Promise]]: *undefined*, [[Resolve]]: *undefined*, [[Reject]]: *undefined* }. + 1. Let _promiseCapability_ be the PromiseCapability Record { [[Promise]]: *undefined*, [[Resolve]]: *undefined*, [[Reject]]: *undefined* }. 1. Let _steps_ be the algorithm steps defined in . 1. Let _executor_ be ! CreateBuiltinFunction(_steps_, « [[Capability]] »). 1. Set _executor_.[[Capability]] to _promiseCapability_. @@ -40099,6 +40099,7 @@

NewPromiseReactionJob ( _reaction_, _argument_ )

1. If _promiseCapability_ is *undefined*, then 1. Assert: _handlerResult_ is not an abrupt completion. 1. Return NormalCompletion(~empty~). + 1. Assert: _promiseCapability_ is a PromiseCapability Record. 1. If _handlerResult_ is an abrupt completion, then 1. Let _status_ be Call(_promiseCapability_.[[Reject]], *undefined*, « _handlerResult_.[[Value]] »). 1. Else, @@ -40213,10 +40214,9 @@

Runtime Semantics: GetPromiseResolve ( _promiseConstructor_ )

Runtime Semantics: PerformPromiseAll ( _iteratorRecord_, _constructor_, _resultCapability_, _promiseResolve_ )

-

The abstract operation PerformPromiseAll takes arguments _iteratorRecord_, _constructor_, _resultCapability_, and _promiseResolve_. It performs the following steps when called:

+

The abstract operation PerformPromiseAll takes arguments _iteratorRecord_, _constructor_, _resultCapability_ (a PromiseCapability Record), and _promiseResolve_. It performs the following steps when called:

1. Assert: IsConstructor(_constructor_) is *true*. - 1. Assert: _resultCapability_ is a PromiseCapability Record. 1. Assert: IsCallable(_promiseResolve_) is *true*. 1. Let _values_ be a new empty List. 1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }. @@ -40296,10 +40296,9 @@

Promise.allSettled ( _iterable_ )

Runtime Semantics: PerformPromiseAllSettled ( _iteratorRecord_, _constructor_, _resultCapability_, _promiseResolve_ )

-

The abstract operation PerformPromiseAllSettled takes arguments _iteratorRecord_, _constructor_, _resultCapability_, and _promiseResolve_. It performs the following steps when called:

+

The abstract operation PerformPromiseAllSettled takes arguments _iteratorRecord_, _constructor_, _resultCapability_ (a PromiseCapability Record), and _promiseResolve_. It performs the following steps when called:

1. Assert: ! IsConstructor(_constructor_) is *true*. - 1. Assert: _resultCapability_ is a PromiseCapability Record. 1. Assert: IsCallable(_promiseResolve_) is *true*. 1. Let _values_ be a new empty List. 1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }. @@ -40425,10 +40424,9 @@

Promise.race ( _iterable_ )

Runtime Semantics: PerformPromiseRace ( _iteratorRecord_, _constructor_, _resultCapability_, _promiseResolve_ )

-

The abstract operation PerformPromiseRace takes arguments _iteratorRecord_, _constructor_, _resultCapability_, and _promiseResolve_. It performs the following steps when called:

+

The abstract operation PerformPromiseRace takes arguments _iteratorRecord_, _constructor_, _resultCapability_ (a PromiseCapability Record), and _promiseResolve_. It performs the following steps when called:

1. Assert: IsConstructor(_constructor_) is *true*. - 1. Assert: _resultCapability_ is a PromiseCapability Record. 1. Assert: IsCallable(_promiseResolve_) is *true*. 1. Repeat, 1. Let _next_ be IteratorStep(_iteratorRecord_). @@ -40600,12 +40598,10 @@

Promise.prototype.then ( _onFulfilled_, _onRejected_ )

PerformPromiseThen ( _promise_, _onFulfilled_, _onRejected_ [ , _resultCapability_ ] )

-

The abstract operation PerformPromiseThen takes arguments _promise_, _onFulfilled_, and _onRejected_ and optional argument _resultCapability_. It performs the “then” operation on _promise_ using _onFulfilled_ and _onRejected_ as its settlement actions. If _resultCapability_ is passed, the result is stored by updating _resultCapability_'s promise. If it is not passed, then PerformPromiseThen is being called by a specification-internal operation where the result does not matter. It performs the following steps when called:

+

The abstract operation PerformPromiseThen takes arguments _promise_, _onFulfilled_, and _onRejected_ and optional argument _resultCapability_ (a PromiseCapability Record). It performs the “then” operation on _promise_ using _onFulfilled_ and _onRejected_ as its settlement actions. If _resultCapability_ is passed, the result is stored by updating _resultCapability_'s promise. If it is not passed, then PerformPromiseThen is being called by a specification-internal operation where the result does not matter. It performs the following steps when called:

1. Assert: IsPromise(_promise_) is *true*. - 1. If _resultCapability_ is present, then - 1. Assert: _resultCapability_ is a PromiseCapability Record. - 1. Else, + 1. If _resultCapability_ is not present, then 1. Set _resultCapability_ to *undefined*. 1. If IsCallable(_onFulfilled_) is *false*, then 1. Set _onFulfilled_ to *undefined*. @@ -40803,7 +40799,7 @@

Async Functions Abstract Operations

AsyncFunctionStart ( _promiseCapability_, _asyncFunctionBody_ )

-

The abstract operation AsyncFunctionStart takes arguments _promiseCapability_ and _asyncFunctionBody_. It performs the following steps when called:

+

The abstract operation AsyncFunctionStart takes arguments _promiseCapability_ (a PromiseCapability Record) and _asyncFunctionBody_. It performs the following steps when called:

1. Let _runningContext_ be the running execution context. 1. Let _asyncContext_ be a copy of _runningContext_.