Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

errorevent properties

3 views
Skip to first unread message

John J Barton

unread,
Apr 1, 2009, 2:58:43 PM4/1/09
to
While trying to debug a problem with Firebug on FF3.5 I filed
https://bugzilla.mozilla.org/show_bug.cgi?id=486229
to suggest that adding 'window' to the errors would be easy, solving an
important problem for Firebug.

But also that code is the following:
nsjsenvironment.cpp NS_ScriptErrorReporter

> if (sameOrigin) {
> errorevent.errorMsg = msg.get();
> errorevent.lineNr = report->lineno;
> } else {
> errorevent.errorMsg = xoriginMsg.get();
> errorevent.lineNr = 0;
> }
>
> // Dispatch() must be synchronous for the recursion block
> // (errorDepth) to work.
> nsEventDispatcher::Dispatch(win, presContext, &errorevent, nsnull,
> &status);

I guess that this is sending an event that should be picked up by code like:
window.addEventListener('error', function echoErrors(event)
{
console.log("error event seen by testErrors:", event);
}, true);

However, the 'event' has no errorMsg or lineNr properties. As far as I
can tell it just says "error happened". How can the message be found?

Also, from within Firebug (extension space) I can add an event listener
but it does not get called. Any hints as to why?

jjb

Boris Zbarsky

unread,
Apr 1, 2009, 3:20:38 PM4/1/09
to
John J Barton wrote:
> I guess that this is sending an event that should be picked up by code
> like:
> window.addEventListener('error', function echoErrors(event)
> {
> console.log("error event seen by testErrors:", event);
> }, true);

Maybe. Window onerror is special and passes extra arguments. See
http://www.w3schools.com/JS/js_onerror.asp for example. So it's not
normal DOM event dispatch.

-Boris

0 new messages