build a firefox extension from within the folder containing the code with ‘cfx xpi’ (command provided by addon-sdk)

then run a Firefox instance with ‘cfx run’

Install Auto-installer addon in Firefox

It need us to build the addon (cfx xpi), and send it inside a HTTP POST request to localhost:8888

It then reinstall the addon on the running Firefox instance

It identifies the addon by its ‘id’ we define in ‘package.json’ file. So if we change the ‘id’ there, a new copy of our addon will get installed along with previously installed file.

How to use

Install auto-installer on a Firefox instance (may be with a different profile than your default profile (firefox -ProfileManager))

Build the addon

cfx xpi

Post it to localhost:8888. e.g with

wget –post-file=myAddon.xpi http://localhost:8888/

Done

while true ; do cfx xpi ; wget –post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done

Install ’compile-bookmarks’ in Emacs

/path/to/firefox-addon-sdk/bin/cfx xpi && wget –post-file=myAddon.xpi http://localhost:8888/

run ‘compile’ function (M-x compile)

execute above mentioned command from mini-buffer



Select ‘add’ from ‘compile’ menu. The command you used previously for compiling will appear there, select it

It will then prompt in mini-buffer for a key to use for compiling with above command

Choose whichever seem right to you. I have chosen ‘f’ for this.

I used addon-sdk to create my simple firefox addon . It makes really easy to create firefox addon by avoiding writing boilerplate code and provides a simple Javascript api for some functionality of Firefox.Addon-sdk do makes things easier but the workflow is still not as straightforward as that of developing Chrome extensions. In chrome, we can load unpackaged extensions which are just folders containing a simple HTML app and a manifest.json. In case of Firefox addons, we need to firstWe need to do this every time we make any change in the addon code. Soundsgross right? It is indeed gross.To make things simpler, there’s an addon in Firefox marketplace called ’ auto-installer ’ which allow us to install addons on the fly. This is highly recommended if you are going to develop a firefox addon.Here’s a great tutorial on Firefox Developers Network for installing and using addon-sdk.So when developing a new Firefox addon, things should go in a flow similar to this.This addon allow pushing the addon we are developing to Firefox on the fly, without the need to do something like ‘cfx run’ over and over again.This make things specially easy with Emacs, see next point.In the article on Firefox developers hub, they suggest following command which I found not very good.Above command builds a Firefox xpi addon from our source code every 5 seconds, and push it to the Firefox instance. It’s annoying in its own right.This package allow keeping ‘compile’ commands like bookmarks, and executing them with keyboard shortcuts. It’s more useful than one might think at first. I do all sort of tasks as compile-commands in Emacs like running unit-tests.Create a bookmark with a compile command like following:When we provide complete path of the ‘cfx’ command, we don’t need to activate the ‘virtualenv’.You can do this byYou can now run build and install your extension in firefox with keys ‘C-` f’.This was the workflow I came up with developing my one firefox addon. I would love to hear how experts do things. If you have time, please tell in comments your way of doing things.