Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Remove upstreamed TriggerPromiseReactions and [[Type]] changes.
Browse files Browse the repository at this point in the history
Per tc39/ecma262#584, update spec diff.
  • Loading branch information
ljharb committed Jun 2, 2016
1 parent c626fb5 commit a1232b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 87 deletions.
62 changes: 11 additions & 51 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,12 @@
"title": "EnqueuePromiseReactions ( _promise_, _fulfillReaction_, _rejectReaction_, _resultCapability_ )",
"number": "5"
},
"sec-triggerpromisereactions": {
"location": "",
"id": "sec-triggerpromisereactions",
"aoid": "TriggerPromiseReactions",
"title": "TriggerPromiseReactions ( _reactions_, _argument_ )",
"number": "6"
},
"sec-promisereactionjob": {
"location": "",
"id": "sec-promisereactionjob",
"aoid": "PromiseReactionJob",
"title": "PromiseReactionJob ( _reaction_, _argument_ )",
"number": "7"
"number": "6"
},
"sec-copyright-and-software-license": {
"location": "",
Expand All @@ -82,11 +75,6 @@
"id": "sec-enqueuepromisereactions",
"location": ""
},
"TriggerPromiseReactions": {
"aoid": "TriggerPromiseReactions",
"id": "sec-triggerpromisereactions",
"location": ""
},
"PromiseReactionJob": {
"aoid": "PromiseReactionJob",
"id": "sec-promisereactionjob",
Expand Down Expand Up @@ -122,13 +110,12 @@
<li><span class="item-toggle-none"></span><a href="#sec-performpromisefinally" title="PerformPromiseFinally ( _promise_, _onFinally_, _resultCapability_ )"><span class="secnum">3</span> PerformPromiseFinally ( <var>promise</var>, <var>onFinally</var>, <var>resultCapability</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-performpromisethen" title="PerformPromiseThen ( _promise_, _onFulfilled_, _onRejected_, _resultCapability_ )"><span class="secnum">4</span> PerformPromiseThen ( <var>promise</var>, <var>onFulfilled</var>, <var>onRejected</var>, <var>resultCapability</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-enqueuepromisereactions" title="EnqueuePromiseReactions ( _promise_, _fulfillReaction_, _rejectReaction_, _resultCapability_ )"><span class="secnum">5</span> EnqueuePromiseReactions ( <var>promise</var>, <var>fulfillReaction</var>, <var>rejectReaction</var>, <var>resultCapability</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-triggerpromisereactions" title="TriggerPromiseReactions ( _reactions_, _argument_ )"><span class="secnum">6</span> TriggerPromiseReactions ( <var>reactions</var>, <var>argument</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-promisereactionjob" title="PromiseReactionJob ( _reaction_, _argument_ )"><span class="secnum">7</span> PromiseReactionJob ( <var>reaction</var>, <var>argument</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-promisereactionjob" title="PromiseReactionJob ( _reaction_, _argument_ )"><span class="secnum">6</span> PromiseReactionJob ( <var>reaction</var>, <var>argument</var> )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li>
</ol>
</div>
</div>
<h1 class="version">Stage 0 Draft / May 17, 2016</h1>
<h1 class="version">Stage 0 Draft / June 2, 2016</h1>
<h1 class="title">Promise.prototype.finally</h1>

<emu-clause id="sec-promise.prototype.finally">
Expand All @@ -155,11 +142,7 @@ <h1><span class="secnum">1</span>Promise.prototype.finally ( <var>onFinally</var

<emu-clause id="sec-promisereaction-records">
<h1><span class="secnum">2</span>PromiseReaction Records<span class="utils"><span class="anchor"><a href="#sec-promisereaction-records">#</a></span></span></h1>
<p>The PromiseReaction is a Record value used to store information about how a promise should react when it becomes resolved or rejected with a given value. PromiseReaction records are created by the
<emu-xref aoid="PerformPromiseThen"><a href="#sec-performpromisethen">PerformPromiseThen</a></emu-xref> abstract operation, and are used by a
<emu-xref aoid="PromiseReactionJob"><a href="#sec-promisereactionjob">PromiseReactionJob</a></emu-xref>.</p>
<p>PromiseReaction records have the fields listed in
<emu-xref href="#table-58"><a href="#table-58">Table 1</a></emu-xref>.</p>
<p>…</p>
<emu-table id="table-58" caption="PromiseReaction Record Fields">
<figure>
<figcaption>Table 1: PromiseReaction Record Fields</figcaption>
Expand All @@ -181,15 +164,15 @@ <h1><span class="secnum">2</span>PromiseReaction Records<span class="utils"><spa
</tr>
<tr>
<td>
[[Capabilities]]

</td>
<td>
A PromiseCapability record

</td>
<td>
The capabilities of the promise for which this record provides a reaction handler.

</td>
</tr>
Expand All @@ -207,17 +190,15 @@ <h1><span class="secnum">2</span>PromiseReaction Records<span class="utils"><spa
</tr>
<tr>
<td>
[[Handler]]

</td>
<td>
A function object or
<emu-val>undefined</emu-val>

</td>
<td>
The function that should be applied to the incoming value, and whose return value will govern what happens to the derived promise. If [[Handler]] is
<emu-val>undefined</emu-val>, a function that depends on the value of [[Type]] will be used instead.

</td>
</tr>
Expand Down Expand Up @@ -332,30 +313,9 @@ <h1><span class="secnum">5</span>EnqueuePromiseReactions ( <var>promise</var>, <
</emu-alg>
</emu-clause>

<!-- es6num="25.4.1.8" -->
<emu-clause id="sec-triggerpromisereactions" aoid="TriggerPromiseReactions">
<h1><span class="secnum">6</span>TriggerPromiseReactions ( <var>reactions</var>, <var>argument</var> )<span class="utils"><span class="anchor"><a href="#sec-triggerpromisereactions">#</a></span></span></h1>
<p>The abstract operation TriggerPromiseReactions takes a collection of PromiseReactionRecords and enqueues a new Job for each record. Each such Job processes the [[Type]] and [[Handler]] of the PromiseReactionRecord, and if the [[Handler]] is a function, calls it passing the given argument. If the [[Handler]] is
<emu-val>undefined</emu-val>, the behavior is determined by the [[Type]].</p>
<emu-alg>
<ol>
<li>Repeat for each <var>reaction</var> in <var>reactions</var>, in original insertion order
<ol>
<li>Perform
<emu-xref aoid="EnqueueJob"><a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-enqueuejob">EnqueueJob</a></emu-xref>(<code>"PromiseJobs"</code>,
<emu-xref aoid="PromiseReactionJob"><a href="#sec-promisereactionjob">PromiseReactionJob</a></emu-xref>, « <var>reaction</var>, <var>argument</var> »).</li>
</ol>
</li>
<li>Return
<emu-val>undefined</emu-val>.
</li>
</ol>
</emu-alg>
</emu-clause>

<!-- es6num="25.4.2.1" -->
<emu-clause id="sec-promisereactionjob" aoid="PromiseReactionJob">
<h1><span class="secnum">7</span>PromiseReactionJob ( <var>reaction</var>, <var>argument</var> )<span class="utils"><span class="anchor"><a href="#sec-promisereactionjob">#</a></span></span></h1>
<h1><span class="secnum">6</span>PromiseReactionJob ( <var>reaction</var>, <var>argument</var> )<span class="utils"><span class="anchor"><a href="#sec-promisereactionjob">#</a></span></span></h1>
<p>The job PromiseReactionJob with parameters <var>reaction</var> and <var>argument</var> applies the appropriate handler to the incoming value, and uses the handler's return value to resolve or reject the derived promise associated with that handler.</p>
<emu-alg>
<ol>
Expand Down
26 changes: 7 additions & 19 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ contributors: Jordan Harband

<emu-clause id="sec-promisereaction-records">
<h1>PromiseReaction Records</h1>
<p>The PromiseReaction is a Record value used to store information about how a promise should react when it becomes resolved or rejected with a given value. PromiseReaction records are created by the PerformPromiseThen abstract operation, and are used by a PromiseReactionJob.</p>
<p>PromiseReaction records have the fields listed in <emu-xref href="#table-58"></emu-xref>.</p>
<p>…</p>
<emu-table id="table-58" caption="PromiseReaction Record Fields">
<table>
<tbody>
Expand All @@ -41,13 +40,13 @@ contributors: Jordan Harband
</tr>
<tr>
<td>
[[Capabilities]]
</td>
<td>
A PromiseCapability record
</td>
<td>
The capabilities of the promise for which this record provides a reaction handler.
</td>
</tr>
<tr>
Expand All @@ -62,13 +61,13 @@ contributors: Jordan Harband
</tr>
<tr>
<td>
[[Handler]]
</td>
<td>
A function object or *undefined*
</td>
<td>
The function that should be applied to the incoming value, and whose return value will govern what happens to the derived promise. If [[Handler]] is *undefined*, a function that depends on the value of [[Type]] will be used instead.
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -129,17 +128,6 @@ contributors: Jordan Harband
</emu-alg>
</emu-clause>

<!-- es6num="25.4.1.8" -->
<emu-clause id="sec-triggerpromisereactions" aoid="TriggerPromiseReactions">
<h1>TriggerPromiseReactions ( _reactions_, _argument_ )</h1>
<p>The abstract operation TriggerPromiseReactions takes a collection of PromiseReactionRecords and enqueues a new Job for each record. Each such Job processes the [[Type]] and [[Handler]] of the PromiseReactionRecord, and if the [[Handler]] is a function, calls it passing the given argument. If the [[Handler]] is *undefined*, the behavior is determined by the [[Type]].</p>
<emu-alg>
1. Repeat for each _reaction_ in _reactions_, in original insertion order
1. Perform EnqueueJob(`"PromiseJobs"`, PromiseReactionJob, &laquo; _reaction_, _argument_ &raquo;).
1. Return *undefined*.
</emu-alg>
</emu-clause>

<!-- es6num="25.4.2.1" -->
<emu-clause id="sec-promisereactionjob" aoid="PromiseReactionJob">
<h1>PromiseReactionJob ( _reaction_, _argument_ )</h1>
Expand Down
24 changes: 7 additions & 17 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ When the `finally` method is called with argument _onFinally_, the following ste

## PromiseReaction Records

The PromiseReaction is a Record value used to store information about how a promise should react when it becomes resolved or rejected with a given value. PromiseReaction records are created by the PerformPromiseThen abstract operation, and are used by a <a href="#sec-promisereactionjob">PromiseReactionJob</a>.
PromiseReaction records have the fields listed in Table 58.
<table>
<tbody>
<tr>
Expand All @@ -19,21 +18,19 @@ PromiseReaction records have the fields listed in Table 58.
<th>Meaning</th>
</tr>
<tr>
<td>[[Capabilities]]</td>
<td>A PromiseCapability record</td>
<td>The capabilities of the promise for which this record provides a reaction handler.</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[Type]]</td>
<td>Either <b>"Fulfill"</b>, <b>"Reject"</b>, or <b>"Finally"</b>.</td>
<td></td>
</tr>
<tr>
<td>[[Handler]]</td>
<td>A function object or <b>undefined</b></td>
<td>
The function that should be applied to the incoming value, and whose return value will govern what happens to the derived promise. If [[Handler]] is <b>undefined</b>, a function that depends on the value of [[Type]] will be used instead.
</td>
<td>…</td>
<td>…</td>
<td>…</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -82,13 +79,6 @@ The abstract operation EnqueuePromiseReactions enqueues PromiseJobs with the pro
1. Set _promise_'s [[PromiseIsHandled]] internal slot to **true**.
1. Return _resultCapability_.[[Promise]].

## TriggerPromiseReactions ( _reactions_, _argument_ )

The abstract operation TriggerPromiseReactions takes a collection of PromiseReactionRecords and enqueues a new Job for each record. Each such Job processes the [[Type]] and [[Handler]] of the PromiseReactionRecord, and if the [[Handler]] is a function, calls it passing the given argument. If the [[Handler]] is **undefined**, the behavior is determined by the [[Type]].
1. Repeat for each _reaction_ in _reactions_, in original insertion order
1. Perform EnqueueJob(`"PromiseJobs"`, <a href="#sec-promisereactionjob">PromiseReactionJob</a>, &laquo; _reaction_, _argument_ &raquo;).
1. Return **undefined**.

## PromiseReactionJob ( _reaction_, _argument_ )

The job PromiseReactionJob with parameters _reaction_ and _argument_ applies the appropriate handler to the incoming value, and uses the handler's return value to resolve or reject the derived promise associated with that handler.
Expand Down

0 comments on commit a1232b9

Please sign in to comment.