W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

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

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 3 Jun 2013 09:52:36 -0500
Message-ID: <CABirCh8aZ9JoFhbvVWF0_vy6mM2BN4EO5UXzJ1=CE_eiDmaH_Q@mail.gmail.com>
To: John Barton <johnjbarton@google.com>
Cc: johnjbarton <johnjbarton@chromium.org>, "www-dom@w3.org" <www-dom@w3.org>, Anne van Kesteren <annevk@annevk.nl>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:02 UTC