-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise handling algorithms are not very clear about what happens if type conversion fails #782
Comments
I am curious if implementations actually pay attention to the T at all... Do they have counterpart algorithms? |
Gecko pays attention to the T in the following ways:
There are no other places that are aware of the T in Gecko as far as I can tell. |
How does |
In the spec as written, it'll return a rejected promise and the success steps won't be run. Let's take a look at what APIs take a Promise argument anyway:
This suggests to me that we should run the rejection steps on conversion failure. |
Yes. See https://searchfox.org/mozilla-central/rev/7088fc958db5935eba24b413b1f16d6ab7bd13ea/dom/serviceworkers/ServiceWorkerEvents.cpp#576,588-591,595-597,605-608 (which checks that the resolution value is an object, then checks that it's a Response. |
Ah, I guess because "converting" will throw, and PerformPromiseThen handles it. That makes sense.
Sounds good to me. |
https://heycam.github.io/webidl/#dfn-perform-steps-once-promise-is-settled
What if the type is
Promise<Node>
and someone passesPromise.resolve(3)
?I think the best we can do is go down the rejection path? Although that makes using "upon fulfillment" in isolation pretty dangerous for non-
any
_T_s.The text was updated successfully, but these errors were encountered: