xpcom/components/nsIComponentManager.idlScriptable
This interface provides methods to access factory objects and instantiate instances of classes.
66
Introduced
Gecko 0.7
Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Method overview

void addBootstrappedManifestLocation(in nsILocalFile aLocation);
void createInstance(in nsCIDRef aClass, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result);
void createInstanceByContractID(in string aContractID, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result);
void getClassObject(in nsCIDRef aClass, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result);
void getClassObjectByContractID(in string aContractID, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result);
void removeBootstrappedManifestLocation(in nsILocalFile aLocation);

Methods

addBootstrappedManifestLocation()

Loads a "bootstrapped" chrome.manifest file from the specified directory or XPI file. A "bootstrapped" chrome manifest supports some of the instructions allowed in a regular chrome manifest, see the Chrome Registration documentation for details.

This method was introduced in Gecko 8 to let bootstrapped add-ons provide content at chrome:// URIs. Until Gecko 10 you had to call this method manually from within the add-on's startup() method (with a matching removeBootstrappedManifestLocation() call in the add-on's shutdown() method).

If you're targeting Gecko 10 or higher there should be no need to call this method, since the bootstrapped add-on's chrome.manifest is loaded automatically now.

void addBootstrappedManifestLocation(
  in interface nsILocalFile aLocation
);
Parameters
aLocation
The directory or XPI from which to load the chrome.manifest.

createInstance()

Creates an instance of the class specified by ClassID. Unlike getService, this returns a new instance each time it is called. (See also nsIFactory.createInstance.)

void createInstance(
  in nsCIDRef aClass,
  in nsISupports aDelegate,
  in nsIIDRef aIID,
  [iid_is(aIID),retval] out nsQIResult result
);
Parameters
aClass
The ClassID of the object instance that is being requested.
aDelegate
The outer object used for aggregation.
aIID
The interface type to be returned.
result
The resulting interface pointer.
Exceptions thrown
NS_ERROR_FACTORY_NOT_REGISTERED
Indicates that the specified class is not registered.

createInstanceByContractID()

Creates an instance of the class specified by ContractID.

void createInstanceByContractID(
  in string aContractID,
  in nsISupports aDelegate,
  in nsIIDRef aIID,
  [iid_is(aIID),retval] out nsQIResult result
);
Parameters
aContractID
The ContractID of the object instance that is being requested.
aDelegate
The outer object used for aggregation.
aIID
The interface type to be returned.
result
The resulting interface pointer.
Exceptions thrown
NS_ERROR_FACTORY_NOT_REGISTERED
Indicates that the specified class is not registered.

getClassObject()

Returns the factory object for the class specified by ClassID.

void getClassObject(
  in nsCIDRef aClass,
  in nsIIDRef aIID,
  [iid_is(aIID),retval] out nsQIResult result
);
Parameters
aClass
The ClassID of the factory that is being requested.
aIID
The interface type to be returned.
result
The resulting interface pointer.
Exceptions thrown
NS_ERROR_FACTORY_NOT_REGISTERED
Indicates that the specified class is not registered.

getClassObjectByContractID()

Returns the factory object for the class specified by ContractID.

void getClassObjectByContractID(
  in string aContractID,
  in nsIIDRef aIID,
  [iid_is(aIID),retval] out nsQIResult result
);
Parameters
aContractID
The ContractID of the factory that is being requested.
aIID
The interface type to be returned.
result
The resulting interface pointer.
Exceptions thrown
NS_ERROR_FACTORY_NOT_REGISTERED
Indicates that the specified class is not registered.

removeBootstrappedManifestLocation()

Unregisters the chrome.manifest file previously registered with the addBootstrappedManifestLocation() method.

See addBootstrappedManifestLocation() for details.

void removeBootstrappedManifestLocation(
  in interface nsILocalFile aLocation
);
Parameters

Examples

Using addBootstrappedManifestLocation in a bootstrapped extension for Firefox 8 and 9:

aLocation
The directory or XPI to stop reading the chrome.manifest from.
function startup(params, aReason) {
  if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0)
    Components.manager.addBootstrappedManifestLocation(params.installPath);
}

function shutdown(params, aReason) {
  if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0)
    Components.manager.removeBootstrappedManifestLocation(params.installPath);
}