March 26, 2006

Firefox Sage extension – beginning development

Posted in sage, Software at 16:25 by graham

I have been using Sage as my feed reader. It’s a great Firefox extension, and it’s very easy to develp with. It took me a little while to get started, so here are my brief notes on how to start hacking your local Sage copy. Thanks to Thomas Themel from the Sage mailing list for getting me started.

Before you start, setup your Firefox for development. Particularly you will need to install the Extension Developer extension. This will allow you to reload you extension during development without having to close and re-start Firefox each time.

Install Sage and bounce Firefox. The .xpi file you downloaded is just a zip file. Installing it unpacks it into your extensions directory.

Go into your profile directory. On Linux this is, from your home directory, .mozilla/firefox/default.XY/extensions/NUMBER/chrome. The NUMBER will be the most recent by date, as sage is the most recent extension you have installled.

Create a new sage directory.

Move sage.jar to the new sage directory.

Run jar xvf sage.jar (assuming you have the jar tool – it comes with any recent version of java). You might be able to use something like WinZip for this. This extracts the files in sage.jar into the current directory.

Rename sage.jar to sage.jar.old

Edit chrome.manifest: replace all jar: references with relative URLs, like changing

content sage    jar:chrome/sage.jar!/content/

to

content sage    chrome/sage/content/

In install.rdf comment out the <em:file> section.

In your profile directory, .mozilla/firefox/default.XY edit (or create) user.js and add:

user_pref("sage.loglevel", 0);

to turn on Sage’s logging.

You are ready to go. Edit one of the files in the new sage directory.

To reload changes, use the Extension Developer plugin, and do ‘Reload all chrome’

Much more information on Extension Development is available from the MozillaZine extension development center

Happy Hacking !

Leave a Comment

Note: Your comment will only appear on the site once I approve it manually. This can take a day or two. Thanks for taking the time to comment.