From 4e6f66306589c02759827d8388e3dde4008a779d Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Tue, 1 Sep 1998 00:16:08 +0000 Subject: [PATCH] Changes for lazy java initialization. --- cmd/winfe/feorphan.cpp | 9 ++------- cmd/winfe/genframe.cpp | 9 ++++++--- include/libmocha.h | 3 +++ include/np2.h | 19 +++++-------------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/cmd/winfe/feorphan.cpp b/cmd/winfe/feorphan.cpp index 59d995b51b65..ad236eb75b44 100644 --- a/cmd/winfe/feorphan.cpp +++ b/cmd/winfe/feorphan.cpp @@ -653,13 +653,8 @@ BOOL fe_ShutdownJava() BOOL bRetval = TRUE; #if defined(OJI) - - nsJVMMgr* jvmMgr = JVM_GetJVMMgr(); - if (jvmMgr == NULL) - return FALSE; - bRetval = (jvmMgr->ShutdownJVM() == nsJVMStatus_Enabled); - // XXX suspend all java threads - jvmMgr->Release(); + (void)JVM_ShutdownJVM(); + // XXX set pCmdUI->Enable(FALSE); #elif defined(JAVA) diff --git a/cmd/winfe/genframe.cpp b/cmd/winfe/genframe.cpp index 9f02074b4e87..21d21c26ded3 100644 --- a/cmd/winfe/genframe.cpp +++ b/cmd/winfe/genframe.cpp @@ -2374,15 +2374,18 @@ void CGenericFrame::OnToggleJavaConsole() void CGenericFrame::OnUpdateJavaConsole(CCmdUI* pCmdUI) { #ifdef OJI - if (JVM_IsJVMAvailable()) + nsJVMStatus status = JVM_GetJVMStatus(); + if (status != nsJVMStatus_Disabled && status != nsJVMStatus_Failed) { + pCmdUI->Enable(TRUE); pCmdUI->SetCheck(JVM_IsConsoleVisible()); + } else pCmdUI->Enable(FALSE); #else if (LJJavaStatus_Failed != LJ_GetJavaStatus()) { - pCmdUI->SetCheck( LJ_IsConsoleShowing() ); + pCmdUI->SetCheck( LJ_IsConsoleShowing() ); } else { - pCmdUI->Enable(FALSE); + pCmdUI->Enable(FALSE); } #endif } diff --git a/include/libmocha.h b/include/libmocha.h index 0e4222d641f4..edc7b63f7219 100644 --- a/include/libmocha.h +++ b/include/libmocha.h @@ -586,6 +586,9 @@ LM_JamSourceIntoJSDebug( const char *filename, #endif +extern JSContext* +LM_GetCrippledContext(void); + NSPR_END_EXTERN_C #endif /* libmocha_h___ */ diff --git a/include/np2.h b/include/np2.h index 7b41fcea9f2b..83df30c6b86a 100644 --- a/include/np2.h +++ b/include/np2.h @@ -23,21 +23,12 @@ #ifndef _NP2_H #define _NP2_H -#include "jni.h" -#include "prthread.h" -struct np_instance; -struct nsIPlugin; -struct nsIPluginInstance; -struct nsIPluginInstancePeer; -struct nsISupports; -PR_EXTERN(struct nsIPluginInstance*) NPL_GetOJIPluginInstance(NPEmbeddedApp *embed); -PR_EXTERN(const char *) NPL_GetText(struct nsIPluginInstance *); -PR_EXTERN(jobject) NPL_GetJavaObject(struct nsIPluginInstance *); -PR_EXTERN(void ) NPL_Release(struct nsISupports *); -PR_EXTERN(XP_Bool) NPL_IsJVMAndMochaPrefsEnabled(void); -PR_EXTERN(PRBool)NPL_JSJInit(void); -PR_EXTERN(JNIEnv *)NPL_EnsureJNIExecEnv(PRThread* thread); +#include "jni.h" +#include "lo_ele.h" + +PR_EXTERN(const char *) NPL_GetText(LO_CommonPluginStruct* embed); +PR_EXTERN(jobject) NPL_GetJavaObject(LO_CommonPluginStruct* embed); #endif /* _NP2_H */