nsIModule

This interface must be implemented by each XPCOM component. It is the main entry point by which the system accesses an XPCOM component.
Inherits from: nsISupports Last changed in Gecko 0.9.9

Method overview

boolean canUnload(in nsIComponentManager aCompMgr);
void getClassObject(in nsIComponentManager aCompMgr, in nsCIDRef aClass, in nsIIDRef aIID, [retval, iid_is(aIID)] out nsQIResult aResult);
void registerSelf(in nsIComponentManager aCompMgr, in nsIFile aLocation, in string aLoaderStr, in string aType);
void unregisterSelf(in nsIComponentManager aCompMgr, in nsIFile aLocation, in string aLoaderStr);

Methods

canUnload()

This method may be queried to determine whether or not the component module can be unloaded by XPCOM.

boolean canUnload(
  in nsIComponentManager aCompMgr
);
Parameters
aCompMgr
The global component manager.
Return value

Indicates to the caller whether or not the component module can be unloaded. Returning true is not a guarantee that the module will be unloaded. It constitues only willingness of the module to be unloaded. It is very important to ensure that no outstanding references to the module's code/data exist before returning true. Returning false guaratees that the module will not be unloaded.

If the component module is native (that is, as part of a DLL), then this method may be called to determine whether or not the DLL may be unloaded from memory.

Note: As of Gecko 1.7, native component modules are never unloaded.

getClassObject()

Obtains a Class Object from a nsIModule for a given CID and IID pair. This class object can either be query to a nsIFactory or a may be query to a nsIClassInfo.

void getClassObject(
  in nsIComponentManager aCompMgr,
  in nsCIDRef aClass,
  in nsIIDRef aIID,
  [retval, iid_is(aIID)] out nsQIResult aResult
);
Parameters
aCompMgr
The global component manager.
aClass
The ClassID of object instance requested.
aIID
The IID of interface requested.
aResult
The resulting interface pointer.
Exceptions thrown
NS_ERROR_FACTORY_NOT_REGISTERED
Indicates that the requested class is not available.
NS_ERROR_NO_INTERFACE
Indicates that the requested interface is not supported.

registerSelf()

When the nsIModule is discovered, this method will be called so that any setup registration can be preformed.

void registerSelf(
  in nsIComponentManager aCompMgr,
  in nsIFile aLocation,
  in string aLoaderStr,
  in string aType
);
Parameters
aCompMgr
The global component manager.
aLocation
The location of the nsIModule on disk.
aLoaderStr
Opaque loader specific string.
aType
Loader Type being used to load this module.

unregisterSelf()

When the nsIModule is being unregistered, this method will be called so that any unregistration can be preformed.

void unregisterSelf(
  in nsIComponentManager aCompMgr,
  in nsIFile aLocation,
  in string aLoaderStr
);
Parameters
aCompMgr
The global component manager.
aLocation
The location of the nsIModule on disk.
aLoaderStr
Opaque loader specific string.

Remarks

This interface was finalized (frozen) for Gecko 0.9.9. See bug 99154 for details. From Gecko 2.0 interfaces are no longer frozen.