Re: [heycam/webidl] Import the Promises Guide. (#772)

domenic commented on this pull request.



>          1.  Let |R| be the first argument to |onRejected|.
         1.  Let |reason| be the result of [=converted to an IDL value|converting=]
             |R| to an IDL value of type {{any}}.
         1.  If there are no steps that are required to be run if the promise was rejected, then
             return <emu-val>undefined</emu-val>.
         1.  Otherwise, return the result of performing any steps that were required to be run if the promise was rejected,
             with |reason| as the rejection reason.
-    1.  Return [=!=] [$PerformPromiseThen$](|promise|, |onFulfilled|, |onRejected|).
+    1.  Let |onRejected| be [=!=] [$CreateBuiltinFunction$](|onRejectedSteps|, « »):
+    1.  Let |constructor| be |promise|.\[[Promise]].\[[Realm]].\[[Intrinsics]].[[{{%Promise%}}]].
+    1.  Let |newCapability| be ? [$NewPromiseCapability$](|constructor|).
+    1.  Return [=!=] [$PerformPromiseThen$](|promise|.\[[Promise]], |onFulfilled|, |onRejected|, |newCapability|).

That seems worthwhile to me. In particular something like "Implementations might want to have two versions of this operation, as not all callers will use the returned promise," or something like that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/772#discussion_r317663241

Received on Monday, 26 August 2019 15:39:14 UTC