in Javascript, Programming

My Windows Firefox add-on development environment

At the moment I am working on a top-secret Firefox Extension. The great Firefox Addon Builder was discontinued in January 2014 and I wanted to write shorter blog posts more often, so here is my Firefox add-on development environment (for beginners and Windows, although it should be easily applicable also on other operating systems).

SDK installation

  1. Install Python 2.5 or 2.6. Python versions 2.6.x, x > 6, are source-only released, so you need to compile them yourselves. Python 2.6.6 was the last version with a Windows installer.
  2. Download the Firefox SDK and unzip it somewhere.
  3. Execute addon-sdk-1.x\bin\activate.bat to test whether it works.

Creating your first project

  1. Create a new empty folder
  2. Start the SDK CLI from within that folder
  3. Execute cfx init in the CLI
  4. Execute cfx run to test the addon in a new, empty Firefox instance

All that could look like this:

C:\tmp>mkdir testaddon
C:\tmp>cd testaddon
Welcome to the Add-on SDK. For the docs, visit
(C:\addon-sdk-1.15) C:\tmp\testaddon>cfx init
* lib directory created
* data directory created
* test directory created
* doc directory created
* written
* generated jID automatically: jid1-3nbhW4edkg5x6w
* package.json written
* test/test-main.js written
* lib/main.js written
* doc/ written
Your sample add-on is now ready.
Do "cfx test" to test it and "cfx run" to try it.  Have fun!
(C:\addon-sdk-1.15) C:\tmp\testaddon>cfx run
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\luebbers\appdata\local\temp\tmpv140_i.mozrunner'.
JavaScript strict warning: resource://gre/modules/XPIProvider.jsm, line 6257: re
ference to undefined property this.icons[32]
Total time: 8.939000 seconds
Program terminated successfully.

make.bat + Notepad++;

  1. To increase productivity I put the commands for packaging and executing the add-on in development in a “make.bat”.
    cd C:\addon-sdk-1.15\bin\
    call activate.bat
    cd C:\git\majascan\
    cfx run
  2. Open the run dialog in Notepad++ with F5 and let it open this file. With “Save” you can create a shortcut for this command.
  3. Develop great Firefox extensions.
  4. ???
  5. non-profit!

Write a Comment