Bug 366617 - Crash when running JavaXPCOM app in IBM JVM. Missing JNICALL in some method declarations. XULRunner only.

This commit is contained in:
pedemont%us.ibm.com 2007-01-11 19:24:27 +00:00
Родитель b83301cd59
Коммит 4e69f18c7e
4 изменённых файлов: 72 добавлений и 32 удалений

Просмотреть файл

@ -131,6 +131,45 @@ LoadXULMethods(JNIEnv* env, jobject aXPCOMPath, void** aFunctions)
if (NS_FAILED(rv))
return rv;
#ifdef XP_WIN32
// The JNICALL calling convention defines to "__stdcall" on Win32, which
// mangles the name.
nsDynamicFunctionLoad funcs[] = {
{ "_Java_org_mozilla_xpcom_internal_MozillaImpl_initialize@8",
(NSFuncPtr*) &aFunctions[kFunc_Initialize] },
{ "_Java_org_mozilla_xpcom_internal_GREImpl_initEmbedding@20",
(NSFuncPtr*) &aFunctions[kFunc_InitEmbedding] },
{ "_Java_org_mozilla_xpcom_internal_GREImpl_termEmbedding@8",
(NSFuncPtr*) &aFunctions[kFunc_TermEmbedding] },
{ "_Java_org_mozilla_xpcom_internal_GREImpl_lockProfileDirectory@12",
(NSFuncPtr*) &aFunctions[kFunc_LockProfileDirectory] },
{ "_Java_org_mozilla_xpcom_internal_GREImpl_notifyProfile@8",
(NSFuncPtr*) &aFunctions[kFunc_NotifyProfile] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_initXPCOM@16",
(NSFuncPtr*) &aFunctions[kFunc_InitXPCOM] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_shutdownXPCOM@12",
(NSFuncPtr*) &aFunctions[kFunc_ShutdownXPCOM] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_getComponentManager@8",
(NSFuncPtr*) &aFunctions[kFunc_GetComponentManager] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_getComponentRegistrar@8",
(NSFuncPtr*) &aFunctions[kFunc_GetComponentRegistrar] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_getServiceManager@8",
(NSFuncPtr*) &aFunctions[kFunc_GetServiceManager] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMImpl_newLocalFile@16",
(NSFuncPtr*) &aFunctions[kFunc_NewLocalFile] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMJavaProxy_callXPCOMMethod@20",
(NSFuncPtr*) &aFunctions[kFunc_CallXPCOMMethod] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMJavaProxy_finalizeProxy@12",
(NSFuncPtr*) &aFunctions[kFunc_FinalizeProxy] },
{ "_Java_org_mozilla_xpcom_internal_XPCOMJavaProxy_isSameXPCOMObject@16",
(NSFuncPtr*) &aFunctions[kFunc_IsSameXPCOMObject] },
{ "_Java_org_mozilla_xpcom_ProfileLock_release@16",
(NSFuncPtr*) &aFunctions[kFunc_ReleaseProfileLock] },
{ "Java_org_mozilla_xpcom_internal_MozillaImpl_getNativeHandleFromAWT@12",
(NSFuncPtr*) &aFunctions[kFunc_GetNativeHandleFromAWT] },
{ nsnull, nsnull }
};
#else
nsDynamicFunctionLoad funcs[] = {
{ "Java_org_mozilla_xpcom_internal_MozillaImpl_initialize",
(NSFuncPtr*) &aFunctions[kFunc_Initialize] },
@ -166,6 +205,7 @@ LoadXULMethods(JNIEnv* env, jobject aXPCOMPath, void** aFunctions)
(NSFuncPtr*) &aFunctions[kFunc_GetNativeHandleFromAWT] },
{ nsnull, nsnull }
};
#endif
rv = XPCOMGlueLoadXULFunctions(funcs);
if (NS_FAILED(rv))

Просмотреть файл

