-
Notifications
You must be signed in to change notification settings - Fork 15
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
Bug in unhandledrejection context of promise rejected in next tick #35
Comments
It took me a bunch of staring but I'm convinced that this is a bug too :) . One simple (but arguably ugly) fix would be to use HostMakeJobCallback on Step 4 of NewPromiseReactionJob, and an associated HostCallJobCallback on the other side--I guess it's only needed for this particular purpose of unhandled rejections. [Ultimately, if AsyncContext works, I think we might end up removing the host hook and using AsyncContext variables for the exact purpose that HTML needs those hooks in the first place. Maybe this would cause some observable changes and not actually be possible, but I'm not sure how interoperable browsers are in these edge cases anyway.] |
Currently we're not using the |
…mpletions Closes tc39#35.
…completions Closes tc39#35.
We should probably maintain an HTML PR so that we can have a coherent understanding of what the hooks are for. For unhandled rejections, this HTML logic would need to save and restore the AsyncContextSnapshot between when the rejection initially occurs and when the event is triggered (after the microtask queue is drained). |
…completions Closes tc39#35.
…completions (#41) * Make sure to propagate a promise job's snapshot when handling abrupt completions Closes #35. * Wrap resolve call in `AsyncContextSwap` as well * Update spec.html * Remove extra AsyncContextSwap --------- Co-authored-by: Justin Ridgewell <[email protected]>
There's currently a bug with our spec text and the handling of
unhandledrejection
, where the global context will be incorrect (undefined?) in the cases we care about:Following the stack:
The problem is that we've specified the restore step only within a HostCallJobCallback call, which is called during 1.e. Which means that by the time we get to 1.h.i to call the
promiseCapability.[[Reject]]
, we've already restored the prior context. That prior context will be present when we finally call HostCallJobCallback, which callsHostPromiseRejectionTracker
.Re: #16, but I'm making a new issue because that one is specific to call/create time context and not the bug in our propagating.
The text was updated successfully, but these errors were encountered: