diff --git a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp index 8a6b2f7725e..566b3097fd4 100644 --- a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp +++ b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp @@ -515,7 +515,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext, returnParam.ptr = &returnParam.val; } - rv = NS_InvokeByIndex(mHelper, mMethodIndex, paramCount, invokeParams); + rv = XPTC_InvokeByIndex(mHelper, mMethodIndex, paramCount, invokeParams); // In case someone is holding on to the txFunctionEvaluationContext which // could thus stay alive longer than this function. diff --git a/content/xtf/src/nsXTFInterfaceAggregator.cpp b/content/xtf/src/nsXTFInterfaceAggregator.cpp index 814bb8392b5..e16a34a5a65 100644 --- a/content/xtf/src/nsXTFInterfaceAggregator.cpp +++ b/content/xtf/src/nsXTFInterfaceAggregator.cpp @@ -37,11 +37,10 @@ * ***** END LICENSE BLOCK ***** */ #include "nsCOMPtr.h" -#include "nsXPTCUtils.h" +#include "xptcall.h" #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" #include "nsServiceManagerUtils.h" -#include "nsAutoPtr.h" #ifdef DEBUG #include #endif @@ -49,7 +48,7 @@ //////////////////////////////////////////////////////////////////////// // nsXTFInterfaceAggregator class -class nsXTFInterfaceAggregator : protected nsAutoXPTCStub +class nsXTFInterfaceAggregator : public nsXPTCStubBase { protected: friend nsresult @@ -60,16 +59,18 @@ protected: nsXTFInterfaceAggregator(const nsIID& iid, nsISupports* inner, - nsISupports* outer, - nsresult *rv); + nsISupports* outer); ~nsXTFInterfaceAggregator(); public: // nsISupports interface NS_DECL_ISUPPORTS + // nsXPTCStubBase + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info); + NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); private: @@ -83,17 +84,14 @@ private: nsXTFInterfaceAggregator::nsXTFInterfaceAggregator(const nsIID& iid, nsISupports* inner, - nsISupports* outer, - nsresult *rv) - : mInner(inner), mOuter(outer), mIID(iid) + nsISupports* outer) + : mInner(inner), mOuter(outer), mIID(iid) { #ifdef DEBUG // printf("nsXTFInterfaceAggregator CTOR\n"); #endif mInner->AddRef(); mOuter->AddRef(); - - *rv = InitStub(iid); } nsXTFInterfaceAggregator::~nsXTFInterfaceAggregator() @@ -114,17 +112,13 @@ NS_NewXTFInterfaceAggregator(const nsIID& iid, if (!aResult) return NS_ERROR_NULL_POINTER; - nsresult rv; - - nsRefPtr result = - new nsXTFInterfaceAggregator(iid, inner, outer, &rv); + nsXTFInterfaceAggregator* result = new nsXTFInterfaceAggregator(iid,inner,outer); if (!result) return NS_ERROR_OUT_OF_MEMORY; - if (NS_FAILED(rv)) - return rv; - - return result->QueryInterface(iid, aResult); + NS_ADDREF(result); + *aResult = result; + return NS_OK; } //---------------------------------------------------------------------- @@ -137,7 +131,7 @@ NS_IMETHODIMP nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if(aIID.Equals(mIID)) { - *aInstancePtr = mXPTCStub; + *aInstancePtr = NS_STATIC_CAST(nsXPTCStubBase*, this); NS_ADDREF_THIS(); return NS_OK; } @@ -147,37 +141,40 @@ nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr) //---------------------------------------------------------------------- // nsXPTCStubBase implementation +NS_IMETHODIMP +nsXTFInterfaceAggregator::GetInterfaceInfo(nsIInterfaceInfo** info) +{ + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); + NS_ASSERTION(iim, "could not get interface info manager"); + return iim->GetInfoForIID( &mIID, info); +} + NS_IMETHODIMP nsXTFInterfaceAggregator::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor *info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params) { - NS_ASSERTION(methodIndex >= 3, - "huh? indirect nsISupports method call unexpected"); + if (methodIndex < 3) { + NS_ERROR("huh? indirect nsISupports method call unexpected on nsXTFInterfaceAggregator."); + return NS_ERROR_FAILURE; + } // prepare args: - int paramCount = info->num_args; - nsXPTCVariant* fullPars; - if (!paramCount) { - fullPars = nsnull; - } - else { - fullPars = new nsXPTCVariant[paramCount]; - if (!fullPars) - return NS_ERROR_OUT_OF_MEMORY; - } + int paramCount = info->GetParamCount(); + nsXPTCVariant* fullPars = paramCount ? new nsXPTCVariant[paramCount] : nsnull; for (int i=0; iparams[i]; + const nsXPTParamInfo& paramInfo = info->GetParam(i); PRUint8 flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0; fullPars[i].Init(params[i], paramInfo.GetType(), flags); } // make the call: - nsresult rv = NS_InvokeByIndex(mInner, - methodIndex, - paramCount, - fullPars); + nsresult rv = XPTC_InvokeByIndex(mInner, + methodIndex, + paramCount, + fullPars); if (fullPars) delete []fullPars; return rv; diff --git a/content/xtf/src/nsXTFWeakTearoff.cpp b/content/xtf/src/nsXTFWeakTearoff.cpp index 1f375eb8bd2..3a74c74b9b8 100644 --- a/content/xtf/src/nsXTFWeakTearoff.cpp +++ b/content/xtf/src/nsXTFWeakTearoff.cpp @@ -37,11 +37,10 @@ * ***** END LICENSE BLOCK ***** */ #include "nsCOMPtr.h" -#include "nsXPTCUtils.h" +#include "xptcall.h" #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" #include "nsServiceManagerUtils.h" -#include "nsAutoPtr.h" #ifdef DEBUG #include #endif @@ -49,21 +48,27 @@ //////////////////////////////////////////////////////////////////////// // nsXTFWeakTearoff class -class nsXTFWeakTearoff : protected nsAutoXPTCStub +class nsXTFWeakTearoff : public nsXPTCStubBase { protected: + friend nsresult + NS_NewXTFWeakTearoff(const nsIID& iid, + nsISupports* obj, + nsISupports** result); + + nsXTFWeakTearoff(const nsIID& iid, + nsISupports* obj); ~nsXTFWeakTearoff(); public: - nsXTFWeakTearoff(const nsIID& iid, - nsISupports* obj, - nsresult *rv); - // nsISupports interface NS_DECL_ISUPPORTS + // nsXPTCStubBase + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info); + NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); private: @@ -75,18 +80,19 @@ private: // implementation: nsXTFWeakTearoff::nsXTFWeakTearoff(const nsIID& iid, - nsISupports* obj, - nsresult *rv) - : mObj(obj), mIID(iid) + nsISupports* obj) + : mObj(obj), mIID(iid) { - MOZ_COUNT_CTOR(nsXTFWeakTearoff); - - *rv = InitStub(iid); +#ifdef DEBUG +// printf("nsXTFWeakTearoff CTOR\n"); +#endif } nsXTFWeakTearoff::~nsXTFWeakTearoff() { - MOZ_COUNT_DTOR(nsXTFWeakTearoff); +#ifdef DEBUG +// printf("nsXTFWeakTearoff DTOR\n"); +#endif } nsresult @@ -97,17 +103,13 @@ NS_NewXTFWeakTearoff(const nsIID& iid, if (!aResult) return NS_ERROR_NULL_POINTER; - nsresult rv; - - nsRefPtr result = - new nsXTFWeakTearoff(iid, obj, &rv); - if (!result) + nsXTFWeakTearoff* result = new nsXTFWeakTearoff(iid,obj); + if (! result) return NS_ERROR_OUT_OF_MEMORY; - if (NS_FAILED(rv)) - return rv; - - return result->QueryInterface(iid, (void**) aResult); + NS_ADDREF(result); + *aResult = result; + return NS_OK; } //---------------------------------------------------------------------- @@ -120,44 +122,53 @@ NS_IMETHODIMP nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if(aIID.Equals(mIID) || aIID.Equals(NS_GET_IID(nsISupports))) { - *aInstancePtr = mXPTCStub; + *aInstancePtr = NS_STATIC_CAST(nsXPTCStubBase*, this); NS_ADDREF_THIS(); return NS_OK; } // we can't map QI onto the obj, because the xpcom wrapper otherwise // QI-accumulates all interfaces defined on mObj - // else return mObj->QueryInterface(aIID, aInstancePtr); - return NS_ERROR_NO_INTERFACE; +// else return mObj->QueryInterface(aIID, aInstancePtr); + else return NS_ERROR_NO_INTERFACE; +} + +//---------------------------------------------------------------------- +// nsXPTCStubBase implementation + +NS_IMETHODIMP +nsXTFWeakTearoff::GetInterfaceInfo(nsIInterfaceInfo** info) +{ + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); + NS_ASSERTION(iim, "could not get interface info manager"); + return iim->GetInfoForIID( &mIID, info); } NS_IMETHODIMP nsXTFWeakTearoff::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params) { - NS_ASSERTION(methodIndex >= 3, - "huh? indirect nsISupports method call unexpected"); + if (methodIndex < 3) { + NS_ERROR("huh? indirect nsISupports method call unexpected on nsXTFWeakTearoff."); + return NS_ERROR_FAILURE; + } // prepare args: - int paramCount = info->num_args; - nsXPTCVariant* fullPars; - if (!paramCount) { - fullPars = nsnull; - } - else { - fullPars = new nsXPTCVariant[paramCount]; - if (!fullPars) - return NS_ERROR_OUT_OF_MEMORY; - } + int paramCount = info->GetParamCount(); + nsXPTCVariant* fullPars = paramCount ? new nsXPTCVariant[paramCount] : nsnull; for (int i=0; iparams[i]; + const nsXPTParamInfo& paramInfo = info->GetParam(i); uint8 flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0; fullPars[i].Init(params[i], paramInfo.GetType(), flags); } // make the call: - nsresult rv = NS_InvokeByIndex(mObj, methodIndex, paramCount, fullPars); + nsresult rv = XPTC_InvokeByIndex(mObj, + methodIndex, + paramCount, + fullPars); if (fullPars) delete []fullPars; return rv; diff --git a/extensions/java/xpcom/src/nsJavaWrapper.cpp b/extensions/java/xpcom/src/nsJavaWrapper.cpp index f2b779447c3..b5f178e317d 100644 --- a/extensions/java/xpcom/src/nsJavaWrapper.cpp +++ b/extensions/java/xpcom/src/nsJavaWrapper.cpp @@ -1477,8 +1477,8 @@ JAVAPROXY_NATIVE(callXPCOMMethod) (JNIEnv *env, jclass that, jobject aJavaProxy, ThrowException(env, rv, "Failed to get real XPCOM object"); return nsnull; } - nsresult invokeResult = NS_InvokeByIndex(realObject, methodIndex, - paramCount, params); + nsresult invokeResult = XPTC_InvokeByIndex(realObject, methodIndex, + paramCount, params); NS_RELEASE(realObject); // Clean up params diff --git a/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp b/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp index 62ad3913560..ae13b00d71a 100644 --- a/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp +++ b/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp @@ -881,7 +881,8 @@ GetNewOrUsedXPCOMObject(JNIEnv* env, jobject aJavaObject, const nsIID& aIID, NS_ENSURE_SUCCESS(rv, rv); if (stub) { // stub is already AddRef'd and QI'd - *aResult = stub->GetStub(); + *aResult = NS_STATIC_CAST(nsISupports*, + NS_STATIC_CAST(nsXPTCStubBase*, stub)); return NS_OK; } @@ -900,14 +901,10 @@ GetNewOrUsedXPCOMObject(JNIEnv* env, jobject aJavaObject, const nsIID& aIID, NS_ENSURE_SUCCESS(rv, rv); // Create XPCOM stub - stub = new nsJavaXPTCStub(aJavaObject, iinfo, &rv); - if (!stub) + stub = new nsJavaXPTCStub(aJavaObject, iinfo); + if (!stub) { return NS_ERROR_OUT_OF_MEMORY; - if (NS_FAILED(rv)) { - delete stub; - return rv; } - rv = gJavaToXPTCStubMap->Add(hash, stub); if (NS_FAILED(rv)) { delete stub; @@ -915,14 +912,14 @@ GetNewOrUsedXPCOMObject(JNIEnv* env, jobject aJavaObject, const nsIID& aIID, } NS_ADDREF(stub); - *aResult = stub->GetStub(); + *aResult = NS_STATIC_CAST(nsISupports*, + NS_STATIC_CAST(nsXPTCStubBase*, stub)); return NS_OK; } nsresult -GetIIDForMethodParam(nsIInterfaceInfo *iinfo, - const XPTMethodDescriptor *methodInfo, +GetIIDForMethodParam(nsIInterfaceInfo *iinfo, const nsXPTMethodInfo *methodInfo, const nsXPTParamInfo ¶mInfo, PRUint8 paramType, PRUint16 methodIndex, nsXPTCMiniVariant *dispatchParams, PRBool isFullVariantArray, nsID &result) @@ -943,7 +940,7 @@ GetIIDForMethodParam(nsIInterfaceInfo *iinfo, if (NS_FAILED(rv)) break; - const nsXPTParamInfo& arg_param = methodInfo->params[argnum]; + const nsXPTParamInfo& arg_param = methodInfo->GetParam(argnum); const nsXPTType& arg_type = arg_param.GetType(); // The xpidl compiler ensures this. We reaffirm it for safety. diff --git a/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.h b/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.h index 865da2e9494..d1d845a9b70 100644 --- a/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.h +++ b/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.h @@ -295,7 +295,7 @@ nsresult GetNewOrUsedXPCOMObject(JNIEnv* env, jobject aJavaObject, const nsIID& aIID, nsISupports** aResult); nsresult GetIIDForMethodParam(nsIInterfaceInfo *iinfo, - const XPTMethodDescriptor *methodInfo, + const nsXPTMethodInfo *methodInfo, const nsXPTParamInfo ¶mInfo, PRUint8 paramType, PRUint16 methodIndex, nsXPTCMiniVariant *dispatchParams, diff --git a/extensions/java/xpcom/src/nsJavaXPTCStub.cpp b/extensions/java/xpcom/src/nsJavaXPTCStub.cpp index 184df6eafb4..8a267c04f17 100644 --- a/extensions/java/xpcom/src/nsJavaXPTCStub.cpp +++ b/extensions/java/xpcom/src/nsJavaXPTCStub.cpp @@ -46,21 +46,12 @@ #include "nsServiceManagerUtils.h" -nsJavaXPTCStub::nsJavaXPTCStub(jobject aJavaObject, nsIInterfaceInfo *aIInfo, - nsresult *rv) +nsJavaXPTCStub::nsJavaXPTCStub(jobject aJavaObject, nsIInterfaceInfo *aIInfo) : mJavaStrongRef(nsnull) , mIInfo(aIInfo) , mMaster(nsnull) , mWeakRefCnt(0) { - const nsIID *iid = nsnull; - aIInfo->GetIIDShared(&iid); - NS_ASSERTION(iid, "GetIIDShared must not fail!"); - - *rv = InitStub(*iid); - if (NS_FAILED(*rv)) - return; - JNIEnv* env = GetJNIEnv(); jobject weakref = env->NewObject(weakReferenceClass, weakReferenceConstructorMID, aJavaObject); @@ -69,10 +60,13 @@ nsJavaXPTCStub::nsJavaXPTCStub(jobject aJavaObject, nsIInterfaceInfo *aIInfo, aJavaObject); #ifdef DEBUG_JAVAXPCOM + nsIID* iid; + mIInfo->GetInterfaceIID(&iid); char* iid_str = iid->ToString(); LOG(("+ nsJavaXPTCStub (Java=%08x | XPCOM=%08x | IID=%s)\n", (PRUint32) mJavaRefHashCode, (PRUint32) this, iid_str)); PR_Free(iid_str); + nsMemory::Free(iid); #endif } @@ -242,7 +236,8 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr) // always return the master stub for nsISupports if (aIID.Equals(NS_GET_IID(nsISupports))) { - *aInstancePtr = master->mXPTCStub; + *aInstancePtr = NS_STATIC_CAST(nsISupports*, + NS_STATIC_CAST(nsXPTCStubBase*, master)); NS_ADDREF(master); return NS_OK; } @@ -259,7 +254,7 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr) nsJavaXPTCStub *stub = master->FindStubSupportingIID(aIID); if (stub) { - *aInstancePtr = stub->mXPTCStub; + *aInstancePtr = stub; NS_ADDREF(stub); return NS_OK; } @@ -314,15 +309,10 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr) if (NS_FAILED(rv)) return rv; - stub = new nsJavaXPTCStub(obj, iinfo, &rv); + stub = new nsJavaXPTCStub(obj, iinfo); if (!stub) return NS_ERROR_OUT_OF_MEMORY; - if (NS_FAILED(rv)) { - delete stub; - return rv; - } - // add stub to the master's list of children, so we can preserve // symmetry in future QI calls. the master will delete each child // when it is destroyed. the refcount of each child is bound to @@ -347,7 +337,7 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr) stub->mMaster = master; master->mChildren.AppendElement(stub); - *aInstancePtr = stub->mXPTCStub; + *aInstancePtr = stub; NS_ADDREF(stub); return NS_OK; } @@ -388,15 +378,22 @@ nsJavaXPTCStub::FindStubSupportingIID(const nsID &iid) return nsnull; } +NS_IMETHODIMP +nsJavaXPTCStub::GetInterfaceInfo(nsIInterfaceInfo **aInfo) +{ + NS_ADDREF(*aInfo = mIInfo); + return NS_OK; +} + NS_IMETHODIMP nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, - const XPTMethodDescriptor *aMethodInfo, + const nsXPTMethodInfo *aMethodInfo, nsXPTCMiniVariant *aParams) { #ifdef DEBUG_JAVAXPCOM const char* ifaceName; mIInfo->GetNameShared(&ifaceName); - LOG(("---> (Java) %s::%s()\n", ifaceName, aMethodInfo->name)); + LOG(("---> (Java) %s::%s()\n", ifaceName, aMethodInfo->GetName())); #endif nsresult rv = NS_OK; @@ -406,7 +403,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, nsCAutoString methodSig("("); // Create jvalue array to hold Java params - PRUint8 paramCount = aMethodInfo->num_args; + PRUint8 paramCount = aMethodInfo->GetParamCount(); jvalue* java_params = nsnull; const nsXPTParamInfo* retvalInfo = nsnull; if (paramCount) { @@ -416,7 +413,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, for (PRUint8 i = 0; i < paramCount && NS_SUCCEEDED(rv); i++) { - const nsXPTParamInfo ¶mInfo = aMethodInfo->params[i]; + const nsXPTParamInfo ¶mInfo = aMethodInfo->GetParam(i); if (!paramInfo.IsRetval()) { rv = SetupJavaParams(paramInfo, aMethodInfo, aMethodIndex, aParams, aParams[i], java_params[i], methodSig); @@ -445,16 +442,15 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, jmethodID mid = nsnull; if (NS_SUCCEEDED(rv)) { nsCAutoString methodName; - if (XPT_MD_IS_GETTER(aMethodInfo->flags) || - XPT_MD_IS_SETTER(aMethodInfo->flags)) { - if (XPT_MD_IS_GETTER(aMethodInfo->flags)) + if (aMethodInfo->IsGetter() || aMethodInfo->IsSetter()) { + if (aMethodInfo->IsGetter()) methodName.AppendLiteral("get"); else methodName.AppendLiteral("set"); - methodName.AppendASCII(aMethodInfo->name); + methodName.AppendASCII(aMethodInfo->GetName()); methodName.SetCharAt(toupper(methodName[3]), 3); } else { - methodName.AppendASCII(aMethodInfo->name); + methodName.AppendASCII(aMethodInfo->GetName()); methodName.SetCharAt(tolower(methodName[0]), 0); } // If it's a Java keyword, then prepend an underscore @@ -562,7 +558,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, if (NS_SUCCEEDED(rv)) { for (PRUint8 i = 0; i < paramCount; i++) { - const nsXPTParamInfo ¶mInfo = aMethodInfo->params[i]; + const nsXPTParamInfo ¶mInfo = aMethodInfo->GetParam(i); if (paramInfo.IsIn() && !paramInfo.IsOut() && !paramInfo.IsDipper()) // 'in' continue; @@ -590,7 +586,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, #endif env->ExceptionClear(); - LOG(("<--- (Java) %s::%s()\n", ifaceName, aMethodInfo->name)); + LOG(("<--- (Java) %s::%s()\n", ifaceName, aMethodInfo->GetName())); return rv; } @@ -599,7 +595,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex, */ nsresult nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, - const XPTMethodDescriptor* aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsXPTCMiniVariant &aVariant, jvalue &aJValue, @@ -1063,7 +1059,7 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, nsresult nsJavaXPTCStub::GetRetvalSig(const nsXPTParamInfo* aParamInfo, - const XPTMethodDescriptor* aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsACString &aRetvalSig) @@ -1173,7 +1169,7 @@ nsJavaXPTCStub::GetRetvalSig(const nsXPTParamInfo* aParamInfo, */ nsresult nsJavaXPTCStub::FinalizeJavaParams(const nsXPTParamInfo &aParamInfo, - const XPTMethodDescriptor *aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsXPTCMiniVariant &aVariant, jvalue &aJValue) diff --git a/extensions/java/xpcom/src/nsJavaXPTCStub.h b/extensions/java/xpcom/src/nsJavaXPTCStub.h index 9a1b55b43eb..711d0298ff8 100644 --- a/extensions/java/xpcom/src/nsJavaXPTCStub.h +++ b/extensions/java/xpcom/src/nsJavaXPTCStub.h @@ -38,7 +38,7 @@ #ifndef _nsJavaXPTCStub_h_ #define _nsJavaXPTCStub_h_ -#include "nsXPTCUtils.h" +#include "xptcall.h" #include "jni.h" #include "nsVoidArray.h" #include "nsIInterfaceInfo.h" @@ -50,7 +50,7 @@ #define NS_JAVAXPTCSTUB_IID \ {0x88dd8130, 0xebe6, 0x4431, {0x9d, 0xa7, 0xe6, 0xb7, 0x54, 0x74, 0xfb, 0x21}} -class nsJavaXPTCStub : protected nsAutoXPTCStub, +class nsJavaXPTCStub : public nsXPTCStubBase, public nsSupportsWeakReference { friend class nsJavaXPTCStubWeakRef; @@ -60,18 +60,19 @@ public: NS_DECL_NSISUPPORTSWEAKREFERENCE NS_DECLARE_STATIC_IID_ACCESSOR(NS_JAVAXPTCSTUB_IID) - nsJavaXPTCStub(jobject aJavaObject, nsIInterfaceInfo *aIInfo, - nsresult *rv); + nsJavaXPTCStub(jobject aJavaObject, nsIInterfaceInfo *aIInfo); virtual ~nsJavaXPTCStub(); + // return a refcounted pointer to the InterfaceInfo for this object + // NOTE: on some platforms this MUST not fail or we crash! + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo **aInfo); + // call this method and return result NS_IMETHOD CallMethod(PRUint16 aMethodIndex, - const XPTMethodDescriptor *aInfo, + const nsXPTMethodInfo *aInfo, nsXPTCMiniVariant *aParams); - nsISomeInterface* GetStub() { return mXPTCStub; } - // getter for mJavaObject jobject GetJavaObject(); @@ -100,18 +101,18 @@ private: PRBool SupportsIID(const nsID &aIID); nsresult SetupJavaParams(const nsXPTParamInfo &aParamInfo, - const XPTMethodDescriptor* aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsXPTCMiniVariant &aVariant, jvalue &aJValue, nsACString &aMethodSig); nsresult GetRetvalSig(const nsXPTParamInfo* aParamInfo, - const XPTMethodDescriptor* aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsACString &aRetvalSig); nsresult FinalizeJavaParams(const nsXPTParamInfo &aParamInfo, - const XPTMethodDescriptor* aMethodInfo, + const nsXPTMethodInfo* aMethodInfo, PRUint16 aMethodIndex, nsXPTCMiniVariant* aDispatchParams, nsXPTCMiniVariant &aVariant, diff --git a/extensions/python/xpcom/client/__init__.py b/extensions/python/xpcom/client/__init__.py index a294946a654..58238150cc2 100644 --- a/extensions/python/xpcom/client/__init__.py +++ b/extensions/python/xpcom/client/__init__.py @@ -44,7 +44,7 @@ from xpcom import xpt, COMException, nsError, logger from xpcom._xpcom import IID_nsISupports, IID_nsIClassInfo, \ IID_nsISupportsCString, IID_nsISupportsString, \ IID_nsISupportsWeakReference, IID_nsIWeakReference, \ - XPTI_GetInterfaceInfoManager, GetComponentManager, NS_InvokeByIndex + XPTI_GetInterfaceInfoManager, GetComponentManager, XPTC_InvokeByIndex # Attribute names we may be __getattr__'d for, but know we don't want to delegate # Could maybe just look for startswith("__") but this may screw things for some objects. @@ -60,7 +60,7 @@ _float_interfaces = _just_float_interfaces + _just_long_interfaces + _just_int_i method_template = """ def %s(self, %s): - return NS_InvokeByIndex(self._comobj_, %d, (%s, (%s))) + return XPTC_InvokeByIndex(self._comobj_, %d, (%s, (%s))) """ def _MakeMethodCode(method): # Build a declaration @@ -457,7 +457,7 @@ class _Interface(_XPCOMBase): if len(param_infos)!=1: # Only expecting a retval raise RuntimeError, "Can't get properties with this many args!" args = ( param_infos, () ) - return NS_InvokeByIndex(self._comobj_, method_index, args) + return XPTC_InvokeByIndex(self._comobj_, method_index, args) # See if we have a method info waiting to be turned into a method. # Do this last as it is a one-off hit. @@ -485,7 +485,7 @@ class _Interface(_XPCOMBase): if len(param_infos)!=1: # Only expecting a single input val raise RuntimeError, "Can't set properties with this many args!" real_param_infos = ( param_infos, (val,) ) - return NS_InvokeByIndex(self._comobj_, method_index, real_param_infos) + return XPTC_InvokeByIndex(self._comobj_, method_index, real_param_infos) def __repr__(self): return "" % (self._object_name_,) diff --git a/extensions/python/xpcom/src/module/_xpcom.cpp b/extensions/python/xpcom/src/module/_xpcom.cpp index 7b8e65f4386..c2bbe969a20 100644 --- a/extensions/python/xpcom/src/module/_xpcom.cpp +++ b/extensions/python/xpcom/src/module/_xpcom.cpp @@ -144,7 +144,7 @@ PyXPCOMMethod_XPTI_GetInterfaceInfoManager(PyObject *self, PyObject *args) } static PyObject * -PyXPCOMMethod_NS_InvokeByIndex(PyObject *self, PyObject *args) +PyXPCOMMethod_XPTC_InvokeByIndex(PyObject *self, PyObject *args) { PyObject *obIS, *obParams; nsCOMPtr pis; @@ -182,7 +182,7 @@ PyXPCOMMethod_NS_InvokeByIndex(PyObject *self, PyObject *args) nsresult r; Py_BEGIN_ALLOW_THREADS; - r = NS_InvokeByIndex(pis, index, arg_helper.m_num_array, arg_helper.m_var_array); + r = XPTC_InvokeByIndex(pis, index, arg_helper.m_num_array, arg_helper.m_var_array); Py_END_ALLOW_THREADS; if ( NS_FAILED(r) ) return PyXPCOM_BuildPyException(r); @@ -435,7 +435,7 @@ static struct PyMethodDef xpcom_methods[]= {"GetComponentManager", PyXPCOMMethod_GetComponentManager, 1}, {"GetComponentRegistrar", PyXPCOMMethod_GetComponentRegistrar, 1}, {"XPTI_GetInterfaceInfoManager", PyXPCOMMethod_XPTI_GetInterfaceInfoManager, 1}, - {"NS_InvokeByIndex", PyXPCOMMethod_XPTC_InvokeByIndex, 1}, + {"XPTC_InvokeByIndex", PyXPCOMMethod_XPTC_InvokeByIndex, 1}, {"GetServiceManager", PyXPCOMMethod_GetServiceManager, 1}, {"IID", PyXPCOMMethod_IID, 1}, // IID is wrong - deprecated - not just IID, but CID, etc. {"ID", PyXPCOMMethod_IID, 1}, // This is the official name. diff --git a/extensions/webservices/proxy/src/wspcallcontext.cpp b/extensions/webservices/proxy/src/wspcallcontext.cpp index f5beec0d65f..fc3b8256d2f 100644 --- a/extensions/webservices/proxy/src/wspcallcontext.cpp +++ b/extensions/webservices/proxy/src/wspcallcontext.cpp @@ -255,7 +255,7 @@ WSPCallContext::CallCompletionListener() dispatchParams[1].SetValIsInterface(); dispatchParams[1].type.flags = XPT_TDP_POINTER | TD_INTERFACE_TYPE; - rv = NS_InvokeByIndex(mAsyncListener, 3, 2, dispatchParams); + rv = XPTC_InvokeByIndex(mAsyncListener, 3, 2, dispatchParams); } else if (mResponse) { nsCOMPtr binding; @@ -410,8 +410,8 @@ WSPCallContext::CallCompletionListener() dispatchParams[paramIndex].type.flags = XPT_TDP_POINTER | TD_INTERFACE_TYPE; - rv = NS_InvokeByIndex(mAsyncListener, mListenerMethodIndex, - paramCount, dispatchParams); + rv = XPTC_InvokeByIndex(mAsyncListener, mListenerMethodIndex, + paramCount, dispatchParams); } else { rv = NS_ERROR_FAILURE; diff --git a/extensions/webservices/proxy/src/wspcomplextypewrapper.cpp b/extensions/webservices/proxy/src/wspcomplextypewrapper.cpp index eeeeb4306a2..d9aa9baa101 100644 --- a/extensions/webservices/proxy/src/wspcomplextypewrapper.cpp +++ b/extensions/webservices/proxy/src/wspcomplextypewrapper.cpp @@ -350,8 +350,8 @@ WSPComplexTypeWrapper::GetPropertyValue(PRUint32 aMethodIndex, } } - rv = NS_InvokeByIndex(mComplexTypeInstance, aMethodIndex, - numParams, var); + rv = XPTC_InvokeByIndex(mComplexTypeInstance, aMethodIndex, + numParams, var); if (NS_FAILED(rv)) { return rv; diff --git a/extensions/webservices/proxy/src/wspprivate.h b/extensions/webservices/proxy/src/wspprivate.h index 53d58aa82a8..9b5a01b1d8c 100644 --- a/extensions/webservices/proxy/src/wspprivate.h +++ b/extensions/webservices/proxy/src/wspprivate.h @@ -59,7 +59,7 @@ #include "nsSOAPUtils.h" // interface info includes -#include "nsXPTCUtils.h" +#include "xptcall.h" #include "nsIInterfaceInfo.h" // WSDL includes @@ -92,7 +92,7 @@ public: nsACString& aCIdentifier); }; -class WSPProxy : protected nsAutoXPTCStub, +class WSPProxy : public nsXPTCStubBase, public nsIWebServiceProxy, public nsIClassInfo { @@ -104,9 +104,11 @@ public: NS_DECL_NSIWEBSERVICEPROXY NS_DECL_NSICLASSINFO + // Would be nice to have a NS_DECL_NSXPTCSTUBBASE NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info); void GetListenerInterfaceInfo(nsIInterfaceInfo** aInfo); void CallCompleted(WSPCallContext* aContext); @@ -250,7 +252,7 @@ protected: nsCOMPtr mInterfaceInfo; }; -class WSPPropertyBagWrapper : protected nsAutoXPTCStub, +class WSPPropertyBagWrapper : public nsXPTCStubBase, public nsIWebServicePropertyBagWrapper, public nsIClassInfo { @@ -262,9 +264,11 @@ public: NS_DECL_NSIWEBSERVICEPROPERTYBAGWRAPPER NS_DECL_NSICLASSINFO + // Would be nice to have a NS_DECL_NSXPTCSTUBBASE NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info); static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); diff --git a/extensions/webservices/proxy/src/wsppropertybagwrapper.cpp b/extensions/webservices/proxy/src/wsppropertybagwrapper.cpp index ff372e9c68d..6cef6752305 100644 --- a/extensions/webservices/proxy/src/wsppropertybagwrapper.cpp +++ b/extensions/webservices/proxy/src/wsppropertybagwrapper.cpp @@ -58,9 +58,7 @@ WSPPropertyBagWrapper::Init(nsIPropertyBag* aPropertyBag, mPropertyBag = aPropertyBag; mInterfaceInfo = aInterfaceInfo; mInterfaceInfo->GetIIDShared(&mIID); - - nsresult rv = InitStub(*mIID); - return rv; + return NS_OK; } NS_METHOD @@ -87,11 +85,8 @@ NS_IMPL_RELEASE(WSPPropertyBagWrapper) NS_IMETHODIMP WSPPropertyBagWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr) { - if (aIID.Equals(NS_GET_IID(nsISupports))) { - *aInstancePtr = NS_STATIC_CAST(nsIXPTCProxy*, this); - } - if(mXPTCStub && mIID && aIID.Equals(*mIID)) { - *aInstancePtr = mXPTCStub; + if((mIID && aIID.Equals(*mIID)) || aIID.Equals(NS_GET_IID(nsISupports))) { + *aInstancePtr = NS_STATIC_CAST(nsXPTCStubBase*, this); } else if (aIID.Equals(NS_GET_IID(nsIWebServicePropertyBagWrapper))) { *aInstancePtr = NS_STATIC_CAST(nsIWebServicePropertyBagWrapper*, this); @@ -108,7 +103,7 @@ WSPPropertyBagWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params) { if (methodIndex < 3) { @@ -119,7 +114,7 @@ WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, nsresult rv = NS_OK; nsAutoString propName; - rv = WSPFactory::C2XML(nsDependentCString(info->name), propName); + rv = WSPFactory::C2XML(nsDependentCString(info->GetName()), propName); if (NS_FAILED(rv)) { return rv; } @@ -131,8 +126,8 @@ WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, } nsCOMPtr iinfo; - if (XPT_MD_IS_GETTER(info->flags)) { - const nsXPTParamInfo& paramInfo = info->params[0]; + if (info->IsGetter()) { + const nsXPTParamInfo& paramInfo = info->GetParam(0); const nsXPTType& type = paramInfo.GetType(); uint8 type_tag = type.TagPart(); @@ -146,12 +141,12 @@ WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, rv = WSPProxy::VariantToValue(type_tag, params[0].val.p, iinfo, val); } - else if (info->num_args == 2) { + else if (info->GetParamCount() == 2) { // If it's not an explicit getter, it has to be an array getter // method. // The first parameter should be the array length out param - const nsXPTParamInfo& paramInfo1 = info->params[0]; + const nsXPTParamInfo& paramInfo1 = info->GetParam(0); const nsXPTType& type1 = paramInfo1.GetType(); if (!paramInfo1.IsOut() || (type1.TagPart() != nsXPTType::T_U32)) { NS_ERROR("Unexpected parameter type for getter"); @@ -159,7 +154,7 @@ WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, } // The second parameter should be the array out pointer itself. - const nsXPTParamInfo& paramInfo2 = info->params[1]; + const nsXPTParamInfo& paramInfo2 = info->GetParam(1); const nsXPTType& type2 = paramInfo2.GetType(); if (!paramInfo2.IsOut() || !type2.IsArray()) { NS_ERROR("Unexpected parameter type for getter"); @@ -192,6 +187,17 @@ WSPPropertyBagWrapper::CallMethod(PRUint16 methodIndex, return rv; } +NS_IMETHODIMP +WSPPropertyBagWrapper::GetInterfaceInfo(nsIInterfaceInfo** info) +{ + NS_ENSURE_ARG_POINTER(info); + + *info = mInterfaceInfo; + NS_ADDREF(*info); + + return NS_OK; +} + /////////////////////////////////////////////////// // // Implementation of nsIClassInfo diff --git a/extensions/webservices/proxy/src/wspproxy.cpp b/extensions/webservices/proxy/src/wspproxy.cpp index 45fd4f629e7..f12493bd81f 100644 --- a/extensions/webservices/proxy/src/wspproxy.cpp +++ b/extensions/webservices/proxy/src/wspproxy.cpp @@ -80,10 +80,6 @@ WSPProxy::Init(nsIWSDLPort* aPort, nsIInterfaceInfo* aPrimaryInterface, nsresult rv; - rv = InitStub(*mIID); - if (NS_FAILED(rv)) - return rv; - mInterfaces = do_CreateInstance(NS_SCRIPTABLE_INTERFACES_CONTRACTID, &rv); if (!mInterfaces) { return rv; @@ -139,13 +135,8 @@ NS_IMPL_RELEASE(WSPProxy) NS_IMETHODIMP WSPProxy::QueryInterface(REFNSIID aIID, void** aInstancePtr) { - if (aIID.Equals(NS_GET_IID(nsISupports))) { - *aInstancePtr = NS_STATIC_CAST(nsIXPTCProxy*, this); - NS_ADDREF_THIS(); - return NS_OK; - } - if(mXPTCStub && mIID && aIID.Equals(*mIID)) { - *aInstancePtr = mXPTCStub; + if((mIID && aIID.Equals(*mIID)) || aIID.Equals(NS_GET_IID(nsISupports))) { + *aInstancePtr = NS_STATIC_CAST(nsXPTCStubBase*, this); NS_ADDREF_THIS(); return NS_OK; } @@ -186,7 +177,7 @@ WSPProxy::QueryInterface(REFNSIID aIID, void** aInstancePtr) */ NS_IMETHODIMP WSPProxy::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params) { nsresult rv; @@ -302,7 +293,7 @@ WSPProxy::CallMethod(PRUint16 methodIndex, PRUint32 i, partCount; input->GetPartCount(&partCount); - PRUint32 maxParamIndex = info->num_args - 1; + PRUint32 maxParamIndex = info->GetParamCount()-1; // Iterate through the parts to figure out how many are // body vs. header blocks @@ -459,7 +450,7 @@ WSPProxy::CallMethod(PRUint16 methodIndex, PRUint32 arrayLength; if (paramIndex < maxParamIndex && - nsXPTType(info->params[paramIndex + 1].type.prefix).IsArray()) { + info->GetParam((PRUint8)(paramIndex + 1)).GetType().IsArray()) { arrayLength = params[paramIndex++].val.u32; } else { @@ -469,7 +460,7 @@ WSPProxy::CallMethod(PRUint16 methodIndex, NS_ASSERTION(paramIndex <= maxParamIndex, "WSDL/IInfo param count mismatch"); - const nsXPTParamInfo& paramInfo = info->params[paramIndex]; + const nsXPTParamInfo& paramInfo = info->GetParam(paramIndex); nsCOMPtr value; rv = ParameterToVariant(mPrimaryInterface, methodIndex, @@ -501,7 +492,7 @@ WSPProxy::CallMethod(PRUint16 methodIndex, if (mIsAsync) { PRUint8 pcount; - pcount = info->num_args; + pcount = info->GetParamCount(); // There has to be at least one parameter - the retval. if (pcount == 0) { rv = NS_ERROR_FAILURE; @@ -510,7 +501,7 @@ WSPProxy::CallMethod(PRUint16 methodIndex, #ifdef DEBUG // The last one should be the retval. - const nsXPTParamInfo& retParamInfo = info->params[pcount - 1]; + const nsXPTParamInfo& retParamInfo = info->GetParam(pcount - 1); if (!retParamInfo.IsRetval()) { rv = NS_ERROR_FAILURE; goto call_method_end; @@ -1144,6 +1135,17 @@ WSPProxy::VariantToArrayValue(uint8 aTypeTag, return NS_OK; } +NS_IMETHODIMP +WSPProxy::GetInterfaceInfo(nsIInterfaceInfo** info) +{ + NS_ENSURE_ARG_POINTER(info); + + *info = mPrimaryInterface; + NS_ADDREF(*info); + + return NS_OK; +} + /////////////////////////////////////////////////// // // Implementation of nsIWebServiceProxy diff --git a/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp b/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp index f6efec455ac..37bb428db5d 100644 --- a/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp +++ b/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp @@ -1770,10 +1770,10 @@ ipcDConnectService::OnInvoke(PRUint32 peer, const DConnectInvoke *invoke, PRUint } } - rv = NS_InvokeByIndex(wrapper->RealInstance(), - invoke->method_index, - paramCount, - params); + rv = XPTC_InvokeByIndex(wrapper->RealInstance(), + invoke->method_index, + paramCount, + params); end: LOG(("sending INVOKE_REPLY: rv=%x\n", rv)); diff --git a/js/src/xpconnect/src/xpcconvert.cpp b/js/src/xpconnect/src/xpcconvert.cpp index 03cd8afd6dc..69e36ae8deb 100644 --- a/js/src/xpconnect/src/xpcconvert.cpp +++ b/js/src/xpconnect/src/xpcconvert.cpp @@ -124,14 +124,14 @@ static intN sXPCOMUCStringFinalizerIndex = -1; // static JSBool -XPCConvert::IsMethodReflectable(const XPTMethodDescriptor& info) +XPCConvert::IsMethodReflectable(const nsXPTMethodInfo& info) { - if(XPT_MD_IS_NOTXPCOM(info.flags) || XPT_MD_IS_HIDDEN(info.flags)) + if(info.IsNotXPCOM() || info.IsHidden()) return JS_FALSE; - for(int i = info.num_args-1; i >= 0; i--) + for(int i = info.GetParamCount()-1; i >= 0; i--) { - const nsXPTParamInfo& param = info.params[i]; + const nsXPTParamInfo& param = info.GetParam(i); const nsXPTType& type = param.GetType(); uint8 base_type = type.TagPart(); diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index cd617519a5a..f9fa7cef8d8 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -71,7 +71,7 @@ #include "nsCOMPtr.h" #include "nsIModule.h" #include "nsAutoLock.h" -#include "nsXPTCUtils.h" +#include "xptcall.h" #include "jsapi.h" #include "jsdhash.h" #include "jsprf.h" @@ -2154,7 +2154,7 @@ public: JSObject* GetRootJSObject(XPCCallContext& ccx, JSObject* aJSObj); NS_IMETHOD CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); JSObject* CallQueryInterfaceOnJSObject(XPCCallContext& ccx, @@ -2190,7 +2190,7 @@ private: enum SizeMode {GET_SIZE, GET_LENGTH}; JSBool GetArraySizeFromParam(JSContext* cx, - const XPTMethodDescriptor* method, + const nsXPTMethodInfo* method, const nsXPTParamInfo& param, uint16 methodIndex, uint8 paramIndex, @@ -2199,7 +2199,7 @@ private: JSUint32* result); JSBool GetInterfaceTypeFromParam(JSContext* cx, - const XPTMethodDescriptor* method, + const nsXPTMethodInfo* method, const nsXPTParamInfo& param, uint16 methodIndex, const nsXPTType& type, @@ -2226,7 +2226,7 @@ private: // nsXPCWrappedJS objects are chained together to represent the various // interface on the single underlying (possibly aggregate) JSObject. -class nsXPCWrappedJS : protected nsAutoXPTCStub, +class nsXPCWrappedJS : public nsXPTCStubBase, public nsWeakRefToIXPConnectWrappedJS, public nsSupportsWeakReference, public nsIPropertyBag @@ -2238,8 +2238,12 @@ public: //NS_DECL_NSISUPPORTSWEAKREFERENCE // methods also on nsIXPConnectWrappedJS NS_DECL_NSIPROPERTYBAG + // Note that both nsXPTCStubBase and nsIXPConnectWrappedJS declare + // GetInterfaceInfo methods with the same sig. So, the declaration + // for it here comes from the NS_DECL_NSIXPCONNECTWRAPPEDJS macro + NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor *info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); /* @@ -2255,7 +2259,6 @@ public: nsISupports* aOuter, nsXPCWrappedJS** wrapper); - nsISomeInterface* GetXPTCStub() { return mXPTCStub; } JSObject* GetJSObject() const {return mJSObj;} nsXPCWrappedJSClass* GetClass() const {return mClass;} REFNSIID GetIID() const {return GetClass()->GetIID();} @@ -2369,7 +2372,7 @@ private: class XPCConvert { public: - static JSBool IsMethodReflectable(const XPTMethodDescriptor& info); + static JSBool IsMethodReflectable(const nsXPTMethodInfo& info); /** * Convert a native object into a jsval. diff --git a/js/src/xpconnect/src/xpcwrappedjs.cpp b/js/src/xpconnect/src/xpcwrappedjs.cpp index 1ccb26eac35..113a62fe975 100644 --- a/js/src/xpconnect/src/xpcwrappedjs.cpp +++ b/js/src/xpconnect/src/xpcwrappedjs.cpp @@ -349,8 +349,6 @@ nsXPCWrappedJS::nsXPCWrappedJS(XPCCallContext& ccx, printf("//////// %d instances of nsXPCWrappedJS created\n", count); #endif - InitStub(GetClass()->GetIID()); - // intensionally do double addref - see Release(). NS_ADDREF_THIS(); NS_ADDREF_THIS(); @@ -471,7 +469,7 @@ nsXPCWrappedJS::GetInterfaceInfo(nsIInterfaceInfo** info) NS_IMETHODIMP nsXPCWrappedJS::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* params) { if(!IsValid()) diff --git a/js/src/xpconnect/src/xpcwrappedjsclass.cpp b/js/src/xpconnect/src/xpcwrappedjsclass.cpp index 00d8d1a1bac..57d1641849d 100644 --- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp @@ -579,7 +579,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, if(nsnull != (sibling = self->Find(aIID))) { NS_ADDREF(sibling); - *aInstancePtr = sibling->GetXPTCStub(); + *aInstancePtr = (void*) sibling; return NS_OK; } @@ -587,7 +587,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, if(nsnull != (sibling = self->FindInherited(aIID))) { NS_ADDREF(sibling); - *aInstancePtr = sibling->GetXPTCStub(); + *aInstancePtr = (void*) sibling; return NS_OK; } @@ -708,7 +708,7 @@ xpcWrappedJSErrorReporter(JSContext *cx, const char *message, JSBool nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx, - const XPTMethodDescriptor* method, + const nsXPTMethodInfo* method, const nsXPTParamInfo& param, uint16 methodIndex, uint8 paramIndex, @@ -726,7 +726,7 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx, if(NS_FAILED(rv)) return JS_FALSE; - const nsXPTParamInfo& arg_param = method->params[argnum]; + const nsXPTParamInfo& arg_param = method->GetParam(argnum); const nsXPTType& arg_type = arg_param.GetType(); // The xpidl compiler ensures this. We reaffirm it for safety. @@ -743,7 +743,7 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx, JSBool nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx, - const XPTMethodDescriptor* method, + const nsXPTMethodInfo* method, const nsXPTParamInfo& param, uint16 methodIndex, const nsXPTType& type, @@ -769,7 +769,7 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx, if(NS_FAILED(rv)) return JS_FALSE; - const nsXPTParamInfo& arg_param = method->params[argnum]; + const nsXPTParamInfo& arg_param = method->GetParam(argnum); const nsXPTType& arg_type = arg_param.GetType(); if(arg_type.IsPointer() && arg_type.TagPart() == nsXPTType::T_IID) @@ -981,7 +981,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx, NS_IMETHODIMP nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, - const XPTMethodDescriptor* info, + const nsXPTMethodInfo* info, nsXPTCMiniVariant* nativeParams) { jsval* stackbase; @@ -998,7 +998,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, nsID param_iid; uint8 outConversionFailedIndex; JSObject* obj; - const char* name = info->name; + const char* name = info->GetName(); jsval fval; void* mark; JSBool foundDependentParam; @@ -1038,9 +1038,9 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, obj = thisObj = wrapper->GetJSObject(); // XXX ASSUMES that retval is last arg. The xpidl compiler ensures this. - paramCount = info->num_args; + paramCount = info->GetParamCount(); argc = paramCount - - (paramCount && XPT_PD_IS_RETVAL(info->params[paramCount-1].flags) ? 1 : 0); + (paramCount && info->GetParam(paramCount-1).IsRetval() ? 1 : 0); if(!cx || !xpcc || !IsReflectable(methodIndex)) goto pre_call_clean_up; @@ -1059,7 +1059,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, // setup stack // if this isn't a function call then we don't need to push extra stuff - if(XPT_MD_IS_GETTER(info->flags) || XPT_MD_IS_SETTER(info->flags)) + if(info->IsGetter() || info->IsSetter()) { stack_size = argc; } @@ -1099,7 +1099,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, if(paramCount) { - const nsXPTParamInfo& firstParam = info->params[0]; + const nsXPTParamInfo& firstParam = info->GetParam(0); if(firstParam.IsIn()) { const nsXPTType& firstType = firstParam.GetType(); @@ -1178,8 +1178,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, goto pre_call_clean_up; } - NS_ASSERTION(XPT_MD_IS_GETTER(info->flags) || sp, - "Only a getter needs no stack."); + NS_ASSERTION(info->IsGetter() || sp, "Only a getter needs no stack."); // this is a function call, so push function and 'this' if(stack_size != argc) @@ -1197,7 +1196,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, // build the args for(i = 0; i < argc; i++) { - const nsXPTParamInfo& param = info->params[i]; + const nsXPTParamInfo& param = info->GetParam(i); const nsXPTType& type = param.GetType(); nsXPTType datum_type; JSUint32 array_count; @@ -1250,7 +1249,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, } // Figure out what our callee is - if(XPT_MD_IS_GETTER(info->flags) || XPT_MD_IS_SETTER(info->flags)) + if(info->IsGetter() || info->IsSetter()) { // Pull the getter or setter off of |obj| uintN attrs; @@ -1263,13 +1262,13 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, &getter, &setter); if(ok) { - if(XPT_MD_IS_GETTER(info->flags) && (attrs & JSPROP_GETTER)) + if(info->IsGetter() && (attrs & JSPROP_GETTER)) { // JSPROP_GETTER means the getter is actually a // function object. ccx.SetCallee((JSObject*)getter); } - else if(XPT_MD_IS_SETTER(info->flags) && (attrs & JSPROP_SETTER)) + else if(info->IsSetter() && (attrs & JSPROP_SETTER)) { // JSPROP_SETTER means the setter is actually a // function object. @@ -1339,7 +1338,7 @@ pre_call_clean_up: // clean up any 'out' params handed in for(i = 0; i < paramCount; i++) { - const nsXPTParamInfo& param = info->params[i]; + const nsXPTParamInfo& param = info->GetParam(i); if(!param.IsOut()) continue; @@ -1394,9 +1393,9 @@ pre_call_clean_up: JS_ClearPendingException(cx); - if(XPT_MD_IS_GETTER(info->flags)) + if(info->IsGetter()) success = JS_GetProperty(cx, obj, name, &result); - else if(XPT_MD_IS_SETTER(info->flags)) + else if(info->IsSetter()) success = JS_SetProperty(cx, obj, name, sp-1); else { @@ -1470,7 +1469,7 @@ pre_call_clean_up: foundDependentParam = JS_FALSE; for(i = 0; i < paramCount; i++) { - const nsXPTParamInfo& param = info->params[i]; + const nsXPTParamInfo& param = info->GetParam(i); if(!param.IsOut() && !param.IsDipper()) continue; @@ -1521,7 +1520,7 @@ pre_call_clean_up: { for(i = 0; i < paramCount; i++) { - const nsXPTParamInfo& param = info->params[i]; + const nsXPTParamInfo& param = info->GetParam(i); if(!param.IsOut()) continue; @@ -1614,7 +1613,7 @@ pre_call_clean_up: for(uint8 k = 0; k < i; k++) { - const nsXPTParamInfo& param = info->params[k]; + const nsXPTParamInfo& param = info->GetParam(k); if(!param.IsOut()) continue; const nsXPTType& type = param.GetType(); diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 56cbb9342dd..93c28467ad7 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -2158,8 +2158,8 @@ XPCWrappedNative::CallMethod(XPCCallContext& ccx, AutoJSSuspendRequest req(ccx); // scoped suspend of request // do the invoke - invokeResult = NS_InvokeByIndex(callee, vtblIndex, - paramCount, dispatchParams); + invokeResult = XPTC_InvokeByIndex(callee, vtblIndex, + paramCount, dispatchParams); // resume non-blocking JS operations now } diff --git a/xpcom/build/dlldeps.cpp b/xpcom/build/dlldeps.cpp index 7596b7f111f..3652fd7b6fd 100644 --- a/xpcom/build/dlldeps.cpp +++ b/xpcom/build/dlldeps.cpp @@ -168,7 +168,9 @@ void XXXNeverCalled() #if defined (DEBUG) && !defined (WINCE) && !defined(XP_OS2) PurePrintf(0); #endif - NS_InvokeByIndex(nsnull, 0, 0, nsnull); + XPTC_InvokeByIndex(nsnull, 0, 0, nsnull); + xptc_dummy(); + xptc_dummy2(); NS_NewGenericFactory(nsnull, nsnull); NS_NewGenericModule2(nsnull, nsnull); NS_GetWeakReference(nsnull); diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in index 8423dda7dc2..9725ab110bf 100644 --- a/xpcom/glue/Makefile.in +++ b/xpcom/glue/Makefile.in @@ -112,7 +112,6 @@ SDK_HEADERS = \ EXPORTS = \ nsThreadUtils.h \ nsProxyRelease.h \ - nsXPTCUtils.h \ $(NULL) SDK_LIBRARY = \ diff --git a/xpcom/glue/nsXPTCUtils.h b/xpcom/glue/nsXPTCUtils.h deleted file mode 100644 index 5710c209742..00000000000 --- a/xpcom/glue/nsXPTCUtils.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla 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/MPL/ - * - * 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 XPCOM. - * - * The Initial Developer of the Original Code is - * the Mozilla Foundation . - * - * Portions created by the Initial Developer are Copyright (C) 2006 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Benjamin Smedberg - New code - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsXPTCUtils_h__ -#define nsXPTCUtils_h__ - -#include "xptcall.h" - -/** - * A helper class that initializes an xptcall helper at construction - * and releases it at destruction. - */ -class nsAutoXPTCStub : protected nsIXPTCProxy -{ -public: - nsISomeInterface* mXPTCStub; - -protected: - nsAutoXPTCStub() : mXPTCStub(nsnull) { } - - nsresult - InitStub(const nsIID& aIID) - { - return NS_GetXPTCallStub(aIID, this, &mXPTCStub); - } - - ~nsAutoXPTCStub() - { - if (mXPTCStub) - NS_DestroyXPTCallStub(mXPTCStub); - } -}; - -#endif // nsXPTCUtils_h__ diff --git a/xpcom/proxy/src/nsProxyEvent.cpp b/xpcom/proxy/src/nsProxyEvent.cpp index 464c9dff9ef..39eef30c085 100644 --- a/xpcom/proxy/src/nsProxyEvent.cpp +++ b/xpcom/proxy/src/nsProxyEvent.cpp @@ -127,7 +127,7 @@ nsProxyObject::nsProxyObjectDestructorEvent::Run() //----------------------------------------------------------------------------- nsProxyObjectCallInfo::nsProxyObjectCallInfo(nsProxyEventObject* owner, - const XPTMethodDescriptor *methodInfo, + const nsXPTMethodInfo *methodInfo, PRUint32 methodIndex, nsXPTCVariant* parameterList, PRUint32 parameterCount) : @@ -175,10 +175,10 @@ nsProxyObjectCallInfo::Run() { PROXY_LOG(("PROXY(%p): Run\n", this)); - mResult = NS_InvokeByIndex(mOwner->GetProxiedInterface(), - mMethodIndex, - mParameterCount, - mParameterList); + mResult = XPTC_InvokeByIndex(mOwner->GetProxiedInterface(), + mMethodIndex, + mParameterCount, + mParameterList); if (IsSync()) { PostCompleted(); @@ -192,7 +192,7 @@ nsProxyObjectCallInfo::RefCountInInterfacePointers(PRBool addRef) { for (PRUint32 i = 0; i < mParameterCount; i++) { - nsXPTParamInfo paramInfo = mMethodInfo->params[i]; + nsXPTParamInfo paramInfo = mMethodInfo->GetParam(i); if (paramInfo.GetType().IsInterfacePointer() ) { @@ -220,7 +220,7 @@ nsProxyObjectCallInfo::CopyStrings(PRBool copy) { for (PRUint32 i = 0; i < mParameterCount; i++) { - const nsXPTParamInfo paramInfo = mMethodInfo->params[i]; + const nsXPTParamInfo paramInfo = mMethodInfo->GetParam(i); if (paramInfo.IsIn()) { @@ -413,7 +413,7 @@ nsProxyObject::LockedFind(REFNSIID aIID, void **aResult) for (peo = mFirst; peo; peo = peo->mNext) { if (peo->GetClass()->GetProxiedIID().Equals(aIID)) { - *aResult = NS_STATIC_CAST(nsISupports*, peo->mXPTCStub); + *aResult = NS_STATIC_CAST(nsISupports*, peo); peo->AddRef(); return NS_OK; } @@ -430,20 +430,16 @@ nsProxyObject::LockedFind(REFNSIID aIID, void **aResult) return rv; peo = new nsProxyEventObject(this, pec, - already_AddRefed(newInterface), &rv); + already_AddRefed(newInterface)); if (!peo) return NS_ERROR_OUT_OF_MEMORY; - if (NS_FAILED(rv)) { - delete peo; - return rv; - } peo->mNext = mFirst; mFirst = peo; NS_ADDREF(peo); - *aResult = NS_STATIC_CAST(nsISupports*, peo->mXPTCStub); + *aResult = (nsISupports*) peo; return NS_OK; } diff --git a/xpcom/proxy/src/nsProxyEventObject.cpp b/xpcom/proxy/src/nsProxyEventObject.cpp index 671321633d4..f68ba9166e6 100644 --- a/xpcom/proxy/src/nsProxyEventObject.cpp +++ b/xpcom/proxy/src/nsProxyEventObject.cpp @@ -55,14 +55,12 @@ nsProxyEventObject::nsProxyEventObject(nsProxyObject *aParent, nsProxyEventClass* aClass, - already_AddRefed aRealInterface, - nsresult *rv) + already_AddRefed aRealInterface) : mRealInterface(aRealInterface), mClass(aClass), mProxyObject(aParent), mNext(nsnull) { - *rv = InitStub(aClass->GetProxiedIID()); } nsProxyEventObject::~nsProxyEventObject() @@ -108,7 +106,7 @@ nsProxyEventObject::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if( aIID.Equals(GetClass()->GetProxiedIID()) ) { - *aInstancePtr = NS_STATIC_CAST(nsISupports*, mXPTCStub); + *aInstancePtr = NS_STATIC_CAST(nsISupports*, this); NS_ADDREF_THIS(); return NS_OK; } @@ -120,13 +118,23 @@ nsProxyEventObject::QueryInterface(REFNSIID aIID, void** aInstancePtr) // nsXPTCStubBase implementation... // +NS_IMETHODIMP +nsProxyEventObject::GetInterfaceInfo(nsIInterfaceInfo** info) +{ + *info = mClass->GetInterfaceInfo(); + NS_ASSERTION(*info, "proxy class without interface"); + + NS_ADDREF(*info); + return NS_OK; +} + nsresult -nsProxyEventObject::convertMiniVariantToVariant(const XPTMethodDescriptor *methodInfo, +nsProxyEventObject::convertMiniVariantToVariant(const nsXPTMethodInfo *methodInfo, nsXPTCMiniVariant * params, nsXPTCVariant **fullParam, uint8 *outParamCount) { - uint8 paramCount = methodInfo->num_args; + uint8 paramCount = methodInfo->GetParamCount(); *outParamCount = paramCount; *fullParam = nsnull; @@ -139,7 +147,7 @@ nsProxyEventObject::convertMiniVariantToVariant(const XPTMethodDescriptor *metho for (int i = 0; i < paramCount; i++) { - const nsXPTParamInfo& paramInfo = methodInfo->params[i]; + const nsXPTParamInfo& paramInfo = methodInfo->GetParam(i); if ((GetProxyType() & NS_PROXY_ASYNC) && paramInfo.IsDipper()) { NS_WARNING("Async proxying of out parameters is not supported"); @@ -181,14 +189,14 @@ nsProxyThreadFilter::AcceptEvent(nsIRunnable *event) NS_IMETHODIMP nsProxyEventObject::CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* methodInfo, + const nsXPTMethodInfo* methodInfo, nsXPTCMiniVariant * params) { NS_ASSERTION(methodIndex > 2, "Calling QI/AddRef/Release through CallMethod"); nsresult rv; - if (XPT_MD_IS_NOTXPCOM(methodInfo->flags)) + if (methodInfo->IsNotXPCOM()) return NS_ERROR_PROXY_INVALID_IN_PARAMETER; nsXPTCVariant *fullParam; @@ -204,8 +212,8 @@ nsProxyEventObject::CallMethod(PRUint16 methodIndex, callDirectly) { // invoke directly using xptc - rv = NS_InvokeByIndex(mRealInterface, methodIndex, - paramCount, fullParam); + rv = XPTC_InvokeByIndex(mRealInterface, methodIndex, + paramCount, fullParam); if (fullParam) free(fullParam); diff --git a/xpcom/proxy/src/nsProxyEventPrivate.h b/xpcom/proxy/src/nsProxyEventPrivate.h index 04cbe279107..dcec286b4c9 100644 --- a/xpcom/proxy/src/nsProxyEventPrivate.h +++ b/xpcom/proxy/src/nsProxyEventPrivate.h @@ -45,7 +45,7 @@ #include "nsIInterfaceInfo.h" #include "nsIProxyObjectManager.h" -#include "nsXPTCUtils.h" +#include "xptcall.h" // defines nsXPTCVariant #include "nsAutoPtr.h" #include "nsCOMPtr.h" @@ -150,31 +150,30 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyObject, NS_PROXYOBJECT_CLASS_IID) * This object is maintained in a singly-linked list from the associated * "parent" nsProxyObject. */ -class nsProxyEventObject : protected nsAutoXPTCStub +class nsProxyEventObject : public nsXPTCStubBase { public: NS_DECL_ISUPPORTS + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info); + // call this method and return result - NS_IMETHOD CallMethod(PRUint16 methodIndex, - const XPTMethodDescriptor* info, - nsXPTCMiniVariant* params); + NS_IMETHOD CallMethod(PRUint16 methodIndex, const nsXPTMethodInfo* info, nsXPTCMiniVariant* params); nsProxyEventClass* GetClass() const { return mClass; } nsISomeInterface* GetProxiedInterface() const { return mRealInterface; } nsIEventTarget* GetTarget() const { return mProxyObject->GetTarget(); } PRInt32 GetProxyType() const { return mProxyObject->GetProxyType(); } - nsresult convertMiniVariantToVariant(const XPTMethodDescriptor *methodInfo, + nsresult convertMiniVariantToVariant(const nsXPTMethodInfo *methodInfo, nsXPTCMiniVariant *params, nsXPTCVariant **fullParam, uint8 *outParamCount); nsProxyEventObject(nsProxyObject *aParent, nsProxyEventClass *aClass, - already_AddRefed aRealInterface, - nsresult *rv); + already_AddRefed aRealInterface); friend class nsProxyObject; @@ -211,7 +210,7 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYEVENT_IID) nsProxyObjectCallInfo(nsProxyEventObject* owner, - const XPTMethodDescriptor *methodInfo, + const nsXPTMethodInfo *methodInfo, PRUint32 methodIndex, nsXPTCVariant* parameterList, PRUint32 parameterCount); @@ -239,7 +238,7 @@ public: private: nsresult mResult; /* this is the return result of the called function */ - const XPTMethodDescriptor *mMethodInfo; + const nsXPTMethodInfo *mMethodInfo; PRUint32 mMethodIndex; /* which method to be called? */ nsXPTCVariant *mParameterList; /* marshalled in parameter buffer */ PRUint32 mParameterCount; /* number of params */ diff --git a/xpcom/reflect/xptcall/porting.html b/xpcom/reflect/xptcall/porting.html index 5b3472c031e..b8b204a1ef6 100644 --- a/xpcom/reflect/xptcall/porting.html +++ b/xpcom/reflect/xptcall/porting.html @@ -47,11 +47,11 @@ There are really two pieces of functionality: invoke and stubs...

