Starting out by reading MDC's "Setting up extension development environment" page is a great first step.
browser.dom.window.dump.enabled doesn't hurt anything, though I don't consider these options as useful.
The DOM Inspector, sometimes a.k.a. "DOMi" is great for inspecting the Chrome layout.
For Firefox 2.x, this is not a separate extension. Choose to install with a Firefox custom install. For Firefox 3.x, it is available at https://addons.mozilla.org/en-US/firefox/addon/6622. (See also bug 339229 and bug 271812 for details on the move.)
ChromeWindow in a pinch, though it's not readily apparent how.
(The lack of any real documentation doesn't help much.)
"Mossop" was kind enough to help me out at
irc.mozilla.org#extdev by pointing me to the
- Open DOM Inspector
- Select the "
#document" nodeName from the left-hand pane.
- Expand "
Subject", then "
Unfortunately, in Firefox 2.x, the property tree is not sorted.
This was fixed with bug 226819, but isn't included until the 2.0.0 version for Firefox 3.x.
defaultView was broken in Firefox 3.0a8 in that it won't expand.
I had reported this in bug 398285.)
I do think that Firebug is a great extension, but it's main use is mostly focused on debugging and analyzing loaded web pages within the main browser window, rather than the Firefox browser itself (i.e., the Chrome).
An interesting hack is to open
chrome://browser/content/browser.xul as a web page.
This essentially opens an instance of Firefox from inside the browser window.
(See "Fun with Firefox Chrome URLs".)
Unfortunately, this can cause a number of side effects, particularly with various add-ons.
(Read more at Issue 194 - Firebug should be able to inspect chrome and "Firebug and Firefox".)
The other issue I had was finding stack traces, or at least the source file and line number of an error. Most of this seems to come naturally for debugging web pages with Firebug, but can be trickier to track down within a Firefox extension.
The first thing to check is that the only unhandled objects being thrown are based on the global
Unlike Java, where only an instance of a class extending
I.E., throwing a string, e.g.
throw "This is an error!" is completely valid.
However, only objects built from the
Error object contain the populated details, e.g.
Even with Console2 installed and throwing
Error objects, I still find the following helpful - at least until Firefox/Console2 supports the
stack by default:
This will actually generate seemingly duplicate messages to the console: first one with the additional detail, then the one that would be generated by default - but I find that it's the safest way, and still allows for showing non-Error objects that were thrown by the default method.
Updated: 2007-10-09, 2008-05-13 - Information on DOM Inspector