addon to previous checking. Changed

JAVA_DOM_OJI_DISABLE check to
JAVA_DOM_OJI_ENABLE not to affect
unix builds.
This commit is contained in:
sdv%sparc.spb.su 2000-01-28 04:20:20 +00:00
Родитель 44848ccef3
Коммит d256e7f83f
4 изменённых файлов: 22 добавлений и 106 удалений

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

@ -5,7 +5,7 @@ A Java component obtains a org.w3c.dom.Document by registering for
Document load notifications. The Document is passed in along with the
notifications. The preferred way for a Java component to register for
Document load notifications is to register via the DOMAccessor
class. However until OJI is used to obtain JNIEnv one has to apply
class. However if OJI is not use to obtain JNIEnv one has to apply
two patches
webshell/src/nsWebShell.cpp.patch
@ -18,6 +18,10 @@ Note:
stand for TestDocLoadListener.
See the section on Building for instructions on how to apply the patches.
To enable OJI usage on win nt add -DJAVA_DOM_OJI_ENABLE to the
DEFINES variable in makefile.win and also set an environment
variable JAVA_DOM_OJI_ENABLE=true
Makefiles
---------

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

@ -22,15 +22,13 @@
DEPTH=..\..
IGNORE_MANIFEST=1
#DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN
DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN -DJAVA_DOM_OJI_DISABLE
JAVA_DOM_OJI_DISABLE=true
DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN
MODULE=javadom
IS_COMPONENT=1
LIBRARY_NAME=libjavadom
CPPSRCS= \
!ifndef JAVA_DOM_OJI_DISABLE
!ifdef JAVA_DOM_OJI_ENABLE
JavaDOMSecurityContext.cpp \
!endif
nsJavaDOMImpl.cpp \
@ -38,7 +36,7 @@ CPPSRCS= \
$(NULL)
CPP_OBJS= \
!ifndef JAVA_DOM_OJI_DISABLE
!ifdef JAVA_DOM_OJI_ENABLE
.\$(OBJDIR)\JavaDOMSecurityContext.obj \
!endif
.\$(OBJDIR)\nsJavaDOMImpl.obj \
@ -48,7 +46,7 @@ CPP_OBJS= \
EXPORTS = \
nsIJavaDOM.h
!ifdef JAVA_DOM_OJI_DISABLE
!ifndef JAVA_DOM_OJI_ENABLE
LINCS= \
-I$(JAVAHOME)\include \
-I$(JAVAHOME)\include\win32
@ -64,7 +62,7 @@ LCFLAGS = \
$(NULL)
LLIBS= \
!ifndef JAVA_DOM_OJI_DISABLE
!ifdef JAVA_DOM_OJI_ENABLE
$(DIST)\lib\oji.lib \
!else
$(JAVAHOME)\lib\jvm.lib \

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

