bug #7018: conditionally initializing LiveConnect classes only if Java is truly enabled.

This commit is contained in:
beard%netscape.com 1999-06-14 06:41:09 +00:00
Родитель 1e47eb8696
Коммит a9efb9dc76
1 изменённых файлов: 12 добавлений и 8 удалений

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

@ -225,16 +225,20 @@ nsJSContext::InitializeExternalClasses()
nsresult
nsJSContext::InitializeLiveConnectClasses()
{
nsresult result = NS_OK;
nsresult rv = NS_OK;
#if defined(OJI)
nsILiveConnectManager* manager = NULL;
result = nsServiceManager::GetService(nsIJVMManager::GetCID(),
nsILiveConnectManager::GetIID(),
(nsISupports **)&manager);
if (result == NS_OK) {
result = manager->InitLiveConnectClasses(mContext, JS_GetGlobalObject(mContext));
nsServiceManager::ReleaseService(nsIJVMManager::GetCID(), manager);
NS_WITH_SERVICE(nsIJVMManager, jvmManager, nsIJVMManager::GetCID(), &rv);
if (rv == NS_OK && jvmManager != nsnull) {
PRBool javaEnabled = PR_FALSE;
if (NS_OK == jvmManager->IsJavaEnabled(&javaEnabled) && javaEnabled) {
nsILiveConnectManager* liveConnectManager = nsnull;
if (NS_OK == jvmManager->QueryInterface(nsILiveConnectManager::GetIID(),
(void**)&liveConnectManager)) {
rv = liveConnectManager->InitLiveConnectClasses(mContext, JS_GetGlobalObject(mContext));
NS_RELEASE(liveConnectManager);
}
}
}
#endif