diff --git a/index.html b/index.html index 365e67c4..f273823d 100644 --- a/index.html +++ b/index.html @@ -7071,12 +7071,13 @@
The rules to execute a function body are as follows. - The algorithm returns an ECMAScript completion record. +
To execute an async function body given session, + bodySource, and arguments. + The algorithm returns success with an ECMAScript Promise instance or error.
If at any point during the algorithm a user prompt appears,
- immediately return Completion { [[\Type]]: normal, [[\Value]]: null,
- [[\Target]]: empty }, but continue to run the other steps of this algorithm [=in parallel=].
+ immediately return success with data null,
+ but continue to run the other steps of this algorithm [=in parallel=].
Let window be the associated window @@ -7086,47 +7087,55 @@
Let environment settings be window's [=relevant settings object=]. -
Let realm be environment settings' realm. -
If body is not parsable as a FunctionBody
- or if parsing detects an early error,
- return
- Completion { [[\Type]]: normal, [[\Value]]: null, [[\Target]]: empty }.
+
Let parameters be ParseText("", FormalParameters[~Yield, +Await]). -
If body begins with a directive prologue - that contains a use strict directive - then let strict be true, - otherwise let strict be false. +
Assert: parameters is a Parse Node. + +
Let
be ParseText(bodySource, AsyncFunctionBody). + +If body is a List of errors: + +
Return a new error with error code javascript error and data null. + +
Prepare to run script with environment settings.
Prepare to run a callback with environment settings.
Let function be the result of - calling FunctionCreate, with arguments: + calling OrdinaryFunctionCreate with arguments:
NON-LEXICAL-THIS.
- Let completion be Function.[[\Call]](window, - parameters) with function as the this value. + arguments) with function as the this value.
Clean up after running a callback with environment settings. @@ -7134,7 +7143,9 @@
Clean up after running script with environment settings. -
Return completion. +
Assert: completion is a normal completion. + +
Return success with data completion.[[\Value]].
The above algorithm is not associated @@ -7180,22 +7191,11 @@
Start the timer with timer and timeout. -
Let promise be a new Promise. - -
Run the following substeps in parallel: -
Let scriptPromise be the result of promise-calling - execute a function body, with arguments - body and arguments. - -
Upon fulfillment of scriptPromise with value v, - resolve promise with value v. +
Upon rejection of scriptPromise with value r, - reject promise with value r. - +
Let promise be the result of trying to + execute an async function body, with arguments + session, body and arguments.
Wait until promise is resolved, or timer's [=timer/timeout fired flag=] is set, @@ -7275,31 +7275,9 @@
Append resolvingFunctions.[[\Resolve]] to
arguments.
-
Let scriptResult be the result of calling - execute a function body, with arguments - body and arguments. - -
If scriptResult.[[\Type]] is not normal, then reject
- promise with value scriptResult.[[\Value]], and abort these steps.
-
-
Prior revisions of this specification did not recognize the - return value of the provided script. In order to preserve legacy behavior, - the return value only influences the command if it is a "thenable" object or - if determining this produces an exception. - -
If Type(scriptResult.[[\Value]]) - is not Object, then abort these steps. - -
Let then be Get(scriptResult.[[\Value]], "then"). - -
If then.[[\Type]] is not normal, then reject
- promise with value then.[[\Value]], and abort these steps.
-
-
If IsCallable(then.[[\Type]]) is false,
- then abort these steps.
-
-
Let scriptPromise be PromiseResolve(Promise, - scriptResult.[[\Value]]). +
Let scriptPromise be the result of trying to + execute an async function body, with arguments + session, body and arguments.
Upon fulfillment of scriptPromise with value v, resolve promise with value v. @@ -11633,21 +11611,18 @@
The following terms are defined in the ECMAScript Language Specification: [[ECMA-262]]
The following terms are defined in the Promises Guide. [[PROMISES-GUIDE]] -
The following terms are defined in the Document Object Model XPath standard [[XPATH]]