Wink Saville’s Blog

December 2, 2007

Debugging initialization of Firefox extensions

Filed under: firefox — wink @ 7:31 pm

That worked beautifully, I wanted to set a break point
on the first line of my code that executed after it loaded.
I ran:

firefox -chrome chrome://venkman/content

and then did “window.open()” my code loaded and I
set a future breakpoint on the first statement in the file.
I then checked “Save Break/Watch Settings On Exit” in
the file menu and then exited firefox.
I’d like to thank Alex Vincent for solving the mystry on how to debug a the initialization/loading of a Firefox extension. Earlier I had a problem concerning why my Firefox extension would not work on the Mac. My attempts to debug that led me to want to use a debugger to watch how my extension worked as it was loaded, but I couldn’t figure out a solution. So I posted a message to the Mozilla developer forums javaScript Debugger email list.

The solution was provided by Alex Vincent, which was to not use the -venkman option but instead execute using -chrome below is the last message I posted this subject which details the solution:

That worked beautifully, I wanted to set a break point
on the first line of my code that executed after it loaded,
so I ran:

firefox -chrome chrome://venkman/content

and then executed “window.open()” as you suggested.
My code loaded and I set a future breakpoint on the
first statement in the file. I then checked
“Save Break/Watch Settings On Exit” in
the file menu and then exited firefox.

I then ran a second time with the same command:

firefox -chrome chrome://venkman/content

Then did “window.open()” a second time and we dropped
back into the debugger at my break point at the top of
the file. This was exactly what I wanted.

This is exactly what I wanted, hopefully this helps
someone else in the future.

THANKS Alex!

Wink

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress