1999-02-25 07:41:02 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-02-25 07:41:02 +03:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-02-25 07:41:02 +03:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-02-25 07:41:02 +03:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:43:54 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-12-01 02:36:32 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-02-25 07:41:02 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
// DO NOT COPY THIS CODE INTO YOUR SOURCE! USE NS_IMPL_NSGETMODULE()
|
|
|
|
|
|
|
|
#include "nsGenericFactory.h"
|
|
|
|
#include "nsCRT.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIComponentManager.h"
|
|
|
|
|
2001-03-12 23:43:02 +03:00
|
|
|
nsGenericFactory::nsGenericFactory(nsModuleComponentInfo *info)
|
|
|
|
: mInfo(info)
|
1999-02-25 07:41:02 +03:00
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
if (mInfo && mInfo->mClassInfoGlobal)
|
|
|
|
*mInfo->mClassInfoGlobal = NS_STATIC_CAST(nsIClassInfo *, this);
|
1999-02-25 07:41:02 +03:00
|
|
|
}
|
|
|
|
|
1999-02-28 22:04:47 +03:00
|
|
|
nsGenericFactory::~nsGenericFactory()
|
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
if (mInfo) {
|
|
|
|
if (mInfo->mFactoryDestructor)
|
|
|
|
mInfo->mFactoryDestructor();
|
|
|
|
if (mInfo->mClassInfoGlobal)
|
|
|
|
*mInfo->mClassInfoGlobal = 0;
|
|
|
|
}
|
1999-02-28 22:04:47 +03:00
|
|
|
}
|
1999-02-25 07:41:02 +03:00
|
|
|
|
2001-03-12 23:43:02 +03:00
|
|
|
NS_IMPL_THREADSAFE_ISUPPORTS3(nsGenericFactory,
|
2000-03-06 00:26:01 +03:00
|
|
|
nsIGenericFactory,
|
2001-03-12 23:43:02 +03:00
|
|
|
nsIFactory,
|
|
|
|
nsIClassInfo)
|
1999-02-25 07:41:02 +03:00
|
|
|
|
2001-03-12 23:43:02 +03:00
|
|
|
NS_IMETHODIMP nsGenericFactory::CreateInstance(nsISupports *aOuter,
|
|
|
|
REFNSIID aIID, void **aResult)
|
1999-02-25 07:41:02 +03:00
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
return mInfo->mConstructor(aOuter, aIID, aResult);
|
1999-02-25 07:41:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsGenericFactory::LockFactory(PRBool aLock)
|
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
// XXX do we care if (mInfo->mFlags & THREADSAFE)?
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsGenericFactory::GetInterfaces(PRUint32 *countp,
|
|
|
|
nsIID* **array)
|
|
|
|
{
|
|
|
|
if (!mInfo->mGetInterfacesProc) {
|
|
|
|
*countp = 0;
|
|
|
|
*array = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return mInfo->mGetInterfacesProc(countp, array);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsGenericFactory::GetHelperForLanguage(PRUint32 language,
|
|
|
|
nsISupports **helper)
|
|
|
|
{
|
|
|
|
if (mInfo->mGetLanguageHelperProc)
|
|
|
|
return mInfo->mGetLanguageHelperProc(language, helper);
|
|
|
|
*helper = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsGenericFactory::GetContractID(char **aContractID)
|
|
|
|
{
|
|
|
|
if (mInfo->mContractID) {
|
|
|
|
*aContractID = (char *)nsMemory::Alloc(strlen(mInfo->mContractID) + 1);
|
|
|
|
if (!*aContractID)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
strcpy(*aContractID, mInfo->mContractID);
|
|
|
|
} else {
|
|
|
|
*aContractID = nsnull;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
NS_IMETHODIMP nsGenericFactory::GetClassDescription(char * *aClassDescription)
|
|
|
|
{
|
|
|
|
if (mInfo->mDescription) {
|
|
|
|
*aClassDescription = (char *)
|
|
|
|
nsMemory::Alloc(strlen(mInfo->mDescription) + 1);
|
|
|
|
if (!*aClassDescription)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
strcpy(*aClassDescription, mInfo->mDescription);
|
|
|
|
} else {
|
|
|
|
*aClassDescription = nsnull;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
NS_IMETHODIMP nsGenericFactory::GetClassID(nsCID *aClassID)
|
2001-03-12 23:43:02 +03:00
|
|
|
{
|
2001-07-31 23:05:34 +04:00
|
|
|
*aClassID = mInfo->mCID;
|
2001-03-12 23:43:02 +03:00
|
|
|
return NS_OK;
|
1999-02-25 07:41:02 +03:00
|
|
|
}
|
1999-02-26 07:08:26 +03:00
|
|
|
|
2001-03-12 23:43:02 +03:00
|
|
|
NS_IMETHODIMP nsGenericFactory::GetImplementationLanguage(PRUint32 *langp)
|
1999-02-26 07:08:26 +03:00
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
*langp = nsIProgrammingLanguage::CPLUSPLUS;
|
2001-03-12 23:43:02 +03:00
|
|
|
return NS_OK;
|
1999-02-26 07:08:26 +03:00
|
|
|
}
|
|
|
|
|
2001-03-12 23:43:02 +03:00
|
|
|
NS_IMETHODIMP nsGenericFactory::GetFlags(PRUint32 *flagsp)
|
1999-02-28 22:04:47 +03:00
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
*flagsp = mInfo->mFlags;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIGenericFactory: component-info accessors
|
|
|
|
NS_IMETHODIMP nsGenericFactory::SetComponentInfo(nsModuleComponentInfo *info)
|
|
|
|
{
|
|
|
|
if (mInfo && mInfo->mClassInfoGlobal)
|
|
|
|
*mInfo->mClassInfoGlobal = 0;
|
|
|
|
mInfo = info;
|
|
|
|
if (mInfo && mInfo->mClassInfoGlobal)
|
|
|
|
*mInfo->mClassInfoGlobal = NS_STATIC_CAST(nsIClassInfo *, this);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsGenericFactory::GetComponentInfo(nsModuleComponentInfo **infop)
|
|
|
|
{
|
|
|
|
*infop = mInfo;
|
|
|
|
return NS_OK;
|
1999-02-28 22:04:47 +03:00
|
|
|
}
|
|
|
|
|
1999-02-26 07:08:26 +03:00
|
|
|
NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
// sorry, aggregation not spoken here.
|
|
|
|
nsresult res = NS_ERROR_NO_AGGREGATION;
|
|
|
|
if (outer == NULL) {
|
|
|
|
nsGenericFactory* factory = new nsGenericFactory;
|
|
|
|
if (factory != NULL) {
|
|
|
|
res = factory->QueryInterface(aIID, aInstancePtr);
|
|
|
|
if (res != NS_OK)
|
|
|
|
delete factory;
|
|
|
|
} else {
|
|
|
|
res = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
1999-02-26 07:08:26 +03:00
|
|
|
}
|
1999-05-26 05:38:36 +04:00
|
|
|
|
1999-06-04 01:51:14 +04:00
|
|
|
NS_COM nsresult
|
1999-05-26 05:38:36 +04:00
|
|
|
NS_NewGenericFactory(nsIGenericFactory* *result,
|
2001-03-12 23:43:02 +03:00
|
|
|
nsModuleComponentInfo *info)
|
1999-05-26 05:38:36 +04:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsIGenericFactory* fact;
|
1999-12-01 02:36:32 +03:00
|
|
|
rv = nsGenericFactory::Create(NULL, NS_GET_IID(nsIGenericFactory), (void**)&fact);
|
1999-05-26 05:38:36 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-03-12 23:43:02 +03:00
|
|
|
rv = fact->SetComponentInfo(info);
|
1999-05-26 05:38:36 +04:00
|
|
|
if (NS_FAILED(rv)) goto error;
|
|
|
|
*result = fact;
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
error:
|
|
|
|
NS_RELEASE(fact);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-12 12:07:26 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount,
|
2000-01-07 05:18:13 +03:00
|
|
|
nsModuleComponentInfo* components,
|
|
|
|
nsModuleDestructorProc dtor)
|
1999-11-12 12:07:26 +03:00
|
|
|
: mInitialized(PR_FALSE),
|
|
|
|
mModuleName(moduleName),
|
|
|
|
mComponentCount(componentCount),
|
|
|
|
mComponents(components),
|
2000-03-22 05:43:48 +03:00
|
|
|
mFactories(32, PR_FALSE),
|
2000-01-07 05:18:13 +03:00
|
|
|
mDtor(dtor)
|
1999-11-12 12:07:26 +03:00
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGenericModule::~nsGenericModule()
|
|
|
|
{
|
|
|
|
Shutdown();
|
|
|
|
}
|
|
|
|
|
2000-03-06 00:26:01 +03:00
|
|
|
NS_IMPL_THREADSAFE_ISUPPORTS1(nsGenericModule, nsIModule)
|
1999-11-12 12:07:26 +03:00
|
|
|
|
|
|
|
// Perform our one-time intialization for this module
|
|
|
|
nsresult
|
|
|
|
nsGenericModule::Initialize()
|
|
|
|
{
|
|
|
|
if (mInitialized) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
mInitialized = PR_TRUE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown this module, releasing all of the module resources
|
|
|
|
void
|
|
|
|
nsGenericModule::Shutdown()
|
|
|
|
{
|
2000-01-07 05:18:13 +03:00
|
|
|
if (mDtor)
|
|
|
|
mDtor(this);
|
1999-11-12 12:07:26 +03:00
|
|
|
// Release the factory objects
|
|
|
|
mFactories.Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a factory object for creating instances of aClass.
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGenericModule::GetClassObject(nsIComponentManager *aCompMgr,
|
|
|
|
const nsCID& aClass,
|
|
|
|
const nsIID& aIID,
|
|
|
|
void** r_classObj)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Defensive programming: Initialize *r_classObj in case of error below
|
|
|
|
if (!r_classObj) {
|
|
|
|
return NS_ERROR_INVALID_POINTER;
|
|
|
|
}
|
|
|
|
*r_classObj = NULL;
|
|
|
|
|
|
|
|
// Do one-time-only initialization if necessary
|
|
|
|
if (!mInitialized) {
|
|
|
|
rv = Initialize();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
// Initialization failed! yikes!
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Choose the appropriate factory, based on the desired instance
|
|
|
|
// class type (aClass).
|
|
|
|
nsIDKey key(aClass);
|
1999-11-20 10:21:53 +03:00
|
|
|
nsCOMPtr<nsIGenericFactory> fact = getter_AddRefs(NS_REINTERPRET_CAST(nsIGenericFactory *, mFactories.Get(&key)));
|
1999-11-12 12:07:26 +03:00
|
|
|
if (fact == nsnull) {
|
|
|
|
nsModuleComponentInfo* desc = mComponents;
|
|
|
|
for (PRUint32 i = 0; i < mComponentCount; i++) {
|
|
|
|
if (desc->mCID.Equals(aClass)) {
|
2001-03-12 23:43:02 +03:00
|
|
|
rv = NS_NewGenericFactory(getter_AddRefs(fact), desc);
|
1999-11-12 12:07:26 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
(void)mFactories.Put(&key, fact);
|
|
|
|
goto found;
|
|
|
|
}
|
|
|
|
desc++;
|
|
|
|
}
|
|
|
|
// not found in descriptions
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
1999-11-12 12:07:26 +03:00
|
|
|
char* cs = aClass.ToString();
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs);
|
1999-11-12 12:07:26 +03:00
|
|
|
nsCRT::free(cs);
|
|
|
|
#endif
|
|
|
|
// XXX put in stop-gap so that we don't search for this one again
|
2001-03-12 23:43:02 +03:00
|
|
|
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
1999-11-12 12:07:26 +03:00
|
|
|
}
|
|
|
|
found:
|
|
|
|
rv = fact->QueryInterface(aIID, r_classObj);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
2000-01-25 00:28:28 +03:00
|
|
|
nsIFile* aPath,
|
1999-11-12 12:07:26 +03:00
|
|
|
const char* registryLocation,
|
|
|
|
const char* componentType)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Registering %s components (all right -- a generic module!)\n", mModuleName);
|
|
|
|
#endif
|
1999-11-12 12:07:26 +03:00
|
|
|
|
|
|
|
nsModuleComponentInfo* cp = mComponents;
|
1999-11-12 12:10:40 +03:00
|
|
|
for (PRUint32 i = 0; i < mComponentCount; i++) {
|
2001-06-21 00:21:49 +04:00
|
|
|
rv = aCompMgr->RegisterComponentWithType(cp->mCID, cp->mDescription,
|
|
|
|
cp->mContractID, aPath,
|
|
|
|
registryLocation, PR_TRUE,
|
|
|
|
PR_TRUE, componentType);
|
1999-11-12 12:07:26 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsGenericModule %s: unable to register %s component => %x\n",
|
1999-12-15 09:23:50 +03:00
|
|
|
mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv);
|
2000-10-29 02:17:53 +04:00
|
|
|
#endif
|
1999-11-12 12:07:26 +03:00
|
|
|
break;
|
|
|
|
}
|
2000-01-12 00:18:55 +03:00
|
|
|
// Call the registration hook of the component, if any
|
|
|
|
if (cp->mRegisterSelfProc)
|
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
rv = cp->mRegisterSelfProc(aCompMgr, aPath, registryLocation,
|
|
|
|
componentType, cp);
|
2000-01-12 00:18:55 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsGenericModule %s: Register hook for %s component returned error => %x\n",
|
2000-01-12 00:18:55 +03:00
|
|
|
mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv);
|
2000-10-29 02:17:53 +04:00
|
|
|
#endif
|
2000-01-12 00:18:55 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-11-12 12:07:26 +03:00
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
2000-01-25 00:28:28 +03:00
|
|
|
nsIFile* aPath,
|
1999-11-12 12:07:26 +03:00
|
|
|
const char* registryLocation)
|
|
|
|
{
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Unregistering %s components (all right -- a generic module!)\n", mModuleName);
|
|
|
|
#endif
|
1999-11-12 12:07:26 +03:00
|
|
|
nsModuleComponentInfo* cp = mComponents;
|
1999-11-12 12:10:40 +03:00
|
|
|
for (PRUint32 i = 0; i < mComponentCount; i++) {
|
2000-01-12 00:18:55 +03:00
|
|
|
// Call the unregistration hook of the component, if any
|
|
|
|
if (cp->mUnregisterSelfProc)
|
|
|
|
{
|
2001-03-12 23:43:02 +03:00
|
|
|
cp->mUnregisterSelfProc(aCompMgr, aPath, registryLocation, cp);
|
2000-01-12 00:18:55 +03:00
|
|
|
}
|
|
|
|
// Unregister the component
|
1999-11-12 12:07:26 +03:00
|
|
|
nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath);
|
|
|
|
if (NS_FAILED(rv)) {
|
2000-10-29 02:17:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsGenericModule %s: unable to unregister %s component => %x\n",
|
1999-11-12 12:07:26 +03:00
|
|
|
mModuleName, cp->mDescription, rv);
|
2000-10-29 02:17:53 +04:00
|
|
|
#endif
|
1999-11-12 12:07:26 +03:00
|
|
|
}
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGenericModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|
|
|
{
|
|
|
|
if (!okToUnload) {
|
|
|
|
return NS_ERROR_INVALID_POINTER;
|
|
|
|
}
|
|
|
|
*okToUnload = PR_FALSE;
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_COM nsresult
|
|
|
|
NS_NewGenericModule(const char* moduleName,
|
|
|
|
PRUint32 componentCount,
|
|
|
|
nsModuleComponentInfo* components,
|
2000-01-07 05:18:13 +03:00
|
|
|
nsModuleDestructorProc dtor,
|
1999-11-12 12:07:26 +03:00
|
|
|
nsIModule* *result)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
NS_ASSERTION(result, "Null argument");
|
|
|
|
|
|
|
|
// Create and initialize the module instance
|
|
|
|
nsGenericModule *m =
|
2000-01-07 05:18:13 +03:00
|
|
|
new nsGenericModule(moduleName, componentCount, components, dtor);
|
1999-11-12 12:07:26 +03:00
|
|
|
if (!m) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increase refcnt and store away nsIModule interface to m in return_cobj
|
|
|
|
rv = m->QueryInterface(NS_GET_IID(nsIModule), (void**)result);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete m;
|
|
|
|
m = nsnull;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|