void xpc_DestroyJSxIDClassObjects() { NS_IF_RELEASE(NS_CLASSINFO_NAME(nsJSIID)); NS_IF_RELEASE(NS_CLASSINFO_NAME(nsJSCID)); NS_IF_RELEASE(gSharedScriptableHelperForJSIID); gClassObjectsWereInited = JS_FALSE; }
JSBool xpc_InitJSxIDClassObjects() { if(gClassObjectsWereInited) return JS_TRUE; nsresult rv = NS_OK; if(!NS_CLASSINFO_NAME(nsJSIID)) { nsCOMPtr<nsIGenericFactory> factory; rv = NS_NewGenericFactory(getter_AddRefs(factory), &CI_nsJSIID); if(NS_FAILED(rv)) goto return_failure; rv = factory->QueryInterface(NS_GET_IID(nsIClassInfo), (void**)&NS_CLASSINFO_NAME(nsJSIID)); if(NS_FAILED(rv)) goto return_failure; } if(!NS_CLASSINFO_NAME(nsJSCID)) { nsCOMPtr<nsIGenericFactory> factory; rv = NS_NewGenericFactory(getter_AddRefs(factory), &CI_nsJSCID); if(NS_FAILED(rv)) goto return_failure; rv = factory->QueryInterface(NS_GET_IID(nsIClassInfo), (void**)&NS_CLASSINFO_NAME(nsJSCID)); if(NS_FAILED(rv)) goto return_failure; } gSharedScriptableHelperForJSIID = new SharedScriptableHelperForJSIID(); if(!gSharedScriptableHelperForJSIID) goto return_failure; NS_ADDREF(gSharedScriptableHelperForJSIID); gClassObjectsWereInited = JS_TRUE; return JS_TRUE; return_failure: return JS_FALSE; }
#ifdef XPC_IDISPATCH_SUPPORT NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDispatchSupport, nsDispatchSupport::GetSingleton) #endif NS_DECL_CLASSINFO(nsXPCException) #ifdef XPCONNECT_STANDALONE #define NO_SUBSCRIPT_LOADER #endif static const nsModuleComponentInfo components[] = { {nsnull, NS_JS_ID_CID, XPC_ID_CONTRACTID, nsJSIDConstructor }, {nsnull, NS_XPCONNECT_CID, XPC_XPCONNECT_CONTRACTID, nsIXPConnectConstructor }, {nsnull, NS_XPC_THREAD_JSCONTEXT_STACK_CID, XPC_CONTEXT_STACK_CONTRACTID, nsIJSContextStackConstructor }, {nsnull, NS_XPCEXCEPTION_CID, XPC_EXCEPTION_CONTRACTID, nsXPCExceptionConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsXPCException), nsnull, &NS_CLASSINFO_NAME(nsXPCException), nsIClassInfo::DOM_OBJECT }, {nsnull, NS_JS_RUNTIME_SERVICE_CID, XPC_RUNTIME_CONTRACTID, nsIJSRuntimeServiceConstructor}, {NS_SCRIPTERROR_CLASSNAME, NS_SCRIPTERROR_CID, NS_SCRIPTERROR_CONTRACTID, nsScriptErrorConstructor }, {nsnull, SCRIPTABLE_INTERFACES_CID, NS_SCRIPTABLE_INTERFACES_CONTRACTID, nsXPCComponents_InterfacesConstructor, 0, 0, 0, 0, 0, 0, nsIClassInfo::THREADSAFE }, {nsnull, XPCVARIANT_CID, XPCVARIANT_CONTRACTID, nsnull, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(XPCVariant), nsnull, &NS_CLASSINFO_NAME(XPCVariant)}, {nsnull, NS_XPC_JSCONTEXT_STACK_ITERATOR_CID, XPC_JSCONTEXT_STACK_ITERATOR_CONTRACTID, nsXPCJSContextStackIteratorConstructor } #ifdef MOZ_JSLOADER // jsloader stuff ,{ "JS component loader", MOZJSCOMPONENTLOADER_CID, MOZJSCOMPONENTLOADER_CONTRACTID, mozJSComponentLoaderConstructor, RegisterJSLoader, UnregisterJSLoader } #ifndef NO_SUBSCRIPT_LOADER ,{ "JS subscript loader", MOZ_JSSUBSCRIPTLOADER_CID, mozJSSubScriptLoadContractID, mozJSSubScriptLoaderConstructor } #endif
<< Debug::flush; return NS_OK; } static nsModuleComponentInfo components[] = { { OOPHM_CLASSNAME, OOPHM_CID, OOPHM_CONTRACTID, ExternalWrapperConstructor, registerSelf, unregisterSelf, /* unregister self */ factoryDestructor, /* factory destructor */ NS_CI_INTERFACE_GETTER_NAME(ExternalWrapper), /* get interfaces */ nsnull, /* language helper */ &NS_CLASSINFO_NAME(ExternalWrapper), /* global class-info pointer */ 0 /* class flags */ } }; // From Gears base/firefox/module.cc static nsModuleInfo const kModuleInfo = { NS_MODULEINFO_VERSION, ("ExternalWrapperModule"), (components), (sizeof(components) / sizeof(components[0])), (nsnull), (nsnull) }; NSGETMODULE_ENTRY_POINT(ExternalWrapperModule) (nsIComponentManager *servMgr,
/** * Component definition table. * Lists all components defined in this module. */ static const nsModuleComponentInfo components[] = { { "Session component", // description NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID SessionConstructor, // constructor function NULL, // registration function NULL, // deregistration function NULL, // destructor function NS_CI_INTERFACE_GETTER_NAME(SessionWrap), // interfaces function NULL, // language helper &NS_CLASSINFO_NAME(SessionWrap) // global class info & flags }, { "VirtualBoxClient component", // description NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID VirtualBoxClientConstructor, // constructor function NULL, // registration function NULL, // deregistration function VirtualBoxClientClassFactory::FactoryDestructor, // destructor function NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClientWrap), // interfaces function NULL, // language helper &NS_CLASSINFO_NAME(VirtualBoxClientWrap) // global class info & flags }, }; NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
rv = ChannelFromResource(resource, notificationCallbacks, getter_AddRefs(channel), getter_AddRefs(resourceURI)); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsIStreamListener> streamListener = NS_WD_NewReportStreamListener(resource, listener, closure); if (!streamListener) return NS_ERROR_OUT_OF_MEMORY; return SendDocumentToChannel(queryDoc, channel, "REPORT", streamListener, withDepth); } NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebDAVService) NS_DECL_CLASSINFO(nsWebDAVService) static const nsModuleComponentInfo components[] = { { "WebDAV Service", NS_WEBDAVSERVICE_CID, NS_WEBDAVSERVICE_CONTRACTID, nsWebDAVServiceConstructor, NULL, NULL, NULL, NS_CI_INTERFACE_GETTER_NAME(nsWebDAVService), NULL, &NS_CLASSINFO_NAME(nsWebDAVService) } }; NS_IMPL_NSGETMODULE(nsWebDAVService, components)
modulePath.get(), moduleTarget.get(), aLoaderStr, aType)); nsresult rc = NS_OK; return rc; } #endif /** * Component definition table. * Lists all components defined in this module. */ static const nsModuleComponentInfo components[] = { { "VirtualBox component", // description NS_VIRTUALBOX_CID, NS_VIRTUALBOX_CONTRACTID, // CID/ContractID VirtualBoxConstructor, // constructor function NULL, /* VirtualBoxRegistration, */ // registration function NULL, // deregistration function NULL, // destructor function /// @todo NS_CI_INTERFACE_GETTER_NAME(VirtualBoxWrap), // interfaces function NULL, // language helper /// @todo &NS_CLASSINFO_NAME(VirtualBoxWrap) // global class info & flags } }; NS_IMPL_NSGETMODULE(VirtualBox_Server_Module, components)
nsnull, nsIClassInfo::MAIN_THREAD_ONLY }, { NS_PRINCIPAL_CLASSNAME, NS_PRINCIPAL_CID, NS_PRINCIPAL_CONTRACTID, nsPrincipalConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsPrincipal), nsnull, &NS_CLASSINFO_NAME(nsPrincipal), nsIClassInfo::MAIN_THREAD_ONLY | nsIClassInfo::EAGER_CLASSINFO }, { NS_SYSTEMPRINCIPAL_CLASSNAME, NS_SYSTEMPRINCIPAL_CID, NS_SYSTEMPRINCIPAL_CONTRACTID, nsSystemPrincipalConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsSystemPrincipal), nsnull, &NS_CLASSINFO_NAME(nsSystemPrincipal), nsIClassInfo::SINGLETON | nsIClassInfo::MAIN_THREAD_ONLY | nsIClassInfo::EAGER_CLASSINFO
/******************************************************/ static JSBool gClassObjectsWereInited = JS_FALSE; NS_DECL_CI_INTERFACE_GETTER(nsJSIID) // Can't make this static. http://bugzilla.mozilla.org/show_bug.cgi?id=81436 nsIClassInfo* NS_CLASSINFO_NAME(nsJSIID); static const nsModuleComponentInfo CI_nsJSIID = {"JSIID", {0x26ecb8d0, 0x35c9, 0x11d5, { 0x90, 0xb2, 0x0, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}, nsnull, nsnull, nsnull,nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsJSIID), GetSharedScriptableHelperForJSIID, &NS_CLASSINFO_NAME(nsJSIID), nsIClassInfo::THREADSAFE}; NS_DECL_CI_INTERFACE_GETTER(nsJSCID) // Can't make this static. http://bugzilla.mozilla.org/show_bug.cgi?id=81436 nsIClassInfo* NS_CLASSINFO_NAME(nsJSCID); static const nsModuleComponentInfo CI_nsJSCID = {"JSCID", {0x9255b5b0, 0x35cf, 0x11d5, { 0x90, 0xb2, 0x0, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}, nsnull, nsnull, nsnull,nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsJSCID), nsnull, &NS_CLASSINFO_NAME(nsJSCID), nsIClassInfo::THREADSAFE}; JSBool xpc_InitJSxIDClassObjects() { if(gClassObjectsWereInited)
NS_DECL_CLASSINFO(xpcTestCallJS) NS_DECL_CLASSINFO(xpcTestChild2) static const nsModuleComponentInfo components[] = { {nsnull, NS_ECHO_CID, "@mozilla.org/js/xpc/test/Echo;1", xpctest::ConstructEcho }, {nsnull, NS_CHILD_CID, "@mozilla.org/js/xpc/test/Child;1", xpctest::ConstructChild }, {nsnull, NS_NOISY_CID, "@mozilla.org/js/xpc/test/Noisy;1", xpctest::ConstructNoisy }, {nsnull, NS_STRING_TEST_CID, "@mozilla.org/js/xpc/test/StringTest;1", xpctest::ConstructStringTest }, {nsnull, NS_OVERLOADED_CID, "@mozilla.org/js/xpc/test/Overloaded;1", xpctest::ConstructOverloaded }, {nsnull, NS_XPCTESTOBJECTREADONLY_CID, "@mozilla.org/js/xpc/test/ObjectReadOnly;1", xpctest::ConstructXPCTestObjectReadOnly }, {nsnull, NS_XPCTESTOBJECTREADWRITE_CID, "@mozilla.org/js/xpc/test/ObjectReadWrite;1", xpctest::ConstructXPCTestObjectReadWrite}, {nsnull, NS_XPCTESTIN_CID, "@mozilla.org/js/xpc/test/In;1", xpctest::ConstructXPCTestIn }, {nsnull, NS_XPCTESTOUT_CID, "@mozilla.org/js/xpc/test/Out;1", xpctest::ConstructXPCTestOut }, {nsnull, NS_XPCTESTINOUT_CID, "@mozilla.org/js/xpc/test/InOut;1", xpctest::ConstructXPCTestInOut }, {nsnull, NS_XPCTESTCONST_CID, "@mozilla.org/js/xpc/test/Const;1", xpctest::ConstructXPCTestConst }, {nsnull, NS_XPCTESTCALLJS_CID, "@mozilla.org/js/xpc/test/CallJS;1", xpctest::ConstructXPCTestCallJS, NULL, NULL, NULL, NS_CI_INTERFACE_GETTER_NAME(xpcTestCallJS), NULL, &NS_CLASSINFO_NAME(xpcTestCallJS) }, {nsnull, NS_XPCTESTPARENTONE_CID, "@mozilla.org/js/xpc/test/ParentOne;1", xpctest::ConstructXPCTestParentOne }, {nsnull, NS_XPCTESTPARENTTWO_CID, "@mozilla.org/js/xpc/test/ParentTwo;1", xpctest::ConstructXPCTestParentTwo }, {nsnull, NS_XPCTESTCHILD2_CID, "@mozilla.org/js/xpc/test/Child2;1", xpctest::ConstructXPCTestChild2, NULL, NULL, NULL, NS_CI_INTERFACE_GETTER_NAME(xpcTestChild2), NULL, &NS_CLASSINFO_NAME(xpcTestChild2) }, {nsnull, NS_XPCTESTCHILD3_CID, "@mozilla.org/js/xpc/test/Child3;1", xpctest::ConstructXPCTestChild3 }, {nsnull, NS_XPCTESTCHILD4_CID, "@mozilla.org/js/xpc/test/Child4;1", xpctest::ConstructXPCTestChild4 }, {nsnull, NS_XPCTESTCHILD5_CID, "@mozilla.org/js/xpc/test/Child5;1", xpctest::ConstructXPCTestChild5 }, {nsnull, NS_ARRAY_CID, "@mozilla.org/js/xpc/test/ArrayTest;1", xpctest::ConstructArrayTest }, {nsnull, NS_XPCTESTDOMSTRING_CID, "@mozilla.org/js/xpc/test/DOMString;1", xpctest::ConstructXPCTestDOMString }, {nsnull, NS_XPCTESTVARIANT_CID, "@mozilla.org/js/xpc/test/TestVariant;1", xpctest::ConstructXPCTestVariant } }; NS_IMPL_NSGETMODULE(xpconnect_test, components)
// Module component information. static nsModuleComponentInfo sbIPDComponents[] = { // Marshall component info. { SB_IPDMARSHALL_CLASSNAME, SB_IPDMARSHALL_CID, SB_IPDMARSHALL_CONTRACTID, sbIPDMarshallConstructor, sbIPDMarshallRegisterSelf, sbIPDMarshallUnregisterSelf, nsnull, NS_CI_INTERFACE_GETTER_NAME(sbIPDMarshall), nsnull, &NS_CLASSINFO_NAME(sbIPDMarshall) }, // Controller component info. { SB_IPDCONTROLLER_CLASSNAME, SB_IPDCONTROLLER_CID, SB_IPDCONTROLLER_CONTRACTID, sbIPDControllerConstructor, sbIPDControllerRegisterSelf, sbIPDControllerUnregisterSelf, nsnull, NS_CI_INTERFACE_GETTER_NAME(sbIPDController), nsnull, &NS_CLASSINFO_NAME(sbIPDController) }
// Create the generic factory NS_GENERIC_FACTORY_CONSTRUCTOR(TestErlXPCOMComponent); // List of components in this module static const nsModuleComponentInfo components[] = { { "TestErlXPCOMComponent: ErlXPCOM test component", ITESTERLXPCOMCOMPONENT_IID, "@lfcia.org/TestErlXPCOMComponent", TestErlXPCOMComponentConstructor, NULL, // registrationProc NULL, // unregistrationProc NULL, // factory destructor NS_CI_INTERFACE_GETTER_NAME(TestErlXPCOMComponent), NULL, // language helper &NS_CLASSINFO_NAME(TestErlXPCOMComponent), nsIClassInfo::THREADSAFE } }; nsresult TestModuleConstructor(nsIModule *self) { return NS_OK; } NS_IMPL_NSGETMODULE_WITH_CTOR(TestErlXPCOMComponentModule, components, TestModuleConstructor) /***************************************************************************/
{ NS_BUFFEREDOUTPUTSTREAM_CLASSNAME, NS_BUFFEREDOUTPUTSTREAM_CID, NS_BUFFEREDOUTPUTSTREAM_CONTRACTID, nsBufferedOutputStream::Create }, { NS_MIMEINPUTSTREAM_CLASSNAME, NS_MIMEINPUTSTREAM_CID, NS_MIMEINPUTSTREAM_CONTRACTID, nsMIMEInputStreamConstructor }, { NS_PROTOCOLPROXYSERVICE_CLASSNAME, NS_PROTOCOLPROXYSERVICE_CID, NS_PROTOCOLPROXYSERVICE_CONTRACTID, nsProtocolProxyServiceConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsProtocolProxyService), nsnull, &NS_CLASSINFO_NAME(nsProtocolProxyService), nsIClassInfo::SINGLETON }, // from netwerk/streamconv: // this converter is "always" built. // HACK-ALERT, register *all* converters // in this converter's component manager // registration. just piggy backing here until // you can add registration functions to // the generic module macro. { "Stream Converter Service", NS_STREAMCONVERTERSERVICE_CID, NS_STREAMCONVERTERSERVICE_CONTRACTID, CreateNewStreamConvServiceFactory, RegisterStreamConverters, // registers *all* converters
APT_CONSOLELISTENER_CID, APT_CONSOLELISTENER_CONTRACTID, aptConsoleListenerConstructor }, #endif { "aptCoreLog", APT_CORELOG_CID, APT_CORELOG_CONTRACTID, aptCoreLogConstructor, nsnull, nsnull, nsnull, /* no factory destructor */ NS_CI_INTERFACE_GETTER_NAME(aptCoreLog), /* interface getter */ nsnull /* no language helper */, &NS_CLASSINFO_NAME(aptCoreLog), nsIClassInfo::SINGLETON }, { "aptEventTypeManager", APT_EVENTTYPEMANAGER_CID, APT_EVENTTYPEMANAGER_CONTRACTID, aptEventTypeManagerConstructor }, { "FCGXStream", FCGXSTREAM_CID, FCGXSTREAM_CONTRACTID, FCGXStreamConstructor }, {
return rv; } static const nsModuleComponentInfo components[] = { { "Compzilla Window Manager Service", COMPZILLA_CONTROL_CID, COMPZILLA_CONTROL_CONTRACTID, compzillaControlConstructor, registerGlobalConstructors, NULL, // mFactoryDestrucrtor NULL, // mGetInterfacesProcPtr NS_CI_INTERFACE_GETTER_NAME(compzillaControl), NULL, // mGetLanguageHelperProc &NS_CLASSINFO_NAME(compzillaControl), nsIClassInfo::SINGLETON }, { "Compzilla Canvas Rendering Context", COMPZILLA_RENDERING_CONTEXT_CID, COMPZILLA_RENDERING_CONTEXT_CONTRACTID, compzillaRenderingContextConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(compzillaRenderingContext), nsnull, &NS_CLASSINFO_NAME(compzillaRenderingContext), nsIClassInfo::DOM_OBJECT }, { "Compzilla Extension",
NS_DECL_CLASSINFO(moab::Core) MB_EXPORT const char* MoabVersion(); MB_EXPORT void GetInterface(MBuuid& interface_requested, UnknownInterface** iface); MB_EXPORT void DeInitialize(); MB_EXPORT void ReleaseInterface(UnknownInterface* iface); static const nsModuleComponentInfo components[] = { { "MOAB Interface", CORE_CID, CORE_CONTRACTID, CoreConstructor, NULL /* NULL if you dont need one */, NULL /* NULL if you dont need one */, NULL /* no factory destructor */, NS_CI_INTERFACE_GETTER_NAME(moab::Core), NULL /* no language helper */, &NS_CLASSINFO_NAME(moab::Core), 0 } }; // implement NSGetModule() NS_IMPL_NSGETMODULE(moab::Core, components); #endif #ifndef _WIN32 #define MB_EXPORT extern "C" #else #define MB_EXPORT extern "C" __declspec(dllexport) #endif