The invoke functionality requires the implementation of the -following on each platform (from xptcall/public/xptcall.h): +following on each platform (from xptcall/public/xptcall.h):

 XPTC_PUBLIC_API(nsresult)
-NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
                    PRUint32 paramCount, nsXPTCVariant* params);
 
@@ -80,7 +80,7 @@ can decide how best to do this for their platforms. The stubs functionality is more complex. The goal here is a class whose vtbl can look like the vtbl of any arbitrary xpcom interface. Objects of this class can then be built to impersonate any xpcom object. The base interface -for this is (from xptcall/public/xptcall.h): +for this is (from xptcall/public/xptcall.h):
 class nsXPTCStubBase : public nsISupports
@@ -177,7 +177,7 @@ href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/test">x
 Not all of the functionality is exercised, but it is a place to get started. 
 xptcall/tests
- has an api level test for NS_InvokeByIndex, but no tests for
+ has an api level test for XPTC_InvokeByIndex, but no tests for
 the stubs functionality. Such a test ought to be written, but this has not
 yet been done.
 
diff --git a/xpcom/reflect/xptcall/public/xptcall.h b/xpcom/reflect/xptcall/public/xptcall.h
index 810d071d146..69adda7cd98 100644
--- a/xpcom/reflect/xptcall/public/xptcall.h
+++ b/xpcom/reflect/xptcall/public/xptcall.h
@@ -20,7 +20,6 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * Benjamin Smedberg 
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -46,6 +45,27 @@
 #include "nsISupports.h"
 #include "xpt_struct.h"
 #include "xptinfo.h"
+#include "nsIInterfaceInfo.h"
+
+/***************************************************************************/
+/*
+ * The linkage of XPTC API functions differs depending on whether the file is
+ * used within the XPTC library or not.  Any source file within the XPTC
+ * library should define EXPORT_XPTC_API whereas any client of the library
+ * should not.
+ */
+#ifdef EXPORT_XPTC_API
+# define XPTC_PUBLIC_API(t)   PR_IMPLEMENT(t)
+# define XPTC_PUBLIC_DATA(t)  PR_IMPLEMENT_DATA(t)
+# define XPTC_EXPORT          NS_EXPORT
+#else
+# define XPTC_PUBLIC_API(t)   NS_IMPORT t
+# define XPTC_PUBLIC_DATA(t)  NS_IMPORT t
+# define XPTC_EXPORT          NS_IMPORT
+#endif
+#define XPTC_FRIEND_API(t)    XPTC_PUBLIC_API(t)
+#define XPTC_FRIEND_DATA(t)   XPTC_PUBLIC_DATA(t)
+/***************************************************************************/
 
 struct nsXPTCMiniVariant
 {
@@ -154,48 +174,49 @@ struct nsXPTCVariant : public nsXPTCMiniVariant
     }
 };
 
-class nsIXPTCProxy : public nsISupports
+/***************************************************************************/
+
+#undef  IMETHOD_VISIBILITY
+#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
+
+class XPTC_EXPORT nsXPTCStubBase : public nsISupports
 {
 public:
-    NS_IMETHOD CallMethod(PRUint16 aMethodIndex,
-                          const XPTMethodDescriptor *aInfo,
-                          nsXPTCMiniVariant *aParams) = 0;
+    // We are going to implement this to force the compiler to generate a 
+    // vtbl for this class. Since this is overridden in the inheriting class
+    // we expect it to never be called. 
+    // *This is needed by the Irix implementation.*
+    NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+
+    // Include generated vtbl stub declarations.
+    // These are virtual and *also* implemented by this class..
+#include "xptcstubsdecl.inc"
+
+    // The following methods must be provided by inheritor of this class.
+
+    // return a refcounted pointer to the InterfaceInfo for this object
+    // NOTE: on some platforms this MUST not fail or we crash!
+    NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info) = 0;
+
+    // call this method and return result
+    NS_IMETHOD CallMethod(PRUint16 methodIndex,
+                          const nsXPTMethodInfo* info,
+                          nsXPTCMiniVariant* params) = 0;
 };
 
-/**
- * This is a typedef to avoid confusion between the canonical
- * nsISupports* that provides object identity and an interface pointer
- * for inheriting interfaces that aren't known at compile-time.
- */
-typedef nsISupports nsISomeInterface;
+#undef  IMETHOD_VISIBILITY
+#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
 
-/**
- * Get a proxy object to implement the specified interface.
- *
- * @param aIID    The IID of the interface to implement.
- * @param aOuter  An object to receive method calls from the proxy object.
- *                The stub forwards QueryInterface/AddRef/Release to the
- *                outer object. The proxy object does not hold a reference to
- *                the outer object; it is the caller's responsibility to
- *                ensure that this pointer remains valid until the stub has
- *                been destroyed.
- * @param aStub   Out parameter for the new proxy object. The object is
- *                not addrefed. The object never destroys itself. It must be
- *                explicitly destroyed by calling
- *                NS_DestroyXPTCallStub when it is no longer needed.
- */
-XPCOM_API(nsresult)
-NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
-                  nsISomeInterface* *aStub);
+PR_BEGIN_EXTERN_C
 
-/**
- * Destroys an XPTCall stub previously created with NS_GetXPTCallStub.
- */
-XPCOM_API(void)
-NS_DestroyXPTCallStub(nsISomeInterface* aStub);
+XPTC_PUBLIC_API(nsresult)
+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant* params);
 
-XPCOM_API(nsresult)
-NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                 PRUint32 paramCount, nsXPTCVariant* params);
+// Used to force linking of these obj for the static library into the dll
+extern void xptc_dummy();
+extern void xptc_dummy2();
+
+PR_END_EXTERN_C
 
 #endif /* xptcall_h___ */
diff --git a/xpcom/reflect/xptcall/src/Makefile.in b/xpcom/reflect/xptcall/src/Makefile.in
index 8fe693cbf59..99227490977 100644
--- a/xpcom/reflect/xptcall/src/Makefile.in
+++ b/xpcom/reflect/xptcall/src/Makefile.in
@@ -48,8 +48,6 @@ MOZILLA_INTERNAL_API = 1
 
 DIRS		= md
 
-REQUIRES = string
-
 CPPSRCS		= xptcall.cpp
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
@@ -61,5 +59,3 @@ FORCE_USE_PIC	= 1
 include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= -DEXPORT_XPTC_API -D_IMPL_NS_COM
-
-LOCAL_INCLUDES += -I$(srcdir)/../../xptinfo/src
diff --git a/xpcom/reflect/xptcall/src/md/os2/Makefile.in b/xpcom/reflect/xptcall/src/md/os2/Makefile.in
index aae936e1e66..f82bd26a101 100644
--- a/xpcom/reflect/xptcall/src/md/os2/Makefile.in
+++ b/xpcom/reflect/xptcall/src/md/os2/Makefile.in
@@ -50,11 +50,7 @@ CPPSRCS		= \
 		../unix/xptcinvoke_gcc_x86_unix.cpp \
 		xptcstubs_gcc_x86_os2.cpp \
 		$(NULL)
