Extension Structure
Installed
Extensions can be installed into the user's profile directory (available only to that profile) or into the application directory (available to all profiles).
Under the application directory, and under the profile directory is a directory called "extensions" - this is where all the extensions live.
The structure for extensions installed under these hierarchies looks like this:
extensions/<extensionID>/
chrome/
components/
defaults/
prefs/
Chrome jar files (content, skin or locale packages) live under chrome, XPCOM components (binary DLLs, JavaScript components etc) live under components, defaults files live under defaults and default preferences files live under defaults/prefs.
The layout of these files is important, as the application scans for things like components and default preferences in these locations. By packaging your extension properly and relying on the automated install process getting this right is fairly simple. If you are writing a custom install script things can be more difficult.
Packaged
When packaged into an XPI archive, extensions wishing to rely on automated install should lay out their archive as follows:
extension.xpi:
manifest.rdf
chrome/
components/
defaults/
pref/
Place chrome jar files in chrome, XPCOM components into components, defaults files into defaults, and default preferences files into defaults/pref. The Extension Manager recreates this layout underneath the extensions folder under the profile or application directory. It registers chrome with the Chrome Registry as required. Information in the install manifest which lives at the top level of the XPI is used to help the installation.
If you want to write your own install.js script instead of using the automated install using manifest.rdf, you may place the files as you like within the XPI file. You must still provide the install manifest as this provides metadata that the Extension Manager uses to configure your extension. For more information read custom installation.