@ -30,7 +30,7 @@
#include "nsIWebShell.h"
#include "nsJavaDOMImpl.h"
#ifndef JAVA_DOM_OJI_DISABLE
#ifdef JAVA_DOM_OJI_ENABLE
#include "ProxyJNI.h"
#include "nsIServiceManager.h"
#endif
@ -48,7 +48,7 @@ static char* strip_whitespace(const PRUnichar* input, int length);
static const char* describe_type(int type);
#endif
#ifndef JAVA_DOM_OJI_DISABLE
#ifdef JAVA_DOM_OJI_ENABLE
static NS_DEFINE_CID(kJVMManagerCID,NS_JVMMANAGER_CID);
#endif
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
@ -87,7 +87,7 @@ NS_IMETHODIMP nsJavaDOMImpl::QueryInterface(REFNSIID aIID, void** aInstance)
return NS_NOINTERFACE;
}
#ifndef JAVA_DOM_OJI_DISABLE
#ifdef JAVA_DOM_OJI_ENABLE
nsJVMManager* nsJavaDOMImpl::jvmManager = NULL;
JavaDOMSecurityContext* nsJavaDOMImpl::securityContext = NULL;
#else
@ -470,7 +470,7 @@ NS_IMETHODIMP nsJavaDOMImpl::HandleUnknownContentType(nsIDocumentLoader* loader,
JNIEnv* nsJavaDOMImpl::GetJNIEnv() {
JNIEnv* env;
#ifndef JAVA_DOM_OJI_DISABLE
#ifdef JAVA_DOM_OJI_ENABLE
nsresult result;
if (!jvmManager) {
NS_WITH_SERVICE(nsIJVMManager, _jvmManager, kJVMManagerCID, &result);
@ -487,20 +487,21 @@ JNIEnv* nsJavaDOMImpl::GetJNIEnv() {
// }
// SetSecurityContext(env,securityContext);
SetSecurityContext(env, new JavaDOMSecurityContext());
#else /* JAVA_DOM_OJI_DISABLE */
#else /* JAVA_DOM_OJI_ENABLE */
if (!jvm) {
StartJVM();
}
#ifdef XP_PC
jvm->AttachCurrentThread((void**)&env,NULL);
jvm->AttachCurrentThread(&env,NULL);
// jvm->AttachCurrentThread((void**)&env,NULL);
#else
jvm->AttachCurrentThread(&env,NULL);
#endif
#endif /* JAVA_DOM_OJI_DISABLE */
#endif /* JAVA_DOM_OJI_ENABLE */
return env;
}
#ifdef JAVA_DOM_OJI_DISABLE
#ifndef JAVA_DOM_OJI_ENABLE
void nsJavaDOMImpl::StartJVM(void) {
JNIEnv *env = NULL;
JDK1_1InitArgs vm_args;
@ -527,7 +528,8 @@ void nsJavaDOMImpl::StartJVM(void) {
printf("classpath is \"%s\"\n", vm_args.classpath);
#endif // DEBUG
#ifdef XP_PC
jint rv = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
jint rv = JNI_CreateJavaVM(&jvm, &env, &vm_args);
// jint rv = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
#else
jint rv = JNI_CreateJavaVM(&jvm, &env, &vm_args);
#endif
@ -538,7 +540,7 @@ void nsJavaDOMImpl::StartJVM(void) {
}
delete[] p;
}
#endif /* JAVA_DOM_OJI_DISABLE */
#endif /* JAVA_DOM_OJI_ENABLE */
#if defined(DEBUG)

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

@ -1,88 +0,0 @@
#ifndef __nsJavaDOMImpl_h__
#define __nsJavaDOMImpl_h__
#include "jni.h"
#include "nsIJavaDOM.h"
#ifndef JAVA_DOM_OJI_DISABLE
#include "nsJVMManager.h"
#include "JavaDOMSecurityContext.h"
#endif /* JAVA_DOM_OJI_DISABLE */
class nsIURI;
class nsIDOMDocument;
class nsIDocumentLoader;
class nsJavaDOMImpl : public nsIJavaDOM {
NS_DECL_ISUPPORTS
public:
nsJavaDOMImpl();
virtual ~nsJavaDOMImpl();
/* nsIDocumentLoaderObserver methods */
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand);
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus);
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel);
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax);
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsString& aMsg);
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus);
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
nsIChannel* channel,
const char *aContentType,
const char *aCommand);
private:
#ifndef JAVA_DOM_OJI_DISABLE
static nsJVMManager* jvmManager;
static JavaDOMSecurityContext* securityContext;
#else
static JavaVM* jvm;
#endif
static jclass domAccessorClass;
static jclass documentClass;
static jclass listenerClass;
static jclass gcClass;
static jobject docListener;
static jfieldID documentPtrFID;
static jmethodID documentInitID;
static jmethodID getInstanceMID;
static jmethodID startURLLoadMID;
static jmethodID endURLLoadMID;
static jmethodID progressURLLoadMID;
static jmethodID statusURLLoadMID;
static jmethodID startDocumentLoadMID;
static jmethodID endDocumentLoadMID;
static jmethodID gcMID;
// cleanup after a JNI method invocation
static PRBool Cleanup(JNIEnv* env);
static JNIEnv* GetJNIEnv(void);
static void StartJVM(void);
nsIDOMDocument* GetDocument(nsIDocumentLoader* loader);
jobject CaffienateDOMDocument(nsIDOMDocument* domDoc);
};
#endif /* __nsJavaDOMImpl_h__ */