One of the questions I get asked a lot is how to integrate a CCK package into a Firefox distribution or install a CCK into an existing Firefox installation. This post will detail various ways to do that. All of the information I'm about to give applies to all add-ons.
Scenario 1: Include an add-on, prevent users from removing it or disabling it. The user cannot even see the add-on.
To include an add-on in a Firefox distribution and hide it, you need to put it in the distribution/bundles directory. Make a directory called distribution in the same directory where the Firefox executable is located. Next create a subdirectory called bundles. Then create a directory with the same ID as your add-on and unzip it into that directory.
Important Note: If your add-on contains search plugins, they have to go in a different directory - distribution/searchplugins/common/. They will not be loaded if they are in your add-on.
Scenario 2: Include an add-on, prevent users from removing it. The user can disable the add-on.
To include an add-on this way, you need to put it in the extensions directory where the Firefox executable is located. Create a directory with the same ID as your add-on and unzip it into that directory. IMPORTANT: If you use this mechanism (which used to work pretty well), your add-ons will be disabled by default. To override this, you'll need to set the preference extensions.autoDisableScopes to 0 via a config file or by creating a new prefs file in the defaults/preferences directory. Setting this value via distribution.ini will not work.
Scenario 3: Install the add-on when a new profile is created. The user can disable or remove the add-on.
For this scenario, we're back to using the distribution directory. The difference will be the directory we place the add-on in. Make a directory called distribution in the same directory where the Firefox executable is located. Next create a subdirectory called extensions. Then create a directory with the same ID as your add-on and unzip it into that directory. Alternatively you can name the XPI with the same ID as your add-on with .XPI on the end and just place the file in that directory.
Scenario 4: Install an add-on outside of the Firefox directory, but have it still available in Firefox. The user can disable the add-on.
This scenario covers a lot of different cases. There are various directories on Windows, Mac and Linux where you can install an add-on and it will be picked up by Firefox. You can get more detail on those locations here. A more common option on Windows is to use the registry. Rather than go into detail here, I'll just point to another great article on developer.mozilla.org. IMPORTANT: If you use any of these methods, you run into the extensions.autoDisableScopes problem again. See Scenario 2 for more information.
I've also seen cases where apps locate the profile directory and install an add-on directly into a profile.
Does anyone have any other scenarios that I'm forgetting?