Graham King

Solvitas perambulum

Firefox Sage extension – beginning development

sage software
Summary
To start hacking your local Sage feed reader, first set up your Firefox for development by installing the Extension Developer extension, which allows you to reload your extension without restarting Firefox. Install Sage and locate its installation directory, usually in your profile directory. Create a new 'sage' directory and move 'sage.jar' into it, then extract its contents. Rename 'sage.jar' to 'sage.jar.old' and update the 'chrome.manifest' file by changing 'jar:' references to relative URLs. In 'install.rdf', comment out the `<em:file>` section. Enable logging by adding `user_pref("sage.loglevel", 0);` to your 'user.js' file. Edit files within the new 'sage' directory and use the Extension Developer plugin to reload changes effortlessly.

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 !