Re: Exceptions in event listeners triggered by dispatchEvent().

On Mon, Jun 3, 2013 at 9:25 AM, John Barton <johnjbarton@google.com> 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

Received on Monday, 3 June 2013 14:53:10 UTC