Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -8236,8 +8236,15 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=]
steps:

1. Let |onFulfilledSteps| be the following steps given argument |V|:
1. Let |value| be the result of [=converted to an IDL value|converting=] |V| to an IDL
value of type |T|.
1. Try running the following step:
1. Let |value| be the result of [=converted to an IDL value|converting=] |V| to an IDL
value of type |T|.

And then, if <a lt="an exception was thrown">an exception |exception| was thrown</a>:

1. If there are steps that are required to be run if the promise was rejected, let
|result| be the result of performing those steps, given |exception|.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|result| is unused. Should it be returned, instead of throwing exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, good question. This matters if:

  1. we want to do a type conversion
  2. the returned promise is used (former "transforming")
  3. we want to do something else than passing the rejection along

Are you aware of an existing case to inform the decision? From #782 (comment), waitUntil/complete fail (1), respondWith/updateWith fail (2), WebAssembly fails (3).

Writing this, I'm realizing that we never actually pass the rejection along, the way WebAssembly needs. Should we pass undefined instead of onRejectedSteps if there's no steps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you aware of an existing case to inform the decision?

I'm not aware of any. However I generally think aligning with promise.then() will be more intuitive for spec authors, if we have that degree of freedom. So I'd prefer that if possible.

Writing this, I'm realizing that we never actually pass the rejection along, the way WebAssembly needs. Should we pass undefined instead of onRejectedSteps if there's no steps?

Definitely.

1. [=ECMAScript/throw=] |exception|.
1. If there are no steps that are required to be run if the promise was fulfilled, then
return <emu-val>undefined</emu-val>.
1. Let |result| be the result of performing any steps that were required to be run if
Expand Down