@ -53,7 +53,7 @@
#endif
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
MOZILLA_NATIVE(initialize) (JNIEnv* env, jobject)
{
if (!InitializeJavaGlobals(env)) {
@ -95,7 +95,7 @@ InitEmbedding_Impl(JNIEnv* env, jobject aLibXULDirectory,
return XRE_InitEmbedding(libXULDir, appDir, provider, nsnull, 0);
}
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(initEmbedding) (JNIEnv* env, jobject, jobject aLibXULDirectory,
jobject aAppDirectory, jobject aAppDirProvider)
{
@ -108,7 +108,7 @@ GRE_NATIVE(initEmbedding) (JNIEnv* env, jobject, jobject aLibXULDirectory,
}
}
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(termEmbedding) (JNIEnv *env, jobject)
{
// Free globals before calling XRE_TermEmbedding(), since we need some
@ -152,7 +152,7 @@ InitXPCOM_Impl(JNIEnv* env, jobject aMozBinDirectory,
nsnull, aResult);
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(initXPCOM) (JNIEnv* env, jobject, jobject aMozBinDirectory,
jobject aAppFileLocProvider)
{
@ -167,7 +167,7 @@ XPCOM_NATIVE(initXPCOM) (JNIEnv* env, jobject, jobject aMozBinDirectory,
return nsnull;
}
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr)
{
nsresult rv;
@ -191,7 +191,7 @@ XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr)
ThrowException(env, rv, "NS_ShutdownXPCOM failed");
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(newLocalFile) (JNIEnv *env, jobject, jstring aPath,
jboolean aFollowLinks)
{
@ -222,7 +222,7 @@ XPCOM_NATIVE(newLocalFile) (JNIEnv *env, jobject, jstring aPath,
return nsnull;
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getComponentManager) (JNIEnv *env, jobject)
{
// Call XPCOM method
@ -241,7 +241,7 @@ XPCOM_NATIVE(getComponentManager) (JNIEnv *env, jobject)
return nsnull;
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getComponentRegistrar) (JNIEnv *env, jobject)
{
// Call XPCOM method
@ -260,7 +260,7 @@ XPCOM_NATIVE(getComponentRegistrar) (JNIEnv *env, jobject)
return nsnull;
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getServiceManager) (JNIEnv *env, jobject)
{
// Call XPCOM method
@ -279,7 +279,7 @@ XPCOM_NATIVE(getServiceManager) (JNIEnv *env, jobject)
return nsnull;
}
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
GRE_NATIVE(lockProfileDirectory) (JNIEnv* env, jobject, jobject aDirectory)
{
nsresult rv = NS_ERROR_FAILURE;
@ -312,7 +312,7 @@ GRE_NATIVE(lockProfileDirectory) (JNIEnv* env, jobject, jobject aDirectory)
return nsnull;
}
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(notifyProfile) (JNIEnv *env, jobject)
{
XRE_NotifyProfile();
@ -322,7 +322,7 @@ GRE_NATIVE(notifyProfile) (JNIEnv *env, jobject)
extern PRUint64 GetPlatformHandle(JAWT_DrawingSurfaceInfo* dsi);
#endif
extern "C" NS_EXPORT jlong
extern "C" NS_EXPORT jlong JNICALL
MOZILLA_NATIVE(getNativeHandleFromAWT) (JNIEnv* env, jobject clazz,
jobject widget)
{

Просмотреть файл

@ -48,63 +48,63 @@
#define LOCKPROXY_NATIVE(func) Java_org_mozilla_xpcom_ProfileLock_##func
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
MOZILLA_NATIVE(initialize) (JNIEnv* env, jobject);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(initEmbedding) (JNIEnv* env, jobject, jobject aLibXULDirectory,
jobject aAppDirectory, jobject aAppDirProvider);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(termEmbedding) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
GRE_NATIVE(lockProfileDirectory) (JNIEnv *, jobject, jobject aDirectory);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(notifyProfile) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
GRE_NATIVE(lockProfileDirectory) (JNIEnv *, jobject, jobject aDirectory);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
GRE_NATIVE(notifyProfile) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(initXPCOM) (JNIEnv* env, jobject, jobject aMozBinDirectory,
jobject aAppFileLocProvider);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(newLocalFile) (JNIEnv *env, jobject, jstring aPath,
jboolean aFollowLinks);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getComponentManager) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getComponentRegistrar) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
XPCOM_NATIVE(getServiceManager) (JNIEnv *env, jobject);
extern "C" NS_EXPORT jobject
extern "C" NS_EXPORT jobject JNICALL
JAVAPROXY_NATIVE(callXPCOMMethod) (JNIEnv *env, jclass that, jobject aJavaProxy,
jstring aMethodName, jobjectArray aParams);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
JAVAPROXY_NATIVE(finalizeProxy) (JNIEnv *env, jclass that, jobject aJavaProxy);
extern "C" NS_EXPORT jboolean
extern "C" NS_EXPORT jboolean JNICALL
JAVAPROXY_NATIVE(isSameXPCOMObject) (JNIEnv *env, jclass that, jobject aProxy1,
jobject aProxy2);
extern "C" NS_EXPORT void
extern "C" NS_EXPORT void JNICALL
LOCKPROXY_NATIVE(release) (JNIEnv *env, jclass that, jlong aLockObject);
extern "C" NS_EXPORT jlong
extern "C" NS_EXPORT jlong JNICALL
MOZILLA_NATIVE(getNativeHandleFromAWT) (JNIEnv* env, jobject, jobject widget);
#endif // _nsJavaInterfaces_h_

Просмотреть файл

@ -718,7 +718,7 @@ JavaToXPTCStubMap::Add(jint aJavaObjectHashCode, nsJavaXPTCStub* aProxy)
iface_info->GetInterfaceIID(&iid);
char* iid_str = iid->ToString();
LOG(("+ JavaToXPTCStubMap (Java=%08x | XPCOM=%08x | IID=%s)\n",
(PRUint32) hash, (PRUint32) aProxy, iid_str));
(PRUint32) aJavaObjectHashCode, (PRUint32) aProxy, iid_str));
PR_Free(iid_str);
nsMemory::Free(iid);
NS_RELEASE(iface_info);
@ -751,7 +751,7 @@ JavaToXPTCStubMap::Find(jint aJavaObjectHashCode, const nsIID& aIID,
if (NS_SUCCEEDED(rv)) {
char* iid_str = aIID.ToString();
LOG(("< JavaToXPTCStubMap (Java=%08x | XPCOM=%08x | IID=%s)\n",
(PRUint32) hash, (PRUint32) *aResult, iid_str));
(PRUint32) aJavaObjectHashCode, (PRUint32) *aResult, iid_str));
PR_Free(iid_str);
}
#endif