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

Domenic Denicola <[email protected]>
Newsgroups gmane.comp.web.dom.general
Message-ID <B4AE8F4E86E26C47AC407D49872F6F9F877D0028@BY2PRD0510MB354.namprd05.prod.outlook.com>
From: Glenn Maynard [[email protected]]

> Using the event loop system just to change the way an exception is handled doesn't make any sense to me.

Really? To JavaScript programmers, it's the only thing that makes sense. There is no way in native JavaScript semantics to do the magic thing the web platform currently does, wherein (a) code is executed synchronously, but (b) exceptions thrown from that code bypass any surrounding `try`/`catch` blocks, and instead reach `window.onerror`.

>From the perspective of reducing magic in the platform, and providing basic primitives JavaScript programmers can use to polyfill and prollyfill future extensions to the platform, John's objection makes perfect sense. There is black C++ magic going on inside dispatchEvent, and it's unfortunate and surprising to JavaScript programmers.

We can't change it, for legacy reasons. But maybe we could expose that black magic to the platform for developers to use, so that it becomes less magic and more technology, that would allow us to build faithful `dispatchEvent` polyfills.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.