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

Catch javascript errors with gecko

31 views
Skip to first unread message

philippe

unread,
Mar 16, 2007, 8:20:10 AM3/16/07
to
Hi

I'm working for a company who builds automats. In the application we
develop in France, the user's interface is a web Browser.

We choose to use mozilla, and I developped gecko, because we need to
control all the processes.

We are loading pages with javascript, and we need to know when there
is a Javascript error.

What I need to do is to trap the JS errors as mozilla do it qhen it
puts JS or CSS error into the JS console.

But I don't know when and how to do that.

I looked at nsiJSConsoleService , nsIConsoleMessage, nsIScriptError....
But I did'nt find any way to do what I want.

First what have I to do : have I to register a listener to a service
(maybe the JS engine), in oder to be informed for errors.

When have I to do that, on each page (during my progress listener's
functions as I do for JSFunctionsDefinition (int the chrome)), or just
once when I create the browser ?

What object do I listen to , what objects do I get.........


I've only questions and no response....


Thank's a lot


Philippe

Boris Zbarsky

unread,
Mar 16, 2007, 10:34:26 AM3/16/07
to
philippe wrote:
> What I need to do is to trap the JS errors as mozilla do it qhen it
> puts JS or CSS error into the JS console.

Get the nsIConsoleService and call registerListener on it.

Which you could tell from the source code of the JS console, btw.... ;)

> First what have I to do : have I to register a listener to a service
> (maybe the JS engine), in oder to be informed for errors.

See above.

> When have I to do that

Depends on when you want to start listening. If you always want to listen, just
do it at startup.

-Boris

philippe

unread,
Mar 19, 2007, 9:22:18 AM3/19/07
to

Thank's very much for your help

It was very usefull.


philippe

0 new messages