Temporary XPConnectFactory (until the real one is available...). This will replace the AppCoresManager as the way to create C++ components in javascript...

git-svn-id: svn://10.0.0.236/trunk@24422 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpotts%netscape.com
1999-03-19 06:15:00 +00:00
parent 27308a8c83
commit e7cad4f98c
11 changed files with 719 additions and 8 deletions

View File

@@ -17,42 +17,57 @@
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsIFactory.h"
#include "nsRepository.h"
#include "nscore.h"
#include "nsIComponentManager.h"
#include "nsAppShellCIDs.h"
#include "nsICmdLineService.h"
/* extern the factory entry points... */
/* extern the factory entry points for each component... */
nsresult NS_NewAppShellServiceFactory(nsIFactory** aFactory);
nsresult NS_NewXPConnectFactoryFactory(nsIFactory** aResult);
#if 0
nsresult NS_NewDefaultProtocolHelperFactory(nsIFactory** aResult);
#endif
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
static NS_DEFINE_IID(kProtocolHelperCID, NS_PROTOCOL_HELPER_CID);
static NS_DEFINE_IID(kXPConnectFactoryCID, NS_XPCONNECTFACTORY_CID);
/*
* Global entry point to register all components in the registry...
*/
extern "C" NS_EXPORT nsresult
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
{
nsComponentManager::RegisterComponent(kAppShellServiceCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
nsComponentManager::RegisterComponent(kCmdLineServiceCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
nsComponentManager::RegisterComponent(kProtocolHelperCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
nsComponentManager::RegisterComponent(kXPConnectFactoryCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
return NS_OK;
}
/*
* Global entry point to unregister all components in the registry...
*/
extern "C" NS_EXPORT nsresult
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
{
nsComponentManager::UnregisterFactory(kAppShellServiceCID, path);
nsComponentManager::UnregisterFactory(kCmdLineServiceCID, path);
nsComponentManager::UnregisterFactory(kProtocolHelperCID, path);
nsComponentManager::UnregisterComponent(kXPConnectFactoryCID, path);
return NS_OK;
}
/*
* Global entry point to create class factories for the components
* available withing the DLL...
*/
#if defined(XP_MAC) && defined(MAC_STATIC)
extern "C" NS_APPSHELL nsresult
NSGetFactory_APPSHELL_DLL(nsISupports* serviceMgr,
@@ -81,13 +96,16 @@ NSGetFactory(nsISupports* serviceMgr,
else if (aClass.Equals(kCmdLineServiceCID)) {
rv = NS_NewCmdLineServiceFactory(aFactory);
}
else if (aClass.Equals(kXPConnectFactoryCID)) {
rv = NS_NewXPConnectFactoryFactory(aFactory);
}
#if 0
else if (aClass.Equals(kProtocolHelperCID)) {
rv = NS_NewDefaultProtocolHelperFactory(aFactory);
}
#endif
return rv;
}

View File

@@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsAppshellNameSet.h"
#include "nsIScriptContext.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsIDOMXPConnectFactory.h"
#include "nsAppShellCIDs.h"
static NS_DEFINE_IID(kIScriptExternalNameSetIID, NS_ISCRIPTEXTERNALNAMESET_IID);
static NS_DEFINE_IID(kXPConnectFactoryCID, NS_XPCONNECTFACTORY_CID);
nsAppShellNameSet::nsAppShellNameSet()
{
NS_INIT_REFCNT();
}
nsAppShellNameSet::~nsAppShellNameSet()
{
}
NS_IMPL_ISUPPORTS(nsAppShellNameSet, kIScriptExternalNameSetIID);
NS_IMETHODIMP
nsAppShellNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
{
nsresult rv;
rv = NS_InitXPConnectFactoryClass(aScriptContext, nsnull);
return rv;
}
NS_IMETHODIMP
nsAppShellNameSet::AddNameSet(nsIScriptContext* aScriptContext)
{
nsresult rv;
nsIScriptNameSpaceManager* manager;
rv = aScriptContext->GetNameSpaceManager(&manager);
if (NS_SUCCEEDED(rv)) {
rv = manager->RegisterGlobalName("XPComFactory",
kXPConnectFactoryCID,
PR_FALSE);
NS_RELEASE(manager);
}
return rv;
}

View File

@@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsAppShellNameSet_h___
#define nsAppShellNameSet_h___
#include "nsISupports.h"
#include "nsIScriptExternalNameSet.h"
class nsIScriptContext;
class nsAppShellNameSet : public nsIScriptExternalNameSet
{
public:
nsAppShellNameSet();
// nsISupports interface...
NS_DECL_ISUPPORTS
// nsIScriptExternalNameSet interface...
NS_IMETHOD InitializeClasses(nsIScriptContext* aScriptContext);
NS_IMETHOD AddNameSet(nsIScriptContext* aScriptContext);
protected:
virtual ~nsAppShellNameSet();
};
#endif // nsAppShellNameSet_h___

View File

@@ -32,6 +32,11 @@
#include "nsIWebShellWindow.h"
#include "nsWebShellWindow.h"
/* For Javascript Namespace Access */
#include "nsDOMCID.h"
#include "nsIScriptNameSetRegistry.h"
#include "nsAppShellNameset.h"
#include "nsWidgetsCID.h"
#include "nsIStreamObserver.h"
@@ -42,6 +47,7 @@
/* Define Class IDs */
static NS_DEFINE_IID(kAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
/* Define Interface IDs */
@@ -50,6 +56,7 @@ static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
static NS_DEFINE_IID(kIWebShellWindowIID, NS_IWEBSHELL_WINDOW_IID);
static NS_DEFINE_IID(kIScriptNameSetRegistryIID, NS_ISCRIPTNAMESETREGISTRY_IID);
@@ -120,15 +127,30 @@ nsAppShellService::Initialize(void)
FCInitialize();
#endif
// Create the Event Queue for the UI thread...
nsIEventQueueService* mEventQService;
nsIEventQueueService* eventQService;
rv = nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **)&mEventQService);
(nsISupports **)&eventQService);
if (NS_OK == rv) {
// XXX: What if this fails?
rv = mEventQService->CreateThreadEventQueue();
rv = eventQService->CreateThreadEventQueue();
}
// Register the nsAppShellNameSet with the global nameset registry...
nsIScriptNameSetRegistry *registry;
rv = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
kIScriptNameSetRegistryIID,
(nsISupports **)&registry);
if (NS_FAILED(rv)) {
goto done;
}
nsAppShellNameSet* nameSet;
nameSet = new nsAppShellNameSet();
registry->AddExternalNameSet(nameSet);
/* FIX - do we need to release this service? When we do, it get deleted,and our name is lost. */
// Create the toplevel window list...
rv = NS_NewISupportsArray(&mWindowList);
if (NS_FAILED(rv)) {
goto done;

View File

@@ -0,0 +1,304 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMXPConnectFactory.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXPConnectFactoryIID, NS_IDOMXPCONNECTFACTORY_IID);
NS_DEF_PTR(nsIDOMXPConnectFactory);
/***********************************************************************/
//
// XPConnectFactory Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXPConnectFactoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXPConnectFactory *a = (nsIDOMXPConnectFactory*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// XPConnectFactory Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXPConnectFactoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXPConnectFactory *a = (nsIDOMXPConnectFactory*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// XPConnectFactory finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXPConnectFactory(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XPConnectFactory enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXPConnectFactory(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XPConnectFactory resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXPConnectFactory(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
//
// Native method CreateInstance
//
PR_STATIC_CALLBACK(JSBool)
XPConnectFactoryCreateInstance(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXPConnectFactory *nativeThis = (nsIDOMXPConnectFactory*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsISupports* nativeRet;
nsAutoString b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (NS_OK != nativeThis->CreateInstance(b0, &nativeRet)) {
return JS_FALSE;
}
nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, rval);
}
else {
JS_ReportError(cx, "Function createInstance requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for XPConnectFactory
//
JSClass XPConnectFactoryClass = {
"XPConnectFactory",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetXPConnectFactoryProperty,
SetXPConnectFactoryProperty,
EnumerateXPConnectFactory,
ResolveXPConnectFactory,
JS_ConvertStub,
FinalizeXPConnectFactory
};
//
// XPConnectFactory class properties
//
static JSPropertySpec XPConnectFactoryProperties[] =
{
{0}
};
//
// XPConnectFactory class methods
//
static JSFunctionSpec XPConnectFactoryMethods[] =
{
{"createInstance", XPConnectFactoryCreateInstance, 1},
{0}
};
//
// XPConnectFactory constructor
//
PR_STATIC_CALLBACK(JSBool)
XPConnectFactory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XPConnectFactory class initialization
//
extern "C" NS_APPSHELL nsresult NS_InitXPConnectFactoryClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XPConnectFactory", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XPConnectFactoryClass, // JSClass
XPConnectFactory, // JSNative ctor
0, // ctor args
XPConnectFactoryProperties, // proto props
XPConnectFactoryMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XPConnectFactory JavaScript object
//
extern "C" NS_APPSHELL nsresult NS_NewScriptXPConnectFactory(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXPConnectFactory");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXPConnectFactory *aXPConnectFactory;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXPConnectFactoryClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXPConnectFactoryIID, (void **)&aXPConnectFactory);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XPConnectFactoryClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXPConnectFactory);
}
else {
NS_RELEASE(aXPConnectFactory);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@@ -0,0 +1,193 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsRepository.h"
#include "nsXPComFactory.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMXPConnectFactory.h"
// Declare IIDs...
static NS_DEFINE_IID(kIDOMXPConnectFactoryIID, NS_IDOMXPCONNECTFACTORY_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
class XPConnectFactoryImpl : public nsIDOMXPConnectFactory,
public nsIScriptObjectOwner
{
public:
XPConnectFactoryImpl();
NS_DECL_ISUPPORTS
// nsIXPConnectFactory interface...
NS_IMETHOD CreateInstance(const nsString &progID, nsISupports**_retval);
// nsIScriptObjectOwner interface...
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void *aScriptObject);
protected:
virtual ~XPConnectFactoryImpl();
private:
void *mScriptObject;
};
XPConnectFactoryImpl::XPConnectFactoryImpl()
{
NS_INIT_REFCNT();
mScriptObject = nsnull;
}
XPConnectFactoryImpl::~XPConnectFactoryImpl()
{
}
// -----
// Implementation of nsISupports interface methods...
// -----
NS_IMPL_ADDREF(XPConnectFactoryImpl)
NS_IMPL_RELEASE(XPConnectFactoryImpl)
NS_IMETHODIMP
XPConnectFactoryImpl::QueryInterface(REFNSIID aIID,void** aInstancePtr)
{
if (aInstancePtr == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kIDOMXPConnectFactoryIID) ) {
nsIDOMXPConnectFactory* tmp = this;
*aInstancePtr = tmp;
AddRef();
return NS_OK;
}
else if ( aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = tmp;
AddRef();
return NS_OK;
}
else if ( aIID.Equals(kISupportsIID) ) {
nsISupports* tmp = (nsIDOMXPConnectFactory*)this;
*aInstancePtr = tmp;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
// -----
// Implementation of nsIXPConnectFactory interface methods...
// -----
NS_IMETHODIMP
XPConnectFactoryImpl::CreateInstance(const nsString &progID, nsISupports**_retval)
{
nsresult rv;
nsCID cid;
char cidBuffer[48];
// Argument validation...
if (!_retval) {
rv = NS_ERROR_NULL_POINTER;
goto done;
}
// Convert the unicode string into a char*
progID.ToCString(cidBuffer, sizeof(cidBuffer));
// Parse the CID string...
//
// XXX: The progID should *not* be treated as a raw CID...
//
if (cid.Parse(cidBuffer)) {
rv = nsRepository::CreateInstance(cid, nsnull, kISupportsIID, (void**)_retval);
if (NS_SUCCEEDED(rv)) {
}
} else {
// the progID does not represent a valid IID...
rv = NS_ERROR_INVALID_ARG;
}
done:
return rv;
}
// -----
// Implementation of nsIScriptObjectOwner interface methods...
// -----
NS_IMETHODIMP
XPConnectFactoryImpl::GetScriptObject(nsIScriptContext *aContext, void **aScriptObject)
{
nsresult rv = NS_OK;
// Argument validation...
if (!aScriptObject) {
rv = NS_ERROR_NULL_POINTER;
} else {
if (!mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
rv = NS_NewScriptXPConnectFactory(aContext, (nsISupports *)(nsIDOMXPConnectFactory*)this, global, (void**)&mScriptObject);
NS_IF_RELEASE(global);
}
*aScriptObject = mScriptObject;
}
return rv;
}
NS_IMETHODIMP
XPConnectFactoryImpl::SetScriptObject(void *aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
// -----
// Entry point to create nsXPConnectFactory factory instances...
// -----
NS_DEF_FACTORY(XPConnectFactory, XPConnectFactoryImpl)
nsresult NS_NewXPConnectFactoryFactory(nsIFactory** aResult)
{
nsresult rv = NS_OK;
nsIFactory* inst = new nsXPConnectFactoryFactory();
if (nsnull == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
else {
NS_ADDREF(inst);
}
*aResult = inst;
return rv;
}