зеркало из https://github.com/mozilla/gecko-dev.git
Lazy LiveConnect fixes.
This commit is contained in:
Родитель
65191223c4
Коммит
103b9ddec6
|
@ -715,7 +715,8 @@ lm_ReallyInitMocha(void)
|
|||
lm_crippled_context = lm_crippled_decoder->js_context;
|
||||
|
||||
#if defined(OJI)
|
||||
(void)JVM_MaybeStartupLiveConnect(lm_crippled_context, JS_GetGlobalObject(lm_crippled_context));
|
||||
if (JVM_MaybeStartupLiveConnect())
|
||||
JSJ_InitJSContext(lm_crippled_context, JS_GetGlobalObject(lm_crippled_context), NULL);
|
||||
|
||||
#elif defined(JAVA)
|
||||
LJ_JSJ_Init();
|
||||
|
|
|
@ -3238,8 +3238,10 @@ lm_InitWindowContent(MochaDecoder *decoder)
|
|||
return JS_FALSE;
|
||||
|
||||
#if defined(OJI)
|
||||
JVM_MaybeStartupLiveConnect(cx, obj);
|
||||
#if 0
|
||||
#if 1
|
||||
if (JVM_MaybeStartupLiveConnect())
|
||||
JSJ_InitJSContext(cx, obj, NULL);
|
||||
#else
|
||||
{
|
||||
PRBool jvmMochaPrefsEnabled = PR_FALSE;
|
||||
if (NPL_IsJVMAndMochaPrefsEnabled() == PR_TRUE) {
|
||||
|
|
|
@ -724,29 +724,29 @@ nsJVMMgr::GetJVMStatus(void)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsJVMMgr::MaybeStartupLiveConnect(JSContext* cx, JSObject* obj)
|
||||
nsJVMMgr::MaybeStartupLiveConnect()
|
||||
{
|
||||
if (fJSJavaVM)
|
||||
return PR_TRUE;
|
||||
|
||||
if (IsLiveConnectEnabled()) {
|
||||
do {
|
||||
if (IsLiveConnectEnabled() && StartupJVM() == nsJVMStatus_Running) {
|
||||
JSJ_Init(&jsj_callbacks);
|
||||
nsIJVMPlugin* plugin = GetJVMPlugin();
|
||||
if (plugin) {
|
||||
const char* classpath = NULL;
|
||||
nsresult err = plugin->GetClassPath(&classpath);
|
||||
if (err) return err;
|
||||
if (err != NS_OK) break;
|
||||
JavaVM* javaVM = NULL;
|
||||
err = plugin->GetJavaVM(&javaVM);
|
||||
if (err) return err;
|
||||
if (err != NS_OK) break;
|
||||
fJSJavaVM = JSJ_ConnectToJavaVM(javaVM, classpath);
|
||||
if (fJSJavaVM) {
|
||||
JSJ_InitJSContext(cx, obj, NULL);
|
||||
}
|
||||
// plugin->Release(); // GetJVMPlugin no longer calls AddRef
|
||||
if (fJSJavaVM != NULL)
|
||||
return PR_TRUE;
|
||||
// plugin->Release(); // GetJVMPlugin no longer calls AddRef
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -764,8 +764,11 @@ nsJVMMgr::MaybeShutdownLiveConnect(void)
|
|||
PRBool
|
||||
nsJVMMgr::IsLiveConnectEnabled(void)
|
||||
{
|
||||
return LM_GetMochaEnabled()
|
||||
&& GetJVMStatus() == nsJVMStatus_Running;
|
||||
if (LM_GetMochaEnabled()) {
|
||||
nsJVMStatus status = GetJVMStatus();
|
||||
return (status == nsJVMStatus_Enabled || status == nsJVMStatus_Running);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1207,12 +1210,12 @@ JVM_GetJNIEnv(void)
|
|||
}
|
||||
|
||||
PR_IMPLEMENT(PRBool)
|
||||
JVM_MaybeStartupLiveConnect(JSContext* cx, JSObject* obj)
|
||||
JVM_MaybeStartupLiveConnect()
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
nsJVMMgr* mgr = JVM_GetJVMMgr();
|
||||
if (mgr) {
|
||||
result = mgr->MaybeStartupLiveConnect(cx, obj);
|
||||
result = mgr->MaybeStartupLiveConnect();
|
||||
mgr->Release();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
const char* GetJavaErrorString(JNIEnv* env);
|
||||
|
||||
nsresult AddToClassPath(const char* dirPath);
|
||||
PRBool MaybeStartupLiveConnect(JSContext* cx, JSObject* obj);
|
||||
PRBool MaybeStartupLiveConnect(void);
|
||||
PRBool MaybeShutdownLiveConnect(void);
|
||||
PRBool IsLiveConnectEnabled(void);
|
||||
JSJavaVM* GetJSJavaVM() { return fJSJavaVM; }
|
||||
|
@ -213,7 +213,7 @@ PR_EXTERN(JNIEnv*)
|
|||
JVM_GetJNIEnv(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_MaybeStartupLiveConnect(JSContext* cx, JSObject* obj);
|
||||
JVM_MaybeStartupLiveConnect(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_MaybeShutdownLiveConnect(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче