This is an archived page. It's not actively maintained.



Registers chrome with the chrome registry.

Method of

Install object


int registerChrome(


The registerChrome method has the following parameters:

SWITCH is the chrome switch indicating what type of file is being registered. SKIN is used to register skins, LOCALE is used to register language packs. PACKAGE, a third possibility is the equivalent of SKIN AND/OR LOCALE, and ensures that everything in the XPI is registered. One final option for the switch parameter is DELAYED_CHROME, which registers the switch only after a relaunch of the browser.
Note that you can combine switches as in the example below.
srcDir is a FileSpecObject representing the source destination of the installation. FileSpecObjects like that required by this function are created using the getFolder method on the Install object.
xpiPath is the path within the XPI in where the contents.rdf file defining the chrome is located. For example, "locale/myLocale/aim," points to the locale/myLocale/aim subdirectory of the same XPI file in which the installation script is located.


An integer error code. For a list of possible values, see Return Codes. In some situations the method may return other errors. In a few cases you may get a registry error.


When the third parameter is omitted (pointing to a specific location within the XPI file), this function is being used in a somewhat deprecated way. In this case, registerChrome is supporting the old format of installation archives, in which the manifest.rdf file was always located at the highest level of the installation archive. In this case, registerChrome does not require a path inside the archive, as it does now in order to locate the more flexible contents.rdf format of installation archives. Note that you can also look in the installed-chrome.txt file in the chrome directory to see how and where the registerChrome function has registered your package with the chrome registry.


Example assumes your XPI file is in Plugins folder and RDF file is in resources subfolder of XPI.

You should probably avoid this call (in the case you are copy/pasting from older install scripts) for plugin installation in Firefox 2.x. It is unclear what, if anything, does this "Chrome registration" accomplish.