Building Restartless Addons for Firefox
Soumya @Debloper Deb
Workshop — Carte Blanche'12
Types of Firefox Addons
 
  1. Extensions
  2. Themes
  3. Locales
  4. Multiple Item Package/Bundles

All major Mozilla-products handles addons in a same fashion.

One single addon package can serve multiple products, each accross multiple versions.

Structure of an extension
General Boilerplate
extension.xpi:                //Extension Package
  /install.rdf                //Extension information
  /chrome.manifest            //Chrome-Registration
  /chrome/
  /chrome/content/            //Main XUL/JS files
  /chrome/icons/default/*     //Extension Icons etc.
  /chrome/locale/*            //Extension Localization
  /defaults/preferences/*.js  //Extension Defaults Prefs
  /plugins/*
  /components/*
  /components/cmdline.js
      

To understand better, unzip & browse this "Hello World!" extension: http://mozilla.doslash.org/stuff/helloworld.zip .

Addon Development Environment
Setup: Step by step...
  1. Create a new Firefox development profile
  2. Set development preferences in about:config
  3. Install development (helper) extensions
  4. Create an addon directory structure
  5. Add proxy file to "install" the addon
  6. Fill install.rdf with necessary details
Find the details for each of the steps in this Etherpad
https://etherpad.mozilla.org/addon-workshop-cbmit
Bootstrapped Extensions...
or more generally: "Restartless Addons"
  1. Contain a special bootstrap.js file at the root
  2. Use Startup/Shutdown scripts to load/unload
  3. Can (hot-)install/remove itself on-the-fly
  4. Can apply changes while application is running
  5. Don't depend on the legacy "XUL overlay" mechanism
  6. Almost no application version dependency/restrictions
Choose Development Environment
Let's get our hands dirty...
Add-on SDK [Download Link]
  1. Work locally/offline
  2. Control/customize defaults
  3. Choose your own editor, revision control etc.

Add-on Builder [Web-App URL]
  1. Edit codes in rich online-editor
  2. Test add-ons instantly as you go
  3. Save time with automated build system
  4. Automated code saving and revision control
 
 

Add-on Development is in Progress:

Please grab your "Jetpack" to fly with us,

Or, hold your breath & count the pulse... :P

You made it!
Hacking Firefox, the fun way...

MDN Add-on Docs: https://builder.addons.mozilla.org/docs/
ExtDev IRC Channel: irc://irc.mozilla.org/#extdev

Get these slides live at: http://debloper.github.com/talks/RestartlessAddons

Fork my GitHub repos @Debloper
Or, follow me on Twitter @Debloper

Thanks!