Create Firefox extensions in Komodo

Posted by shanec on 2007-01-26 16:14

Want to make a Firefox extension? Where do you start? Well, there are some resources to get you started:

http://kb.mozillazine.org/Getting_started_with_extension_development
http://developer.mozilla.org/en/docs/Building_an_Extension

Ouch! That's a lot of documentation to get to a "Hello World" extension. Whatever happened to print "hello world";? Well, using Komodo you can shorten the experience to almost the same level (ie. not having to know "all of the above").

Attached is a project template that creates a simple "hello world" extension for Firefox. This template shows an example of using a config dialog in a project template, but that's for another time.

Once you in install the kpz (see below), go to the file->new->new project from template menu, and select the firefox entry under "My Templates". Choose a directory and project name.

A dialog will appear asking a few basic questions for configuration of the project.

Once that is done, open up the "project" folder in the new project, and double click on "build XPI". An xpi file will appear in the project. Drag that onto firefox to install it. Restart, you will have a new menu item in the firefox Tools menu (it will say "Hello World" if you did not change any options in the project configuration dialog).

To use:

drop kpz file in:

OSX:
~/Library/Application Support/Komodo/4.0/project-templates/My Templates/firefox.kpz

Linux:
~/.komodo/4.0/project-templates/My Templates/firefox.kpz

Windows:
%APPDATA%/ActiveState/Komodo/4.0/project-templates/My Templates/firefox.kpz

AttachmentSize
firefox.kpz14.13 KB

francesco | Sun, 2007-02-18 01:23

Thank you.
This article was very helpful for my first steps with komodo (and firefox extensions). Anyway, double-clicking the buildxpi macro didn't work for me. I looked at the macro source and I've seen that it needs a zip tool that should be in the system's path. The macro seems to build a command line string that explicitely invokes "zip".
You can probably circumvent the problem by replacing the "zip" call (and -Dr parameters, which I guess are for "D"irectory and "r"ecursive) with your own utility that can create a zip file.
Or you can do as I did, executing each step "manually". I've used WinRAR. I created a zip file containing the "content" directory which I named "helloworld.jar" and then created another zip file named "helloworld.xpi", containing "helloworld.jar", "chrome.manifest" and "install.rdf".
Then you can drag your "helloworld.xpi" onto firefox and it works pretty well...