Additional information: How to build a Firefox extension

Mozilla pins (wallpaper) on Flickr – Photo Sharing!

This entry inspired me.
How to build a Firefox extension (

I use Mac OSX 10.5 and Firefox 3.0.5.

Set up your development environment


Small script for starting firefox.
% cat ~/bin/
/Applications/ -no-remote -P dev

I created a new profile “dev” for development.

I mainly use 2 add-ons.

Event Spy catch the events like “click”, “mousedown” etc.



Use dump(); for simple print debug.

Browser layout overview

If you want to hook and change default event, you should learn about browser layout. browser.js, browser.xul may help you. These files are in /Applications/
% unzip browser.jar
Or you can find in the firefox source:
% tar jxvf firefox-3.0.5-source.tar.bz2
% find . -name browser.js

Firefox toolbar and some default buttons are made by browser.xul. Some events and functions defined at browser.js.

XUL tips

<menupopupset> needs <popupset>. Use document.loadOverlay for <popupset>. It doesn’t work with document.createElement().

Release candidate

% zip -r ~/your-add-on.xpi . -x "*.svn*"

If you submit your add-on then its status turns in sandbox. A few days later your add-on will appear Newest Add-ons. (you must log in and check “show experimental add-ons”)

This entry was posted in Tweak and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.