Skip to content

Commit 183a2a0

Browse files
Andreu Botelladomenic
Andreu Botella
authored andcommitted
Fix "react to a promise"'s default handlers
"React to a promise"'s default handlers used to return undefined rather than propagating the resolved value or the rejection reason to the returned promise. This change fixes that, and changes "upon fulfillment" and "upon rejection" to return the resulting promise. Closes #921.
1 parent a524b9f commit 183a2a0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

index.bs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8425,19 +8425,17 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=]
84258425
1. Let |onFulfilledSteps| be the following steps given argument |V|:
84268426
1. Let |value| be the result of [=converted to an IDL value|converting=] |V| to an IDL
84278427
value of type |T|.
8428-
1. If there are no steps that are required to be run if the promise was fulfilled, then
8429-
return <emu-val>undefined</emu-val>.
8430-
1. Let |result| be the result of performing any steps that were required to be run if
8431-
the promise was fulfilled, given |value| if |T| is not {{undefined}}.
8428+
1. If there is a set of steps to be run if the promise was fulfilled, then let |result| be
8429+
the result of performing them, given |value| if |T| is not {{undefined}}. Otherwise, let
8430+
|result| be |value|.
84328431
1. Return |result|, [=converted to an ECMAScript value=].
84338432
1. Let |onFulfilled| be [=!=] [$CreateBuiltinFunction$](|onFulfilledSteps|, « »):
84348433
1. Let |onRejectedSteps| be the following steps given argument |R|:
84358434
1. Let |reason| be the result of [=converted to an IDL value|converting=]
84368435
|R| to an IDL value of type {{any}}.
8437-
1. If there are no steps that are required to be run if the promise was rejected, then
8438-
return <emu-val>undefined</emu-val>.
8439-
1. Let |result| be the result of performing any steps that were required to be run if the
8440-
promise was rejected, given |reason|.
8436+
1. If there is a set of steps to be run if the promise was rejected, then let |result| be
8437+
the result of performing them, given |reason|. Otherwise, let |result| be
8438+
[=a promise rejected with=] |reason|.
84418439
1. Return |result|, [=converted to an ECMAScript value=].
84428440
1. Let |onRejected| be [=!=] [$CreateBuiltinFunction$](|onRejectedSteps|, « »):
84438441
1. Let |constructor| be |promise|.\[[Promise]].\[[Realm]].\[[Intrinsics]].[[{{%Promise%}}]].
@@ -8461,7 +8459,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=]
84618459
<code><a interface>Promise</a>&lt;|T|&gt;</code> |promise| given some steps |steps| taking a
84628460
value of type |T|, perform the following steps:
84638461

8464-
1. [=promise/React=] to |promise|:
8462+
1. Return the result of [=promise/reacting=] to |promise|:
84658463
* If |promise| was fulfilled with value |v|, then:
84668464
1. Perform |steps| with |v|.
84678465
</div>
@@ -8472,7 +8470,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=]
84728470
<code><a interface>Promise</a>&lt;<var ignore>T</var>&gt;</code> |promise| given some steps
84738471
|steps| taking an ECMAScript value, perform the following steps:
84748472

8475-
1. [=promise/React=] to |promise|:
8473+
1. Return the result of [=promise/reacting=] to |promise|:
84768474
* If |promise| was rejected with reason |r|, then:
84778475
1. Perform |steps| with |r|.
84788476
</div>

0 commit comments

Comments
 (0)