Bug 375449 - NS_InvokeByIndex not exported from xpcom, only from xpcom_core, r=dbaron
authorbenjamin@smedbergs.us
Tue, 24 Apr 2007 10:02:51 -0700
changeset 760 fedcde3827276a856a31ebd09370f5eb4e40afd6
parent 759 3bd3515f289034328d814222487507452353d633
child 761 f6ab8d7ab5f9d29764bc370ab7e7f795e172a8fb
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs375449
milestone1.9a4pre
Bug 375449 - NS_InvokeByIndex not exported from xpcom, only from xpcom_core, r=dbaron
extensions/java/xpcom/glue/Makefile.in
xpcom/build/nsXPCOMPrivate.h
xpcom/glue/standalone/nsXPCOMGlue.cpp
xpcom/reflect/xptcall/public/xptcall.h
xpcom/reflect/xptcall/tests/Makefile.in
xpcom/reflect/xptinfo/tests/Makefile.in
xpcom/stub/nsXPComStub.cpp
--- a/extensions/java/xpcom/glue/Makefile.in
+++ b/extensions/java/xpcom/glue/Makefile.in
@@ -52,16 +52,20 @@ endif
 ifeq ($(OS_ARCH),Darwin)
 DLL_SUFFIX = .jnilib
 endif
 
 CPPSRCS	= nsJavaXPCOMGlue.cpp
 
 DEFINES += -DXPCOM_GLUE
 
+REQUIRES += \
+  xpcom \
+  $(NULL)
+
 LOCAL_INCLUDES	= -I$(JAVA_INCLUDE_PATH)
 
 ifeq ($(OS_ARCH),WINNT)
 LOCAL_INCLUDES += -I$(JAVA_INCLUDE_PATH)/win32
 else
 ifeq ($(OS_ARCH),OS2)
 LOCAL_INCLUDES += -I$(JAVA_INCLUDE_PATH)/OS2
 else
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -37,16 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsXPComPrivate_h__
 #define nsXPComPrivate_h__
 
 #include "nscore.h"
 #include "nsXPCOM.h"
 #include "nsXPCOMStrings.h"
+#include "xptcall.h"
 
 class nsStringContainer;
 class nsCStringContainer;
 class nsIComponentLoader;
 
 /**
  * During this shutdown notification all threads which run XPCOM code must
  * be joined.
@@ -105,16 +106,20 @@ typedef void       (* DebugBreakFunc)(PR
                                       const char *aFile, PRInt32 aLine);
 
 typedef void       (* xpcomVoidFunc)();
 typedef void       (* LogAddRefFunc)(void*, nsrefcnt, const char*, PRUint32);
 typedef void       (* LogReleaseFunc)(void*, nsrefcnt, const char*);
 typedef void       (* LogCtorFunc)(void*, const char*, PRUint32);
 typedef void       (* LogCOMPtrFunc)(void*, nsISupports*);
 
+typedef nsresult   (* GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*, nsISomeInterface**);
+typedef void       (* DestroyXPTCallStubFunc)(nsISomeInterface*);
+typedef nsresult   (* InvokeByIndexFunc)(nsISupports*, PRUint32, PRUint32, nsXPTCVariant*);
+
 // PRIVATE AND DEPRECATED
 typedef NS_CALLBACK(XPCOMExitRoutine)(void);
 
 typedef nsresult   (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, PRUint32 priority);
 typedef nsresult   (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
 
 typedef struct XPCOMFunctions{
     PRUint32 version;
@@ -169,16 +174,19 @@ typedef struct XPCOMFunctions{
     xpcomVoidFunc logInitFunc;
     xpcomVoidFunc logTermFunc;
     LogAddRefFunc logAddRefFunc;
     LogReleaseFunc logReleaseFunc;
     LogCtorFunc logCtorFunc;
     LogCtorFunc logDtorFunc;
     LogCOMPtrFunc logCOMPtrAddRefFunc;
     LogCOMPtrFunc logCOMPtrReleaseFunc;
+    GetXPTCallStubFunc getXPTCallStubFunc;
+    DestroyXPTCallStubFunc destroyXPTCallStubFunc;
+    InvokeByIndexFunc invokeByIndexFunc;
 
 } XPCOMFunctions;
 
 typedef nsresult (PR_CALLBACK *GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
 XPCOM_API(nsresult)
 NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
 
 // think hard before changing this
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -486,16 +486,43 @@ NS_LogCOMPtrAddRef(void *aCOMPtr, nsISup
 
 XPCOM_API(void)
 NS_LogCOMPtrRelease(void *aCOMPtr, nsISupports *aObject)
 {
     if (xpcomFunctions.logCOMPtrReleaseFunc)
         xpcomFunctions.logCOMPtrReleaseFunc(aCOMPtr, aObject);
 }
 
+XPCOM_API(nsresult)
+NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
+                  nsISomeInterface* *aStub)
+{
+    if (!xpcomFunctions.getXPTCallStubFunc)
+        return NS_ERROR_NOT_INITIALIZED;
+
+    return xpcomFunctions.getXPTCallStubFunc(aIID, aOuter, aStub);
+}
+
+XPCOM_API(void)
+NS_DestroyXPTCallStub(nsISomeInterface* aStub)
+{
+    if (xpcomFunctions.destroyXPTCallStubFunc)
+        xpcomFunctions.destroyXPTCallStubFunc(aStub);
+}
+
+XPCOM_API(nsresult)
+NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                 PRUint32 paramCount, nsXPTCVariant* params)
+{
+    if (!xpcomFunctions.invokeByIndexFunc)
+        return NS_ERROR_NOT_INITIALIZED;
+
+    return xpcomFunctions.invokeByIndexFunc(that, methodIndex,
+                                            paramCount, params);
+}
 
 // Default GRE startup/shutdown code
 
 extern "C"
 nsresult GRE_Startup()
 {
     const char* xpcomLocation = GRE_GetXPCOMPath();
 
--- a/xpcom/reflect/xptcall/public/xptcall.h
+++ b/xpcom/reflect/xptcall/public/xptcall.h
@@ -36,16 +36,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* Public declarations for xptcall. */
 
 #ifndef xptcall_h___
 #define xptcall_h___
 
+#ifdef MOZILLA_INTERNAL_API
+# define NS_GetXPTCallStub     NS_GetXPTCallStub_P
+# define NS_DestroyXPTCallStub NS_DestroyXPTCallStub_P
+# define NS_InvokeByIndex      NS_InvokeByIndex_P
+#endif
+
 #include "prtypes.h"
 #include "nscore.h"
 #include "nsISupports.h"
 #include "xpt_struct.h"
 #include "xptinfo.h"
 
 struct nsXPTCMiniVariant
 {
--- a/xpcom/reflect/xptcall/tests/Makefile.in
+++ b/xpcom/reflect/xptcall/tests/Makefile.in
@@ -45,17 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= TestXPTC
 SIMPLE_PROGRAMS	= TestXPTCInvoke$(BIN_SUFFIX)
 REQUIRES	= xpcom \
 		  $(NULL)
 
 CPPSRCS		= TestXPTCInvoke.cpp
 
 LIBS		= \
-		$(XPCOM_LIBS) \
+		$(XPCOM_GLUE_LDOPTS) \
 		$(NSPR_LIBS) \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 # For _write().
 ifeq ($(OS_ARCH),BSD_OS)
 OS_LIBS		+= -lgcc
--- a/xpcom/reflect/xptinfo/tests/Makefile.in
+++ b/xpcom/reflect/xptinfo/tests/Makefile.in
@@ -44,13 +44,13 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= xpcom
 
 SIMPLE_PROGRAMS	= TestInterfaceInfo$(BIN_SUFFIX)
 
 CPPSRCS		= TestInterfaceInfo.cpp
 
 LIBS		= \
-		$(XPCOM_LIBS) \
+		$(XPCOM_GLUE_LDOPTS) \
 		$(NSPR_LIBS) \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/xpcom/stub/nsXPComStub.cpp
+++ b/xpcom/stub/nsXPComStub.cpp
@@ -33,16 +33,17 @@
  * 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 ***** */
 
 #include "nsXPCOM.h"
 #include "nsXPCOMPrivate.h"
 #include "nsXPCOMStrings.h"
+#include "xptcall.h"
 
 #include <string.h>
 
 /**
  * Private Method to register an exit routine.  This method
  * used to allow you to setup a callback that will be called from 
  * the NS_ShutdownXPCOM function after all services and 
  * components have gone away. It was fatally flawed in that the component
@@ -105,17 +106,20 @@ static const XPCOMFunctions kFrozenFunct
     &NS_DebugBreak_P,
     &NS_LogInit_P,
     &NS_LogTerm_P,
     &NS_LogAddRef_P,
     &NS_LogRelease_P,
     &NS_LogCtor_P,
     &NS_LogDtor_P,
     &NS_LogCOMPtrAddRef_P,
-    &NS_LogCOMPtrRelease_P
+    &NS_LogCOMPtrRelease_P,
+    &NS_GetXPTCallStub_P,
+    &NS_DestroyXPTCallStub_P,
+    &NS_InvokeByIndex_P
 };
 
 EXPORT_XPCOM_API(nsresult)
 NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
 {
     if (!functions)
         return NS_ERROR_OUT_OF_MEMORY;
 
@@ -306,16 +310,38 @@ NS_LogCOMPtrAddRef(void *aCOMPtr, nsISup
 
 #undef NS_LogCOMPtrRelease
 EXPORT_XPCOM_API(void)
 NS_LogCOMPtrRelease(void *aCOMPtr, nsISupports* aObject)
 {
   NS_LogCOMPtrRelease_P(aCOMPtr, aObject);
 }
 
+#undef NS_GetXPTCallStub
+EXPORT_XPCOM_API(nsresult)
+NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
+                  nsISomeInterface* *aStub)
+{
+  return NS_GetXPTCallStub_P(aIID, aOuter, aStub);
+}
+
+#undef NS_DestroyXPTCallStub
+EXPORT_XPCOM_API(void)
+NS_DestroyXPTCallStub(nsISomeInterface* aStub)
+{
+  NS_DestroyXPTCallStub_P(aStub);
+}
+
+#undef NS_InvokeByIndex
+EXPORT_XPCOM_API(nsresult)
+NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+                 PRUint32 paramCount, nsXPTCVariant* params)
+{
+  return NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
+}
 
 /*
  * Stubs for nsXPCOMPrivate.h
  */
 
 EXPORT_XPCOM_API(nsresult)
 NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
 {