From: whatwg [mailto:whatwg-boun...@lists.whatwg.org] On Behalf Of Boris Zbarsky
>> In this case the event would be fired > > By "the" event do you mean the error event or the rejectionhandled event? Ah, trick question! Because, see, I was confused when I wrote that, and myself did not know! >> but no listener would be present at that time, so "got here" would not be >> logged. > > In my mental model based on your initial mail here, the rejectionhandled > event would get fired at the point when catch() is called, which is after > window.onrejectionhandled is set. You are totally right. To state what happens in that scenario more clearly: - `error` is fired at time zero. Nobody is listening. - `rejectionhandled` is fired at time 200 ms. Somebody is listening, and "got here" is logged. So to answer the original question: > If there is no listener for either when the promise would normally fire > error, but then a listener for "rejectionhandled" gets added before a > .catch() call on the promise, does the listener get called? Yes, yes it does. Sorry about the massive confusion. I should probably stop writing emails for the night :).