nsIModule 编辑

xpcom/components/nsIModule.idlScriptable 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:82 次

字数:5946

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文