Closed Bug 851765 Opened 8 years ago Closed 8 years ago

Javascript exceptions thrown within CustomEvent handlers aren't logged

Categories

(DevTools :: Console, defect)

19 Branch
x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 503244

People

(Reporter: blendmaster, Unassigned)

Details

Attachments

(1 file)

In short, this code doesn't log an exception to the JS console, which makes the error silent and debugging hard:

```
document.addEventListener('custom', function() {
  throw new Error('error in customEvent handler')
})

document.dispatchEvent(new CustomEvent('custom'))
```

While the [DOM3 Events spec][0] is correctly implemented in that the `dispatchEvent` call _itself_ doesn't propogate the thrown error, the JS console should still log the error for debugging purposes (just like other JS errors).

Furthermore, the exception is also not emitted to `window.onerror`, which makes debugging CustomEvent handlers especially difficult.

Fortunately, the JS debugger's "break on exceptions" mode does break within CustomEvent handlers, but debugging errors that way isn't always as easy as looking at console messages.

See the attachment for a small test of the above points (open up the the native console or firebug to check).

[0]: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
Attachment #725717 - Attachment mime type: text/plain → text/html
Thank you for the bug report. The exception is not shown in the Error Console either. This is a lower level bug, most-likely a duplicate of bug 503244. If you believe otherwise, please reopen.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 503244
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.