[whatwg] Stack trace in window.onerror

Ian Hickson ian at hixie.ch
Fri Jul 26 14:52:18 PDT 2013

On Fri, 26 Jul 2013, James Greene wrote:
> My last name ends with an 'e' ('Greene' vs. 'Green').  Please correct 
> that when you get a chance. Thanks!

Oops, my apologies. Fixed.

> You had mentioned earlier that there is already a window 'error' event 
> that can be listened to via `window.addEventListener('error', fn, 
> false);` if you don't use `window.onerror = fn;`:

Or indeed if you do. They both fire.

> Is that clarified in the spec somewhere already?

Yeah, this was a recent change.

> Although that makes perfect sense to me, I have never noticed it before 
> nor heard of any browser vendors implementing such.  Have there been any 
> such implementations yet?  If so, that's *wonderful* news.  :)

Some quick testing shows this working in at least Firefox and Chrome. That 
is, the 'error' event fires. In Chrome it has attributes "message", 
"lineno", and "filename", but it doesn't seem to in Firefox.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list