You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "react to a promise" algorithm seems to be a spec-level version of Promise.prototype.then, except that when it's called with a missing handler, a default handler is substituted which simply resolves the promise with undefined.
In other words, you would expect "react to a promise" to be equivalent to:
I understand that, even when there's no fulfillment handler given, the conversion to IDL of the resolved value must happen, so the promise can reject if the conversion throws (see also #782). But even in that case, the return value shouldn't be undefined. And for the rejection handler even that is unnecessary, since converting an ECMAScript value to any cannot fail.
The fact that this is the intended behavior is borne out by the definitions of "upon fulfillment" and "upon rejection", as well as by the usage of these operations in the Fetch, Streams, Background Fetch and Service Worker specs.
The text was updated successfully, but these errors were encountered:
"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.
Closeswhatwg#921.
"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.
The "react to a promise" algorithm seems to be a spec-level version of
Promise.prototype.then
, except that when it's called with a missing handler, a default handler is substituted which simply resolves the promise withundefined
.In other words, you would expect "react to a promise" to be equivalent to:
and it's instead:
I understand that, even when there's no fulfillment handler given, the conversion to IDL of the resolved value must happen, so the promise can reject if the conversion throws (see also #782). But even in that case, the return value shouldn't be
undefined
. And for the rejection handler even that is unnecessary, since converting an ECMAScript value toany
cannot fail.The fact that this is the intended behavior is borne out by the definitions of "upon fulfillment" and "upon rejection", as well as by the usage of these operations in the Fetch, Streams, Background Fetch and Service Worker specs.
The text was updated successfully, but these errors were encountered: