fixes bug 312946 "javascript:Packages.prototype crashes browser if Java plugin is not found" r=brendan
This commit is contained in:
Родитель
86118f28bd
Коммит
1fc0356bc0
|
@ -471,8 +471,10 @@ jsj_ConnectToJavaVM(JSJavaVM *jsjava_vm)
|
|||
JS_ASSERT(JSJ_callbacks->create_java_vm);
|
||||
JS_ASSERT(JSJ_callbacks->destroy_java_vm);
|
||||
|
||||
ok = JSJ_callbacks->create_java_vm(&jsjava_vm->java_vm, &jsjava_vm->main_thread_env, jsjava_vm->init_args);
|
||||
if (!ok || jsjava_vm->java_vm == NULL) {
|
||||
ok = JSJ_callbacks->create_java_vm(&jsjava_vm->java_vm,
|
||||
&jsjava_vm->main_thread_env,
|
||||
jsjava_vm->init_args);
|
||||
if (!ok) {
|
||||
jsj_LogError("Failed to create Java VM\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
|
|
@ -337,12 +337,16 @@ JS_STATIC_DLL_CALLBACK(PRBool)
|
|||
create_java_vm_impl(SystemJavaVM* *jvm, JNIEnv* *initialEnv, void* initargs)
|
||||
{
|
||||
// const char* classpath = (const char*)initargs;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIJVMManager> managerService = do_GetService(kJVMManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
*jvm = NS_REINTERPRET_CAST(SystemJavaVM*, managerService.get()); // unused in the browse
|
||||
nsCOMPtr<nsIJVMManager> serv = do_GetService(kJVMManagerCID);
|
||||
if (!serv)
|
||||
return PR_FALSE;
|
||||
*initialEnv = JVM_GetJNIEnv();
|
||||
return (*jvm != NULL && *initialEnv != NULL);
|
||||
if (!*initialEnv)
|
||||
return PR_FALSE;
|
||||
// serv will be released when this function returns, but that's OK because
|
||||
// the XPCOM service manager will keep it alive.
|
||||
*jvm = NS_REINTERPRET_CAST(SystemJavaVM*, serv.get());
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(PRBool)
|
||||
|
|
Загрузка…
Ссылка в новой задаче