Skip to content

Commit 0d82749

Browse files
committed
[web-animations-1] Switch to using WebIDL definitions of promise algorithms
1 parent 0db0c1c commit 0d82749

1 file changed

Lines changed: 18 additions & 31 deletions

File tree

web-animations-1/Overview.bs

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,14 @@ urlPrefix: https://heycam.github.io/webidl/#dfn-; type: dfn; spec: webidl
117117
text: thrown; url: throw
118118
text: convert ecmascript to idl value
119119
urlPrefix: https://heycam.github.io/webidl/; type: dfn; spec: webidl
120+
text: a new promise
121+
text: create a new resolved Promise; url: a-promise-resolved-with
120122
text: [EnforceRange]; url: EnforceRange
121123
text: es to dictionary
122124
text: es to DOMString; url: es-to-DOMString
123125
text: DOMString to es; url: DOMString-to-es
126+
text: reject a promise; url: reject
127+
text: resolve a promise; url: resolve
124128
urlPrefix: http://www.ecma-international.org/ecma-262/6.0/#sec-; type: dfn; spec: ecma-262
125129
text: code realms
126130
text: completion record specification type
@@ -132,8 +136,6 @@ urlPrefix: http://www.ecma-international.org/ecma-262/6.0/#sec-; type: dfn; spec
132136
text: IteratorValue
133137
text: Promise object; url: promise-objects
134138
text: Promise; url: promise-objects
135-
text: PromiseCapability record; url: promisecapability-records
136-
text: Promise.resolve; url: promise.resolve
137139
text: Type; url: ecmascript-data-types-and-values
138140
text: well known symbols
139141
text: [[DefineOwnProperty]]; url: ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
@@ -868,7 +870,8 @@ The procedure to <dfn>reset an animation's pending tasks</dfn> for
868870
promise</a> with a DOMException named "AbortError".
869871
1. Let <var>animation</var>'s <a>current ready promise</a> be the result of
870872
<a lt="create a new resolved Promise">creating a new resolved Promise
871-
object</a>.
873+
object</a> with value <var>animation</var> in the <a>relevant Realm</a> of
874+
<var>animation</var>.
872875

873876
<h4 id="the-current-time-of-an-animation">The current time of an animation</h4>
874877

@@ -1074,29 +1077,12 @@ following conditions are true:
10741077
* the animation is associated with a <a>timeline</a> that is not
10751078
<a lt="inactive timeline">inactive</a>.
10761079

1077-
<h4 id='promise-objects'>Promise objects</h4>
1078-
1079-
<a>Promise objects</a> are defined by [[!ECMA-262]].
1080-
1081-
To <dfn>resolve a Promise</dfn> with <var>value</var>,
1082-
call the \[[Call]] internal \[[Resolve]] method on the <a>PromiseCapability
1083-
record</a> for the promise, passing <code>undefined</code> as
1084-
<var>thisArgument</var> and (<var>value</var>) as <var>argumentsList</var>.
1085-
1086-
To <dfn>reject a Promise</dfn> with <var>reason</var>,
1087-
call the \[[Call]] internal \[[Reject]] method on the <a>PromiseCapability
1088-
record</a> for the promise, passing <code>undefined</code> as
1089-
<var>thisArgument</var> and
1090-
(<var>reason</var>) as <var>argumentsList</var>.
1091-
1092-
To <dfn>create a new resolved Promise</dfn> with <var>value</var>, call
1093-
<a>Promise.resolve</a>, passing <var>value</var> as <var ignore>x</var>.
1094-
10951080
<h4 id='the-current-ready-promise'>The current ready promise</h4>
10961081

10971082
Each <a>animation</a> has a <dfn>current ready promise</dfn>.
10981083
The <a>current ready promise</a> is initially a resolved <a>Promise</a> created
1099-
using the procedure to <a>create a new resolved Promise</a>.
1084+
using the procedure to <a>create a new resolved Promise</a> with the animation
1085+
itself as its value and created in the <a>relevant Realm</a> of the animation.
11001086

11011087
The object is replaced with a new <a>Promise object</a> every time the animation
11021088
queues a <a>pending play task</a> or a <a>pending pause task</a> when it
@@ -1190,8 +1176,8 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11901176
let its [=start time=] be <a>unresolved</a>.
11911177

11921178
1. If <var>has pending ready promise</var> is false,
1193-
let <var>animation</var>'s <a>current ready promise</a> be a new
1194-
(pending) <a>Promise</a> object.
1179+
let <var>animation</var>'s <a>current ready promise</a> be
1180+
<a>a new promise</a> in the <a>relevant Realm</a> of <var>animation</var>.
11951181

11961182
1. Schedule a task to run as soon as <var>animation</var> is <a>ready</a>.
11971183
The task shall perform the following steps:
@@ -1245,7 +1231,7 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
12451231

12461232
</div>
12471233

1248-
1. <a lt="resolve a Promise">Resolve</a> <var>animation</var>'s <a>current
1234+
1. <a lt="resolve a promise">Resolve</a> <var>animation</var>'s <a>current
12491235
ready promise</a> with <var>animation</var>.
12501236

12511237
1. Run the procedure to <a>update an animation's finished state</a> for
@@ -1336,8 +1322,8 @@ follows:
13361322
1. If <var>animation</var> has a <a>pending play task</a>, cancel that task
13371323
and let <var>has pending ready promise</var> be true.
13381324
1. If <var>has pending ready promise</var> is false,
1339-
set <var>animation</var>'s <a>current ready promise</a> to a new
1340-
(pending) <a>Promise</a> object.
1325+
set <var>animation</var>'s <a>current ready promise</a> to
1326+
<a>a new promise</a> in the <a>relevant Realm</a> of <var>animation</var>.
13411327
1. Schedule a task to be executed at the first possible moment after
13421328
the user agent has performed any processing necessary to suspend
13431329
the playback of
@@ -1443,7 +1429,7 @@ Each animation has a <dfn>current finished promise</dfn>.
14431429
The <a>current finished promise</a> is initially a pending <a>Promise</a>
14441430
object.
14451431

1446-
The object is replaced with a new (pending) <a>Promise</a> object every time
1432+
The object is replaced with a new <a>promise</a> every time
14471433
the animation leaves the <a>finished play state</a>.
14481434

14491435
<h4 id="updating-the-finished-state">Updating the finished state</h4>
@@ -1597,7 +1583,7 @@ follows:
15971583
1. If <var>current finished state</var> is false and
15981584
<var>animation</var>'s <a>current finished promise</a> is already
15991585
resolved, set <var>animation</var>'s <a>current finished promise</a> to
1600-
a new (pending) Promise object.
1586+
<a>a new promise</a> in the <a>relevant Realm</a> of <var>animation</var>.
16011587

16021588
<div class="informative-bg">
16031589

@@ -1718,8 +1704,9 @@ as follows:
17181704
<var>animation</var>.
17191705
1. <a lt="reject a Promise">Reject</a> the <a>current finished promise</a>
17201706
with a DOMException named "AbortError".
1721-
1. Let <a>current finished promise</a> be a new (pending) <a>Promise</a>
1722-
object.
1707+
1. Let <a>current finished promise</a> be
1708+
<a>a new promise</a> in the <a>relevant Realm</a> of
1709+
<var>animation</var>.
17231710
1. <a lt="create an event">Create</a> an {{AnimationPlaybackEvent}},
17241711
|cancelEvent|.
17251712
1. Set |cancelEvent|'s {{Event/type}} attribute to <a lt="cancel

0 commit comments

Comments
 (0)