Has anybody managed to get a full stack trace from within
window.onerror? I am only able to obtain a trace back to the onerror
event itself which is pretty pointless.
It does not work as you expect because the `onerror' event-handler
property and runtime exceptions are mutually exclusive concepts of
error handling.
Assigning a Function object reference (an event listener) to the
`onerror' property of Window host objects is a *proprietary* means in
some NN4-compatible *DOM APIs* to have the *user agent* (not: the
script engine) call the referenced function if *any* error occurs
*anywhere* from that point forward. (Assigning `null' to that
property would disable this functionality again. The property is also
available for proprietary Image host objects whereas only errors
related to loading the image are handled.)
A stack trace, on the other hand, is related to an execution context
in which runtime exceptions (handled with try...catch...finally) were
created or thrown (with `new Error()' or `throw' or by API
components). The latter are a *standardized* *language* feature (as
of the ECMAScript Language Specification, Edition 3 Final), and thus
are handled by the *script engine* instead.
So, because with `window.onerror' the caller is the user agent and not
the execution context in which you assigned to `window.onerror', your
stack trace is rather empty in the event listener.
HTH
PointedEars