-REQUIRES = string
-LOCAL_INCLUDES = \
-		-I$(srcdir)/../unix \
-		-I$(srcdir)/../../../../xptinfo/src \
-		$(NULL)
+LOCAL_INCLUDES	= -I$(srcdir)/../unix
 DEFINES		+= -DMOZ_NEED_LEADING_UNDERSCORE
 
 # Force use of PIC
diff --git a/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp b/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp
index 37339877b98..6c3c92ed7e9 100644
--- a/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp
+++ b/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp
@@ -38,7 +38,6 @@
 /* Implement shared vtbl methods. */
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 #include "xptc_platforms_unixish_x86.h"
 #include "xptc_gcc_x86_unix.h"
 
@@ -51,6 +50,7 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
 
     nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
     nsXPTCMiniVariant* dispatchParams = NULL;
+    nsIInterfaceInfo* iface_info = NULL;
     const nsXPTMethodInfo* info;
     PRUint8 paramCount;
     PRUint8 i;
@@ -58,7 +58,12 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
 
     NS_ASSERTION(self,"no self");
 
-    self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
+    self->GetInterfaceInfo(&iface_info);
+    NS_ASSERTION(iface_info,"no interface info");
+
+    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
+    NS_ASSERTION(info,"no interface info");
+
     paramCount = info->GetParamCount();
 
     // setup variant array pointer
@@ -90,7 +95,9 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
         }
     }
 
-    result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+    result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+
+    NS_RELEASE(iface_info);
 
     if(dispatchParams != paramBuffer)
         delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in
