diff --git a/index.html b/index.html index f04ea5dfc..b1037a5f4 100644 --- a/index.html +++ b/index.html @@ -6066,12 +6066,13 @@
The rules to execute a function body are as follows. - The algorithm returns an ECMASCript completion record. +
When required to execute a function body with arguments + body, arguments, and async, the + implementation must:
If at any point during the algorithm a user prompt appears,
abort all subsequent substeps of this algorithm, and return
- Completion { [[\Type]]: normal
, [[\Value]]: null
, [[\Target]]: empty
}.
+ success with data null
.
Let window be the associated window @@ -6086,8 +6087,7 @@
If body is not parsable as a FunctionBody
or if parsing detects an early error,
- return
- Completion { [[\Type]]: normal
, [[\Value]]: null
, [[\Target]]: empty
}.
+ return error with error code javascript error.
If body begins with a directive prologue that contains a use strict directive @@ -6098,6 +6098,17 @@
Prepare to run a callback with environment settings. +
Let promise be a new Promise. + +
If async is true
:
+
+
Let resolvingFunctions be CreateResolvingFunctions(promise). + +
Append resolvingFunctions.[[\Resolve]]
+ to arguments.
+
Let function be the result of calling FunctionCreate, with arguments: @@ -6121,7 +6132,37 @@
Let completion be Call(function, window, - parameters). + arguments). + +
If completion.[[\Type]] is throw
,
+ reject promise with completion.[[\Value]].
+
+
Otherwise, if async is false
,
+ resolve promise with completion.[[\Value]].
+
+
Otherwise, + +
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 this algorithm if it is a "thenable" object or + if determining this produces an exception. + +
If Type(completion.[[\Value]]) + is Object: + +
Let then be Get(completion.[[\Value]], "then"). + +
If then.[[\Type]] is not normal
, then reject
+ promise with value then.[[\Value]].
+
+
Otherwise, if IsCallable(then.[[\Value]]) is
+ true
, then resolve promise with completion.[[\Value]].
+
Wait for promise to settle.
Clean up after running a callback with environment settings. @@ -6129,7 +6170,20 @@
Clean up after running a script with environment settings. -
Return completion. +
If promise rejected: + +
Let result be the result of trying to + JSON clone the rejection value of promise. + +
Return error with error code javascript error + and data result. +
Let result be the result of trying to + JSON clone the fulfillment value of promise. + +
Return success with data result.
The above algorithm is not associated @@ -6162,33 +6216,32 @@
Handle any user prompts, and return its value if it is an error. -
Let promise be a new Promise. +
Let results be a new queue.
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. +
Let script result be the result of calling
+ execute a function body, with arguments
+ body, arguments, and false
.
-
Upon rejection of scriptPromise with value r, - reject promise with value r. -
Enqueue script result in results. +
Run the following substeps in parallel: + +
Wait session script timeout milliseconds. + +
Enqueue error with error code + script timeout in results. +
If promise is still pending and - the session script timeout is reached, - return error with error code script timeout. +
Wait for the size of results to be greater than 0. -
Upon fulfillment of promise with value v, - let result be a JSON clone of v, and - return success with data result. +
Dequeue result from results. -
Upon rejection of promise with reason r, - let result be a JSON clone of r, and - return error with error code javascript error - and data result. +
Return result. @@ -6216,69 +6269,41 @@
The remote end steps are:
Let body and arguments by the result of trying to - extract the script arguments from a request with - argument parameters. - -
If the current browsing context is no longer open, - return error with error code no such window. - -
Handle any user prompts, and return its value if it is an error. - -
Let promise be a new Promise. - -
Run the following substeps in parallel: -
Let resolvingFunctions be CreateResolvingFunctions(promise). - -
Append resolvingFunctions.[[\Resolve]]
to
- arguments.
-
-
Let result be the result of calling - execute a function body, with arguments - body and arguments. +
Let body and arguments be the result of + trying to extract the script arguments from a request + with argument parameters. -
If scriptResult.[[\Type]] is not normal
, then reject
- promise with value scriptResult.[[\Value]], and abort these steps.
+
If the current browsing context is no longer open, + return error with error code no such window. -
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. +
Handle any user prompts, and return its value if it is an error. -
If Type(scriptResult.[[\Value]]) - is not Object, then abort these steps. +
Let results be a new queue. -
Let then be Get(scriptResult.[[\Value]], "then"). +
Run the following substeps in parallel: -
If then.[[\Type]] is not normal
, then reject
- promise with value then.[[\Value]], and abort these steps.
+
Let script result be the result of calling
+ execute a function body, with arguments
+ body, arguments, and true
.
-
If IsCallable(then.[[\Type]]) is false
,
- then abort these steps.
+
Enqueue script result in results. +
Let scriptPromise be PromiseResolve(Promise, - scriptResult.[[\Value]]). +
Run the following substeps in parallel: -
Upon fulfillment of scriptPromise with value v, - resolve promise with value v. +
Wait session script timeout milliseconds. -
Upon rejection of scriptPromise with value r, - reject promise with value r. -
Enqueue error with error code + script timeout in results. +
If promise is still pending and - session script timeout milliseconds is reached, - return error with error code script timeout. +
Wait for the size of results to be greater than 0. -
Upon fulfillment of promise with value v, - let result be a JSON clone of v, and - return success with data result. +
Dequeue result from results. -
Upon rejection of promise with reason r, - let result be a JSON clone of r, and - return error with error code javascript error - and data result. +
Return result.
The following terms are defined in the ECMAScript Language Specification: [[ECMA-262]]