/* Load Netscape-specific Java extension classes, methods, and fields */ static JSBool init_netscape_java_classes(JSJavaVM *jsjava_vm, JNIEnv *jEnv) { LOAD_CLASS(netscape/javascript/JSObject, njJSObject); LOAD_CLASS(netscape/javascript/JSException, njJSException); LOAD_CLASS(netscape/javascript/JSUtil, njJSUtil); #if !defined(OJI) JSObject_RegisterNativeMethods(jEnv); #endif #ifndef OJI LOAD_CONSTRUCTOR(netscape.javascript.JSObject, JSObject, "(I)V", njJSObject); #endif LOAD_CONSTRUCTOR(netscape.javascript.JSException, JSException, "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V", njJSException); /* Load second constructor for wrapping JS exception objects inside JSExceptions */ _LOAD_METHOD(netscape.javascript.JSException,<init>, JSException_wrap, "(ILjava/lang/Object;)V", njJSException, JS_FALSE); #ifndef OJI LOAD_FIELDID(netscape.javascript.JSObject, internal, "I", njJSObject); #endif LOAD_FIELDID(netscape.javascript.JSException, lineno, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, tokenIndex, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, source, "Ljava/lang/String;", njJSException); LOAD_FIELDID(netscape.javascript.JSException, filename, "Ljava/lang/String;", njJSException); LOAD_FIELDID(netscape.javascript.JSException, wrappedExceptionType, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, wrappedException, "Ljava/lang/Object;", njJSException); LOAD_STATIC_METHOD(netscape.javascript.JSUtil, getStackTrace, "(Ljava/lang/Throwable;)Ljava/lang/String;", njJSUtil); return JS_TRUE; }
/* Load Netscape-specific Java extension classes, methods, and fields */ static JSBool init_netscape_java_classes(JSJavaVM *jsjava_vm, JNIEnv *jEnv) { LOAD_CLASS(netscape/javascript/JSObject, njJSObject); LOAD_CLASS(netscape/javascript/JSException, njJSException); LOAD_CLASS(netscape/javascript/JSUtil, njJSUtil); #if defined(XP_MAC) || !defined(OJI) JSObject_RegisterNativeMethods(jEnv); #endif #ifndef OJI LOAD_CONSTRUCTOR(netscape.javascript.JSObject, JSObject, "(I)V", njJSObject); #endif LOAD_CONSTRUCTOR(netscape.javascript.JSException, JSException, "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V", njJSException); /* Load second constructor for wrapping JS exception objects inside JSExceptions */ _LOAD_METHOD(netscape.javascript.JSException,<init>, JSException_wrap, "(ILjava/lang/Object;)V", njJSException, JS_FALSE); #ifndef OJI LOAD_FIELDID(netscape.javascript.JSObject, internal, "I", njJSObject); #endif LOAD_FIELDID(netscape.javascript.JSException, lineno, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, tokenIndex, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, source, "Ljava/lang/String;", njJSException); LOAD_FIELDID(netscape.javascript.JSException, filename, "Ljava/lang/String;", njJSException); LOAD_FIELDID(netscape.javascript.JSException, wrappedExceptionType, "I", njJSException); LOAD_FIELDID(netscape.javascript.JSException, wrappedException, "Ljava/lang/Object;", njJSException); LOAD_STATIC_METHOD(netscape.javascript.JSUtil, getStackTrace, "(Ljava/lang/Throwable;)Ljava/lang/String;", njJSUtil); #ifdef AIX # define JAVA_STATIC_INITIALIZER_BUG #endif #ifdef JAVA_STATIC_INITIALIZER_BUG /* The following is used to work around a bug in AIX JDK1.1.6 (See * #331620), in which static initializers are not run when a * static field is referenced from native code. The problem does * not manifest itself if the field is accessed from Java code, so * we first call some Java code to access the fields of interest * before attempting to read them from native code. */ LOAD_STATIC_METHOD(netscape.javascript.JSUtil, workAroundAIXJavaBug,"()V", njJSUtil); (*jEnv)->CallStaticObjectMethod(jEnv, njJSUtil, njJSUtil_workAroundAIXJavaBug); #endif /* JAVA_STATIC_INITIALIZER_BUG */ return JS_TRUE; }