Re: Exceptions in event listeners triggered by dispatchEvent().
Glenn Maynard <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CABirCh8aZ9JoFhbvVWF0_vy6mM2BN4EO5UXzJ1=CE_eiDmaH_Q@mail.gmail.com> |
On Mon, Jun 3, 2013 at 9:25 AM, John Barton <[email protected]> wrote: > Thanks for pointing to the correct document. However, I'm confused. I > could not find any thing on how exceptions are handled when dispatchEvent > is called from JS. Exception handling is discussed for Futures. > > As currently implemented in Chrome and Firefox, dispatchEvent() acts like > a JS function call -- it does not create an event-loop turn and like a host > event -- it fails to propagate the exceptions. This combination feels like > an accident, not an intended behavior. > As Anne says, errors should be sent to global error handling, but they definitely shouldn't cause the event dispatch to be aborted and prevent other event handlers from being run. I'm not sure if you mean the first part of that or the last, but it's definitely intentional that a failed event handler won't prevent other event handlers from running. That would probably break large portions of the web. Surely you don't mean that the exception should be discarded just because > the spec says nothing? > Specs say what to do--they don't enumerate every single thing not to do. That said, this is probably currently underspecified; Anne described where the fix will probably be (eg. somewhere in WebIDL). -- Glenn Maynard