index cea265ec81d..463afa7e058 100644
--- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in
+++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in
@@ -46,8 +46,6 @@ MODULE		= xpcom
 LIBRARY_NAME	= xptcmd
 MOZILLA_INTERNAL_API = 1
 
-REQUIRES = string
-
 #
 # The default is this buildable, but non-functioning code.
 #
@@ -380,10 +378,7 @@ include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= -DEXPORT_XPTC_API -D_IMPL_NS_COM
 
-LOCAL_INCLUDES += \
-	-I$(srcdir)/../.. \
-	-I$(srcdir)/../../../../xptinfo/src \
-	$(NULL)
+INCLUDES	+= -I$(srcdir)/../..
 
 ifeq ($(OS_ARCH),Linux)
 ifneq (,$(findstring mips, $(OS_TEST)))
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
index 9d84c8ac0c4..8a5c9afbe7d 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
@@ -31,12 +31,12 @@
 .text
 	.align 2
 #
-#   NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-#                    PRUint32 paramCount, nsXPTCVariant* params)
+#   XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+#                   PRUint32 paramCount, nsXPTCVariant* params)
 #
 
-.globl __NS_InvokeByIndex	
-__NS_InvokeByIndex:
+.globl __XPTC_InvokeByIndex	
+__XPTC_InvokeByIndex:
 	mflr	r0
 	stw	r31,-4(r1)
 #
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
index 5c445b50392..5502b5590d0 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
@@ -91,9 +91,9 @@ xptc_invoke_copy_to_stack_keeper (void)
 
 
 /*
-  EXPORT_XPCOM_API(nsresult)
-  NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                   PRUint32 paramCount, nsXPTCVariant* params);
+  XPTC_PUBLIC_API(nsresult)
+  XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+		     PRUint32 paramCount, nsXPTCVariant* params);
 
   Each param takes at most two 4-byte words.
   It doesn't matter if we push too many words, and calculating the exact
@@ -117,12 +117,12 @@ xptc_invoke_copy_to_stack_keeper (void)
  */
 #if defined(XP_WIN32) || defined(XP_OS2)
 extern "C" {
-    nsresult _NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                               PRUint32 paramCount, nsXPTCVariant* params);
-    EXPORT_XPCOM_API(nsresult)
-    NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                     PRUint32 paramCount, nsXPTCVariant* params) { 
-        return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
+    nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                                   PRUint32 paramCount, nsXPTCVariant* params);
+    XPTC_PUBLIC_API(nsresult)
+         XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                            PRUint32 paramCount, nsXPTCVariant* params) { 
+        return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
     }
 }
 #endif
@@ -133,12 +133,12 @@ __asm__ (
    is what xptcstubs uses. */
 	".align 2\n\t"
 #if defined(XP_WIN32) || defined(XP_OS2)
-	".globl " SYMBOL_UNDERSCORE "_NS_InvokeByIndex\n\t"
-	SYMBOL_UNDERSCORE "_NS_InvokeByIndex:\n\t"
+	".globl " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex\n\t"
+	SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex:\n\t"
 #else
-	".globl " SYMBOL_UNDERSCORE "NS_InvokeByIndex\n\t"
-	".type  " SYMBOL_UNDERSCORE "NS_InvokeByIndex,@function\n"
-	SYMBOL_UNDERSCORE "NS_InvokeByIndex:\n\t"
+	".globl " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
+	".type  " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex,@function\n"
+	SYMBOL_UNDERSCORE "XPTC_InvokeByIndex:\n\t"
 #endif
 	"pushl %ebp\n\t"
 	"movl  %esp, %ebp\n\t"
@@ -193,7 +193,7 @@ __asm__ (
 	"popl  %ebp\n\t"
 	"ret\n"
 #if !defined(XP_WIN32) && !defined(XP_OS2)
-	".size " SYMBOL_UNDERSCORE "NS_InvokeByIndex, . -" SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
+	".size " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
 #endif
 );
 
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
index 4458995cb1a..9a08acfd4b7 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
@@ -133,13 +133,13 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s, double
     }
 }
 
-extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                                      PRUint32 paramCount, 
-                                      nsXPTCVariant* params);
+extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant* params);
 
-EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                 PRUint32 paramCount, nsXPTCVariant* params)
+extern "C"
+XPTC_PUBLIC_API(nsresult)
+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant* params)
 {
-    return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
+    return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
 }    
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
index 1e68b2a382f..90fc8da832b 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
@@ -73,9 +73,9 @@ invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d)
 
 }
 
-EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                 PRUint32 paramCount, nsXPTCVariant* params)
+XPTC_PUBLIC_API(nsresult)
+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant* params)
 {
 #ifdef __GNUC__            /* Gnu compiler. */
   PRUint32 result;
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp
index a817f23efed..a8d2c6e743c 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp
@@ -131,9 +131,10 @@ invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s,
     }
 }
 
-EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex(nsISupports * that, PRUint32 methodIndex,
-                 PRUint32 paramCount, nsXPTCVariant * params)
+extern "C"
+XPTC_PUBLIC_API(nsresult)
+XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant * params)
 {
     PRUint32 nr_gpr, nr_fpr, nr_stack;
     invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
index da5a8c5b764..b12da4e513b 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
@@ -40,7 +40,6 @@
 #ifdef __GNUC__         /* Gnu Compiler. */
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 #include "xptc_platforms_unixish_x86.h"
 #include "xptc_gcc_x86_unix.h"
 
@@ -53,6 +52,7 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
 
     nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
     nsXPTCMiniVariant* dispatchParams = NULL;
+    nsIInterfaceInfo* iface_info = NULL;
     const nsXPTMethodInfo* info;
     PRUint8 paramCount;
     PRUint8 i;
@@ -60,7 +60,12 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
 
     NS_ASSERTION(self,"no self");
 
-    self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
+    self->GetInterfaceInfo(&iface_info);
+    NS_ASSERTION(iface_info,"no interface info");
+
+    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
+    NS_ASSERTION(info,"no interface info");
+
     paramCount = info->GetParamCount();
 
     // setup variant array pointer
@@ -92,7 +97,9 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
         }
     }
 
-    result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+    result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+
+    NS_RELEASE(iface_info);
 
     if(dispatchParams != paramBuffer)
         delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp
index 9c4193f51e9..a7c1883d0a7 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp
@@ -37,7 +37,6 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 
 /* Under the Mac OS X PowerPC ABI, the first 8 integer and 13 floating point
  * parameters are delivered in registers and are not on the stack, although
@@ -81,6 +80,7 @@ PrepareAndDispatch(
 
   nsXPTCMiniVariant      paramBuffer[PARAM_BUFFER_COUNT];
   nsXPTCMiniVariant     *dispatchParams = NULL;
+  nsIInterfaceInfo      *interfaceInfo  = NULL;
   const nsXPTMethodInfo *methodInfo;
   PRUint8                paramCount;
   PRUint8                i;
@@ -95,7 +95,10 @@ PrepareAndDispatch(
 
   NS_ASSERTION(self, "no self");
 
-  self->mEntry->GetMethodInfo(PRUint16(methodIndex), &methodInfo);
+  self->GetInterfaceInfo(&interfaceInfo);
+  NS_ASSERTION(interfaceInfo, "no interface info");
+
+  interfaceInfo->GetMethodInfo(PRUint16(methodIndex), &methodInfo);
   NS_ASSERTION(methodInfo, "no method info");
 
   paramCount = methodInfo->GetParamCount();
@@ -178,8 +181,9 @@ PrepareAndDispatch(
     }
   }
 
-  result = self->mOuter->
-    CallMethod((PRUint16)methodIndex, methodInfo, dispatchParams);
+  result = self->CallMethod((PRUint16)methodIndex, methodInfo, dispatchParams);
+
+  NS_RELEASE(interfaceInfo);
 
   if(dispatchParams != paramBuffer)
     delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp
index 00ffe7260de..0864045f265 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp
@@ -39,7 +39,6 @@
 
 #include "xptcprivate.h"
 #include "xptc_platforms_unixish_x86.h"
-#include "xptiprivate.h"
 
 static nsresult
 PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
@@ -48,6 +47,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
 
     nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
     nsXPTCMiniVariant* dispatchParams = NULL;
+    nsIInterfaceInfo* iface_info = NULL;
     const nsXPTMethodInfo* info;
     PRUint8 paramCount;
     PRUint8 i;
@@ -55,7 +55,10 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
 
     NS_ASSERTION(self,"no self");
 
-    self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
+    self->GetInterfaceInfo(&iface_info);
+    NS_ASSERTION(iface_info,"no interface info");
+
+    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
     NS_ASSERTION(info,"no interface info");
 
     paramCount = info->GetParamCount();
@@ -89,8 +92,9 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
         }
     }
 
-    result = self->mOuter->
-        CallMethod((PRUint16)methodIndex, info, dispatchParams);
+    result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+
+    NS_RELEASE(iface_info);
 
     if(dispatchParams != paramBuffer)
         delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
index 72bf5826ddd..3e80ebe1dce 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
@@ -39,7 +39,6 @@
 // Implement shared vtbl methods.
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 
 // The Linux/x86-64 ABI passes the first 6 integer parameters and the
 // first 8 floating point parameters in registers (rdi, rsi, rdx, rcx,
@@ -66,6 +65,7 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
 {
     nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
     nsXPTCMiniVariant* dispatchParams = NULL;
+    nsIInterfaceInfo* iface_info = NULL;
     const nsXPTMethodInfo* info;
     PRUint32 paramCount;
     PRUint32 i;
@@ -73,7 +73,12 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
 
     NS_ASSERTION(self,"no self");
 
-    self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
+    self->GetInterfaceInfo(&iface_info);
+    NS_ASSERTION(iface_info,"no interface info");
+    if (!iface_info)
+        return NS_ERROR_UNEXPECTED;
+
+    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
     NS_ASSERTION(info,"no method info");
     if (!info)
         return NS_ERROR_UNEXPECTED;
@@ -148,7 +153,9 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
         }
     }
 
-    result = self->mOuter->CallMethod((PRUint16) methodIndex, info, dispatchParams);
+    result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
+
+    NS_RELEASE(iface_info);
 
     if (dispatchParams != paramBuffer)
         delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/xpcom/reflect/xptcall/src/md/win32/Makefile.in
index 31d21cddc0c..2f60597d11b 100644
--- a/xpcom/reflect/xptcall/src/md/win32/Makefile.in
+++ b/xpcom/reflect/xptcall/src/md/win32/Makefile.in
@@ -62,9 +62,6 @@ CPPSRCS		= xptcinvoke.cpp xptcstubs.cpp
 
 endif
 
-REQUIRES = string
-
-LOCAL_INCLUDES += -I$(srcdir)/../../../../xptinfo/src
 
 # Force use of PIC
 FORCE_USE_PIC	= 1
diff --git a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
index 145c58002a5..9fbf2f94b71 100644
--- a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
+++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
@@ -77,9 +77,9 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s)
 }
 
 #pragma warning(disable : 4035) // OK to have no return value
-extern "C" NS_EXPORT __declspec(naked) nsresult NS_FROZENCALL
-NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
-                 PRUint32 paramCount, nsXPTCVariant* params)
+__declspec(naked) XPTC_PUBLIC_API(nsresult)
+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                   PRUint32 paramCount, nsXPTCVariant* params)
 {
     __asm {
         push    ebp
diff --git a/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp b/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp
index 5f3679a15a9..bd5ab975910 100644
--- a/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp
+++ b/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp
@@ -38,7 +38,6 @@
 /* Implement shared vtbl methods. */
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 
 #ifndef WIN32
 #error "This code is for Win32 only"
@@ -54,6 +53,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex,
 
     nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
     nsXPTCMiniVariant* dispatchParams = NULL;
+    nsIInterfaceInfo* iface_info = NULL;
     const nsXPTMethodInfo* info = NULL;
     PRUint8 paramCount;
     PRUint8 i;
@@ -64,8 +64,11 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex,
 
     NS_ASSERTION(self,"no self");
 
-    self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
-    NS_ASSERTION(info,"no method info");
+    self->GetInterfaceInfo(&iface_info);
+    NS_ASSERTION(iface_info,"no interface info");
+
+    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
+    NS_ASSERTION(info,"no interface info");
 
     paramCount = info->GetParamCount();
 
@@ -111,7 +114,9 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex,
     }
     *stackBytesToPop = ((PRUint32)ap) - ((PRUint32)args);
 
