diff --git a/xpcom/base/nsError.h b/xpcom/base/nsError.h index 0f1c791d1e5..e430b264951 100644 --- a/xpcom/base/nsError.h +++ b/xpcom/base/nsError.h @@ -176,6 +176,20 @@ typedef PRUint32 nsresult; /* Returned when a factory already is registered */ #define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100) + +/* Returned when a proxy could not be create a proxy for one of the IN parameters + This is returned only when the "real" meathod has NOT been invoked. +*/ + +#define NS_ERROR_PROXY_INVALID_IN_PARAMETER ((nsresult) 0x80010010L) + +/* Returned when a proxy could not be create a proxy for one of the OUT parameters + This is returned only when the "real" meathod has ALREADY been invoked. +*/ + +#define NS_ERROR_PROXY_INVALID_OUT_PARAMETER ((nsresult) 0x80010011L) + + /*@}*/ //////////////////////////////////////////////////////////////////////////////// diff --git a/xpcom/proxy/public/nsProxyEvent.h b/xpcom/proxy/public/nsProxyEvent.h index 75f1ae5fcf2..72668f0dbf9 100644 --- a/xpcom/proxy/public/nsProxyEvent.h +++ b/xpcom/proxy/public/nsProxyEvent.h @@ -95,7 +95,7 @@ class nsProxyObject : public nsISupports } AutoProxyConvertTypes; - void AutoProxyParameterList(nsXPTMethodInfo *methodInfo, nsXPTCMiniVariant * params, + nsresult AutoProxyParameterList(nsXPTMethodInfo *methodInfo, nsXPTCMiniVariant * params, nsIInterfaceInfo *interfaceInfo, AutoProxyConvertTypes convertType); nsIEventQueue *mDestQueue; /* destination queue */ diff --git a/xpcom/proxy/src/nsProxyEvent.cpp b/xpcom/proxy/src/nsProxyEvent.cpp index 991f4186cc2..07518664c19 100644 --- a/xpcom/proxy/src/nsProxyEvent.cpp +++ b/xpcom/proxy/src/nsProxyEvent.cpp @@ -144,9 +144,11 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi /////////////////////////////////////////////////////////////////////// // Auto-proxification /////////////////////////////////////////////////////////////////////// - AutoProxyParameterList(methodInfo, params, interfaceInfo, convertInParameters); + nsresult rv = AutoProxyParameterList(methodInfo, params, interfaceInfo, convertInParameters); /////////////////////////////////////////////////////////////////////// - + + if (NS_FAILED(rv)) + return rv; // convert the nsXPTCMiniVariant to a nsXPTCVariant @@ -187,13 +189,13 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi { mDestQueue->PostSynchronousEvent(event, nsnull); - nsresult rv = proxyInfo->GetResult(); + rv = proxyInfo->GetResult(); delete proxyInfo; /////////////////////////////////////////////////////////////////////// // Auto-proxification /////////////////////////////////////////////////////////////////////// - AutoProxyParameterList(methodInfo, params, interfaceInfo, convertOutParameters); + rv = AutoProxyParameterList(methodInfo, params, interfaceInfo, convertOutParameters); /////////////////////////////////////////////////////////////////////// mDestQueue->ExitMonitor(); @@ -212,7 +214,7 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi } -void +nsresult nsProxyObject::AutoProxyParameterList(nsXPTMethodInfo *methodInfo, nsXPTCMiniVariant * params, nsIInterfaceInfo *interfaceInfo, AutoProxyConvertTypes convertType) { @@ -262,20 +264,27 @@ nsProxyObject::AutoProxyParameterList(nsXPTMethodInfo *methodInfo, nsXPTCMiniVar interfaceInfo->GetIIDForParam(¶mInfo, &iid); - manager->GetProxyObject( GetQueue(), - *iid, - anInterface, - GetProxyType(), - (void**) &aProxyObject); + rv = manager->GetProxyObject(GetQueue(), + *iid, + anInterface, + GetProxyType(), + (void**) &aProxyObject); nsAllocator::Free((void*)iid); - + NS_RELEASE(manager); + + if (NS_FAILED(rv)) + return rv; + if (paramInfo.IsOut()) *((void**)params[i].val.p) = ((void*)aProxyObject); else (params[i].val.p) = ((void*)aProxyObject); - - NS_RELEASE(manager); + } + else + { + // Could not get nsIProxyObjectManager + return rv; } } else