Mozilla Extension Development Notes

From Mavaball

Revision as of 16:36, 27 November 2008 by Mattball (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page contains a set of notes collected while developing Mozilla Extensions (e.g., for Firefox or Thunderbird) on the Mac OS X platform. I use the Mac OS X 10.5 platform, but suspect it may work with some earlier versions as well... (Specifically I use version 10.5.5, but I can't imagine the last digit makes any difference here).

A Mozilla Extension is a package that extends the behavior of Firefox or Thunderbird. This is a type of 'Add-on'. The other popular type of Add-on is the Plug-in, which is an application that helps you view certain file types (like Flash).

(Last updated: Mattball 15:53, 27 November 2008 (UTC))

Contents

Resources

Here are links to important resources for Mozilla Extension development:

  • Extensions - Home page for Mozilla (e.g., Firefox or Thunderbird) Extension development
  • Get Extension Developer to help you debug your Extension
  • Extension Wizard - This helps to quickly generate a template Extension with your application name and other info.

Extension Wizard Notes

The Extension Wizard is very useful in starting out quickly with an extension. Unfortunately, for Mac OS X users, there are some quirks between GNU tools and BSD tools that need to be tweaked:

build.sh

The Extension Wizard creates a file named build.sh that can build the xpi (pronounced 'zippy') file used to deliver the extension to customers. Before using this on Mac OS X, you need to do the following:

Run

chmod +x build.sh config_build.sh

In build.sh, change the following lines to make the GNU version compatible with Mac OS X's BSD commands. Change:

mkdir --parent --verbose

to

mkdir -p -v

Also change:

cp --verbose --parent

to

cp -v

BSD's cp and mkdir don't support GNU's long style options (e.g., '--verbose'), but instead only support the traditional short versions (e.g., '-v').

Tips

  • Use Safari instead of Firefox for general web browsing during extension development. You have to restart Firefox every time you change your extension, so this can quickly become tedious.

Directories

Firefox Extension Directory

The firefox extensions directory is located here on Mac OS X (substitute 'matt' for your user name, and '28a9sils' for your Profile name):

/Users/matt/Library/Application Support/Firefox/Profiles/28a9sils.default/extensions

Create a file named 'appname@yourname' (replace 'appname' with your extension name, and 'yourname' with your name or domain) within the extension directory, and put the full path to the working copy of your extension here.

As an example, I created a file named keyfixer@mavaball.net with the following contents:

/Users/matt/Workspace/keyfixer_0.4
Personal tools