-    result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+    result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+
+    NS_RELEASE(iface_info);
 
     if(dispatchParams != paramBuffer)
         delete [] dispatchParams;
diff --git a/xpcom/reflect/xptcall/src/xptcall.cpp b/xpcom/reflect/xptcall/src/xptcall.cpp
index 0d08ecedbff..8a459170e2a 100644
--- a/xpcom/reflect/xptcall/src/xptcall.cpp
+++ b/xpcom/reflect/xptcall/src/xptcall.cpp
@@ -38,58 +38,18 @@
 /* entry point wrappers. */
 
 #include "xptcprivate.h"
-#include "xptiprivate.h"
 
-NS_IMETHODIMP
-nsXPTCStubBase::QueryInterface(REFNSIID aIID,
-                               void **aInstancePtr)
+// This method is never called and is only here so the compiler
+// will generate a vtbl for this class. 
+// *Needed by the Irix implementation.*
+NS_IMETHODIMP nsXPTCStubBase::QueryInterface(REFNSIID aIID,
+                                             void** aInstancePtr)
 {
-    if (aIID.Equals(mEntry->mIID)) {
-        NS_ADDREF_THIS();
-        *aInstancePtr = NS_STATIC_CAST(nsISupports*, this);
-        return NS_OK;
-    }
-
-    return mOuter->QueryInterface(aIID, aInstancePtr);
+   NS_ASSERTION(0,"wowa! nsXPTCStubBase::QueryInterface called");
+   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP_(nsrefcnt)
-nsXPTCStubBase::AddRef()
+void
+xptc_dummy2()
 {
-    return mOuter->AddRef();
-}
-
-NS_IMETHODIMP_(nsrefcnt)
-nsXPTCStubBase::Release()
-{
-    return mOuter->Release();
-}
-
-EXPORT_XPCOM_API(nsresult)
-NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
-                  nsISomeInterface* *aResult)
-{
-    NS_ENSURE_ARG(aOuter && aResult);
-
-    xptiInterfaceInfoManager *iim =
-        xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
-    NS_ENSURE_TRUE(iim, NS_ERROR_NOT_INITIALIZED);
-
-    xptiInterfaceEntry *iie = iim->GetInterfaceEntryForIID(&aIID);
-    if (!iie || !iie->EnsureResolved())
-        return NS_ERROR_FAILURE;
-
-    nsXPTCStubBase* newbase = new nsXPTCStubBase(aOuter, iie);
-    if (!newbase)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    *aResult = newbase;
-    return NS_OK;
-}
-
-EXPORT_XPCOM_API(void)
-NS_DestroyXPTCallStub(nsISomeInterface* aStub)
-{
-    nsXPTCStubBase* stub = NS_STATIC_CAST(nsXPTCStubBase*, aStub);
-    delete(stub);
 }
diff --git a/xpcom/reflect/xptcall/src/xptcprivate.h b/xpcom/reflect/xptcall/src/xptcprivate.h
index a8a6ed39e59..3691fa0a5cc 100644
--- a/xpcom/reflect/xptcall/src/xptcprivate.h
+++ b/xpcom/reflect/xptcall/src/xptcprivate.h
@@ -41,52 +41,5 @@
 #define xptcprivate_h___
 
 #include "xptcall.h"
-#include "nsAutoPtr.h"
-
-class xptiInterfaceEntry;
-
-#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n() = 0;
-#else
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64) = 0;
-#endif
-
-#define SENTINEL_ENTRY(n) NS_IMETHOD Sentinel##n() = 0;
-
-class nsIXPTCStubBase : public nsISupports
-{
-public:
-#include "xptcstubsdef.inc"
-};
-
-#undef STUB_ENTRY
-#undef SENTINEL_ENTRY
-
-#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n();
-#else
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
-#endif
-
-#define SENTINEL_ENTRY(n) NS_IMETHOD Sentinel##n();
-
-class nsXPTCStubBase : public nsIXPTCStubBase
-{
-public:
-    NS_DECL_ISUPPORTS_INHERITED
-
-#include "xptcstubsdef.inc"
-
-    nsXPTCStubBase(nsIXPTCProxy* aOuter, xptiInterfaceEntry *aEntry) :
-        mOuter(aOuter), mEntry(aEntry) { }
-
-    nsIXPTCProxy*          mOuter;
-    xptiInterfaceEntry*    mEntry;
-
-    ~nsXPTCStubBase() { }
-};
-
-#undef STUB_ENTRY
-#undef SENTINEL_ENTRY
 
 #endif /* xptcprivate_h___ */
diff --git a/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp b/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
index 224416a0529..76829eb2ad8 100644
--- a/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
+++ b/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
@@ -413,7 +413,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.i32;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 3, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 3, 3, var)))
         printf("\t1 + 1 = %d\n", var[2].val.i32);
     else
         printf("\tFAILED");
@@ -431,7 +431,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.i64;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 5, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 5, 3, var)))
         printf("\t1L + 1L = %d\n", (int)var[2].val.i64);
     else
         printf("\tFAILED");
@@ -449,7 +449,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.i32;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 4, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 4, 3, var)))
         printf("\t2 * 2 = %d\n", var[2].val.i32);
     else
         printf("\tFAILED");
@@ -467,7 +467,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.i64;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 6, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 6, 3, var)))
         printf("\t2L * 2L = %d\n", (int)var[2].val.i64);
     else
         printf("\tFAILED");
@@ -517,7 +517,7 @@ int main()
     var[10].flags = nsXPTCVariant::PTR_IS_DATA;
     var[10].ptr = &var[10].val.i32;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 7, 11, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 7, 11, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n",
                 var[10].val.i32);
 
@@ -534,7 +534,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.f;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 8, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 8, 3, var)))
         printf("\t1 + 2 = %ff\n",
                 (double) var[2].val.f);
 
@@ -584,7 +584,7 @@ int main()
     var[10].flags = nsXPTCVariant::PTR_IS_DATA;
     var[10].ptr = &var[10].val.d;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 9, 11, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 9, 11, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %f\n",
                 var[10].val.d);
     else
@@ -635,7 +635,7 @@ int main()
     var[10].flags = nsXPTCVariant::PTR_IS_DATA;
     var[10].ptr = &var[10].val.f;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 10, 11, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 10, 11, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %ff\n",
                 (double) var[10].val.f);
     else
@@ -726,7 +726,7 @@ int main()
     var[20].flags = nsXPTCVariant::PTR_IS_DATA;
     var[20].ptr = &var[20].val.f;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 11, 21, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 11, 21, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = %ff\n",
                 (double) var[20].val.f);
 
@@ -775,7 +775,7 @@ int main()
     var[10].flags = nsXPTCVariant::PTR_IS_DATA;
     var[10].ptr = &var[10].val.i64;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 12, 11, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 12, 11, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n",
 	       (int)var[10].val.i64);
     else
@@ -826,7 +826,7 @@ int main()
     var[10].flags = nsXPTCVariant::PTR_IS_DATA;
     var[10].ptr = &var[10].val.i64;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 13, 11, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 13, 11, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n",
 	       (int)var[10].val.i64);
     else
@@ -881,7 +881,7 @@ int main()
     var[11].flags = nsXPTCVariant::PTR_IS_DATA;
     var[11].ptr = &var[11].val.d;
 
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 14, 12, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 14, 12, var)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n",
                 var[11].val.d);
     else
@@ -900,7 +900,7 @@ int main()
     var[2].flags = nsXPTCVariant::PTR_IS_DATA;
     var[2].ptr = &var[2].val.p;
     
-    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 15, 3, var)))
+    if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 15, 3, var)))
         printf(" = %s\n", var[2].val.p);
     else
         printf("\tFAILED");
@@ -1119,12 +1119,12 @@ static void DoMultipleInheritenceTest()
         var[0].val.i32 = 1;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(foo, 3, 1, var);
+        XPTC_InvokeByIndex(foo, 3, 1, var);
 
         var[0].val.i32 = 2;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(foo, 4, 1, var);
+        XPTC_InvokeByIndex(foo, 4, 1, var);
 
         printf("\n");
 
@@ -1137,12 +1137,12 @@ static void DoMultipleInheritenceTest()
         var[0].val.i32 = 1;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(bar, 3, 1, var);
+        XPTC_InvokeByIndex(bar, 3, 1, var);
 
         var[0].val.i32 = 2;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(bar, 4, 1, var);
+        XPTC_InvokeByIndex(bar, 4, 1, var);
 
         printf("\n");
 
@@ -1289,12 +1289,12 @@ static void DoMultipleInheritenceTest2()
         var[0].val.i32 = 1;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(foo, 3, 1, var);
+        XPTC_InvokeByIndex(foo, 3, 1, var);
 
         var[0].val.i32 = 2;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(foo, 4, 1, var);
+        XPTC_InvokeByIndex(foo, 4, 1, var);
 
         printf("\n");
 
@@ -1307,12 +1307,12 @@ static void DoMultipleInheritenceTest2()
         var[0].val.i32 = 1;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(bar, 3, 1, var);
+        XPTC_InvokeByIndex(bar, 3, 1, var);
 
         var[0].val.i32 = 2;
         var[0].type = nsXPTType::T_I32;
         var[0].flags = 0;
-        NS_InvokeByIndex(bar, 4, 1, var);
+        XPTC_InvokeByIndex(bar, 4, 1, var);
 
         printf("\n");
 
@@ -1362,7 +1362,7 @@ static void DoSpeedTest()
     printf("Doing %d invoked call iterations...\n", count); 
     start = PR_IntervalNow();
     for(i = count; i; i--)
-        (void)NS_InvokeByIndex(test, 3, 3, var);
+        (void)XPTC_InvokeByIndex(test, 3, 3, var);
     interval_invoke = PR_IntervalNow() - start;
 
     printf(" direct took %0.2f seconds\n", 
diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
index 92c17ec6a7b..a6cf5abdc2c 100644
--- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
+++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
@@ -1724,21 +1724,18 @@ EntryToInfo(xptiInterfaceEntry* entry, nsIInterfaceInfo **_retval)
     return NS_OK;    
 }
 
-xptiInterfaceEntry*
-xptiInterfaceInfoManager::GetInterfaceEntryForIID(const nsIID *iid)
-{
-    xptiHashEntry *hashEntry = (xptiHashEntry*)
-        PL_DHashTableOperate(mWorkingSet.mIIDTable, iid, PL_DHASH_LOOKUP);
-    return PL_DHASH_ENTRY_IS_FREE(hashEntry) ? nsnull : hashEntry->value;
-}
-
 /* nsIInterfaceInfo getInfoForIID (in nsIIDPtr iid); */
 NS_IMETHODIMP xptiInterfaceInfoManager::GetInfoForIID(const nsIID * iid, nsIInterfaceInfo **_retval)
 {
     NS_ASSERTION(iid, "bad param");
     NS_ASSERTION(_retval, "bad param");
 
-    xptiInterfaceEntry* entry = GetInterfaceEntryForIID(iid);
+    xptiHashEntry* hashEntry = (xptiHashEntry*)
+        PL_DHashTableOperate(mWorkingSet.mIIDTable, iid, PL_DHASH_LOOKUP);
+
+    xptiInterfaceEntry* entry = 
+        PL_DHASH_ENTRY_IS_FREE(hashEntry) ? nsnull : hashEntry->value;
+
     return EntryToInfo(entry, _retval);
 }
 
diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h
index 70c48d6cacb..8568ba6765e 100644
--- a/xpcom/reflect/xptinfo/src/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/src/xptiprivate.h
@@ -627,8 +627,6 @@ public:
 
     //////////////////////
 
-    nsID                    mIID;
-
 private:
     xptiInterfaceEntry();   // not implemented
 
@@ -668,6 +666,7 @@ private:
                             const XPTTypeDescriptor** type);
 
 private:
+    nsID                    mIID;
     union {
         xptiTypelib         mTypelib;     // Valid only until resolved.
         xptiInterfaceGuts*  mInterface;   // Valid only after resolved.
@@ -907,8 +906,6 @@ public:
 
     static void WriteToLog(const char *fmt, ...);
 
-    xptiInterfaceEntry* GetInterfaceEntryForIID(const nsIID *iid);
-
 private:
     ~xptiInterfaceInfoManager();
     xptiInterfaceInfoManager(); // not implmented