O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #86. Create a Chrome Package

Packages are the fundamental concept underlying most chrome content. Here's how to make one.

Pieces of software installed on top of Firefox are called extensions, themes, locales, or add-ons. The name extension and those other names are all product bundle names. Extension product bundles, for example, are handled by the Extension Manager. Inside these product bundles is the lower-level nuts-and-bolts concept of a package. This hack covers the different package representations and the extra steps that are needed for packages to be formally recognized by Firefox in the chrome registry.

An extension's packages include the extension's user-interface (UI) content, plus some additional information. This information makes up the extra bits and pieces needed for the extension to work in Firefox. Users see an extension as something that carries out a particular task for them. This encompasses the UI and the code to implement any functionality. A package includes these files, but it also serves as the name of the extension as it is used in file paths and in RDF files. Packages underlie all themes, locales, and extensions for Firefox.

Here are the steps needed to bring a package into existence:

  1. Create your files locally on disk.

  2. Choose to leave them in a flat file structure or put them in a JAR.

  3. Create the contents.rdf files necessary for Firefox chrome registration.

  4. Enable special chrome:// URLs for your package.

After these steps, the package is ready for further ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required