--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -640,8 +640,9 @@ msvcp80.dll
msvcr80.dll
#else
mozcrt19.dll
#endif
#endif
xpicleanup@BIN_SUFFIX@
chrome.manifest
install.rdf
+@DLL_PREFIX@jsj@DLL_SUFFIX@
--- a/caps/idl/nsIPrincipal.idl
+++ b/caps/idl/nsIPrincipal.idl
@@ -46,25 +46,16 @@ struct JSContext;
struct JSPrincipals;
%}
interface nsIURI;
[ptr] native JSContext(JSContext);
[ptr] native JSPrincipals(JSPrincipals);
-/**
- * WARNING!! The JEP needs to call GetOrigin() to support
- * JavaScript-to-Java LiveConnect. So every change to the nsIPrincipal
- * interface (big enough to change its IID) also breaks JavaScript-to-Java
- * LiveConnect on mac.
- *
- * If you REALLY have to change this interface, please mark your bug as
- * blocking bug 293973.
- */
[scriptable, uuid(b8268b9a-2403-44ed-81e3-614075c92034)]
interface nsIPrincipal : nsISerializable
{
/**
* Values of capabilities for each principal. Order is
* significant: if an operation is performed on a set
* of capabilities, the minimum is computed.
*/
--- a/caps/idl/nsIScriptSecurityManager.idl
+++ b/caps/idl/nsIScriptSecurityManager.idl
@@ -36,25 +36,16 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIPrincipal.idl"
#include "nsIXPCSecurityManager.idl"
interface nsIURI;
interface nsIChannel;
-/**
- * WARNING!! The JEP needs to call GetSubjectPrincipal()
- * to support JavaScript-to-Java LiveConnect. So every change to the
- * nsIScriptSecurityManager interface (big enough to change its IID) also
- * breaks JavaScript-to-Java LiveConnect on mac.
- *
- * If you REALLY have to change this interface, please mark your bug as
- * blocking bug 293973.
- */
[scriptable, uuid(f8e350b9-9f31-451a-8c8f-d10fea26b780)]
interface nsIScriptSecurityManager : nsIXPCSecurityManager
{
///////////////// Security Checks //////////////////
/**
* Checks whether the running script is allowed to access aProperty.
*/
[noscript] void checkPropertyAccess(in JSContextPtr aJSContext,
--- a/caps/src/nsSecurityManagerFactory.cpp
+++ b/caps/src/nsSecurityManagerFactory.cpp
@@ -304,18 +304,18 @@ nsSecurityNameSet::InitializeNameSet(nsI
JSClass *objectClass = JS_GET_CLASS(cx, obj);
jsval v;
if (!JS_GetProperty(cx, global, "netscape", &v))
return NS_ERROR_FAILURE;
JSObject *securityObj;
if (JSVAL_IS_OBJECT(v)) {
/*
- * "netscape" property of window object exists; must be LiveConnect
- * package. Get the "security" property.
+ * "netscape" property of window object exists; get the
+ * "security" property.
*/
obj = JSVAL_TO_OBJECT(v);
if (!JS_GetProperty(cx, obj, "security", &v) || !JSVAL_IS_OBJECT(v))
return NS_ERROR_FAILURE;
securityObj = JSVAL_TO_OBJECT(v);
} else {
/* define netscape.security object */
obj = JS_DefineObject(cx, global, "netscape", objectClass, nsnull, 0);
--- a/config/system-headers
+++ b/config/system-headers
@@ -411,17 +411,16 @@ limits.h
link.h
linux/kernel.h
linux/limits.h
linux/rtc.h
linux/version.h
list
List.h
Lists.h
-LiveConnectManagerTests.h
LListBox.h
LListener.h
LMenuBar.h
LMenu.h
LModelDirector.h
LModelObject.h
LModelProperty.h
loader.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -9415,19 +9415,19 @@ nsHTMLPluginObjElementSH::SetupProtoChai
if (pi_proto && JS_GET_CLASS(cx, pi_proto) != sObjectClass) {
// The plugin wrapper has a proto that's not Object.prototype, set
// 'pi.__proto__.__proto__' to the original 'this.__proto__'
if (pi_proto != my_proto && !::JS_SetPrototype(cx, pi_proto, my_proto)) {
return NS_ERROR_UNEXPECTED;
}
} else {
- // 'pi' didn't have a prototype, or pi's proto was 'Object.prototype'
- // (i.e. pi is an LiveConnect wrapped Java applet), set
- // 'pi.__proto__' to the original 'this.__proto__'
+ // 'pi' didn't have a prototype, or pi's proto was
+ // 'Object.prototype' (i.e. pi is an NPRuntime wrapped JS object)
+ // set 'pi.__proto__' to the original 'this.__proto__'
if (!::JS_SetPrototype(cx, pi_obj, my_proto)) {
return NS_ERROR_UNEXPECTED;
}
}
// Before this proto dance the objects involved looked like this:
//
// this.__proto__.__proto__
@@ -9466,18 +9466,17 @@ nsHTMLPluginObjElementSH::SetupProtoChai
// should look like this:
//
// this.__proto__.__proto__.__proto__
// ^ ^ ^ ^
// | | | |__ Object.prototype
// | | |
// | | |__ xpc embed wrapper proto (shared)
// | |
- // | |__ pi (plugin instance) wrapper, most likely wrapped
- // | by LiveConnect
+ // | |__ pi (plugin instance) NPRuntime JS object wrapper
// |
// |__ xpc wrapped native embed node
//
return NS_OK;
}
NS_IMETHODIMP
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -5794,17 +5794,17 @@ nsGlobalWindow::InitJavaProperties()
return;
}
// Set mDidInitJavaProperties to true here even if initialization
// can fail. If it fails, we won't try again...
mDidInitJavaProperties = PR_TRUE;
// Check whether the plugin supports NPRuntime, if so, init through
- // it, else use liveconnect.
+ // it.
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
if (!host) {
return;
}
mDummyJavaPluginOwner = new nsDummyJavaPluginOwner(mDoc);
if (!mDummyJavaPluginOwner) {
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -397,18 +397,17 @@ public:
* or content in that document) has a paint event listener.
*/
PRBool HasPaintEventListeners()
{
return mMayHavePaintEventListener;
}
/**
- * Initialize window.java and window.Packages, and start LiveConnect
- * if we're running with a non-NPRuntime enabled Java plugin.
+ * Initialize window.java and window.Packages.
*/
virtual void InitJavaProperties() = 0;
virtual void* GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) = 0;
virtual void CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
nsScriptObjectHolder& aHandler) = 0;
/*
--- a/embedding/config/gre-installer-win.pkg
+++ b/embedding/config/gre-installer-win.pkg
@@ -15,23 +15,16 @@
; *****
[gre]
; required prefs files
greprefs\*
;
-; oji/LiveConnect support
-;
-components\oji.dll
-components\oji.xpt
-jsj3250.dll
-
-;
; Type info support for nsIController
;
components\xuldoc.xpt
;
; history
;
components\history.xpt
--- a/embedding/config/gre-win
+++ b/embedding/config/gre-win
@@ -3,23 +3,16 @@
; The files specified in this manifest will be added to
; the list of files specified in basebrowser-win manifest
; to create the GRE package
;
[gre]
;
-; oji/LiveConnect support
-;
-components\oji.dll
-components\oji.xpt
-jsj3250.dll
-
-;
; Type info support for nsIController
;
components\xuldoc.xpt
;
; history
;
components\history.xpt
--- a/js/jsd/mkshell.bat
+++ b/js/jsd/mkshell.bat
@@ -1,4 +1,4 @@
@echo off
-REM nmake -f jsdshell.mak JSDEBUGGER_JAVA_UI=1 LIVECONNECT=1 %1 %2 %3 %4 %5
+REM nmake -f jsdshell.mak JSDEBUGGER_JAVA_UI=1 %1 %2 %3 %4 %5
@echo on
nmake -f jsdshell.mak JSDEBUGGER_JAVA_UI=1 %1 %2 %3 %4 %5
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -287,30 +287,16 @@ ASFILES = lock_$(OS_ARCH).s
endif
endif
endif
ifndef BUILD_OPT
MOCHAFILE = 1
endif
-ifndef NSBUILDROOT
-JSJAVA_STUBHEADERS = \
- -I$(topsrcdir)/sun-java/include/_gen \
- -I$(topsrcdir)/sun-java/netscape/javascript/_jri \
- -I$(topsrcdir)/sun-java/netscape/security/_jri
-else
-JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR)
-endif
-
-JSJAVA_CFLAGS = \
- -I$(topsrcdir)/sun-java/md-include \
- -I$(topsrcdir)/sun-java/include \
- $(JSJAVA_STUBHEADERS)
-
# Define keyword generator before rules.mk, see bug 323979 comment 50
HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX)
GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX)
HOST_SIMPLE_PROGRAMS += host_jsoplengen$(HOST_BIN_SUFFIX)
GARBAGE += jsautooplen.h host_jsoplengen$(HOST_BIN_SUFFIX)
--- a/js/src/Makefile.ref
+++ b/js/src/Makefile.ref
@@ -317,20 +317,16 @@ endif
endif
ifndef BUILD_OPT
#JS_CPPFILES += \
# vprof/vprof.cpp \
# $(NULL)
endif
-ifdef JS_LIVECONNECT
-DIRS += liveconnect
-endif
-
ifdef JS_HAS_FILE_OBJECT
JS_CPPFILES += jsfile.cpp
JS_HFILES += jsfile.h
endif
LIB_CPPFILES = $(JS_CPPFILES)
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
PROG_CPPFILES = js.cpp
--- a/js/src/SpiderMonkey.rsp
+++ b/js/src/SpiderMonkey.rsp
@@ -1,11 +1,3 @@
mozilla/js/src/*
mozilla/js/src/config/*
-mozilla/js/src/liveconnect/*
-mozilla/js/src/liveconnect/_jni/*
-mozilla/js/src/liveconnect/classes/*
-mozilla/js/src/liveconnect/classes/netscape/*
-mozilla/js/src/liveconnect/classes/netscape/javascript/*
-mozilla/js/src/liveconnect/config/*
-mozilla/js/src/liveconnect/macbuild/*
-mozilla/js/src/liveconnect/macbuild/JavaSession/*
mozilla/js/src/macbuild/*
--- a/js/src/config.mk
+++ b/js/src/config.mk
@@ -146,29 +146,16 @@ endif
DEFINES += -DDEBUG -DDEBUG_$(USER)
OBJDIR_TAG = _DBG
endif
SO_SUFFIX = so
NS_USE_NATIVE = 1
-# Java stuff
-CLASSDIR = $(DEPTH)/liveconnect/classes
-JAVA_CLASSES = $(patsubst %.java,%.class,$(JAVA_SRCS))
-TARGETS += $(addprefix $(CLASSDIR)/$(OBJDIR)/$(JARPATH)/, $(JAVA_CLASSES))
-JAVAC = $(JDK)/bin/javac
-JAVAC_FLAGS = -classpath "$(CLASSPATH)" -d $(CLASSDIR)/$(OBJDIR)
-ifeq ($(OS_ARCH), WINNT)
- SEP = ;
-else
- SEP = :
-endif
-CLASSPATH = $(JDK)/lib/classes.zip$(SEP)$(CLASSDIR)/$(OBJDIR)
-
include $(DEPTH)/ref-config/$(OS_CONFIG).mk
ifndef OBJ_SUFFIX
ifdef USE_MSVC
OBJ_SUFFIX = obj
else
OBJ_SUFFIX = o
endif
--- a/js/src/config/system-headers
+++ b/js/src/config/system-headers
@@ -411,17 +411,16 @@ limits.h
link.h
linux/kernel.h
linux/limits.h
linux/rtc.h
linux/version.h
list
List.h
Lists.h
-LiveConnectManagerTests.h
LListBox.h
LListener.h
LMenuBar.h
LMenu.h
LModelDirector.h
LModelObject.h
LModelProperty.h
loader.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -202,20 +202,19 @@ typedef struct InterpStruct InterpStruct
# define JS_EVAL_CACHE_SHIFT 6
#endif
#define JS_EVAL_CACHE_SIZE JS_BIT(JS_EVAL_CACHE_SHIFT)
#ifdef JS_EVAL_CACHE_METERING
# define EVAL_CACHE_METER_LIST(_) _(probe), _(hit), _(step), _(noscope)
# define identity(x) x
-/* Have to typedef this for LiveConnect C code, which includes us. */
-typedef struct JSEvalCacheMeter {
+struct JSEvalCacheMeter {
uint64 EVAL_CACHE_METER_LIST(identity);
-} JSEvalCacheMeter;
+};
# undef identity
#endif
#ifdef JS_FUNCTION_METERING
# define FUNCTION_KIND_METER_LIST(_) \
_(allfun), _(heavy), _(nofreeupvar), _(onlyfreevar), \
_(display), _(flat), _(setupvar), _(badfunarg)
--- a/js/src/jsconfig.mk
+++ b/js/src/jsconfig.mk
@@ -103,38 +103,26 @@ else
rm -rf $(NSPR_DIST)/include/META-INF
echo $(NSPR_VERSION) > $(NSPR_VERSIONFILE)
endif
SHIP_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR)
SHIP_DIR = $(SHIP_DIST)/SHIP
SHIP_LIBS = libjs.$(SO_SUFFIX) libjs.a
-ifdef JS_LIVECONNECT
- SHIP_LIBS += libjsj.$(SO_SUFFIX) libjsj.a
-endif
ifeq ($(OS_ARCH), WINNT)
SHIP_LIBS = js32.dll js32.lib
- ifdef JS_LIVECONNECT
- SHIP_LIBS += jsj.dll jsj.lib
- endif
endif
SHIP_LIBS += $(LCJAR)
SHIP_LIBS := $(addprefix $(SHIP_DIST)/lib/, $(SHIP_LIBS))
SHIP_INCS = js*.h prmjtime.h resource.h *.msg *.tbl
-ifdef JS_LIVECONNECT
- SHIP_INCS += netscape*.h nsC*.h nsI*.h
-endif
SHIP_INCS := $(addprefix $(SHIP_DIST)/include/, $(SHIP_INCS))
SHIP_BINS = js
-ifdef JS_LIVECONNECT
- SHIP_BINS += lcshell
-endif
ifeq ($(OS_ARCH), WINNT)
SHIP_BINS := $(addsuffix .exe, $(SHIP_BINS))
endif
SHIP_BINS := $(addprefix $(SHIP_DIST)/bin/, $(SHIP_BINS))
ifdef BUILD_OPT
JSREFJAR = jsref_opt.jar
else
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -1146,17 +1146,16 @@ js_Invoke(JSContext *cx, uintN argc, jsv
#endif
/* Function is inlined, all other classes use object ops. */
ops = funobj->map->ops;
/*
* XXX this makes no sense -- why convert to function if clasp->call?
* XXX better to call that hook without converting
- * XXX the only thing that needs fixing is liveconnect
*
* FIXME bug 408416: try converting to function, for API compatibility
* if there is a call op defined.
*/
if ((ops == &js_ObjectOps) ? clasp->call : ops->call) {
ok = clasp->convert(cx, funobj, JSTYPE_FUNCTION, &v);
if (!ok)
goto out2;
--- a/js/src/jsinterp.h
+++ b/js/src/jsinterp.h
@@ -125,43 +125,39 @@ struct JSStackFrame {
uintN sharpDepth; /* array/object initializer depth */
JSObject *sharpArray; /* scope for #n= initializer vars */
uint32 flags; /* frame flags -- see below */
JSStackFrame *dormantNext; /* next dormant frame chain */
JSObject *xmlNamespace; /* null or default xml namespace in E4X */
JSStackFrame *displaySave; /* previous value of display entry for
script->staticLevel */
-#ifdef __cplusplus /* Aargh, LiveConnect, bug 442399. */
inline void assertValidStackDepth(uintN depth);
-#endif
};
#ifdef __cplusplus
static JS_INLINE uintN
FramePCOffset(JSStackFrame* fp)
{
return uintN((fp->imacpc ? fp->imacpc : fp->regs->pc) - fp->script->code);
}
#endif
static JS_INLINE jsval *
StackBase(JSStackFrame *fp)
{
return fp->slots + fp->script->nfixed;
}
-#ifdef __cplusplus /* Aargh, LiveConnect, bug 442399. */
void
JSStackFrame::assertValidStackDepth(uintN depth)
{
JS_ASSERT(0 <= regs->sp - StackBase(this));
JS_ASSERT(depth <= uintptr_t(regs->sp - StackBase(this)));
}
-#endif
static JS_INLINE uintN
GlobalVarCount(JSStackFrame *fp)
{
uintN n;
JS_ASSERT(!fp->fun);
n = fp->script->nfixed;
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -634,30 +634,27 @@ js_ChangeNativePropertyAttrs(JSContext *
* result parameters must later call OBJ_DROP_PROPERTY(cx, obj, *propp) both to
* drop the held property, and to release the lock on obj.
*/
extern JSBool
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
JSProperty **propp);
-#ifdef __cplusplus /* FIXME: bug 442399 removes this LiveConnect requirement. */
-
/*
* Flags for the defineHow parameter of js_DefineNativeProperty.
*/
const uintN JSDNP_CACHE_RESULT = 1; /* an interpreter call from JSOP_INITPROP */
const uintN JSDNP_DONT_PURGE = 2; /* suppress js_PurgeScopeChain */
extern JSBool
js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
uintN flags, intN shortid, JSProperty **propp,
uintN defineHow = 0);
-#endif
/*
* Unlike js_DefineProperty, propp must be non-null. On success, and if id was
* found, return true with *objp non-null and locked, and with a held property
* stored in *propp. If successful but id was not found, return true with both
* *objp and *propp null. Therefore all callers who receive a non-null *propp
* must later call OBJ_DROP_PROPERTY(cx, *objp, *propp).
*/
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -103,17 +103,17 @@ typedef enum JSProtoKey {
/* JSObjectOps.checkAccess mode enumeration. */
typedef enum JSAccessMode {
JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */
JSACC_PARENT = 1, /* XXXbe redundant w.r.t. id */
/*
* enum value #2 formerly called JSACC_IMPORT,
- * gap preserved for liveconnect ABI compatibility.
+ * gap preserved for ABI compatibility.
*/
JSACC_WATCH = 3, /* a watchpoint on object foo for id 'bar' */
JSACC_READ = 4, /* a "get" of foo.bar */
JSACC_WRITE = 8, /* a "set" of foo.bar = baz */
JSACC_LIMIT
} JSAccessMode;
deleted file mode 100644
--- a/js/src/liveconnect/LiveConnect.dsp
+++ /dev/null
@@ -1,157 +0,0 @@
-# Microsoft Developer Studio Project File - Name="LiveConnect" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=LiveConnect - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "LiveConnect.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "LiveConnect.mak" CFG="LiveConnect - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "LiveConnect - Win32 Release" (based on\
- "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "LiveConnect - Win32 Debug" (based on\
- "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "LiveConnect - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I ".." /I "$(JDK)\include" /I "$(JDK)\include\win32" /D "NDEBUG" /D "XP_WIN" /D "JSFILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\Release\js32.lib $(JDK)\lib\javai.lib /nologo /subsystem:windows /dll /debug /machine:I386
-
-!ELSEIF "$(CFG)" == "LiveConnect - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".." /I "$(JDK)\include" /I "$(JDK)\include\win32" /D "_DEBUG" /D "_CONSOLE" /D "DEBUG" /D "XP_WIN" /D "JSFILE" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\Debug\js32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/LiveConnect_g.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "LiveConnect - Win32 Release"
-# Name "LiveConnect - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_field.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JavaArray.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JavaClass.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JavaMember.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JavaObject.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JavaPackage.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_JSObject.c
-
-!IF "$(CFG)" == "LiveConnect - Win32 Release"
-
-!ELSEIF "$(CFG)" == "LiveConnect - Win32 Debug"
-
-# ADD CPP /I ".\_jni"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_method.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\liveconnect\jsj_utils.c
-# End Source File
-# End Target
-# End Project
deleted file mode 100644
--- a/js/src/liveconnect/LiveConnectShell.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="LiveConnectShell" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=LiveConnectShell - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "LiveConnectShell.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "LiveConnectShell.mak" CFG="LiveConnectShell - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "LiveConnectShell - Win32 Release" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE "LiveConnectShell - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "LiveConnectShell - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "LiveConnectShell_"
-# PROP BASE Intermediate_Dir "LiveConnectShell_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "$(JDK)\include" /I "$(JDK)\include\win32" /I "." /D "_WIN32" /D "WIN32" /D "NDEBUG" /D "XP_WIN" /D "_WINDOWS" /D "JSFILE" /D "LIVECONNECT" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/lcshell.exe"
-# Begin Special Build Tool
-SOURCE=$(InputPath)
-PostBuild_Desc=Copy DLL(s) to build directory
-PostBuild_Cmds=COPY ..\Release\js32.dll .\Release
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "LiveConnectShell - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "LiveConnectShell0"
-# PROP BASE Intermediate_Dir "LiveConnectShell0"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "$(JDK)\include" /I "$(JDK)\include\win32" /I "." /D "LIVECONNECT" /D "_WIN32" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "XP_WIN" /D "_WINDOWS" /D "JSFILE" /FR /YX /FD /c
-# SUBTRACT CPP /u
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib $(JDK)\lib\javai_g.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/lcshell.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE=$(InputPath)
-PostBuild_Desc=Copy DLL(s) to build directory
-PostBuild_Cmds=COPY ..\Debug\js32.dll .\Debug
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "LiveConnectShell - Win32 Release"
-# Name "LiveConnectShell - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\js.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Debug\js32.lib
-# End Source File
-# Begin Source File
-
-SOURCE=.\jsj_simpleapi.c
-
-!IF "$(CFG)" == "LiveConnectShell - Win32 Release"
-
-!ELSEIF "$(CFG)" == "LiveConnectShell - Win32 Debug"
-
-# ADD CPP /I ".."
-# SUBTRACT CPP /I "."
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
deleted file mode 100644
--- a/js/src/liveconnect/LiveConnectShell.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "LiveConnect"=.\LiveConnect.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "LiveConnectShell"=.\LiveConnectShell.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name LiveConnect
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
deleted file mode 100644
--- a/js/src/liveconnect/Makefile.in
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE = liveconnect
-LIBRARY_NAME = jsj
-EXPORT_LIBRARY = 1
-ifeq ($(OS_ARCH)$(MOZ_ENABLE_LIBXUL),WINNT)
-LIBRARY_NAME = jsj$(MOZ_BITS)$(VERSION_NUMBER)
-MAPFILE = $(LIBRARY_NAME).map
-endif
-JNI_GEN_DIR = _jni
-GRE_MODULE = 1
-LIBXUL_LIBRARY = 1
-
-REQUIRES = js \
- xpcom \
- xpconnect \
- java \
- caps \
- necko \
- string \
- $(NULL)
-
-CSRCS = \
- jsj.c \
- jsj_JSObject.c \
- jsj_JavaArray.c \
- jsj_JavaClass.c \
- jsj_JavaMember.c \
- jsj_JavaObject.c \
- jsj_JavaPackage.c \
- jsj_array.c \
- jsj_class.c \
- jsj_convert.c \
- jsj_field.c \
- jsj_hash.c \
- jsj_method.c \
- jsj_utils.c \
- $(NULL)
-
-CPPSRCS = \
- nsCLiveconnect.cpp \
- nsCLiveconnectFactory.cpp \
- $(NULL)
-
-EXPORTS = \
- $(srcdir)/jsjava.h \
- $(srcdir)/$(JNI_GEN_DIR)/netscape_javascript_JSObject.h \
- $(srcdir)/$(JNI_GEN_DIR)/netscape_javascript_JSException.h \
- $(srcdir)/nsILiveconnect.h \
- $(srcdir)/nsISecureLiveconnect.h \
- $(srcdir)/nsISecurityContext.h \
- $(NULL)
-
-EXTRA_DSO_LDOPTS += \
- $(LIBS_DIR) \
- $(MOZ_JS_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-
deleted file mode 100644
--- a/js/src/liveconnect/Makefile.ref
+++ /dev/null
@@ -1,169 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-#
-# JSRef GNUmake makefile.
-#
-
-DEPTH = ..
-
-# Create JAR file
-DIRS += classes
-
-#
-# XCFLAGS may be set in the environment or on the gmake command line
-#
-CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) \
- -DJSFILE $(XCFLAGS)
-LDFLAGS += -lm $(XLDFLAGS)
-
-# For purify
-PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
- $(INCLUDES) $(XCFLAGS)
-
-#
-# LC file lists
-#
-LC_HFILES = \
- jsj_hash.h \
- jsj_private.h \
- jsjava.h \
- netscape_javascript_JSObject.h \
- nsCLiveconnectFactory.h \
- nsILiveconnect.h \
- nsISecureLiveconnect.h \
- nsISecurityContext.h \
- $(NULL)
-
-OTHER_HFILES = \
- jsj.msg \
- $(NULL)
-
-HFILES = $(LC_HFILES) $(OTHER_HFILES)
-
-LC_CFILES = \
- jsj.c \
- jsj_JSObject.c \
- jsj_JavaArray.c \
- jsj_JavaClass.c \
- jsj_JavaMember.c \
- jsj_JavaObject.c \
- jsj_JavaPackage.c \
- jsj_array.c \
- jsj_class.c \
- jsj_convert.c \
- jsj_field.c \
- jsj_hash.c \
- jsj_method.c \
- jsj_utils.c \
- $(NULL)
-
-LIB_CFILES = $(LC_CFILES)
-
-PROG_FILE = js
-
-include $(DEPTH)/config.mk
-include config/$(OS_CONFIG).mk
-
-INCLUDES += -I. -I.. -I../$(OBJDIR)
-
-ifdef USE_MSVC
-OTHER_LIBS += $(DEPTH)/fdlibm/$(OBJDIR)/fdlibm.lib
-else
-OTHER_LIBS += -L$(DEPTH)/fdlibm/$(OBJDIR) -lfdm -L../$(OBJDIR) -ljs
-endif
-
-#
-# Line editing support.
-# Define JS_READLINE or JS_EDITLINE to enable line editing in the
-# lcshell command-line interpreter.
-#
-ifdef JS_READLINE
-# For those platforms with the readline library installed.
-DEFINES += -DEDITLINE
-OTHER_LIBS += -lreadline
-else
-ifdef JS_EDITLINE
-# Use the editline library from ../editline.
-PREDIRS += ../editline
-DEFINES += -DEDITLINE
-OTHER_LIBS += -L../editline/$(OBJDIR) -ledit
-endif
-endif
-
-NSPR_LIBSUFFIX = 4
-
-ifdef JS_THREADSAFE
-DEFINES += -DJS_THREADSAFE
-INCLUDES += -I../../../dist/$(OBJDIR)/include
-ifdef USE_MSVC
-OTHER_LIBS += $(DEPTH)/../../dist/$(OBJDIR)/lib/libnspr${NSPR_LIBSUFFIX}.lib
-else
-OTHER_LIBS += -L$(DEPTH)/../../dist/$(OBJDIR)/lib -lnspr${NSPR_LIBSUFFIX}
-endif
-endif
-
-ifdef USE_MSVC
-LIBRARY = $(OBJDIR)/jsj.lib
-SHARED_LIBRARY = $(OBJDIR)/jsj.dll
-PROGRAM = $(OBJDIR)/lcshell.exe
-else
-LIBRARY = $(OBJDIR)/libjsj.a
-SHARED_LIBRARY = $(OBJDIR)/libjsj.$(SO_SUFFIX)
-PROGRAM = $(OBJDIR)/lcshell
-endif
-
-include $(DEPTH)/rules.mk
-
-ifdef USE_MSVC
-$(OBJDIR)/$(PROG_FILE)_lc.obj: ../$(PROG_FILE).c
- @$(MAKE_OBJDIR)
- $(CC) -Fo$@ -c $(CFLAGS) -DLIVECONNECT ../$(PROG_FILE).c
-
-$(PROGRAM): $(OBJDIR)/$(PROG_FILE)_lc.obj $(OBJDIR)/jsj_simpleapi.obj $(LIBRARY)
- link.exe -out:"$@" $(EXE_LINK_FLAGS) ../$(OBJDIR)/js32.lib $(OTHER_LIBS) $?
-else
-$(OBJDIR)/$(PROG_FILE).o: ../$(PROG_FILE).c
- @$(MAKE_OBJDIR)
- $(CC) -o $@ -c $(CFLAGS) -DLIVECONNECT ../$(PROG_FILE).c
-
-$(PROGRAM): $(OBJDIR)/$(PROG_FILE).o $(OBJDIR)/jsj_simpleapi.o
- @$(MAKE_OBJDIR)
- $(CC) -o $@ $(CFLAGS) $+ $(LIBRARY) ../$(OBJDIR)/libjs.a $(LDFLAGS) $(OTHER_LIBS)
-endif
deleted file mode 100644
--- a/js/src/liveconnect/README.html
+++ /dev/null
@@ -1,712 +0,0 @@
-<!-- ***** BEGIN LICENSE BLOCK *****
- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
- -
- - The contents of this file are subject to the Mozilla Public License Version
- - 1.1 (the "License"); you may not use this file except in compliance with
- - the License. You may obtain a copy of the License at
- - http://www.mozilla.org/MPL/
- -
- - Software distributed under the License is distributed on an "AS IS" basis,
- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- - for the specific language governing rights and limitations under the
- - License.
- -
- - The Original Code is Mozilla Communicator client code, released
- - March 31, 1998.
- -
- - The Initial Developer of the Original Code is
- - Netscape Communications Corporation.
- - Portions created by the Initial Developer are Copyright (C) 1998-1999
- - the Initial Developer. All Rights Reserved.
- -
- - Contributor(s):
- -
- - Alternatively, the contents of this file may be used under the terms of
- - either of the GNU General Public License Version 2 or later (the "GPL"),
- - or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- - in which case the provisions of the GPL or the LGPL are applicable instead
- - of those above. If you wish to allow use of your version of this file only
- - under the terms of either the GPL or the LGPL, and not to allow others to
- - use your version of this file under the terms of the MPL, indicate your
- - decision by deleting the provisions above and replace them with the notice
- - and other provisions required by the GPL or the LGPL. If you do not delete
- - the provisions above, a recipient may use your version of this file under
- - the terms of any one of the MPL, the GPL or the LGPL.
- -
- - ***** END LICENSE BLOCK ***** -->
-
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="Scott Furman">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>README for LiveConnect</title>
-</head>
-<body>
-This is the README file for the JavaScript LiveConnect
-Version 3 ("LC3") implementation.
-<h2>
-Table of Contents</h2>
-
-<blockquote><a href="#Introduction">Introduction</a>
-<br><a href="#New_Features">New features</a>
-<br><a href="#Compatibility">Compatibility</a>
-<br><a href="#Limitations">Limitations/Bugs/To-Do</a>
-<br><a href="#Build_conventions">Build conventions</a>
-<br><a href="#coding_conventions">Naming and coding conventions</a>
-<br><a href="#API">The LiveConnect API</a>
-<br><a href="#sample_shell_interaction">Sample LiveConnect shell interactions</a></blockquote>
-
-<h2>
-<a NAME="Introduction"></a>Introduction</h2>
-<span CLASS=LXRLONGDESC> <span CLASS=LXRSHORTDESC>LiveConnect is a library that
-permits JavaScript and Java virtual machines to interoperate.</span> Specifically,
-it enables JavaScript to access Java fields, invoke Java methods and enables Java
-to access JavaScript object properties and evaluate arbitrary JavaScript.</span>
-LiveConnect was originally an integrated feature of both the Netscape Navigator
-browser and Netscape's server-side JavaScript. Now, it is a standalone library
-that can be embedded within other projects, such as the Mozilla browser. More
-information on LiveConnect can be found by <a href="http://developer.netscape.com/find/find.cgi?scope=LiveConnect&browse-category=&ui=sr&chunk-size=&page=1&taxonomy=DevEdge+Online">searching
-the index on Netscape's DevEdge site</a>. This README assumes basic familiarity
-with <a href="http://lxr.mozilla.org/mozilla/source/js/src/README.html">JSRef</a>,
-the reference implementation of JavaScript, and with the LiveConnect technology.
-<p>The JSRef project/makefiles (located in another directory) build a library
- or DLL containing the JavaScript runtime (compiler, interpreter, decompiler,
- garbage collector, atom manager, standard classes). The LiveConnect project/makefiles
- build a library that links with both JSRef and any Java Virtual Machine (JVM)
- that implements the Java Native Interface (JNI), as specified by JavaSoft.
- It then compiles a small "shell" example program and links that with the library
- to make an interpreter that can be used interactively and with test scripts.
- See the <a href="#sample_shell_interaction">sample shell interactions</a>.
-<p><i>Scott Furman, 10/31/98</i>
-<h2>
-<a NAME="New_Features"></a>New features</h2>
-The following features were not available in the versions of LiveConnect that
-were integrated with Netscape Navigator versions 4.x and earlier. For information
-on LiveConnect version 1, which was used in Navigator versions 3 and 4, and Enterprise
-Server 3, see <a href="http://developer.netscape.com/find/find.cgi?scope=LiveConnect&browse-category=&ui=sr&chunk-size=&page=1&taxonomy=DevEdge+Online">Netscape's
-DevEdge site</a> or any number of 3rd-party publications.)
-<h4> LiveConnect version 3 (8/31/99)</h4>
-
-<ul>
- <li> In previous versions of LiveConnect, when more than one overloaded Java
- method was compatible with the types of arguments in an invocation from JS,
- the choice of Java method was made arbitrarily, by using the first one enumerated
- by the Java reflection APIs. Unfortunately, the ordering of methods
- when enumerating is not governed by any specification, so differences between
- JVM vendors could lead to inconsistencies in LiveConnect behavior. Now,
- a <a href="http://www.mozilla.org/js/liveconnect/lc3_method_overloading.html">JVM-independent
- set of rules</a> is used to choose among a set of overloaded methods.
- Informally, the method with Java parameter types that most closely match
- the JavaScript types is chosen.<BR>
- <BR>
- </li>
- <li> The weak correspondence between the JS language typing system and Java's
- may result in ambiguity and/or shadowing when resolving among overloaded Java
- methods, even when using LC3's improved method overload resolution algorithm
- (see above). For example, JS's number type can map to a Java method
- argument that has any floating-point or integral types: byte, char, short,
- int, long, float, double. If necessary, it is now possible to
- bypass the method overload resolution process and explicitly specify the method
- to be invoked:</li>
- <BR>
- <br>
-
- <ul>
- <tt>myPrintMethod = java.io.PrintStream["print(double)"];</tt> <br>
- <tt>myPrintMethod(13);</tt>
- </ul>
- <br>
- <li> Static methods can now be invoked using either the class name or a reference
- to an instance of the class. (Older versions of LiveConnect allow only
- the former.)<BR>
- <BR>
- </li>
- <li> It is no longer necessary to convert Java Strings to JS strings before
- using them as the receivers of JS string methods, which is typically done
- by appending an empty string to the Java string, e.g.
- <BLOCKQUOTE>
- <P> <tt> s = new java.lang.String("foo")</tt> // s contains
- a Java string<br>
- <tt> s = s + "";
- </tt>// s is now a JS string <br>
- <tt> m = s.match(/o?/)</tt> </P>
- </BLOCKQUOTE>
- </li>
- <p>The explicit conversion to a JS string is no longer required because <i>java.lang.String</i>
- objects are treated as a special case that "inherit" all the methods of JS
- strings, i.e. so that the second statement in the example above is now superfluous.<BR>
- <BR>
- <li> Similarly, JavaArray objects "inherit" the methods of JS's <tt>Array.prototype</tt>,
- so it is possible to apply many, though not all, of the JS array utility methods
- such as <tt>reverse()</tt> and <tt>join()</tt> to JavaArray objects.<BR>
- <BR>
- </li>
- <li> There is now support for the <tt>instanceof</tt> and <tt>in</tt> operators.
- These operators are currently proposed for inclusion in the ECMA-2 standard.<BR>
- <BR>
- </li>
- <li> LiveConnect has been extended to take advantage of JavaScript exceptions,
- a language feature that debuted in JavaScript 1.4. Now, when JavaScript
- calls into Java, any Java exceptions are converted to JS exceptions which
- can be caught using JS try-catch statements. Similarly, JS exceptions
- are propagated to Java wrapped in an instance of <i>netscape.javascript.JSException</i>.<BR>
- <BR>
- </li>
- <li>JavaScript Array objects can now be passed to Java methods that expect a
- Java array as an argument. <BR>
- LiveConnect will create a new Java array of the appropriate type with a length
- equal to that of the JS Array object. Each element of the Java array is filled
- in by converting the corresponding element of the JS array, including undefined
- elements, to an equivalent Java value. Note: Since the contents of the JS
- array are copied, side-effects made by the invoked Java method to the Java
- array will not be reflected in the JS array argument. </li>
-</ul>
-
-<h4>
-LiveConnect version 2 (7/31/98)</h4>
-
-<blockquote>
- <li> The Java methods of <i>java.lang.Object</i> are now invokeable methods
- of <tt><font size=+1>JavaArray</font></tt> objects, matching the behavior
- of arrays when accessed from Java<i>.</i> (Java arrays are a subclass
- of <i>java.lang.Object</i>.) For example, Java's <tt>getClass()</tt> and <tt>hashCode()</tt>
- methods can now be called on <tt>JavaArray</tt> objects. (In prior versions
- of LiveConnect, the methods of <i>java.lang.Object</i> were only inherited
- by non-array Java objects.)</li>
-
- <p>Note that this change has caused the string representation of JavaArray objects
- to change. Previously, the JavaArray toString() method always printed
- "<tt><font size=+1>[object JavaArray]"</font></tt> for all <tt>JavaArray</tt>'s.
- Now, the Java <tt>java.lang.Object.toString()</tt> method is called to convert
- JavaArray objects to strings, just as with other, non-array Java objects that
- are accessible via LiveConnect. <tt>java.lang.Object.toString()</tt>is defined
- in the <i>Java Language Specification</i> to return the value of the following
- expression:
- <p><tt><font size=-1>getClass().getName() + '@' + Integer.toHexString(hashCode())</font></tt><BR>
- <br>
-
- <li> A one-character string is now an acceptable match for an argument to a
- Java method of type <tt>char</tt>. (In earlier versions of LiveConnect,
- the only acceptable match for a <tt>char</tt> had to be a JavaScript value
- that was convertible to a number.) For example, the following is now
- possible:</li>
-
- <p><tt><font size=-1>c = new java.lang.Character("F")</font></tt><BR>
- <br>
-
-<li>
-A JavaClass object is now an acceptable match for an argument to a Java
-method of type <i>java.lang.Class</i>. For example, you can now write:</li>
-
-<p><tt><font size=-1>java.lang.reflect.Array.newInstance(java.lang.String,
-3)</font></tt>
-<p>instead of the more verbose:
- <p><tt><font size=-1>jls = java.lang.Class.forName("java.lang.String")</font></tt>
- <br>
- <tt><font size=-1>java.lang.reflect.Array.newInstance(jls, 3)</font></tt>
- <p><br>
-
-</blockquote>
-
-<h2>
-<a NAME="Compatibility"></a>Compatibility</h2>
-Unlike this standalone/component release, all previous versions of LiveConnect
-appeared only as an integrated feature of Netscape Navigator or the Enterprise
-Server. The variants of LiveConnect that appeared in Navigator versions
-3.x and 4.x all behave much the same, modulo bugs. For brevity we refer
-to this classic version of LiveConnect as "LC1" (LiveConnect version 1) and this
-most recent release as "LC3". With a few exceptions LC3 provides a superset
-of LC1 features. (There was an intermediate LiveConnect release known as "LC2"
-in 7/98, but it was not used in any products.)
-<ul>
- <li> As in LC1, JavaScript objects appear to Java as instances of <i>netscape.javascript.JSObject</i>.
- In LC1, two <i>JSObject</i>'s could be tested for equality, i.e. to see if
- they refer to the same instance, by using the `==' operator. Instead,
- developers must now use the <tt>equals()</tt>method of <i>netscape.javascript.JSObject</i>
- for comparison, a method that overrides <tt>java.lang.Object.equals()</tt>.
- Note that using <tt>equals()</tt> instead of `==' will work the same in all
- versions of LiveConnect, including LC3</li>
- <p>[It is not possible to replicate the identity behavior of the `==' operator
- that LC1 provides without the use of "weak" references, i.e. references that
- do not contribute to making a Java object reachable for purposes of garbage
- collection, but which nonetheless allow reference to an object as long as
- it is reachable by other means. The use of weak references is not portable,
- however. It is not part of the JNI or JDK 1.1 and it is not provided
- on all JVMs. The JDK1.2 release includes standard support for weak references.]<BR>
- <br>
-
- <li> It's possible that, in a set of overloaded Java methods, more than one
- method is compatible with the types of the actual arguments in a call from
- JavaScript to Java via LiveConnect. LC1 and LC2 resolved these ambiguities
- in a simplistic manner, by simply invoking whatever method was enumerated
- first by the JVM. The enumeration order of reflected methods using <i>java.lang.reflect</i>
- is not specified by Sun and may differ among vendor's JVMs, i.e. enumeration
- could be in order of classfile appearance, hashtable order, etc. Hence,
- the Java method chosen when there is more than one compatible method may vary
- depending on the JVM. With the Netscape and Sun JVMs, it is possible
- to change the behavior of an LC1/LC2 program by changing the order that Java
- methods appear in a source file, thus changing the method enumeration order.</li>
- <p>In LC3, a new method overload resolution algorithm is used. Informally,
- the method with Java parameter types that most closely match the JavaScript
- types is chosen. You can read all the gorey details in the <a href="http://www.mozilla.org/js/liveconnect/lc3_method_overloading.html">spec</a>.<BR>
- <br>
-
- <li> There are several minor changes in error handling to make LiveConnect more
- conformant to ECMAScript. These include, for example, making any attempt
- to delete JavaObject, JavaClass or JavaPackage properties fail silently, rather
- than causing an error. Also, some error messages have been changed to
- be more informative. These changes should generally be backward-compatible
- with LC1 because few programs that use LiveConnect will depend on the exact
- behavior of LiveConnect when handling errors.</li>
-</ul>
-
-<h2> <a NAME="Limitations"></a>Limitations/Bugs/To-Do<BR>
-</h2>
-<ul>
- <li> The efficiency of calling Java methods leaves something to be desired,
- due to the convoluted nature of implementing native methods for JS.
- JS_CloneFunctionObject() is called for every Java method invocation and the
- inability to store private data in a JSFunction object requires that the method
- table be searched twice instead of once for every invocation.<BR>
- <BR>
- </li>
- <li> When Java objects are referenced from JS, they are entered into a hash
- table, so as to ensure that the same JS Object wrapper is used every time
- a particular Java object is reflected into JS. In this way, the behavior
- of the JS '==' and '===' operators are preserved. Unfortunately, the
- hash table may grow quite large (objects are only removed from the hash table
- when finalized). In thread-safe systems, the hash table must be locked
- when accessed, leading to slow performance. One alternate solution would be
- to make it possible to overload JS's equality-test operators, so that the
- hash table would no longer be required.<BR>
- <BR>
- </li>
- <li> Initially, JavaClassDescriptor objectswere reference-counted to permit
- free'ing of unused descriptors. However, it's relatively common to develop
- cycles in the graph of JavaClassDescriptors, which leads to unused JavaClassDescriptors
- that have non-zero reference counts. For that reason, JavaClassDescriptors
- are not free'ed until JSJ_Shutdown(). Luckily, the amount of memory
- used by JavaClassDescriptors tends to be relatively small.<BR>
- <BR>
- </li>
- <li> The LiveConnect API is designed to allow multiple JVMs to be used simultaneously
- in the same executable (although each JSContext is limited to interaction
- with at most one JVM). However, the API is not fully implemented.
- For example, many global variables will need to become members of the JSJavaVM
- struct so that they are stored on a per-JVM basis.<BR>
- <BR>
- </li>
- <li> Java and JavaScript use independent garbage collection systems. A reference
- between the two worlds must, therefore, take the form of a GC root. It's possible
- to create uncollectable objects when cyclic graphs cross the boundary between
- JS and Java, e.g. a JS object that refers to a Java object that refers back
- to the original JS object. There is no simple solution to this dual-GC problem.
- Luckily, such cyclic object graphs are extremely rare. </li>
-</ul>
-
-<h2>
-<a NAME="Build_conventions"></a>Build conventions</h2>
-<P>The following directions are for building the standalone version of LiveConnect.
- To build the version that's used in the Mozilla browser, see the <A HREF="http://www.mozilla.org/docs/">Mozilla
- build documentation</A>.</P>
-<P>On all platforms, you must update your JVM's <tt>CLASSPATH</tt> to point to
- the <tt>js/src/liveconnect/classes</tt> subdirectory. If you do not, LiveConnect
- will still operate but with the limitation that JS objects may not be passed
- as arguments of Java methods and it will not be possible to call from Java into
- JavaScript, i.e. the <i>netscape.javascript.JSObject</i> class will be inaccessible.
- Another downside of operating without these classes is that Java error messages
- will not include a Java stack trace, when one is available. If your <tt>CLASSPATH</tt>
- is set improperly, you will see a message like, "<tt>initialization error: Can't
- load class netscape/javascript/JSObject</tt>" when starting a LiveConnect debug
- build. </P>
-<p>By default, all platforms build a version of LiveConnect that is <i>not</i>
- threadsafe. If you require thread-safety, you must also populate the <tt>mozilla/dist</tt>
- directory with <a href="http://www.mozilla.org/docs/tplist/catCode/nsprdesc.htm">NSPR</a>
- headers and libraries. (NSPR implements a portable threading library,
- among other things. The source is downloadable via <a href="http://www.mozilla.org/cvs.html">CVS</a>
- from <tt><a href="http://lxr.mozilla.org/mozilla/source/nsprpub">mozilla/nsprpub</a></tt>.)
- Next, you must define <tt>JS_THREADSAFE</tt> when building LiveConnect, either
- on the command-line (gmake/nmake) or in a universal header file. Note
- that JSRef must also be built with <tt>JS_THREADSAFE</tt>.
-<p>One important note about building on Windows: There are two independent build
- systems (in addition to the Mozilla browser build system). One of them uses
- the IDE project files and the other uses gmake and makefiles. The former will
- be preferred by most for debugging and the latter is more complete, since it
- builds the necessary Java classes in addition to compiling the LiveConnect C
- code.
-<ul><b>Windows</b>
-<ul>
-<li>
-Build the JS runtime and interpreter, <tt>js32.dll</tt>, by using the
-<a href="http://lxr.mozilla.org/mozilla/source/js/src/README.html#Build">normal
-JSRef build procedure</a>.</li> <li> Set the <tt>JDK</tt> environment variable to point to the top-level JDK directory,
- e.g. <tt>D:\jdk1.1.5</tt>. This is used to establish paths for header
- file inclusion, linking and execution. If you are not using Sun's
- JVM, the project files may require manual tweaking to set these paths correctly.</li>
-
- <li> Use MSVC 5 or MSVC 6 with the <tt>LiveConnectShell.dsw</tt> project file.
- <font color="#993300">NOTE: makefile.win is an nmake file used only for
- building the JS-engine in the Mozilla browser. Don't attempt to use
- it to build the standalone JS-engine.</font></li>
-
-<li>
-The output files (DLLs and executables) are placed in either the <tt>js\src\liveconnect\Debug</tt>
-or the <tt>js\src\liveconnect\Release</tt> directory.</li>
-
-<li>
-The LiveConnect-enabled shell is named <tt>lcshell.exe</tt> and appears
-in the output directory.</li>
-
-<li>
-You must have the JVM DLL in your <tt><font size=+1>PATH</font></tt> environment
-variable in order to run. If you are using the Sun JDK, the DLL appears
-in the JDK's bin directory, e.g. <tt>D:\jdk1.1.5\bin\javai_g.dll</tt>.</li>
-
-<li>
-Use any Java compiler to compile the java source files in the <tt>js\src\liveconnect\classes\netscape\javascript</tt>
-directory.</li>
-
- <li> Update your JVM's <tt>CLASSPATH</tt> to point to the <tt>js\src\liveconnect\classes</tt>
- subdirectory. (See above)<br>
-<BR></li>
-</ul>
-<b>Mac OS</b>
-<ul>
-<li>
-Using CodeWarrior Pro 3 is recommended, though the project files will probably
-also work with CodeWarrior Pro 4.</li>
-
-<li>
-Install Apple's JVM, MRJ 2.0 (or later), and the <a href="ftp://dev.apple.com/devworld/Java/MRJSDK2.0.1EarlyAccess4.hqx">MRJ
-SDK v2.0.1ea4</a>. Note: You do not need to install MRJ if you are
-running a recent version of MacOS 8, since it is shipped with the OS.</li>
-
-<li>
-Copy the folders <tt>CIncludes</tt> & <tt>Libraries</tt> from the SDK's
-<tt>Interfaces&Libraries</tt> directory to <tt>js:src:liveconnect:macbuild:JavaSession</tt>.</li>
-
-<li>
-Build the LiveConnect test application, <tt>LiveConnectShell</tt>, with
-<tt>js:src:liveconnect:macbuild:LiveConnectShell.mcp</tt>.</li>
-
-<li>
-Build <tt>liveconnect.jar</tt> with <tt>js:src:liveconnect:macbuild:LiveConnect.mcp</tt>.</li>
-
-<li>
-Make an alias to <tt>liveconnect.jar</tt> and place it in "<tt>{SystemFolder}Extensions:MRJ
-Libraries:MRJClasses</tt>".<br>
-<BR></li>
-</ul>
- <b>Unix</b> (also works on Windows)
- <ul>
- <li> <font color="#000000">Use '<tt>gmake -f Makefile.ref</tt>' to build.
- To compile optimized code, pass <tt>BUILD_OPT=1</tt> on the gmake command
- line or preset it in the environment or <tt>Makefile.ref</tt>. </font><font color="#990000">NOTE:
- Do not attempt to use <tt>Makefile</tt> to build. This file is used
- only for building LiveConnect in the Mozilla browser.</font></li>
- <li> <font color="#000000">Each platform on which LiveConnect is built must
- have a *.mk configuration file in the <tt>js/src/liveconnect/config</tt>
- directory. The configuration file specifies the JVM headers/libraries
- used and allows for customization of command-line options. To date,
- the build system has been tested on Solaris, AIX, HP/UX, OSF, IRIX, x86
- Linux and Windows NT. Most platforms will work with either the vendor compiler
- or gcc.</font></li>
- <li>Update your JVM's <tt><font size=+1>CLASSPATH</font></tt> to point to
- the <tt>js/src/liveconnect/classes</tt> subdirectory. (See above)</li>
- </ul>
-</ul>
-
-<h2>
-<a NAME="coding_conventions"></a>Naming and coding conventions:</h2>
-
-<ul>
-<li>
-Public function names begin with JSJ_ followed by capitalized "intercaps",
-e.g. JSJ_ConnectToJavaVM.</li>
-
-<li>
-Extern but library-private function names use a jsj_ prefix and mixed case,
-e.g. jsj_LookupSymbol.</li>
-
-<li>
-Most static function names have unprefixed, underscore-separated names:
-get_char.</li>
-
-<li>
-But static native methods of JS objects have intercaps names, e.g., JavaObject_getProperty().</li>
-
-<li>
-And library-private and static data use underscores, not intercaps (but
-library-private data do use a js_ prefix).</li>
-
-<li>
-Scalar type names are lowercase and js-prefixed: jsdouble.</li>
-
-<li>
-Aggregate type names are JS-prefixed and mixed-case: JSObject.</li>
-
-<li>
-Macros are generally ALL_CAPS and underscored, to call out potential side
-effects, multiple uses of a formal argument, etc.</li>
-
-<li>
-Four spaces of indentation per statement nesting level. The files
-are space-filled, so adjusting of your tab setting should be unnecessary.</li>
-
-<li>
-I don't bow down to the ancient "80 columns per line" gods, since most
-of us are not using vt100's to read source code. My rule of thumb
-is to use no more than 95 columns per line, but exceptions are made to
-format tables or table-like code.</li>
-
-<li>
-DLL entry points have their return type expanded within a JS_EXPORT_API()
-macro call, to get the right Windows secret type qualifiers in the right
-places for both 16- and 32-bit builds.</li>
-
-<h2>
-<a NAME="API"></a>The LiveConnect API</h2>
-All public LiveConnect entry points and callbacks are documented in
-<A HREF=http://lxr.mozilla.org/mozilla/source/js/src/liveconnect/jsjava.h>jsjava.h</A>,
-the header file that exports those functions.
-<br>
-<h2>
-<a NAME="File_walkthrough"></a>File walk-through</h2>
-
-<table BORDER=3 CELLSPACING=0 CELLPADDING=4 >
-<tr>
-<td>jsjava.h</td>
-
-<td>LiveConnect's only public header file. Defines all public API
-entry points, callbacks and types. </td>
-</tr>
-
-<tr>
-<td>jsj_private.h</td>
-
-<td>LiveConnect internal header file for intra-module sharing of functions
-and types.</td>
-</tr>
-
-<tr>
-<td>jsj.c</td>
-
-<td>Public LiveConnect API entry points and initialization code. Handling
-of multiple threads and multiple JVMs.</td>
-</tr>
-
-<tr>
-<td>jsj_array.c</td>
-
-<td>Read and write elements of a Java array, performing needed conversions
-to/from JS types.</td>
-</tr>
-
-<tr>
-<td>jsj_class.c</td>
-
-<td>Construct and manipulate JavaClassDescriptor structs, which are the
-native representation for Java classes. JavaClassDescriptors are
-used to describe the methods and fields of a class, including their type
-signatures, and include a reference to the peer <i>java.lang.Class</i>
-object. Since each Java object has a class, there is a JavaClassDescriptor
-associated with the JavaScript reflection of each Java Object.</td>
-</tr>
-
-<tr>
-<td>jsj_convert.c</td>
-
-<td>Convert between Java and JavaScript values of all types, which may
-require calling routines in other files to wrap JS objects as Java objects
-and vice-versa.</td>
-</tr>
-
-<tr>
-<td>jsj_field.c</td>
-
-<td>Reflect Java fields as properties of JavaObject objects and implement
-getter/setter access to those fields.</td>
-</tr>
-
-<tr>
-<td>jsj_JavaArray.c</td>
-
-<td>Implementation of the JavaScript JavaArray class. Instances of
-JavaArray are used to reflect Java arrays.</td>
-</tr>
-
-<tr>
-<td>jsj_JavaClass.c</td>
-
-<td>Implementation of the JavaScript JavaClass class. Instances
-of JavaClass are used to reflect Java classes.</td>
-</tr>
-
-<tr>
-<td>jsj_JavaObject.c</td>
-
-<td>Implementation of the JavaScript JavaObject class. Instances
-of JavaObject are used to reflect Java objects, except for Java arrays,
-although some of the code in this file is used by the JavaArray code.</td>
-</tr>
-
-<tr>
-<td>jsj_JavaMember.c</td>
-
-<td>Implementation of the JavaScript JavaMember class. JavaMember's
-are a strange beast required only to handle the special case of a public
-field and a public method that appear in the same Java class and which
-have the same name.</td>
-</tr>
-
-<tr>
-<td>jsj_JavaPackage.c</td>
-
-<td>Implementation of the JavaScript JavaPackage class. Instances
-of JavaPackage are used to reflect Java packages. The JS properties
-of a JavaPackage are either nested JavaPackage objects or a JavaClass object.</td>
-</tr>
-
-<tr>
-<td>jsj_JSObject.c</td>
-
-<td>Implementation of the native methods for the <i>netscape.javascript.JSObject</i>
-Java class, which are used for calling into JavaScript from Java.
-It also contains the code that wraps JS objects as instances of <i>netscape.javascript.JSObject
-</i>and
-the code that handles propagation of exceptions both into and out of Java.</td>
-</tr>
-
-<tr>
-<td>jsj_method.c</td>
-
-<td>Reflect Java methods as properties of JavaObject objects and make it
-possible to invoke those methods. Includes overloaded method resolution
-and argument/return-value conversion code.</td>
-</tr>
-
-<tr>
-<td>jsj_utils.c</td>
-
-<td>Low-level utility code for reporting errors, etc.</td>
-</tr>
-</table>
-
-<h2>
-<a NAME="sample_shell_interaction"></a>Sample LiveConnect shell interactions</h2>
-
-<h4>
-Java packages, classes and constructors</h4>
-<tt>js> java</tt>
-<br><tt>[JavaPackage java]</tt>
-<br><tt>js> awt = java.awt</tt>
-<br><tt>[JavaPackage java.awt]</tt>
-<br><tt>js> Rectangle = awt.Rectangle</tt>
-<br><tt>[JavaClass java.awt.Rectangle]</tt>
-<h4>
-Java instance fields and methods</h4>
-<tt>js> r = new java.awt.Rectangle(34, 23)</tt>
-<br><tt>java.awt.Rectangle[x=0,y=0,width=34,height=23]</tt>
-<br><tt>js> r.width - r.height</tt>
-<br><tt>11</tt>
-<br><tt>js> r.x = 7; r.y = 4</tt>
-<br><tt>4</tt>
-<br><tt>js> r</tt>
-<br><tt>java.awt.Rectangle[x=7,y=4,width=34,height=23]</tt>
-<br><tt>js> r.grow(3)</tt>
-<br><tt>There is no Java method java.awt.Rectangle.grow that matches JavaScript
-argument types (number).</tt>
-<br><tt>Candidate methods with the same name are:</tt>
-<br><tt> void grow(int, int)</tt>
-<p><tt>js> r.grow(3, 3)</tt>
-<br><tt>js> r</tt>
-<br><tt>java.awt.Rectangle[x=4,y=1,width=40,height=29]</tt>
-<h4>
-Java arrays</h4>
-<tt>js> s = new java.lang.String("mastiff")</tt>
-<br><tt>mastiff</tt>
-<br><tt>js> c = s.toCharArray()</tt>
-<br><tt>[C@298e9b</tt>
-<br><tt>js> c[0] = "b"; c[4] = "a"; c[5] = "r"; c[6] = "d"</tt>
-<br><tt>d</tt>
-<br><tt>js> s2 = new java.lang.String(c)</tt>
-<br><tt>bastard</tt>
-<h4>
-Java static fields and methods</h4>
-<tt>js> java.lang.reflect.Modifier.ABSTRACT</tt>
-<br><tt>1024</tt>
-<br><tt>js> java.lang.Math.sin(3) + 2</tt>
-<br><tt>2.1411200080598674</tt>
-<h4>
-Explicit resolution of overloaded Java methods</h4>
-<tt>js> x = "23"</tt>
-<br><tt>23</tt>
-<br><tt>js> java.lang.Math.abs(x)</tt>
-<br><tt>The choice of static Java method java.lang.Math.abs matching JavaScript
-argument types (string) is ambiguous.</tt>
-<br><tt>Candidate methods are:</tt>
-<br><tt> long abs(long)</tt>
-<br><tt> float abs(float)</tt>
-<br><tt> double abs(double)</tt>
-<br><tt> int abs(int)</tt>
-<br><tt>js> abs = java.lang.Math["abs(int)"]</tt>
-<p><tt>function abs(int)() {</tt>
-<br><tt> [native code]</tt>
-<br><tt>}</tt>
-<p><tt>js> abs(x)</tt>
-<br><tt>23</tt>
-<h4>
-Public Method/field enumeration</h4>
-<tt>js> out = java.lang.System.out</tt>
-<br><tt>java.io.PrintStream@2980f5</tt>
-<br><tt>js> for (m in out) print(m)</tt>
-<br><tt>println</tt>
-<br><tt>print</tt>
-<br><tt>checkError</tt>
-<br><tt>close</tt>
-<br><tt>flush</tt>
-<br><tt>write</tt>
-<br><tt>wait</tt>
-<br><tt>notifyAll</tt>
-<br><tt>notify</tt>
-<br><tt>toString</tt>
-<br><tt>equals</tt>
-<br><tt>hashCode</tt>
-<br><tt>getClass</tt>
-<br><tt>js> for (m in java.lang.String) print(m)</tt>
-<br><tt>copyValueOf</tt>
-<br><tt>valueOf</tt>
-<h4>
-'instanceof' and 'in' operators</h4>
-<tt>js> s = new java.lang.String("foop")</tt>
-<br><tt>foop</tt>
-<br><tt>js> s instanceof java.lang.Class</tt>
-<br><tt>false</tt>
-<br><tt>js> s instanceof java.lang.Object</tt>
-<br><tt>true</tt>
-<br><tt>js> "valueOf" in s</tt>
-<br><tt>true</tt>
-<br><tt>js> "NoSuchThing" in s</tt>
-<br><tt>false</tt>
-<h4>
-Applying JavaScript string methods to Java strings</h4>
-<tt>js> s = new java.lang.String("The rain in Spain falls mainly on my
-head.")</tt>
-<br><tt>The rain in Spain falls mainly on my head.</tt>
-<br><tt>js> s.match(/Spain.*my/)</tt>
-<br><tt>Spain falls mainly on my</tt>
-<h4>
-Applying JavaScript array methods to Java arrays</h4>
-<tt>js> s = new java.lang.String("JavaScript")</tt>
-<br><tt>JavaScript</tt>
-<br><tt>js> c = s.toCharArray()</tt>
-<br><tt>[C@298aef</tt>
-<br><tt>js> c.reverse()</tt>
-<br><tt>[C@298aef</tt>
-<br><tt>js> new java.lang.String(c)</tt>
-<br><tt>tpircSavaJ</tt>
-<br>
-</body>
-</html>
deleted file mode 100644
--- a/js/src/liveconnect/_jni/netscape_javascript_JSException.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include "jni.h"
-
-/* Header for class netscape_javascript_JSException */
-
-#ifndef _Included_netscape_javascript_JSException
-#define _Included_netscape_javascript_JSException
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
deleted file mode 100644
--- a/js/src/liveconnect/_jni/netscape_javascript_JSObject.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * This file is part of the Java-vendor-neutral implementation of LiveConnect
- *
- * Declarations of private (internal) functions/data/types for
- * JavaScript <==> Java communication.
- *
- */
-
-#include <jni.h>
-/* Header for class netscape_javascript_JSObject */
-
-#ifndef _Included_netscape_javascript_JSObject
-#define _Included_netscape_javascript_JSObject
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: netscape_javascript_JSObject
- * Method: initClass
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_initClass
- (JNIEnv *, jclass);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getMember
- * Signature: (Ljava/lang/String;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_netscape_javascript_JSObject_getMember
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getSlot
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_netscape_javascript_JSObject_getSlot
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: setMember
- * Signature: (Ljava/lang/String;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_setMember
- (JNIEnv *, jobject, jstring, jobject);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: setSlot
- * Signature: (ILjava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_setSlot
- (JNIEnv *, jobject, jint, jobject);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: removeMember
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_removeMember
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: call
- * Signature: (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_netscape_javascript_JSObject_call
- (JNIEnv *, jobject, jstring, jobjectArray);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: eval
- * Signature: (Ljava/lang/String;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_netscape_javascript_JSObject_eval
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: toString
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_netscape_javascript_JSObject_toString
- (JNIEnv *, jobject);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getWindow
- * Signature: (Ljava/applet/Applet;)Lnetscape/javascript/JSObject;
- */
-JNIEXPORT jobject JNICALL Java_netscape_javascript_JSObject_getWindow
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: finalize
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_finalize
- (JNIEnv *, jobject);
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: equals
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL Java_netscape_javascript_JSObject_equals
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
deleted file mode 100644
--- a/js/src/liveconnect/classes/Makefile.in
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE = java
-
-#
-# the idea is that the install phase for those modules will
-# make their own signed jar files
-# there are some exceptions here that we deal with
-# stuff in modules and in ns/js/jsj
-#
-JMODS = netscape/javascript netscape/javascript/adapters
-
-#
-# JDIRS is dependant on JAVA_DESTPATH in config/rules.m[a]k.
-# Be sure to touch that directory if you add a new directory to
-# JDIRS, or else it will not build. FIXME
-#
-JDIRS = $(JMODS)
-
-JAR_JSJ = jsj10.jar
-JAR_JSJ_CLASSES = $(JMODS)
-
-#
-# jars to build at install time
-#
-JARS = $(JAR_JSJ)
-
-include $(topsrcdir)/config/rules.mk
-
-JAVA_SOURCEPATH = $(topsrcdir)/js/src/liveconnect/classes
-
-doc::
- $(JAVADOC) -d $(DIST)/doc netscape.javascript
-
-natives_list:: FORCE
- rm -rf $@
- find . -name "*.class" -print | sed 's@\./\(.*\)\.class$$@\1@' | \
- sed 's@/@.@g' | xargs $(JVH) -natives | sort > $@
-
-check_natives:: natives_list
- rm -f found_natives
- nm -B ../*.o \
- | egrep "Java.*_stub" | awk '{ print $$3; }' | sort > found_natives
- diff found_natives natives_list
-
-FORCE:
deleted file mode 100644
--- a/js/src/liveconnect/classes/Makefile.ref
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../..
-
-include $(DEPTH)/config.mk
-JAR = $(JDK)/bin/jar
-include $(DEPTH)/liveconnect/config/$(OS_CONFIG).mk
-
-JARS = $(LCJAR)
-
-JARS := $(addprefix $(CLASSDIR)/$(OBJDIR)/, $(JARS))
-
-PREDIRS = netscape
-TARGETS += $(JARS)
-
-include $(DEPTH)/rules.mk
-
-$(CLASSDIR)/$(OBJDIR)/$(LCJAR):
- cd $(CLASSDIR)/$(OBJDIR) ; \
- $(JAR) cvf $(@F) netscape
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/Makefile.ref
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../..
-
-include $(DEPTH)/config.mk
-include $(DEPTH)/liveconnect/config/$(OS_CONFIG).mk
-
-DIRS = javascript
-
-include $(DEPTH)/rules.mk
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/JSException.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package netscape.javascript;
-
-/**
- * JSException is an exception which is thrown when JavaScript code
- * returns an error.
- */
-
-public
-class JSException extends RuntimeException {
- public static final int EXCEPTION_TYPE_EMPTY = -1;
- public static final int EXCEPTION_TYPE_VOID = 0;
- public static final int EXCEPTION_TYPE_OBJECT = 1;
- public static final int EXCEPTION_TYPE_FUNCTION = 2;
- public static final int EXCEPTION_TYPE_STRING = 3;
- public static final int EXCEPTION_TYPE_NUMBER = 4;
- public static final int EXCEPTION_TYPE_BOOLEAN = 5;
- public static final int EXCEPTION_TYPE_ERROR = 6;
-
- String filename;
- int lineno;
- String source;
- int tokenIndex;
- private int wrappedExceptionType;
- private Object wrappedException;
-
- /**
- * Constructs a JSException without a detail message.
- * A detail message is a String that describes this particular exception.
- *
- * @deprecated Not for public use in future versions.
- */
- public JSException() {
- super();
- filename = "unknown";
- lineno = 0;
- source = "";
- tokenIndex = 0;
- wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
- }
-
- /**
- * Constructs a JSException with a detail message.
- * A detail message is a String that describes this particular exception.
- * @param s the detail message
- *
- * @deprecated Not for public use in future versions.
- */
- public JSException(String s) {
- super(s);
- filename = "unknown";
- lineno = 0;
- source = "";
- tokenIndex = 0;
- wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
- }
-
- /**
- * Constructs a JSException with a wrapped JavaScript exception object.
- * This constructor needs to be public so that Java users can throw
- * exceptions to JS cleanly.
- */
- private JSException(int wrappedExceptionType, Object wrappedException) {
- super();
- this.wrappedExceptionType = wrappedExceptionType;
- this.wrappedException = wrappedException;
- }
-
- /**
- * Constructs a JSException with a detail message and all the
- * other info that usually comes with a JavaScript error.
- * @param s the detail message
- *
- * @deprecated Not for public use in future versions.
- */
- public JSException(String s, String filename, int lineno,
- String source, int tokenIndex) {
- super(s);
- this.filename = filename;
- this.lineno = lineno;
- this.source = source;
- this.tokenIndex = tokenIndex;
- wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
- }
-
- /**
- * Instance method getWrappedExceptionType returns the int mapping of the
- * type of the wrappedException Object.
- */
- public int getWrappedExceptionType() {
- return wrappedExceptionType;
- }
-
- /**
- * Instance method getWrappedException.
- */
- public Object getWrappedException() {
- return wrappedException;
- }
-
-}
-
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/JSObject.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* more doc todo:
- * threads
- * gc
- *
- *
- */
-
-package netscape.javascript;
-
-import java.applet.Applet;
-
-/**
- * JSObject allows Java to manipulate objects that are
- * defined in JavaScript.
- * Values passed from Java to JavaScript are converted as
- * follows:<ul>
- * <li>JSObject is converted to the original JavaScript object
- * <li>Any other Java object is converted to a JavaScript wrapper,
- * which can be used to access methods and fields of the java object.
- * Converting this wrapper to a string will call the toString method
- * on the original object, converting to a number will call the
- * doubleValue method if possible and fail otherwise. Converting
- * to a boolean will try to call the booleanValue method in the
- * same way.
- * <li>Java arrays are wrapped with a JavaScript object that understands
- * array.length and array[index]
- * <li>A Java boolean is converted to a JavaScript boolean
- * <li>Java byte, char, short, int, long, float, and double are converted
- * to JavaScript numbers
- * </ul>
- * Values passed from JavaScript to Java are converted as follows:<ul>
- * <li>objects which are wrappers around java objects are unwrapped
- * <li>other objects are wrapped with a JSObject
- * <li>strings, numbers and booleans are converted to String, Double,
- * and Boolean objects respectively
- * </ul>
- * This means that all JavaScript values show up as some kind
- * of java.lang.Object in Java. In order to make much use of them,
- * you will have to cast them to the appropriate subclass of Object,
- * e.g. <code>(String) window.getMember("name");</code> or
- * <code>(JSObject) window.getMember("document");</code>.
- */
-public final class JSObject {
- /* the internal object data */
- private int internal;
- private long long_internal;
-
- /**
- * initialize
- */
- private static native void initClass();
- static {
- // On MRJ, this property won't exist, because the library is preloaded.
- String liveConnectLibrary = System.getProperty("netscape.jsj.dll", null);
- if (liveConnectLibrary != null) {
- System.loadLibrary(liveConnectLibrary);
- initClass();
- }
- }
-
- /**
- * it is illegal to construct a JSObject manually
- */
- private JSObject(int jsobj_addr) {
- internal = jsobj_addr;
- }
-
- private JSObject(long jsobj_addr) {
- long_internal = jsobj_addr;
- }
-
- /**
- * Retrieves a named member of a JavaScript object.
- * Equivalent to "this.<i>name</i>" in JavaScript.
- */
- public native Object getMember(String name);
-
- /**
- * Retrieves an indexed member of a JavaScript object.
- * Equivalent to "this[<i>index</i>]" in JavaScript.
- */
-// public Object getMember(int index) { return getSlot(index); }
- public native Object getSlot(int index);
-
- /**
- * Sets a named member of a JavaScript object.
- * Equivalent to "this.<i>name</i> = <i>value</i>" in JavaScript.
- */
- public native void setMember(String name, Object value);
-
- /**
- * Sets an indexed member of a JavaScript object.
- * Equivalent to "this[<i>index</i>] = <i>value</i>" in JavaScript.
- */
-// public void setMember(int index, Object value) {
-// setSlot(index, value);
-// }
- public native void setSlot(int index, Object value);
-
- /**
- * Removes a named member of a JavaScript object.
- */
- public native void removeMember(String name);
-
- /**
- * Calls a JavaScript method.
- * Equivalent to "this.<i>methodName</i>(<i>args</i>[0], <i>args</i>[1], ...)" in JavaScript.
- */
- public native Object call(String methodName, Object args[]);
-
- /**
- * Evaluates a JavaScript expression. The expression is a string
- * of JavaScript source code which will be evaluated in the context
- * given by "this".
- */
- public native Object eval(String s);
-
- /**
- * Converts a JSObject to a String.
- */
- public native String toString();
-
- // should use some sort of identifier rather than String
- // is "property" the right word?
- // native String[] listProperties();
-
-
- /**
- * get a JSObject for the window containing the given applet
- */
- public static native JSObject getWindow(Applet applet);
-
- /**
- * Finalization decrements the reference count on the corresponding
- * JavaScript object.
- */
- protected native void finalize();
-
- /**
- * Override java.lang.Object.equals() because identity is not preserved
- * with instances of JSObject.
- */
- public native boolean equals(Object obj);
-}
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/JSProxy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/**
- * The JSProxy interface allows applets and plugins to
- * share javascript contexts.
- */
-
-package netscape.javascript;
-import java.applet.Applet;
-
-public interface JSProxy {
- Object getMember(JSObject jso, String name);
- Object getSlot(JSObject jso, int index);
- void setMember(JSObject jso, String name, Object value);
- void setSlot(JSObject jso, int index, Object value);
- void removeMember(JSObject jso, String name);
- Object call(JSObject jso, String methodName, Object args[]);
- Object eval(JSObject jso, String s);
- String toString(JSObject jso);
- JSObject getWindow(Applet applet);
-}
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/JSRunnable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package netscape.javascript;
-
-/**
- * Runs a JavaScript object with a run() method in a separate thread.
- */
-public class JSRunnable implements Runnable {
- private JSObject runnable;
-
- public JSRunnable(JSObject runnable) {
- this.runnable = runnable;
- synchronized(this) {
- new Thread(this).start();
- try {
- this.wait();
- } catch (InterruptedException ie) {
- }
- }
- }
-
- public void run() {
- try {
- runnable.call("run", null);
- synchronized(this) {
- notifyAll();
- }
- } catch (Throwable t) {
- System.err.println(t);
- t.printStackTrace(System.err);
- }
- }
-}
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/JSUtil.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/* ** */
-
-package netscape.javascript;
-import java.io.*;
-
-public class JSUtil {
-
- /* Return the stack trace of an exception or error as a String */
- public static String getStackTrace(Throwable t) {
- ByteArrayOutputStream captureStream;
- PrintWriter p;
-
- captureStream = new ByteArrayOutputStream();
- p = new PrintWriter(captureStream);
-
- t.printStackTrace(p);
- p.flush();
-
- return captureStream.toString();
- }
-}
deleted file mode 100644
--- a/js/src/liveconnect/classes/netscape/javascript/Makefile.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../../..
-
-include $(DEPTH)/config.mk
-include $(DEPTH)/liveconnect/config/$(OS_CONFIG).mk
-
-JARPATH = netscape/javascript
-
-JAVA_SRCS = JSException.java \
- JSObject.java \
- JSProxy.java \
- JSRunnable.java \
- JSUtil.java
-
-include $(DEPTH)/rules.mk
deleted file mode 100644
--- a/js/src/liveconnect/config/AIX4.1.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# Change these to the current platform settings!!!
-
-JDK = /tools/ns
-
-INCLUDES += -I$(JDK)/include/java -I$(JDK)/include/java/aix
-
-OTHER_LIBS += -L$(JDK)/lib/aix/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/AIX4.2.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# Change these to the current platform settings!!!
-
-JDK = /tools/ns
-
-INCLUDES += -I$(JDK)/include/java -I$(JDK)/include/java/aix
-
-OTHER_LIBS += -L$(JDK)/lib/aix/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/AIX4.3.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# Change these to the current platform settings!!!
-
-#JDK = /tools/ns
-JDK = /share/builds/components/jdk/1.2beta/AIX
-JAVAC = $(JDK)/sh/javac
-JAR = $(JDK)/sh/jar
-
-INCLUDES += -I$(JDK)/include
-
-#OTHER_LIBS += -L$(JDK)/lib/aix/native_threads -ljava
-OTHER_LIBS += -L$(JDK)/jre/bin -ljava -L$(JDK)/jre/bin/classic -ljvm
-
deleted file mode 100644
--- a/js/src/liveconnect/config/HP-UXB.10.10.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.5/HP-UX10
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/hp-ux
-
-OTHER_LIBS += -L$(JDK)/lib/PA_RISC/green_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/HP-UXB.10.20.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.5/HP-UX10
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/hp-ux
-
-OTHER_LIBS += -L$(JDK)/lib/PA_RISC/green_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/HP-UXB.11.00.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.5/HP-UX
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/hp-ux
-
-OTHER_LIBS += -L$(JDK)/lib/PA_RISC/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/IRIX6.2.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.6/IRIX
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/irix
-
-OTHER_LIBS += -L$(JDK)/lib/sgi/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/IRIX6.3.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.6/IRIX
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/irix
-
-OTHER_LIBS += -L$(JDK)/lib/sgi/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/IRIX6.5.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-JDK = /share/builds/components/jdk/1.1.6/IRIX
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/irix
-
-OTHER_LIBS += -L$(JDK)/lib32/sgi/native_threads -ljava
deleted file mode 100644
--- a/js/src/liveconnect/config/Linux_All.mk
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# JDK_DIR should be the directory you put the JDK in, and should have
-# the appropriate lib/ and include/ dirs on it.
-# If you're not using the `Blackdown' JDK, try changing the following line:
-
-# JDK=/share/builds/components/jdk/1.1.7/Linux
-
-ifndef JDK_VERSION
-JDK_VERSION = 1.2.2
-endif
-
-JDK = /share/builds/components/jdk/$(JDK_VERSION)/Linux
-
-# INCLUDES += -I$(JDK)/include -I$(JDK)/include/solaris
-INCLUDES += -I$(JDK)/include/linux -I$(JDK)/include
-
-OTHER_LIBS += -L$(JDK)/jre/lib/i386/native_threads
-OTHER_LIBS += -L$(JDK)/jre/lib/i386/classic
-OTHER_LIBS += -L$(JDK)/jre/lib/i386 -ljava -ljvm -lhpi
-
-# To run lcshell with the above, built in a Mozilla tree with a local nspr:
-# LD_LIBRARY_PATH=../../../dist/lib:/share/builds/components/jdk/1.2.2/Linux/jre/lib/i386:/share/builds/components/jdk/1.2.2/Linux/jre/lib/i386/classic:/share/builds/components/jdk/1.2.2/Linux/jre/lib/i386/native_threads CLASSPATH=./classes/Linux_All_DBG.OBJ/js15lc30.jar lcshell
-
-# Uncomment below to maybe build against 1.3.
-
-# export THREADS_FLAG=native
-
-# JDK = /usr/java/jdk1.3
-
-# INCLUDES += -I$(JDK)/include -I$(JDK)/include/md \
-# -I$(JDK)/include/genunix -I$(JDK)/include/linux \
-
-# OTHER_LIBS += -L$(JDK)/jre/lib/i386/native_threads -ljava \
-# -L$(JDK)/jre/lib/i386 -lverify -lhpi
-
-# export THREADS_FLAG=native
deleted file mode 100644
--- a/js/src/liveconnect/config/OSF1V4.0.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# JDK = /share/builds/components/jdk/1.1.6/OSF1
-
-# INCLUDES += -I$(JDK)/include/java -I$(JDK)/include/java/alpha
-
-# OTHER_LIBS += -L$(JDK)/lib/alpha -ljava
-
-# XLDFLAGS += -taso
-
-ifndef JDK_VERSION
-JDK_VERSION = 1.2.2
-endif
-
-# jni.h #error's without this.
-CFLAGS += -pthread
-
-JDK = /share/builds/components/jdk/$(JDK_VERSION)/OSF1
-
-# INCLUDES += -I$(JDK)/include -I$(JDK)/include/solaris
-INCLUDES += -I$(JDK)/include/alpha -I$(JDK)/include
-
-# XXX is this consistent with -pthread above?
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha/native_threads
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha/classic
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha -ljava -ljvm
-
-# Taken from the previous revision - no idea what it does.
-XLDFLAGS += -taso
deleted file mode 100644
--- a/js/src/liveconnect/config/OSF1V5.0.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# JDK = /share/builds/components/jdk/1.1.6/OSF1
-
-# INCLUDES += -I$(JDK)/include/java -I$(JDK)/include/java/alpha
-
-# OTHER_LIBS += -L$(JDK)/lib/alpha -ljava
-
-# XLDFLAGS += -taso
-
-ifndef JDK_VERSION
-JDK_VERSION = 1.2.2
-endif
-
-# jni.h #error's without this.
-CFLAGS += -pthread
-
-JDK = /share/builds/components/jdk/$(JDK_VERSION)/OSF1
-
-# INCLUDES += -I$(JDK)/include -I$(JDK)/include/solaris
-INCLUDES += -I$(JDK)/include/alpha -I$(JDK)/include
-
-# XXX is this consistent with -pthread above?
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha/native_threads
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha/classic
-OTHER_LIBS += -L$(JDK)/jre/lib/alpha -ljava -ljvm
deleted file mode 100644
--- a/js/src/liveconnect/config/SunOS5.5.1.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# Change these to the current platform settings!!!
-
-ifndef JDK_VERSION
-JDK_VERSION = 1.2.2
-endif
-
-JDK = /share/builds/components/jdk/$(JDK_VERSION)/SunOS
-
-# INCLUDES += -I$(JDK)/include -I$(JDK)/include/solaris
-INCLUDES += -I$(JDK)/include/solaris -I$(JDK)/include
-
-OTHER_LIBS += -L$(JDK)/jre/lib/sparc/native_threads
-OTHER_LIBS += -L$(JDK)/jre/lib/sparc/classic
-OTHER_LIBS += -L$(JDK)/jre/lib/sparc -ljava -ljvm
-
-
deleted file mode 100644
--- a/js/src/liveconnect/config/SunOS5.6.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-include $(DEPTH)/liveconnect/config/SunOS5.5.1.mk
deleted file mode 100644
--- a/js/src/liveconnect/config/SunOS5.7.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-include $(DEPTH)/liveconnect/config/SunOS5.5.1.mk
deleted file mode 100644
--- a/js/src/liveconnect/config/SunOS5.8.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-include $(DEPTH)/liveconnect/config/SunOS5.5.1.mk
deleted file mode 100644
--- a/js/src/liveconnect/config/WINNT4.0.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-ifeq ($(JDKVER),1_2_2)
-
-JDK = c:/jdk1.2.2
-OTHER_LIBS += $(JDK)/lib/jvm.lib ../$(OBJDIR)/js32.lib
-
-else
-
-JDK = c:/jdk1.1.8
-OTHER_LIBS += $(JDK)/lib/javai.lib ../$(OBJDIR)/js32.lib
-
-endif
-
-INCLUDES += -I$(JDK)/include -I$(JDK)/include/win32
-
-JSDLL_CFLAGS =
deleted file mode 100644
--- a/js/src/liveconnect/jsj.c
+++ /dev/null
@@ -1,886 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * This file is part of the Java-vendor-neutral implementation of LiveConnect
- *
- * It contains the top-level initialization code and the implementation of the
- * public API.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "jsj_private.h" /* LiveConnect internals */
-#include "jsjava.h" /* LiveConnect external API */
-
-#ifdef JSJ_THREADSAFE
-# include "prmon.h"
-#endif
-
-JSBool jsj_JSIsCallingApplet = JS_FALSE;
-
-/*
- * At certain times during initialization, there may be no JavaScript context
- * available to direct error reports to, in which case the error messages
- * are sent to this function. The caller is responsible for free'ing
- * the js_error_msg argument.
- */
-static void
-report_java_initialization_error(JNIEnv *jEnv, const char *js_error_msg)
-{
- const char *error_msg, *java_error_msg;
-
- java_error_msg = NULL;
-
- if (jEnv) {
- java_error_msg = jsj_GetJavaErrorMessage(jEnv);
- (*jEnv)->ExceptionClear(jEnv);
- }
-
- if (java_error_msg) {
- error_msg = JS_smprintf("initialization error: %s (%s)\n",
- js_error_msg, java_error_msg);
- free((void*)java_error_msg);
- } else {
- error_msg = JS_smprintf("initialization error: %s\n",
- js_error_msg);
- }
-
- jsj_LogError(error_msg);
- JS_smprintf_free((char*)error_msg);
-}
-
-/*
- * Opaque JVM handles to Java classes and methods required for Java reflection.
- * These are computed and cached during initialization.
- */
-
-jclass jlObject; /* java.lang.Object */
-jclass jlrMethod; /* java.lang.reflect.Method */
-jclass jlrField; /* java.lang.reflect.Field */
-jclass jlrArray; /* java.lang.reflect.Array */
-jclass jlVoid; /* java.lang.Void */
-jclass jlrConstructor; /* java.lang.reflect.Constructor */
-jclass jlThrowable; /* java.lang.Throwable */
-jclass jlSystem; /* java.lang.System */
-jclass jlClass; /* java.lang.Class */
-jclass jlBoolean; /* java.lang.Boolean */
-jclass jlDouble; /* java.lang.Double */
-jclass jlString; /* java.lang.String */
-jclass jaApplet; /* java.applet.Applet */
-jclass njJSObject; /* netscape.javascript.JSObject */
-jclass njJSException; /* netscape.javascript.JSException */
-jclass njJSUtil; /* netscape.javascript.JSUtil */
-
-jmethodID jlClass_getMethods; /* java.lang.Class.getMethods() */
-jmethodID jlClass_getConstructors; /* java.lang.Class.getConstructors() */
-jmethodID jlClass_getFields; /* java.lang.Class.getFields() */
-jmethodID jlClass_getName; /* java.lang.Class.getName() */
-jmethodID jlClass_getComponentType; /* java.lang.Class.getComponentType() */
-jmethodID jlClass_getModifiers; /* java.lang.Class.getModifiers() */
-jmethodID jlClass_isArray; /* java.lang.Class.isArray() */
-
-jmethodID jlrMethod_getName; /* java.lang.reflect.Method.getName() */
-jmethodID jlrMethod_getParameterTypes; /* java.lang.reflect.Method.getParameterTypes() */
-jmethodID jlrMethod_getReturnType; /* java.lang.reflect.Method.getReturnType() */
-jmethodID jlrMethod_getModifiers; /* java.lang.reflect.Method.getModifiers() */
-
-jmethodID jlrConstructor_getParameterTypes; /* java.lang.reflect.Constructor.getParameterTypes() */
-jmethodID jlrConstructor_getModifiers; /* java.lang.reflect.Constructor.getModifiers() */
-
-jmethodID jlrField_getName; /* java.lang.reflect.Field.getName() */
-jmethodID jlrField_getType; /* java.lang.reflect.Field.getType() */
-jmethodID jlrField_getModifiers; /* java.lang.reflect.Field.getModifiers() */
-
-jmethodID jlrArray_newInstance; /* java.lang.reflect.Array.newInstance() */
-
-jmethodID jlBoolean_Boolean; /* java.lang.Boolean constructor */
-jmethodID jlBoolean_booleanValue; /* java.lang.Boolean.booleanValue() */
-jmethodID jlDouble_Double; /* java.lang.Double constructor */
-jmethodID jlDouble_doubleValue; /* java.lang.Double.doubleValue() */
-
-jmethodID jlThrowable_toString; /* java.lang.Throwable.toString() */
-jmethodID jlThrowable_getMessage; /* java.lang.Throwable.getMessage() */
-
-jmethodID jlSystem_identityHashCode; /* java.lang.System.identityHashCode() */
-
-jobject jlVoid_TYPE; /* java.lang.Void.TYPE value */
-
-jmethodID njJSException_JSException; /* netscape.javascript.JSException constructor */
-jmethodID njJSException_JSException_wrap;/*netscape.javascript.JSException alternate constructor */
-jmethodID njJSObject_JSObject; /* netscape.javascript.JSObject constructor */
-jmethodID njJSUtil_getStackTrace; /* netscape.javascript.JSUtil.getStackTrace() */
-jfieldID njJSObject_internal; /* netscape.javascript.JSObject.internal */
-jfieldID njJSObject_long_internal; /* netscape.javascript.JSObject.long_internal */
-jfieldID njJSException_lineno; /* netscape.javascript.JSException.lineno */
-jfieldID njJSException_tokenIndex; /* netscape.javascript.JSException.tokenIndex */
-jfieldID njJSException_source; /* netscape.javascript.JSException.source */
-jfieldID njJSException_filename; /* netscape.javascript.JSException.filename */
-jfieldID njJSException_wrappedExceptionType; /* netscape.javascript.JSException.wrappedExceptionType */
-jfieldID njJSException_wrappedException; /* netscape.javascript.JSException.wrappedException */
-
-/* Obtain a reference to a Java class */
-#define LOAD_CLASS(qualified_name, class) \
- { \
- jclass _##class = (*jEnv)->FindClass(jEnv, #qualified_name); \
- if (_##class == 0) { \
- (*jEnv)->ExceptionClear(jEnv); \
- report_java_initialization_error(jEnv, \
- "Can't load class " #qualified_name); \
- return JS_FALSE; \
- } \
- class = (*jEnv)->NewGlobalRef(jEnv, _##class); \
- (*jEnv)->DeleteLocalRef(jEnv, _##class); \
- }
-
-/* Obtain a methodID reference to a Java method or constructor */
-#define _LOAD_METHOD(qualified_class, method, mvar, signature, class, is_static)\
- if (is_static) { \
- class##_##mvar = \
- (*jEnv)->GetStaticMethodID(jEnv, class, #method, signature); \
- } else { \
- class##_##mvar = \
- (*jEnv)->GetMethodID(jEnv, class, #method, signature); \
- } \
- if (class##_##mvar == 0) { \
- (*jEnv)->ExceptionClear(jEnv); \
- report_java_initialization_error(jEnv, \
- "Can't get mid for " #qualified_class "." #method "()"); \
- return JS_FALSE; \
- }
-
-/* Obtain a methodID reference to a Java instance method */
-#define LOAD_METHOD(qualified_class, method, signature, class) \
- _LOAD_METHOD(qualified_class, method, method, signature, class, JS_FALSE)
-
-/* Obtain a methodID reference to a Java static method */
-#define LOAD_STATIC_METHOD(qualified_class, method, signature, class) \
- _LOAD_METHOD(qualified_class, method, method, signature, class, JS_TRUE)
-
-/* Obtain a methodID reference to a Java constructor */
-#define LOAD_CONSTRUCTOR(qualified_class, method, signature, class) \
- _LOAD_METHOD(qualified_class,<init>, method, signature, class, JS_FALSE)
-
-/* Obtain a fieldID reference to a Java instance or static field */
-#define _LOAD_FIELDID(qualified_class, field, signature, class, is_static) \
- if (is_static) { \
- class##_##field = (*jEnv)->GetStaticFieldID(jEnv, class, #field, signature);\
- } else { \
- class##_##field = (*jEnv)->GetFieldID(jEnv, class, #field, signature);\
- } \
- if (class##_##field == 0) { \
- (*jEnv)->ExceptionClear(jEnv); \
- report_java_initialization_error(jEnv, \
- "Can't get fid for " #qualified_class "." #field); \
- return JS_FALSE; \
- }
-
-/* Obtain a fieldID reference to a Java instance field */
-#define LOAD_FIELDID(qualified_class, field, signature, class) \
- _LOAD_FIELDID(qualified_class, field, signature, class, JS_FALSE)
-
-/* Obtain the value of a static field in a Java class */
-#define LOAD_FIELD_VAL(qualified_class, field, signature, class, type) \
- { \
- jfieldID field_id; \
- field_id = (*jEnv)->GetStaticFieldID(jEnv, class, #field, signature);\
- if (field_id == 0) { \
- report_java_initialization_error(jEnv, \
- "Can't get fid for " #qualified_class "." #field); \
- return JS_FALSE; \
- } \
- class##_##field = \
- (*jEnv)->GetStatic##type##Field(jEnv, class, field_id); \
- if (class##_##field == 0) { \
- (*jEnv)->ExceptionClear(jEnv); \
- report_java_initialization_error(jEnv, \
- "Can't read static field " #qualified_class "." #field); \
- return JS_FALSE; \
- } \
- }
-
-/* Obtain the value of a static field in a Java class, which is known to
- contain an object value. */
-#define LOAD_FIELD_OBJ(qualified_class, field, signature, class) \
- LOAD_FIELD_VAL(qualified_class, field, signature, class, Object); \
- class##_##field = (*jEnv)->NewGlobalRef(jEnv, class##_##field);
-
-/*
- * Load the Java classes, and the method and field descriptors required for Java reflection.
- * Returns JS_TRUE on success, JS_FALSE on failure.
- */
-static JSBool
-init_java_VM_reflection(JSJavaVM *jsjava_vm, JNIEnv *jEnv)
-{
- /* Load Java system classes and method, including java.lang.reflect classes */
- LOAD_CLASS(java/lang/Object, jlObject);
- LOAD_CLASS(java/lang/Class, jlClass);
- LOAD_CLASS(java/lang/reflect/Method, jlrMethod);
- LOAD_CLASS(java/lang/reflect/Constructor, jlrConstructor);
- LOAD_CLASS(java/lang/reflect/Field, jlrField);
- LOAD_CLASS(java/lang/reflect/Array, jlrArray);
- LOAD_CLASS(java/lang/Throwable, jlThrowable);
- LOAD_CLASS(java/lang/System, jlSystem);
- LOAD_CLASS(java/lang/Boolean, jlBoolean);
- LOAD_CLASS(java/lang/Double, jlDouble);
- LOAD_CLASS(java/lang/String, jlString);
- LOAD_CLASS(java/lang/Void, jlVoid);
-
- LOAD_CLASS(java/applet/Applet, jaApplet);
-
- LOAD_METHOD(java.lang.Class, getMethods, "()[Ljava/lang/reflect/Method;",jlClass);
- LOAD_METHOD(java.lang.Class, getConstructors, "()[Ljava/lang/reflect/Constructor;",jlClass);
- LOAD_METHOD(java.lang.Class, getFields, "()[Ljava/lang/reflect/Field;", jlClass);
- LOAD_METHOD(java.lang.Class, getName, "()Ljava/lang/String;", jlClass);
- LOAD_METHOD(java.lang.Class, isArray, "()Z", jlClass);
- LOAD_METHOD(java.lang.Class, getComponentType, "()Ljava/lang/Class;", jlClass);
- LOAD_METHOD(java.lang.Class, getModifiers, "()I", jlClass);
-
- LOAD_METHOD(java.lang.reflect.Method, getName, "()Ljava/lang/String;", jlrMethod);
- LOAD_METHOD(java.lang.reflect.Method, getParameterTypes, "()[Ljava/lang/Class;", jlrMethod);
- LOAD_METHOD(java.lang.reflect.Method, getReturnType, "()Ljava/lang/Class;", jlrMethod);
- LOAD_METHOD(java.lang.reflect.Method, getModifiers, "()I", jlrMethod);
-
- LOAD_METHOD(java.lang.reflect.Constructor, getParameterTypes, "()[Ljava/lang/Class;", jlrConstructor);
- LOAD_METHOD(java.lang.reflect.Constructor, getModifiers, "()I", jlrConstructor);
-
- LOAD_METHOD(java.lang.reflect.Field, getName, "()Ljava/lang/String;", jlrField);
- LOAD_METHOD(java.lang.reflect.Field, getType, "()Ljava/lang/Class;", jlrField);
- LOAD_METHOD(java.lang.reflect.Field, getModifiers, "()I", jlrField);
-
- LOAD_STATIC_METHOD(java.lang.reflect.Array,
- newInstance, "(Ljava/lang/Class;I)Ljava/lang/Object;",jlrArray);
-
- LOAD_METHOD(java.lang.Throwable, toString, "()Ljava/lang/String;", jlThrowable);
- LOAD_METHOD(java.lang.Throwable, getMessage, "()Ljava/lang/String;", jlThrowable);
-
- LOAD_METHOD(java.lang.Double, doubleValue, "()D", jlDouble);
-
- LOAD_METHOD(java.lang.Boolean, booleanValue, "()Z", jlBoolean);
-
- LOAD_STATIC_METHOD(java.lang.System, identityHashCode, "(Ljava/lang/Object;)I", jlSystem);
-
- LOAD_CONSTRUCTOR(java.lang.Boolean, Boolean, "(Z)V", jlBoolean);
- LOAD_CONSTRUCTOR(java.lang.Double, Double, "(D)V", jlDouble);
-
- LOAD_FIELD_OBJ(java.lang.Void, TYPE, "Ljava/lang/Class;", jlVoid);
-
- return JS_TRUE;
-}
-
-#if !defined(OJI)
-
-/**
- * Workaround for the fact that MRJ loads a different instance of the shared library.
- */
-
-#include "netscape_javascript_JSObject.h"
-
-/* Manually load the required native methods. */
-static JSBool
-JSObject_RegisterNativeMethods(JNIEnv* jEnv)
-{
-
- static JNINativeMethod nativeMethods[] = {
- {"initClass", "()V", (void*)&Java_netscape_javascript_JSObject_initClass},
-
-#ifndef OJI
- {"getMember", "(Ljava/lang/String;)Ljava/lang/Object;", (void*)&Java_netscape_javascript_JSObject_getMember},
- {"getSlot", "(I)Ljava/lang/Object;", (void*)&Java_netscape_javascript_JSObject_getSlot},
- {"setMember", "(Ljava/lang/String;Ljava/lang/Object;)V", (void*)&Java_netscape_javascript_JSObject_setMember},
- {"setSlot", "(ILjava/lang/Object;)V", (void*)&Java_netscape_javascript_JSObject_setSlot},
- {"removeMember", "(Ljava/lang/String;)V", (void*)&Java_netscape_javascript_JSObject_removeMember},
- {"call", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;", (void*)&Java_netscape_javascript_JSObject_call},
- {"eval", "(Ljava/lang/String;)Ljava/lang/Object;", (void*)&Java_netscape_javascript_JSObject_eval},
-
- {"toString", "()Ljava/lang/String;", (void*)&Java_netscape_javascript_JSObject_toString},
- {"getWindow", "(Ljava/applet/Applet;)Lnetscape/javascript/JSObject;", (void*)&Java_netscape_javascript_JSObject_getWindow},
- {"finalize", "()V", (void*)&Java_netscape_javascript_JSObject_finalize},
- {"equals", "(Ljava/lang/Object;)Z", (void*)&Java_netscape_javascript_JSObject_equals}
-#endif /* !OJI */
-
- };
- (*jEnv)->RegisterNatives(jEnv, njJSObject, nativeMethods, sizeof(nativeMethods) / sizeof(JNINativeMethod));
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- report_java_initialization_error(jEnv, "Couldn't initialize JSObject native methods.");
- (*jEnv)->ExceptionClear(jEnv);
- return JS_FALSE;
- }
- /* Call the initClass method */
- Java_netscape_javascript_JSObject_initClass(jEnv, njJSObject);
- return JS_TRUE;
-}
-
-#endif
-
-/* 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;
-}
-
-JSJavaVM *jsjava_vm_list = NULL;
-
-static JSJavaThreadState *thread_list = NULL;
-
-#ifdef JSJ_THREADSAFE
-static PRMonitor *thread_list_monitor = NULL;
-#endif
-
-/*
- * Called once per Java VM, this function initializes the classes, fields, and
- * methods required for Java reflection. If java_vm is NULL, a new Java VM is
- * created, using the provided classpath in addition to any default classpath.
- * The classpath argument is ignored, however, if java_vm_arg is non-NULL.
- */
-JSJavaVM *
-JSJ_ConnectToJavaVM(SystemJavaVM *java_vm_arg, void* initargs)
-{
- SystemJavaVM* java_vm;
- JSJavaVM *jsjava_vm;
- JNIEnv *jEnv;
-
- JS_ASSERT(JSJ_callbacks);
- JS_ASSERT(JSJ_callbacks->attach_current_thread);
- JS_ASSERT(JSJ_callbacks->detach_current_thread);
- JS_ASSERT(JSJ_callbacks->get_java_vm);
-
- jsjava_vm = (JSJavaVM*)malloc(sizeof(JSJavaVM));
- if (!jsjava_vm)
- return NULL;
- memset(jsjava_vm, 0, sizeof(JSJavaVM));
-
- java_vm = java_vm_arg;
-
- /* If a Java VM was passed in, try to attach to it on the current thread. */
- if (java_vm) {
- jEnv = JSJ_callbacks->attach_current_thread(java_vm);
- if (jEnv == NULL) {
- jsj_LogError("Failed to attach to Java VM thread\n");
- free(jsjava_vm);
- return NULL;
- }
-
- jsjava_vm->java_vm = java_vm;
- jsjava_vm->main_thread_env = jEnv;
- } else {
- jsjava_vm->init_args = initargs;
- }
-
-#ifdef JSJ_THREADSAFE
- if (jsjava_vm_list == NULL) {
- thread_list_monitor =
- (struct PRMonitor *) PR_NewMonitor();
- }
-#endif /* JSJ_THREADSAFE */
-
- /* Put this VM on the list of all created VMs */
- jsjava_vm->next = jsjava_vm_list;
- jsjava_vm_list = jsjava_vm;
-
- return jsjava_vm;
-}
-
-/* Completes a lazy connection to the host Java VM. */
-static JSBool
-jsj_ConnectToJavaVM(JSJavaVM *jsjava_vm)
-{
- if (!jsjava_vm->java_vm) {
- JSBool ok;
- 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) {
- jsj_LogError("Failed to create Java VM\n");
- return JS_FALSE;
- }
-
- /* Remember that we created the VM so that we know to destroy it later */
- jsjava_vm->jsj_created_java_vm = JS_TRUE;
- }
-
- if (!jsjava_vm->jsj_inited_java_vm) {
- /*
- * JVM initialization for netscape.javascript.JSObject is performed
- * independently of the other classes that are initialized in
- * init_java_VM_reflection, because we allow it to fail. In the case
- * of failure, LiveConnect is still operative, but only when calling
- * from JS to Java and not vice-versa.
- */
- init_netscape_java_classes(jsjava_vm, jsjava_vm->main_thread_env);
-
- /* Load the Java classes, and the method and field descriptors required for
- Java reflection. */
- if (!init_java_VM_reflection(jsjava_vm, jsjava_vm->main_thread_env) ||
- !jsj_InitJavaObjReflectionsTable()) {
- jsj_LogError("LiveConnect was unable to reflect one or more components of the Java runtime.\nGo to http://bugzilla.mozilla.org/show_bug.cgi?id=5369 for details.\n");
- /* This function crashes when called from here.
- Check that all the preconditions for this
- call are satisfied before making it. [jd]
- JSJ_DisconnectFromJavaVM(jsjava_vm); */
- return JS_FALSE;
- }
-
- jsjava_vm->jsj_inited_java_vm = JS_TRUE;
- }
-
- return JS_TRUE;
-}
-
-JSJCallbacks *JSJ_callbacks = NULL;
-
-/* Called once to set up callbacks for all instances of LiveConnect */
-void
-JSJ_Init(JSJCallbacks *callbacks)
-{
- JS_ASSERT(callbacks);
- JSJ_callbacks = callbacks;
-}
-
-/*
- * Initialize the provided JSContext by setting up the JS classes necessary for
- * reflection and by defining JavaPackage objects for the default Java packages
- * as properties of global_obj. Additional packages may be pre-defined by
- * setting the predefined_packages argument. (Pre-defining a Java package at
- * initialization time is not necessary, but it will make package lookup faster
- * and, more importantly, will avoid unnecessary network accesses if classes
- * are being loaded over the network.)
- */
-JSBool
-JSJ_InitJSContext(JSContext *cx, JSObject *global_obj,
- JavaPackageDef *predefined_packages)
-{
- /* Initialize the JavaScript classes used for reflection */
- if (!jsj_init_JavaObject(cx, global_obj))
- return JS_FALSE;
-
-/* if (!jsj_init_JavaMember(cx, global_obj))
- return JS_FALSE; */
-
- if (!jsj_init_JavaPackage(cx, global_obj, predefined_packages))
- return JS_FALSE;
-
- if (!jsj_init_JavaClass(cx, global_obj))
- return JS_FALSE;
-
- if (!jsj_init_JavaArray(cx, global_obj))
- return JS_FALSE;
-
- if (!jsj_init_JavaMember(cx, global_obj))
- return JS_FALSE;
-
- return JS_TRUE;
-}
-
-/* Eliminate a reference to a Java class */
-#define UNLOAD_CLASS(qualified_name, class) \
- if (class) { \
- (*jEnv)->DeleteGlobalRef(jEnv, class); \
- class = NULL; \
- }
-
-/*
- * This routine severs the connection to a Java VM, freeing all related resources.
- * It shouldn't be called until the global scope has been cleared in all related
- * JSContexts (so that all LiveConnect objects are finalized) and a JavaScript
- * GC is performed. Otherwise, accessed to free'ed memory could result.
- */
-void
-JSJ_DisconnectFromJavaVM(JSJavaVM *jsjava_vm)
-{
- SystemJavaVM *java_vm;
- JSJavaVM *j, **jp;
-
- /* Since JSJ_ConnectToJavaVM is now lazy */
- java_vm = jsjava_vm->java_vm;
- if (java_vm) {
- JNIEnv *jEnv = jsjava_vm->main_thread_env;
-
- /* Drop all references to Java objects and classes */
- jsj_DiscardJavaObjReflections(jEnv);
- jsj_DiscardJavaClassReflections(jEnv);
-
- if (jsjava_vm->jsj_created_java_vm) {
- (void)JSJ_callbacks->destroy_java_vm(java_vm, jEnv);
- } else {
- UNLOAD_CLASS(java/lang/Object, jlObject);
- UNLOAD_CLASS(java/lang/Class, jlClass);
- UNLOAD_CLASS(java/lang/reflect/Method, jlrMethod);
- UNLOAD_CLASS(java/lang/reflect/Constructor, jlrConstructor);
- UNLOAD_CLASS(java/lang/reflect/Field, jlrField);
- UNLOAD_CLASS(java/lang/reflect/Array, jlrArray);
- UNLOAD_CLASS(java/lang/Throwable, jlThrowable);
- UNLOAD_CLASS(java/lang/System, jlSystem);
- UNLOAD_CLASS(java/lang/Boolean, jlBoolean);
- UNLOAD_CLASS(java/lang/Double, jlDouble);
- UNLOAD_CLASS(java/lang/String, jlString);
- UNLOAD_CLASS(java/lang/Void, jlVoid);
- UNLOAD_CLASS(java/applet/Applet, jaApplet);
- UNLOAD_CLASS(netscape/javascript/JSObject, njJSObject);
- UNLOAD_CLASS(netscape/javascript/JSException, njJSException);
- UNLOAD_CLASS(netscape/javascript/JSUtil, njJSUtil);
- }
- }
-
- /* Remove this VM from the list of all JSJavaVM objects. */
- for (jp = &jsjava_vm_list; (j = *jp) != NULL; jp = &j->next) {
- if (j == jsjava_vm) {
- *jp = jsjava_vm->next;
- break;
- }
- }
- JS_ASSERT(j); /* vm not found in list */
-
-#ifdef JSJ_THREADSAFE
- if (jsjava_vm_list == NULL) {
- PR_DestroyMonitor(thread_list_monitor);
- thread_list_monitor = NULL;
- }
-#endif /* JSJ_THREADSAFE */
-
- free(jsjava_vm);
-}
-
-static JSJavaThreadState *
-new_jsjava_thread_state(JSJavaVM *jsjava_vm, const char *thread_name, JNIEnv *jEnv)
-{
- JSJavaThreadState *jsj_env;
-
- jsj_env = (JSJavaThreadState *)malloc(sizeof(JSJavaThreadState));
- if (!jsj_env)
- return NULL;
- memset(jsj_env, 0, sizeof(JSJavaThreadState));
-
- jsj_env->jEnv = jEnv;
- jsj_env->jsjava_vm = jsjava_vm;
- if (thread_name)
- jsj_env->name = strdup(thread_name);
-
-#ifdef JSJ_THREADSAFE
- PR_EnterMonitor(thread_list_monitor);
-#endif
-
- jsj_env->next = thread_list;
- thread_list = jsj_env;
-
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(thread_list_monitor);
-#endif
-
- return jsj_env;
-}
-
-static JSJavaThreadState *
-find_jsjava_thread(JNIEnv *jEnv)
-{
- JSJavaThreadState *e, **p, *jsj_env;
- jsj_env = NULL;
-
-#ifdef JSJ_THREADSAFE
- PR_EnterMonitor(thread_list_monitor);
-#endif
-
- /* Search for the thread state among the list of all created
- LiveConnect threads */
- for (p = &thread_list; (e = *p) != NULL; p = &(e->next)) {
- if (e->jEnv == jEnv) {
- jsj_env = e;
- break;
- }
- }
-
- /* Move a found thread to head of list for faster search next time. */
- if (jsj_env && p != &thread_list) {
- *p = jsj_env->next;
- jsj_env->next = thread_list;
- thread_list = jsj_env;
- }
-
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(thread_list_monitor);
-#endif
-
- return jsj_env;
-}
-
-JS_EXPORT_API(JSJavaThreadState *)
-JSJ_AttachCurrentThreadToJava(JSJavaVM *jsjava_vm, const char *name, JNIEnv **java_envp)
-{
- JNIEnv *jEnv;
- SystemJavaVM *java_vm;
- JSJavaThreadState *jsj_env;
-
- /* Make sure we're fully connected to the Java VM */
- if (!jsj_ConnectToJavaVM(jsjava_vm))
- return NULL;
-
- /* Try to attach a Java thread to the current native thread */
- if (!JSJ_callbacks || !JSJ_callbacks->attach_current_thread)
- return NULL;
-
- java_vm = jsjava_vm->java_vm;
- if (!(jEnv = JSJ_callbacks->attach_current_thread(java_vm)))
- return NULL;
-
- if (java_envp)
- *java_envp = jEnv;
-
- /* If we found an existing thread state, just return it. */
- jsj_env = find_jsjava_thread(jEnv);
- if (jsj_env)
- return jsj_env;
-
- /* Create a new wrapper around the thread/VM state */
- jsj_env = new_jsjava_thread_state(jsjava_vm, name, jEnv);
-
- return jsj_env;
-}
-
-static JSJavaVM *
-map_java_vm_to_jsjava_vm(SystemJavaVM *java_vm)
-{
- JSJavaVM *v;
- for (v = jsjava_vm_list; v; v = v->next) {
- if (!jsj_ConnectToJavaVM(v))
- return NULL;
- if (v->java_vm == java_vm)
- return v;
- }
- return NULL;
-}
-
-/*
- * Unfortunately, there's no standard means to associate any private data with
- * a JNI thread environment, so we need to use the Java environment pointer as
- * the key in a lookup table that maps it to a JSJavaThreadState structure,
- * where we store all our per-thread private data. If no existing thread state
- * is found, a new one is created.
- *
- * If an error occurs, returns NULL and sets the errp argument to an error
- * message, which the caller is responsible for free'ing.
- */
-JSJavaThreadState *
-jsj_MapJavaThreadToJSJavaThreadState(JNIEnv *jEnv, char **errp)
-{
- JSJavaThreadState *jsj_env;
- SystemJavaVM *java_vm;
- JSJavaVM *jsjava_vm;
-
- /* If we found an existing thread state, just return it. */
- jsj_env = find_jsjava_thread(jEnv);
- if (jsj_env)
- return jsj_env;
-
- /* No one set up a LiveConnect thread state for a given Java thread.
- Invoke the callback to create one on-the-fly. */
-
- /* First, figure out which Java VM is calling us */
- if (JSJ_callbacks && JSJ_callbacks->get_java_vm)
- java_vm = JSJ_callbacks->get_java_vm(jEnv);
- else
- return NULL;
- if (java_vm == NULL)
- return NULL;
-
- /* Get our private JavaVM data */
- jsjava_vm = map_java_vm_to_jsjava_vm(java_vm);
- if (!jsjava_vm) {
- *errp = JS_smprintf("Total weirdness: No JSJavaVM wrapper ever created "
- "for JavaVM 0x%08x", java_vm);
- return NULL;
- }
-
- jsj_env = new_jsjava_thread_state(jsjava_vm, NULL, jEnv);
- if (!jsj_env)
- return NULL;
-
- return jsj_env;
-}
-
-/*
- * This function is used to specify a particular JSContext as *the* JavaScript
- * execution environment to be used when LiveConnect is accessed from the given
- * Java thread, i.e. by using one of the methods of netscape.javascript.JSObject.
- * (There can only be one such JS context for a given Java thread. To
- * multiplex JSContexts among a single thread, this function must be called
- * before Java is invoked on that thread.) The return value is the previous
- * context associated with the given Java thread.
- */
-JS_EXPORT_API(JSContext *)
-JSJ_SetDefaultJSContextForJavaThread(JSContext *cx, JSJavaThreadState *jsj_env)
-{
- JSContext *old_context;
- old_context = jsj_env->cx;
- jsj_env->cx = cx;
-
- /* The following line prevents clearing of jsj_env->cx by jsj_ExitJava() */
- jsj_env->recursion_depth++;
- return old_context;
-}
-
-JS_EXPORT_API(JSBool)
-JSJ_DetachCurrentThreadFromJava(JSJavaThreadState *jsj_env)
-{
- SystemJavaVM *java_vm;
- JNIEnv* jEnv;
- JSJavaThreadState *e, **p;
-
- /* Disassociate the current native thread from its corresponding Java thread */
- java_vm = jsj_env->jsjava_vm->java_vm;
- jEnv = jsj_env->jEnv;
-
-#ifdef JSJ_THREADSAFE
- PR_EnterMonitor(thread_list_monitor);
-#endif /* JSJ_THREADSAFE */
-
- if (!JSJ_callbacks->detach_current_thread(java_vm, jEnv)) {
-
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(thread_list_monitor);
-#endif /* JSJ_THREADSAFE */
-
- return JS_FALSE;
- }
-
- /* Destroy the LiveConnect execution environment passed in */
- jsj_ClearPendingJSErrors(jsj_env);
-
- for (p = &thread_list; (e = *p) != NULL; p = &(e->next)) {
- if (e == jsj_env) {
- *p = jsj_env->next;
- break;
- }
- }
-
- JS_ASSERT(e);
-
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(thread_list_monitor);
-#endif /* JSJ_THREADSAFE */
-
- free(jsj_env);
- return JS_TRUE;
-}
-
-/* Utility routine to wrap a Java object inside a JS object, having a
- a result type of either JavaObject or JavaArray. */
-JSBool
-JSJ_ConvertJavaObjectToJSValue(JSContext *cx, jobject java_obj, jsval *vp)
-{
- JNIEnv *jEnv;
- JSBool result;
- JSJavaThreadState *jsj_env;
-
- /* Get the Java per-thread environment pointer for this JSContext */
- jsj_env = jsj_EnterJava(cx, &jEnv);
- if (!jEnv)
- return JS_FALSE;
-
- result = jsj_ConvertJavaObjectToJSValue(cx, jEnv, java_obj, vp);
- jsj_ExitJava(jsj_env);
- return result;
-}
-
-
-JS_EXPORT_API(JSBool)
-JSJ_ConvertJSValueToJavaObject(JSContext *cx, jsval v, jobject *vp)
-{
- if (!JSVAL_IS_PRIMITIVE(v)) {
- JSObject *js_obj = JSVAL_TO_OBJECT(v);
- JavaObjectWrapper *java_wrapper = JS_GetPrivate(cx, js_obj);
- *vp = java_wrapper->java_obj;
- return JS_TRUE;
- }
- return JS_FALSE;
-}
-
-
-JS_EXPORT_API(JSBool)
-JSJ_IsJSCallApplet()
-{
- return jsj_JSIsCallingApplet;
-}
deleted file mode 100644
--- a/js/src/liveconnect/jsj.msg
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* -*- Mode: C; tab-width: 8 -*-
- * Copyright (C) 1998-1999 Netscape Communications Corporation, All Rights Reserved.
- */
-
-/*
- Error messages for LiveConnect. See JSJMSG.def for format.
-
-*/
-
-MSG_DEF(JSJMSG_NOT_AN_ERROR, 0, 0, "<Error #0 is reserved>")
-MSG_DEF(JSJMSG_CANT_LOAD_JSOBJECT, 1, 0, "Couldn't convert JavaScript object to an "
- "instance of netscape.javascript.JSObject "
- "because that class could not be loaded.")
-MSG_DEF(JSJMSG_CANT_CONVERT_JS, 2, 2, "Unable to convert JavaScript value {0} to "
- "Java value of type {1}")
-MSG_DEF(JSJMSG_BAD_OP_JARRAY, 3, 0, "illegal operation on JavaArray prototype object")
-MSG_DEF(JSJMSG_CANT_WRITE_JARRAY, 4, 1, "Attempt to write to invalid Java array element \"{0}\"")
-MSG_DEF(JSJMSG_BAD_INDEX_EXPR, 5, 0, "invalid Java array index expression")
-MSG_DEF(JSJMSG_BAD_JARRAY_INDEX, 6, 1, "Java array index {0} out of range")
-MSG_DEF(JSJMSG_JARRAY_PROP_DEFINE, 7, 0, "Cannot define a new property in a JavaArray")
-MSG_DEF(JSJMSG_JARRAY_PROP_DELETE, 8, 0, "Properties of JavaArray objects may not be deleted")
-MSG_DEF(JSJMSG_JARRAY_PROP_WATCH, 9, 0, "Cannot place watchpoints on JavaArray object properties")
-MSG_DEF(JSJMSG_JARRAY_PROP_EXPORT, 10, 0, "Cannot export a JavaArray object's properties")
-MSG_DEF(JSJMSG_BAD_JCLASS_EXPR, 11, 0, "invalid JavaClass property expression. "
- "(methods and fields of a JavaClass object can only be identified by their name)")
-MSG_DEF(JSJMSG_MISSING_NAME, 12, 2, "Java class {0} has no public static field or method named \"{1}\"")
-MSG_DEF(JSJMSG_MISSING_STATIC, 13, 2, "No static field named \"{0}\" in Java class {1}")
-MSG_DEF(JSJMSG_JCLASS_PROP_DEFINE, 14, 0, "Cannot define a new property in a JavaClass")
-MSG_DEF(JSJMSG_JCLASS_PROP_DELETE, 15, 0, "Properties of JavaClass objects may not be deleted")
-MSG_DEF(JSJMSG_JCLASS_PROP_WATCH, 16, 0, "Cannot place watchpoints on JavaClass object properties")
-MSG_DEF(JSJMSG_JCLASS_PROP_EXPORT, 17, 0, "Cannot export a JavaClass object's properties")
-MSG_DEF(JSJMSG_BAD_OP_JCLASS, 18, 0, "illegal operation on JavaClass prototype object")
-MSG_DEF(JSJMSG_BAD_OP_PROTO, 19, 0, "illegal operation on prototype object")
-MSG_DEF(JSJMSG_NEED_JOBJECT_ARG, 20, 0, "getClass expects a Java object argument")
-MSG_DEF(JSJMSG_PROTO_GETCLASS, 21, 0, "getClass called on prototype object")
-MSG_DEF(JSJMSG_BAD_OP_JOBJECT, 22, 0, "illegal operation on JavaObject prototype object")
-MSG_DEF(JSJMSG_BAD_JOBJECT_EXPR, 23, 0, "invalid JavaObject property expression. "
- "(methods and field properties of a JavaObject object can only be strings)")
-MSG_DEF(JSJMSG_NO_INSTANCE_NAME, 24, 2, "Java class {0} has no public field or method named \"{1}\"")
-MSG_DEF(JSJMSG_NO_NAME_IN_CLASS, 25, 2, "No instance field named \"{0}\" in Java class {1}")
-MSG_DEF(JSJMSG_JOBJECT_PROP_DEFINE, 26, 0, "Cannot define a new property in a JavaObject")
-MSG_DEF(JSJMSG_JOBJECT_PROP_DELETE, 27, 0, "Properties of JavaObject objects may not be deleted")
-MSG_DEF(JSJMSG_JOBJECT_PROP_WATCH, 28, 0, "Cannot place watchpoints on JavaObject object properties")
-MSG_DEF(JSJMSG_JOBJECT_PROP_EXPORT, 29, 0, "Cannot export a JavaObject object's properties")
-MSG_DEF(JSJMSG_CONVERT_TO_FUNC, 30, 0, "can't convert Java object to function")
-MSG_DEF(JSJMSG_BAD_ADD_TO_PACKAGE, 31, 0, "illegal attempt to add property to JavaPackage prototype object")
-MSG_DEF(JSJMSG_DONT_ADD_TO_PACKAGE, 32, 0, "You may not add properties to a JavaPackage object")
-MSG_DEF(JSJMSG_MISSING_PACKAGE, 33, 1, "No Java system package with name \"{0}\" was identified "
- "and no Java class with that name exists either")
-MSG_DEF(JSJMSG_DOUBLE_SHIPPING, 34, 1, "Package {0} defined twice ?")
-MSG_DEF(JSJMSG_BAD_PACKAGE_PREDEF, 35, 1, "Illegal predefined package definition for {0}")
-MSG_DEF(JSJMSG_NULL_MEMBER_NAME, 36, 0, "illegal null member name")
-MSG_DEF(JSJMSG_NULL_FUNCTION_NAME, 37, 0, "illegal null JavaScript function name")
-MSG_DEF(JSJMSG_NULL_EVAL_ARG, 38, 0, "illegal null string eval argument")
-MSG_DEF(JSJMSG_MULTIPLE_JTHREADS, 39, 0, "[Obsolete error message]")
-MSG_DEF(JSJMSG_ABSTRACT_JCLASS, 40, 1, "Java class {0} is abstract and therefore may not be instantiated")
-MSG_DEF(JSJMSG_IS_INTERFACE, 41, 1, "{0} is a Java interface and therefore may not be instantiated")
-MSG_DEF(JSJMSG_NOT_PUBLIC, 42, 1, "Java class {0} is not public and therefore may not be instantiated")
-MSG_DEF(JSJMSG_NO_CONSTRUCTORS, 43, 1, "No public constructors defined for Java class {0}")
-MSG_DEF(JSJMSG_BAD_PROTO_ASSIGNMENT,44, 0, "Only objects can be assigned as the value of the __proto__ property")
-MSG_DEF(JSJMSG_NEED_JCLASS_ARG, 45, 0, "The JavaClass constructor expects an instance of java.lang.Class as an argument")
deleted file mode 100644
--- a/js/src/liveconnect/jsj_JSObject.c
+++ /dev/null
@@ -1,1377 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* This file is part of the Java-vendor-neutral implementation of LiveConnect
- *
- * It contains the implementation of the native methods for the
- * netscape.javascript.JSObject Java class, which are used for calling into
- * JavaScript from Java. It also contains the code that handles propagation
- * of exceptions both into and out of Java.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "jsj_private.h"
-#include "jsjava.h"
-
-#include "jscntxt.h" /* For js_ReportErrorAgain().
- TODO - get rid of private header */
-
-#include "netscape_javascript_JSObject.h" /* javah-generated headers */
-
-
-/* A captured JavaScript error, created when JS_ReportError() is called while
- running JavaScript code that is itself called from Java. */
-struct CapturedJSError {
- char * message;
- JSErrorReport report; /* Line # of error, etc. */
- jthrowable java_exception; /* Java exception, error, or null */
- CapturedJSError * next; /* Next oldest captured JS error */
-};
-
-
-/*********************** Reflection of JSObjects ****************************/
-
-#ifdef PRESERVE_JSOBJECT_IDENTITY
-/*
- * This is a hash table that maps from JS objects to Java objects.
- * It is used to ensure that the same Java object results when a JS
- * object is reflected more than once, so that Java object equality
- * tests work in the expected manner.
- *
- * The entry keys are JSObject pointers and the entry values are Java objects
- * (of type jobject). When the corresponding Java instance is finalized,
- * the entry is removed from the table, and a JavaScript GC root for the JS
- * object is removed.
- *
- * This code is disabled because cycles in GC roots between the two systems
- * cause every reflected JS object to become uncollectable. This can only
- * be solved by using weak links, a feature not available in JDK1.1.
- */
-static JSHashTable *js_obj_reflections = NULL;
-
-#ifdef JSJ_THREADSAFE
-/*
- * Used to protect the js_obj_reflections hashtable from simultaneous
- * read/write or * write/write access.
- */
-static PRMonitor *js_obj_reflections_monitor = NULL;
-#endif /* JSJ_THREADSAFE */
-#endif /* PRESERVE_JSOBJECT_IDENTITY */
-
-JSBool
-jsj_init_js_obj_reflections_table()
-{
-#ifdef PRESERVE_JSOBJECT_IDENTITY
- if(js_obj_reflections != NULL)
- {
- return JS_TRUE;
- }
- js_obj_reflections = JS_NewHashTable(128, NULL, JS_CompareValues,
- JS_CompareValues, NULL, NULL);
- if (!js_obj_reflections)
- return JS_FALSE;
-
-#ifdef JSJ_THREADSAFE
- js_obj_reflections_monitor = PR_NewMonitor();
- if (!js_obj_reflections_monitor) {
- JS_HashTableDestroy(js_obj_reflections);
- return JS_FALSE;
- }
-#endif /* JSJ_THREADSAFE */
-#endif /* PRESERVE_JSOBJECT_IDENTITY */
-
- return JS_TRUE;
-}
-
-/*
- * Return a Java object that "wraps" a given JS object by storing the address
- * of the JS object in a private field of the Java object. A hash table is
- * used to ensure that the mapping of JS objects to Java objects is done on
- * one-to-one basis.
- *
- * If an error occurs, returns NULL and reports an error.
- */
-
-#ifdef PRESERVE_JSOBJECT_IDENTITY
-
-jobject
-jsj_WrapJSObject(JSContext *cx, JNIEnv *jEnv, JSObject *js_obj)
-{
- jobject java_wrapper_obj;
- JSHashEntry *he, **hep;
-
- java_wrapper_obj = NULL;
-
-#ifdef JSJ_THREADSAFE
- PR_EnterMonitor(js_obj_reflections_monitor);
-#endif
-
- /* First, look in the hash table for an existing reflection of the same
- JavaScript object. If one is found, return it. */
- hep = JS_HashTableRawLookup(js_obj_reflections, (JSHashNumber)js_obj, js_obj);
-
- /* If the same JSObject is reflected into Java more than once then we should
- return the same Java object, both for efficiency and so that the '=='
- operator works as expected in Java when comparing two JSObjects.
- However, it is not possible to hold a reference to a Java object without
- inhibiting GC of that object, at least not in a portable way, i.e.
- a weak reference. So, for now, JSObject identity is broken. */
-
- he = *hep;
- if (he) {
- java_wrapper_obj = (jobject)he->value;
- JS_ASSERT(java_wrapper_obj);
- if (java_wrapper_obj)
- goto done;
- }
-
- /* No existing reflection found, so create a new Java object that wraps
- the JavaScript object by storing its address in a private integer field. */
-#ifndef OJI
- java_wrapper_obj =
- (*jEnv)->NewObject(jEnv, njJSObject, njJSObject_JSObject, (jint)js_obj);
-#else
- if (JSJ_callbacks && JSJ_callbacks->get_java_wrapper != NULL) {
- java_wrapper_obj = JSJ_callbacks->get_java_wrapper(jEnv, (jint)handle);
- }
-#endif /*! OJI */
-
- if (!java_wrapper_obj) {
- jsj_UnexpectedJavaError(cx, jEnv, "Couldn't create new instance of "
- "netscape.javascript.JSObject");
- goto done;
- }
-
- /* Add the new reflection to the hash table. */
- he = JS_HashTableRawAdd(js_obj_reflections, hep, (JSHashNumber)js_obj,
- js_obj, java_wrapper_obj);
- if (he) {
- /* Tell the JavaScript GC about this object since the only reference
- to it may be in Java-land. */
- JS_AddNamedRoot(cx, (void*)&he->key, "&he->key");
- } else {
- JS_ReportOutOfMemory(cx);
- /* No need to delete java_wrapper_obj because Java GC will reclaim it */
- java_wrapper_obj = NULL;
- }
-
- /*
- * Release local reference to wrapper object, since some JVMs seem reticent
- * about collecting it otherwise.
- */
- /* FIXME -- beard: this seems to make calls into Java with JSObject's fail. */
- /* We should really be creating a global ref if we are putting it in a hash table. */
- /* (*jEnv)->DeleteLocalRef(jEnv, java_wrapper_obj); */
-
-done:
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(js_obj_reflections_monitor);
-#endif
-
- return java_wrapper_obj;
-}
-
-/*
- * Remove the mapping of a JS object from the hash table that maps JS objects
- * to Java objects. This is called from the finalizer of an instance of
- * netscape.javascript.JSObject.
- */
-JSBool
-jsj_remove_js_obj_reflection_from_hashtable(JSContext *cx, JSObject *js_obj)
-{
- JSHashEntry *he, **hep;
- JSBool success = JS_FALSE;
-
-#ifdef JSJ_THREADSAFE
- PR_EnterMonitor(js_obj_reflections_monitor);
-#endif
-
- /* Get the hash-table entry for this wrapper object */
- hep = JS_HashTableRawLookup(js_obj_reflections, (JSHashNumber)js_obj, js_obj);
- he = *hep;
-
- JS_ASSERT(he);
- if (he) {
- /* Tell the JS GC that Java no longer keeps a reference to this
- JS object. */
- success = JS_RemoveRoot(cx, (void *)&he->key);
-
- JS_HashTableRawRemove(js_obj_reflections, hep, he);
- }
-
-#ifdef JSJ_THREADSAFE
- PR_ExitMonitor(js_obj_reflections_monitor);
-#endif
-
- return success;
-}
-
-#else /* !PRESERVE_JSOBJECT_IDENTITY */
-
-
-/*
- * The caller must call DeleteLocalRef() on the returned object when no more
- * references remain.
- */
-jobject
-jsj_WrapJSObject(JSContext *cx, JNIEnv *jEnv, JSObject *js_obj)
-{
- jobject java_wrapper_obj;
- JSObjectHandle *handle;
-
- /* Create a tiny stub object to act as the GC root that points to the
- JSObject from its netscape.javascript.JSObject counterpart. */
- handle = (JSObjectHandle*)JS_malloc(cx, sizeof(JSObjectHandle));
- if (!handle)
- return NULL;
- handle->js_obj = js_obj;
- handle->rt = JS_GetRuntime(cx);
-
- /* Create a new Java object that wraps the JavaScript object by storing its
- address in a private integer field. */
-#ifndef OJI
- java_wrapper_obj =
- (*jEnv)->NewObject(jEnv, njJSObject, njJSObject_JSObject, (lcjsobject)handle);
-#else
- if (JSJ_callbacks && JSJ_callbacks->get_java_wrapper != NULL) {
- java_wrapper_obj = JSJ_callbacks->get_java_wrapper(jEnv, (lcjsobject)handle);
- } else {
- java_wrapper_obj = NULL;
- }
-#endif /*! OJI */
- if (!java_wrapper_obj) {
- jsj_UnexpectedJavaError(cx, jEnv, "Couldn't create new instance of "
- "netscape.javascript.JSObject");
- JS_free(cx, handle);
- goto done;
- }
-
- JS_AddNamedRoot(cx, &handle->js_obj, "&handle->js_obj");
-
-done:
-
- return java_wrapper_obj;
-}
-
-JSObject *
-jsj_UnwrapJSObjectWrapper(JNIEnv *jEnv, jobject java_wrapper_obj)
-{
- JSObjectHandle *handle;
-
-#ifndef OJI
-#if JS_BYTES_PER_LONG == 8 || JS_BYTES_PER_WORD == 8
- handle = (JSObjectHandle*)((*jEnv)->GetLongField(jEnv, java_wrapper_obj, njJSObject_long_internal));
-#else
- handle = (JSObjectHandle*)((*jEnv)->GetIntField(jEnv, java_wrapper_obj, njJSObject_internal));
-#endif
-#else
- /* Unwrapping this wrapper requires knowledge of the structure of the object. This is privileged
- information that only the object implementor can know. In this case the object implementor
- is the java plugin (such as the Sun plugin class sun.plugin.javascript.navig5.JSObject.
- Since the plugin owns this structure, we defer to it to unwrap the object. If the plugin
- does not implement this callback, then it should be set to null. In that case we try something
- that works with Sun's plugin assuming that it has not yet been implemented yet. This 'else'
- case should be removed as soon as the unwrap function is supported by the Sun JPI. */
-
- if (JSJ_callbacks && JSJ_callbacks->unwrap_java_wrapper != NULL) {
- handle = (JSObjectHandle*)JSJ_callbacks->unwrap_java_wrapper(jEnv, java_wrapper_obj);
- }
- else {
- jclass cid = (*jEnv)->GetObjectClass(jEnv, java_wrapper_obj);
-#if JS_BYTES_PER_LONG == 8 || JS_BYTES_PER_WORD == 8
- jfieldID fid = (*jEnv)->GetFieldID(jEnv, cid, "nativeJSObject", "J");
- handle = (JSObjectHandle*)((*jEnv)->GetLongField(jEnv, java_wrapper_obj, fid));
-#else
- jfieldID fid = (*jEnv)->GetFieldID(jEnv, cid, "nativeJSObject", "I");
- handle = (JSObjectHandle*)((*jEnv)->GetIntField(jEnv, java_wrapper_obj, fid));
-#endif
- }
-#endif
-
- /* JNI returns a NULL handle for a Java 'null' */
- if (!handle)
- return NULL;
-
- return handle->js_obj;
-
-}
-
-#endif /* !PRESERVE_JSOBJECT_IDENTITY */
-
-/*************** Handling of Java exceptions in JavaScript ******************/
-
-/*
- * Free up a JavaScript error that has been stored by the
- * capture_js_error_reports_for_java() function.
- */
-static CapturedJSError *
-destroy_saved_js_error(JNIEnv *jEnv, CapturedJSError *error)
-{
- CapturedJSError *next_error;
- if (!error)
- return NULL;
- next_error = error->next;
-
- if (error->java_exception)
- (*jEnv)->DeleteGlobalRef(jEnv, error->java_exception);
- if (error->message)
- free((char*)error->message);
- if (error->report.filename)
- free((char*)error->report.filename);
- if (error->report.linebuf)
- free((char*)error->report.linebuf);
- free(error);
-
- return next_error;
-}
-
-/*
- * Capture a JS error that has been reported using JS_ReportError() by JS code
- * that has itself been called from Java. A copy of the JS error data is made
- * and hung off the JSJ environment. When JS completes and returns to its Java
- * caller, this data is used to synthesize an instance of
- * netscape.javascript.JSException. If the resulting JSException is not caught
- * within Java, it may be propagated up the stack beyond the Java caller back
- * into JavaScript, in which case the error will be re-reported as a JavaScript
- * error.
- */
-static void
-capture_js_error_reports_for_java(JSContext *cx, const char *message,
- JSErrorReport *report)
-{
- CapturedJSError *new_error;
- JSJavaThreadState *jsj_env;
- jthrowable java_exception, tmp_exception;
- JNIEnv *jEnv;
-
- /* Warnings are not propagated as Java exceptions - they are simply
- ignored. Ditto for exceptions that are duplicated in the form
- of error reports. */
- if (report && (report->flags & (JSREPORT_WARNING | JSREPORT_EXCEPTION)))
- return;
-
- /* Create an empty struct to hold the saved JS error state */
- new_error = malloc(sizeof(CapturedJSError));
- if (!new_error)
- goto out_of_memory;
- memset(new_error, 0, sizeof(CapturedJSError));
-
- /* Copy all the error info out of the original report into a private copy */
- if (message) {
- new_error->message = strdup(message);
- if (!new_error->message) {
- free(new_error);
- return;
- }
- }
- if (report) {
- new_error->report.lineno = report->lineno;
-
- if (report->filename) {
- new_error->report.filename = strdup(report->filename);
- if (!new_error->report.filename)
- goto out_of_memory;
- }
-
- if (report->linebuf) {
- new_error->report.linebuf = strdup(report->linebuf);
- if (!new_error->report.linebuf)
- goto out_of_memory;
- new_error->report.tokenptr =
- new_error->report.linebuf + (report->tokenptr - report->linebuf);
- }
- }
-
- /* Get the head of the list of pending JS errors */
- jsj_env = jsj_EnterJava(cx, &jEnv);
- if (!jsj_env)
- goto abort;
-
- /* If there's a Java exception associated with this error, save it too. */
- java_exception = (*jEnv)->ExceptionOccurred(jEnv);
- if (java_exception) {
- (*jEnv)->ExceptionClear(jEnv);
- tmp_exception = java_exception; /* Make a copy */
- java_exception = (*jEnv)->NewGlobalRef(jEnv, java_exception);
- new_error->java_exception = java_exception;
- (*jEnv)->DeleteLocalRef(jEnv, tmp_exception);
- }
-
- /* Push this error onto the list of pending JS errors */
- new_error->next = jsj_env->pending_js_errors;
- jsj_env->pending_js_errors = new_error;
- jsj_ExitJava(jsj_env);
- return;
-
-abort:
-out_of_memory:
- /* No recovery action possible */
- JS_ASSERT(0);
- destroy_saved_js_error(jEnv, new_error);
- return;
-}
-
-void
-jsj_ClearPendingJSErrors(JSJavaThreadState *jsj_env)
-{
- while (jsj_env->pending_js_errors)
- jsj_env->pending_js_errors = destroy_saved_js_error(jsj_env->jEnv, jsj_env->pending_js_errors);
-}
-
-/*
- * This is called upon returning from JS back into Java. Any JS errors
- * reported during that time will be converted into Java exceptions. It's
- * possible that a JS error was actually triggered by Java at some point, in
- * which case the original Java exception is thrown.
- */
-static void
-throw_any_pending_js_error_as_a_java_exception(JSJavaThreadState *jsj_env)
-{
- CapturedJSError *error;
- JNIEnv *jEnv;
- jstring message_jstr, linebuf_jstr, filename_jstr;
- jint index, lineno;
- JSErrorReport *report;
- JSContext *cx;
- jsval pending_exception;
- jobject java_obj;
- int dummy_cost;
- JSBool is_local_refp;
- JSType primitive_type;
- jthrowable java_exception;
-
- message_jstr = linebuf_jstr = filename_jstr = java_exception = NULL;
-
- /* Get the Java JNI environment */
- jEnv = jsj_env->jEnv;
-
- cx = jsj_env->cx;
- /* Get the pending JS exception if it exists */
- if (cx&&JS_IsExceptionPending(cx)) {
- if (!JS_GetPendingException(cx, &pending_exception))
- goto out_of_memory;
-
- /* Find out the JSTYPE of this jsval. */
- primitive_type = JS_TypeOfValue(cx, pending_exception);
-
- /* Convert jsval exception to a java object and then use it to
- create an instance of JSException. */
- if (!jsj_ConvertJSValueToJavaObject(cx, jEnv,
- pending_exception,
- jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &java_obj,
- &is_local_refp))
- goto done;
-
- java_exception = (*jEnv)->NewObject(jEnv, njJSException,
- njJSException_JSException_wrap,
- primitive_type, java_obj);
- if (is_local_refp)
- (*jEnv)->DeleteLocalRef(jEnv, java_obj);
- if (!java_exception)
- goto out_of_memory;
-
- /* Throw the newly-created JSException */
- if ((*jEnv)->Throw(jEnv, java_exception) < 0) {
- JS_ASSERT(0);
- jsj_LogError("Couldn't throw JSException\n");
- goto done;
- }
- JS_ClearPendingException(cx);
- return;
- }
- if (!jsj_env->pending_js_errors) {
-#ifdef DEBUG
- /* Any exception should be cleared as soon as it's detected, so there
- shouldn't be any pending. */
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- /* A Java exception occurred, but nobody in JS-land noticed. */
- JS_ASSERT(0);
- (*jEnv)->ExceptionClear(jEnv);
- }
-#endif
- return;
- }
-
- /* Get the deepest (oldest) saved JS error */
- /* XXX - What's the right thing to do about newer errors ?
- For now we just throw them away */
- error = jsj_env->pending_js_errors;
- while (error->next)
- error = error->next;
-
- /*
- * If the JS error was originally the result of a Java exception, rethrow
- * the original exception.
- */
- if (error->java_exception) {
- (*jEnv)->Throw(jEnv, error->java_exception);
- goto done;
- }
-
- /* Propagate any JS errors that did not originate as Java exceptions into
- Java as an instance of netscape.javascript.JSException */
-
- /* First, marshall the arguments to the JSException constructor */
- message_jstr = NULL;
- if (error->message) {
- message_jstr = (*jEnv)->NewStringUTF(jEnv, error->message);
- if (!message_jstr)
- goto out_of_memory;
- }
-
- report = &error->report;
-
- filename_jstr = NULL;
- if (report->filename) {
- filename_jstr = (*jEnv)->NewStringUTF(jEnv, report->filename);
- if (!filename_jstr)
- goto out_of_memory;
- }
-
- linebuf_jstr = NULL;
- if (report->linebuf) {
- linebuf_jstr = (*jEnv)->NewStringUTF(jEnv, report->linebuf);
- if (!linebuf_jstr)
- goto out_of_memory;
- }
-
- lineno = report->lineno;
- index = report->linebuf ? report->tokenptr - report->linebuf : 0;
-
- /* Call the JSException constructor */
- java_exception = (*jEnv)->NewObject(jEnv, njJSException, njJSException_JSException,
- message_jstr, filename_jstr, lineno, linebuf_jstr, index);
- if (!java_exception)
- goto out_of_memory;
-
- /* Throw the newly-created JSException */
- if ((*jEnv)->Throw(jEnv, java_exception) < 0) {
- JS_ASSERT(0);
- jsj_UnexpectedJavaError(cx, jEnv, "Couldn't throw JSException\n");
- }
- goto done;
-
-out_of_memory:
- /* No recovery possible */
- JS_ASSERT(0);
- jsj_LogError("Out of memory while attempting to throw JSException\n");
-
-done:
- jsj_ClearPendingJSErrors(jsj_env);
- /*
- * Release local references to Java objects, since some JVMs seem reticent
- * about collecting them otherwise.
- */
- if (message_jstr)
- (*jEnv)->DeleteLocalRef(jEnv, message_jstr);
- if (filename_jstr)
- (*jEnv)->DeleteLocalRef(jEnv, filename_jstr);
- if (linebuf_jstr)
- (*jEnv)->DeleteLocalRef(jEnv, linebuf_jstr);
- if (java_exception)
- (*jEnv)->DeleteLocalRef(jEnv, java_exception);
-}
-
-/*
- * This function is called up returning from Java back into JS as a result of
- * a thrown netscape.javascript.JSException, which itself must have been caused
- * by a JS error when Java called into JS. The original JS error is
- * reconstituted from the JSException and re-reported as a JS error.
- *
- * Returns JS_FALSE if an internal error occurs, JS_TRUE otherwise.
- */
-JSBool
-jsj_ReportUncaughtJSException(JSContext *cx, JNIEnv *jEnv, jthrowable java_exception)
-{
- JSBool success;
- JSErrorReport report;
- const char *linebuf, *filename, *message, *tokenptr;
- jint lineno, token_index;
- jstring linebuf_jstr, filename_jstr, message_jstr;
-
- /* Initialize everything to NULL */
- memset(&report, 0, sizeof(JSErrorReport));
- success = JS_FALSE;
- filename_jstr = linebuf_jstr = message_jstr = NULL;
- filename = message = linebuf = tokenptr = NULL;
-
- lineno = (*jEnv)->GetIntField(jEnv, java_exception, njJSException_lineno);
- report.lineno = lineno;
-
- filename_jstr = (*jEnv)->GetObjectField(jEnv, java_exception, njJSException_filename);
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- jsj_UnexpectedJavaError(cx, jEnv, "Unable to access filename field of a JSException");
- goto done;
- }
- if (filename_jstr)
- filename = (*jEnv)->GetStringUTFChars(jEnv, filename_jstr, 0);
- report.filename = filename;
-
- linebuf_jstr = (*jEnv)->GetObjectField(jEnv, java_exception, njJSException_source);
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- jsj_UnexpectedJavaError(cx, jEnv, "Unable to access source field of a JSException");
- goto done;
- }
- if (linebuf_jstr)
- linebuf = (*jEnv)->GetStringUTFChars(jEnv, linebuf_jstr, 0);
- report.linebuf = linebuf;
-
- token_index = (*jEnv)->GetIntField(jEnv, java_exception, njJSException_lineno);
- report.tokenptr = linebuf + token_index;
-
- message_jstr = (*jEnv)->CallObjectMethod(jEnv, java_exception, jlThrowable_getMessage);
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- jsj_UnexpectedJavaError(cx, jEnv, "Unable to access message of a JSException");
- goto done;
- }
- if (message_jstr)
- message = (*jEnv)->GetStringUTFChars(jEnv, message_jstr, 0);
-
- js_ReportErrorAgain(cx, message, &report);
-
- success = JS_TRUE;
-
-done:
-
- if (filename_jstr && filename)
- (*jEnv)->ReleaseStringUTFChars(jEnv, filename_jstr, filename);
- if (linebuf_jstr && linebuf)
- (*jEnv)->ReleaseStringUTFChars(jEnv, linebuf_jstr, linebuf);
- if (message_jstr && message)
- (*jEnv)->ReleaseStringUTFChars(jEnv, message_jstr, message);
- return success;
-}
-
-
-
-/*************** Utilities for calling JavaScript from Java *****************/
-
-/*
- * This routine is called just prior to invoking any JS API function from
- * Java. It performs a common set of chores, such as obtaining the LiveConnect
- * state for the invoking Java thread and determining the JSContext to be
- * used for this thread.
- *
- * Returns NULL on failure.
- */
-
-
-JSJavaThreadState *
-jsj_enter_js(JNIEnv *jEnv, void* applet_obj, jobject java_wrapper_obj,
- JSContext **cxp, JSObject **js_objp, JSErrorReporter *old_error_reporterp,
- void **pNSIPrincipaArray, int numPrincipals, void *pNSISecurityContext)
-{
- JSContext *cx;
- char *err_msg;
- JSObject *js_obj;
- JSJavaThreadState *jsj_env;
-
- cx = NULL;
- err_msg = NULL;
-
- /* Invoke callback, presumably used to implement concurrency constraints */
- if (JSJ_callbacks && JSJ_callbacks->enter_js_from_java) {
-#ifdef OJI
- if (!JSJ_callbacks->enter_js_from_java(jEnv, &err_msg, pNSIPrincipaArray, numPrincipals, pNSISecurityContext,applet_obj))
-#else
- if (!JSJ_callbacks->enter_js_from_java(jEnv, &err_msg))
-#endif
- goto entry_failure;
- }
-
- /* Check the JSObject pointer in the wrapper object. */
- if (js_objp) {
-
-#ifdef PRESERVE_JSOBJECT_IDENTITY
-#if JS_BYTES_PER_LONG == 8
- js_obj = (JSObject *)((*jEnv)->GetLongField(jEnv, java_wrapper_obj, njJSObject_long_internal));
-#else
- js_obj = (JSObject *)((*jEnv)->GetIntField(jEnv, java_wrapper_obj, njJSObject_internal));
-#endif
-#else /* !PRESERVE_JSOBJECT_IDENTITY */
- js_obj = jsj_UnwrapJSObjectWrapper(jEnv, java_wrapper_obj);
-#endif /* PRESERVE_JSOBJECT_IDENTITY */
-
- JS_ASSERT(js_obj);
- if (!js_obj)
- goto error;
- *js_objp = js_obj;
- }
-
- /* Get the per-thread state corresponding to the current Java thread */
- jsj_env = jsj_MapJavaThreadToJSJavaThreadState(jEnv, &err_msg);
- if (!jsj_env)
- goto error;
-
- /* Get the JSContext that we're supposed to use for this Java thread */
- cx = jsj_env->cx;
- if (!cx) {
- /* We called spontaneously into JS from Java, rather than from JS into
- Java and back into JS. Invoke a callback to obtain/create a
- JSContext for us to use. */
- if (JSJ_callbacks && JSJ_callbacks->map_jsj_thread_to_js_context) {
-#ifdef OJI
- cx = JSJ_callbacks->map_jsj_thread_to_js_context(jsj_env,
- applet_obj,
- jEnv, &err_msg);
-#else
- cx = JSJ_callbacks->map_jsj_thread_to_js_context(jsj_env,
- jEnv, &err_msg);
-#endif
- if (!cx)
- goto error;
- } else {
- err_msg = JS_smprintf("Unable to find/create JavaScript execution "
- "context for JNI thread 0x%08x", jEnv);
- goto error;
- }
- }
- *cxp = cx;
-
- /*
- * Capture all JS error reports so that they can be thrown into the Java
- * caller as an instance of netscape.javascript.JSException.
- */
- *old_error_reporterp =
- JS_SetErrorReporter(cx, capture_js_error_reports_for_java);
-
-#ifdef JSJ_THREADSAFE
- JS_BeginRequest(cx);
-#endif
-
- return jsj_env;
-
-error:
- JS_ASSERT(!cx);
- /* Invoke callback, presumably used to implement concurrency constraints */
- if (JSJ_callbacks && JSJ_callbacks->exit_js)
- JSJ_callbacks->exit_js(jEnv, cx);
-
-entry_failure:
- JS_ASSERT(!cx);
- if (err_msg) {
- jsj_LogError(err_msg);
- JS_smprintf_free(err_msg);
- }
-
- return NULL;
-}
-
-/*
- * This utility function is called just prior to returning into Java from JS.
- */
-JSBool
-jsj_exit_js(JSContext *cx, JSJavaThreadState *jsj_env, JSErrorReporter original_reporter)
-{
- JNIEnv *jEnv;
-
-#ifdef JSJ_THREADSAFE
- JS_EndRequest(cx);
-#endif
-
- /* Restore the JS error reporter */
- JS_SetErrorReporter(cx, original_reporter);
-
- jEnv = jsj_env->jEnv;
-
-#ifdef DEBUG
- /* Any Java exceptions should have been noticed and reported already */
- if ((*jEnv)->ExceptionOccurred(jEnv)) {
- JS_ASSERT(0);
- jsj_LogError("Unhandled Java exception detected");
- return JS_FALSE;
- }
-#endif
-
- /*
- * Convert reported JS errors to JSExceptions, unless the errors were
- * themselves the result of Java exceptions, in which case the original
- * Java exception is simply propagated.
- */
- throw_any_pending_js_error_as_a_java_exception(jsj_env);
-
- /* Invoke callback, presumably used to implement concurrency constraints */
- if (JSJ_callbacks && JSJ_callbacks->exit_js)
- JSJ_callbacks->exit_js(jEnv, cx);
-
- return JS_TRUE;
-}
-
-
-/* Get the JavaClassDescriptor that corresponds to java.lang.Object */
-JavaClassDescriptor *
-jsj_get_jlObject_descriptor(JSContext *cx, JNIEnv *jEnv)
-{
- /* The JavaClassDescriptor for java.lang.Object */
- static JavaClassDescriptor *jlObject_descriptor = NULL;
-
- if (!jlObject_descriptor)
- jlObject_descriptor = jsj_GetJavaClassDescriptor(cx, jEnv, jlObject);
- return jlObject_descriptor;
-}
-
-/****************** Implementation of methods of JSObject *******************/
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: initClass
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_netscape_javascript_JSObject_initClass(JNIEnv *jEnv, jclass java_class)
-{
- jsj_init_js_obj_reflections_table();
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getMember
- * Signature: (Ljava/lang/String;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL
-Java_netscape_javascript_JSObject_getMember(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jstring property_name_jstr)
-{
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val;
- int dummy_cost;
- JSBool dummy_bool;
- const jchar *property_name_ucs2;
- jsize property_name_len;
- JSErrorReporter saved_reporter;
- jobject member;
- jboolean is_copy;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
- property_name_ucs2 = NULL;
- if (!property_name_jstr) {
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_NULL_MEMBER_NAME);
- member = NULL;
- goto done;
- }
-
- /* Get the Unicode string for the JS property name */
- property_name_ucs2 = (*jEnv)->GetStringChars(jEnv, property_name_jstr, &is_copy);
- if (!property_name_ucs2) {
- JS_ASSERT(0);
- goto done;
- }
- property_name_len = (*jEnv)->GetStringLength(jEnv, property_name_jstr);
-
- if (!JS_GetUCProperty(cx, js_obj, property_name_ucs2, property_name_len, &js_val))
- goto done;
-
- jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val,
- jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &member, &dummy_bool);
-
-done:
- if (property_name_ucs2)
- (*jEnv)->ReleaseStringChars(jEnv, property_name_jstr, property_name_ucs2);
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return member;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getSlot
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL
-Java_netscape_javascript_JSObject_getSlot(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jint slot)
-{
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val;
- int dummy_cost;
- JSBool dummy_bool;
- JSErrorReporter saved_reporter;
- jobject member;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
-
- if (!JS_GetElement(cx, js_obj, slot, &js_val))
- goto done;
- if (!jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val, jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &member, &dummy_bool))
- goto done;
-
-done:
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return member;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: setMember
- * Signature: (Ljava/lang/String;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_netscape_javascript_JSObject_setMember(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jstring property_name_jstr,
- jobject java_obj)
-{
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val;
- const jchar *property_name_ucs2;
- jsize property_name_len;
- JSErrorReporter saved_reporter;
- jboolean is_copy;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return;
-
- property_name_ucs2 = NULL;
- if (!property_name_jstr) {
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_NULL_MEMBER_NAME);
- goto done;
- }
-
- /* Get the Unicode string for the JS property name */
- property_name_ucs2 = (*jEnv)->GetStringChars(jEnv, property_name_jstr, &is_copy);
- if (!property_name_ucs2) {
- JS_ASSERT(0);
- goto done;
- }
- property_name_len = (*jEnv)->GetStringLength(jEnv, property_name_jstr);
-
- if (!jsj_ConvertJavaObjectToJSValue(cx, jEnv, java_obj, &js_val))
- goto done;
-
- JS_SetUCProperty(cx, js_obj, property_name_ucs2, property_name_len, &js_val);
-
-done:
- if (property_name_ucs2)
- (*jEnv)->ReleaseStringChars(jEnv, property_name_jstr, property_name_ucs2);
- jsj_exit_js(cx, jsj_env, saved_reporter);
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: setSlot
- * Signature: (ILjava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_netscape_javascript_JSObject_setSlot(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jint slot,
- jobject java_obj)
-{
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val;
- JSErrorReporter saved_reporter;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return;
-
- if (!jsj_ConvertJavaObjectToJSValue(cx, jEnv, java_obj, &js_val))
- goto done;
- JS_SetElement(cx, js_obj, slot, &js_val);
-
-done:
- jsj_exit_js(cx, jsj_env, saved_reporter);
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: removeMember
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_netscape_javascript_JSObject_removeMember(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jstring property_name_jstr)
-{
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val;
- const jchar *property_name_ucs2;
- jsize property_name_len;
- JSErrorReporter saved_reporter;
- jboolean is_copy;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return;
-
- if (!property_name_jstr) {
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_NULL_MEMBER_NAME);
- goto done;
- }
- /* Get the Unicode string for the JS property name */
- property_name_ucs2 = (*jEnv)->GetStringChars(jEnv, property_name_jstr, &is_copy);
- if (!property_name_ucs2) {
- JS_ASSERT(0);
- goto done;
- }
- property_name_len = (*jEnv)->GetStringLength(jEnv, property_name_jstr);
-
- JS_DeleteUCProperty2(cx, js_obj, property_name_ucs2, property_name_len, &js_val);
-
- (*jEnv)->ReleaseStringChars(jEnv, property_name_jstr, property_name_ucs2);
-
-done:
- jsj_exit_js(cx, jsj_env, saved_reporter);
- return;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: call
- * Signature: (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL
-Java_netscape_javascript_JSObject_call(JNIEnv *jEnv, jobject java_wrapper_obj,
- jstring function_name_jstr, jobjectArray java_args)
-{
- int i, argc, arg_num;
- jsval *argv;
- JSContext *cx = NULL;
- JSObject *js_obj;
- jsval js_val, function_val;
- int dummy_cost;
- JSBool dummy_bool;
- const jchar *function_name_ucs2;
- jsize function_name_len;
- JSErrorReporter saved_reporter;
- jboolean is_copy;
- jobject result;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
- function_name_ucs2 = NULL;
- result = NULL;
- if (!function_name_jstr) {
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_NULL_FUNCTION_NAME);
- goto done;
- }
-
- /* Get the function name to eval as raw Unicode characters */
- function_name_ucs2 = (*jEnv)->GetStringChars(jEnv, function_name_jstr, &is_copy);
- if (!function_name_ucs2) {
- JS_ASSERT(0);
- goto done;
- }
- function_name_len = (*jEnv)->GetStringLength(jEnv, function_name_jstr);
-
- /* Allocate space for JS arguments */
- if (java_args) {
- argc = (*jEnv)->GetArrayLength(jEnv, java_args);
- argv = (jsval*)JS_malloc(cx, argc * sizeof(jsval));
- } else {
- argc = 0;
- argv = 0;
- }
-
- /* Convert arguments from Java to JS values */
- for (arg_num = 0; arg_num < argc; arg_num++) {
- jobject arg = (*jEnv)->GetObjectArrayElement(jEnv, java_args, arg_num);
-
- if (!jsj_ConvertJavaObjectToJSValue(cx, jEnv, arg, &argv[arg_num]))
- goto cleanup_argv;
- JS_AddNamedRoot(cx, &argv[arg_num], "&argv[arg_num]");
- }
-
- if (!JS_GetUCProperty(cx, js_obj, function_name_ucs2, function_name_len,
- &function_val))
- goto cleanup_argv;
-
- if (!JS_CallFunctionValue(cx, js_obj, function_val, argc, argv, &js_val))
- goto cleanup_argv;
-
- jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val, jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &result, &dummy_bool);
-
-cleanup_argv:
- if (argv) {
- for (i = 0; i < arg_num; i++)
- JS_RemoveRoot(cx, &argv[i]);
- JS_free(cx, argv);
- }
-
-done:
- if (function_name_ucs2)
- (*jEnv)->ReleaseStringChars(jEnv, function_name_jstr, function_name_ucs2);
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return result;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: eval
- * Signature: (Ljava/lang/String;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL
-Java_netscape_javascript_JSObject_eval(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jstring eval_jstr)
-{
- const char *codebase;
- JSPrincipals *principals;
- JSContext *cx = NULL;
- JSBool eval_succeeded;
- JSObject *js_obj;
- jsval js_val;
- int dummy_cost;
- JSBool dummy_bool;
- const jchar *eval_ucs2;
- jsize eval_len;
- JSErrorReporter saved_reporter;
- jboolean is_copy;
- jobject result;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
- result = NULL;
- eval_ucs2 = NULL;
- if (!eval_jstr) {
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_NULL_EVAL_ARG);
- goto done;
- }
-
- /* Get the string to eval as raw Unicode characters */
- eval_ucs2 = (*jEnv)->GetStringChars(jEnv, eval_jstr, &is_copy);
- if (!eval_ucs2) {
- JS_ASSERT(0);
- goto done;
- }
- eval_len = (*jEnv)->GetStringLength(jEnv, eval_jstr);
-
- /* Set up security stuff */
- principals = NULL;
- if (JSJ_callbacks && JSJ_callbacks->get_JSPrincipals_from_java_caller)
- principals = JSJ_callbacks->get_JSPrincipals_from_java_caller(jEnv, cx, NULL, 0, NULL);
- codebase = principals ? principals->codebase : NULL;
-
- /* Have the JS engine evaluate the unicode string */
- eval_succeeded = JS_EvaluateUCScriptForPrincipals(cx, js_obj, principals,
- eval_ucs2, eval_len,
- codebase, 0, &js_val);
- if (!eval_succeeded)
- goto done;
-
- /* Convert result to a subclass of java.lang.Object */
- jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val, jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &result, &dummy_bool);
-
-done:
- if (eval_ucs2)
- (*jEnv)->ReleaseStringChars(jEnv, eval_jstr, eval_ucs2);
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return result;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: toString
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_netscape_javascript_JSObject_toString(JNIEnv *jEnv,
- jobject java_wrapper_obj)
-{
- jstring result;
- JSContext *cx = NULL;
- JSObject *js_obj;
- JSString *jsstr;
- JSErrorReporter saved_reporter;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
- result = NULL;
- jsstr = JS_ValueToString(cx, OBJECT_TO_JSVAL(js_obj));
- if (jsstr)
- result = jsj_ConvertJSStringToJavaString(cx, jEnv, jsstr);
- if (!result)
- result = (*jEnv)->NewStringUTF(jEnv, "*JavaObject*");
-
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return result;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: getWindow
- * Signature: (Ljava/applet/Applet;)Lnetscape/javascript/JSObject;
- */
-JNIEXPORT jobject JNICALL
-Java_netscape_javascript_JSObject_getWindow(JNIEnv *jEnv,
- jclass js_object_class,
- jobject java_applet_obj)
-{
- char *err_msg;
- JSContext *cx = NULL;
- JSObject *js_obj = NULL;
- jsval js_val;
- int dummy_cost;
- JSBool dummy_bool;
- JSErrorReporter saved_reporter;
- jobject java_obj;
- JSJavaThreadState *jsj_env;
-
- jsj_env = jsj_enter_js(jEnv, java_applet_obj, NULL, &cx, NULL, &saved_reporter, NULL, 0, NULL);
- if (!jsj_env)
- return NULL;
-
- err_msg = NULL;
- java_obj = NULL;
- if (JSJ_callbacks && JSJ_callbacks->map_java_object_to_js_object)
- js_obj = JSJ_callbacks->map_java_object_to_js_object(jEnv, java_applet_obj, &err_msg);
- if (!js_obj) {
- if (err_msg) {
- JS_ReportError(cx, err_msg);
- free(err_msg);
- }
- goto done;
- }
- js_val = OBJECT_TO_JSVAL(js_obj);
- jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val, jsj_get_jlObject_descriptor(cx, jEnv),
- &dummy_cost, &java_obj, &dummy_bool);
-done:
- if (!jsj_exit_js(cx, jsj_env, saved_reporter))
- return NULL;
-
- return java_obj;
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: finalize
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_netscape_javascript_JSObject_finalize(JNIEnv *jEnv, jobject java_wrapper_obj)
-{
- JSBool success;
- JSObjectHandle *handle;
-
- success = JS_FALSE;
-
-#if JS_BYTES_PER_LONG == 8 || JS_BYTES_PER_WORD == 8
- handle = (JSObjectHandle *)((*jEnv)->GetLongField(jEnv, java_wrapper_obj, njJSObject_long_internal));
-#else
- handle = (JSObjectHandle *)((*jEnv)->GetIntField(jEnv, java_wrapper_obj, njJSObject_internal));
-#endif
- JS_ASSERT(handle);
- if (!handle)
- return;
-
- success = JS_RemoveRootRT(handle->rt, &handle->js_obj);
- free(handle);
-
- JS_ASSERT(success);
-}
-
-/*
- * Class: netscape_javascript_JSObject
- * Method: equals
- * Signature: (Ljava/lang/Object;)Z
- */
-
-JNIEXPORT jboolean JNICALL
-Java_netscape_javascript_JSObject_equals(JNIEnv *jEnv,
- jobject java_wrapper_obj,
- jobject comparison_obj)
-{
-#ifdef PRESERVE_JSOBJECT_IDENTITY
-# error "Missing code should be added here"
-#else
- JSObject *js_obj1, *js_obj2;
-
- /* Check that we're comparing with another netscape.javascript.JSObject */
- if (!comparison_obj)
- return 0;
- if (!(*jEnv)->IsInstanceOf(jEnv, comparison_obj, njJSObject))
- return 0;
-
- js_obj1 = jsj_UnwrapJSObjectWrapper(jEnv, java_wrapper_obj);
- js_obj2 = jsj_UnwrapJSObjectWrapper(jEnv, comparison_obj);
-
- return (js_obj1 == js_obj2);
-#endif /* PRESERVE_JSOBJECT_IDENTITY */
-}
-
deleted file mode 100644
--- a/js/src/liveconnect/jsj_JavaArray.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * This file is part of the Java-vendor-neutral implementation of LiveConnect
- *
- * It contains the definition of the JavaScript JavaArray class.
- * Instances of JavaArray are used to reflect Java arrays.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "jsj_private.h" /* LiveConnect internals */
-#include "jsobj.h"
-
-/* Shorthands for ASCII (7-bit) decimal and hex conversion. */
-#define JS7_ISDEC(c) (((c) >= '0') && ((c) <= '9'))
-#define JS7_UNDEC(c) ((c) - '0')
-
-/*
- * Convert any jsval v to an integer jsval if ToString(v)
- * contains a base-10 integer that fits into 31 bits.
- * Otherwise return v.
- */
-static jsval
-try_convert_to_jsint(JSContext *cx, jsval idval)
-{
- const jschar *cp;
- JSString *jsstr;
-
- jsstr = JS_ValueToString(cx, idval);
- if (!jsstr)
- return idval;
-
- cp = JS_GetStringChars(jsstr);
- if (JS7_ISDEC(*cp)) {
- jsuint index = JS7_UNDEC(*cp++);
- jsuint oldIndex = 0;
- jsuint c = 0;
- if (index != 0) {
- while (JS7_ISDEC(*cp)) {
- oldIndex = index;
- c = JS7_UNDEC(*cp);
- index = 10*index + c;
- cp++;
- }
- }
- if (*cp == 0 &&
- (oldIndex < (JSVAL_INT_MAX / 10) ||
- (oldIndex == (JSVAL_INT_MAX / 10) && c < (JSVAL_INT_MAX % 10)))) {
- return INT_TO_JSVAL(index);
- }
- }
- return idval;
-}
-
-
-static JSBool
-access_java_array_element(JSContext *cx,
- JNIEnv *jEnv,
- JSObject *obj,
- jsid id,
- jsval *vp,
- JSBool do_assignment)
-{
- jsval idval;
- jarray java_array;
- JavaClassDescriptor *class_descriptor;
- JavaObjectWrapper *java_wrapper;
- jsize array_length, index;
- JavaSignature *array_component_signature;
-
- /* printf("In JavaArray_getProperty\n"); */
-
- java_wrapper = JS_GetPrivate(cx, obj);
- if (!java_wrapper) {
- const char *property_name;
- if (JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) &&
- (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL) {
- if (!strcmp(property_name, "constructor")) {
- if (vp)
- *vp = JSVAL_VOID;
- return JS_TRUE;
- }
- }
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_BAD_OP_JARRAY);
- return JS_FALSE;
- }
- class_descriptor = java_wrapper->class_descriptor;
- java_array = java_wrapper->java_obj;
-
- JS_ASSERT(class_descriptor->type == JAVA_SIGNATURE_ARRAY);
-
- JS_IdToValue(cx, id, &idval);
-
- if (!JSVAL_IS_INT(idval))
- idval = try_convert_to_jsint(cx, idval);
-
- if (!JSVAL_IS_INT(idval)) {
- /*
- * Usually, properties of JavaArray objects are indexed by integers, but
- * Java arrays also inherit all the methods of java.lang.Object, so a
- * string-valued property is also possible.
- */
- if (JSVAL_IS_STRING(idval)) {
- const char *member_name;
-
- member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
-
- if (do_assignment) {
- JSVersion version = JS_GetVersion(cx);
-
- if (!JSVERSION_IS_ECMA(version)) {
-
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_CANT_WRITE_JARRAY, member_name);
- return JS_FALSE;
- } else {
- if (vp)
- *vp = JSVAL_VOID;
- return JS_TRUE;
- }
- } else {
- if (!strcmp(member_name, "length")) {
- array_length = jsj_GetJavaArrayLength(cx, jEnv, java_array);
- if (array_length < 0)
- return JS_FALSE;
- if (vp)
- *vp = INT_TO_JSVAL(array_length);
- return JS_TRUE;
- }
-
- /* Check to see if we're reflecting a Java array method */
- return JavaObject_getPropertyById(cx, obj, id, vp);
- }
- }
-
- JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
- JSJMSG_BAD_INDEX_EXPR);
- return JS_FALSE;
- }
-
- index = JSVAL_TO_INT(idval);
-
-#if 0
- array_length = jsj_GetJavaArrayLength(cx, jEnv, java_array);
- if (array_length < 0)
- return JS_FALSE;
-