Mozilla #JetPack: Create a simple debugger

So I wanted to create a simple JetPack debugger that will write me some data and will dump me some objects on my …Firefox error console.

Here is the code. This simple tutorial shows :

0. How to use some of Firefox Services via Services.jsm
1. How to work with nsIConsoleService

Why I need that? Well I want to debug some of my extensions without using console/notifications or Firebug. This can be usable for getting better support for users. You can always put some debug lines on your code that will be visible for your addon user.

Anyway this is an example library and it’s not for production use :)


Posted

in

, , ,

by

Tags:

Comments

3 responses to “Mozilla #JetPack: Create a simple debugger”

  1. PJ Avatar
    PJ

    Maybe it can be called logger, instead of debugger. I like it – it can be useful if you are using online builder at AMO website.

    Thanks for writing this tutorials Bogo!!!

  2. Jeff Griffiths Avatar
    Jeff Griffiths

    I like the approach, console.log is very useful but not implemented on Firefox 3.x. You could easily adjust your code to just implement a workable console.log if it doesn’t exist, sort of like this:

    https://github.com/canuckistani/jetpack-console.log-injection-example

    1. Bogo Avatar
      Bogo

      Jeff Griffiths: Awesome, thanks for the fork :)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: