Deleting obsolete contents of jsj directory

This commit is contained in:
fur%netscape.com 1998-09-24 00:32:24 +00:00
Родитель 6fadda588f
Коммит 3d4c0f0c83
27 изменённых файлов: 13 добавлений и 6877 удалений

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

@ -1,5 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
jsjava.h

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

@ -1,80 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
include $(DEPTH)/config/config.mk
ifdef JAVA_OR_OJI
DIRS = classes
endif
MODULE = java
LIBRARY_NAME = jsj
REQUIRES = java js applet nspr img util layer
CSRCS = \
jsjava.c \
jsStubs.c \
$(NULL)
JRI_GEN = netscape.javascript.JSObject netscape.javascript.JSException
ifdef JAVA_OR_OJI
CSRCS += jsjsa.c \
stubs.c \
jsj_nodl.c \
$(NULL)
EXPORTS = jsjava.h \
$(JRI_GEN_DIR)/netscape_javascript_JSObject.h \
$(JRI_GEN_DIR)/netscape_javascript_JSException.h \
$(NULL)
else
EXPORTS = jsjava.h \
$(NULL)
endif
include $(DEPTH)/config/rules.mk
######################################################################
# Generate jsj_nodl.c (so that you can check it in)
# These make rules only works on IRIX...sigh
ifeq ($(OS_ARCH),IRIX)
jsj_nodl.c: $(OBJDIR)/stubs.o Makefile $(DEPTH)/config/nodl.pl
rm -f $@
$(PERL) $(DEPTH)/config/nodl.pl "jsj_nodl_tab" \
`nm -Bn $(OBJDIR)/stubs.o | egrep Java_.*_stub | awk '{print $$3;}'` > $@
endif
ifdef JAVA_OR_OJI
$(OBJDIR)/stubs.o: \
$(JRI_GEN_DIR)/netscape_javascript_JSObject.c \
$(JRI_GEN_DIR)/netscape_javascript_JSException.c \
$(NULL)
else
$(OBJDIR)/stubs.o:
endif
export:: install

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

@ -1,86 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
ifdef JAVA_OR_OJI
DIRS = classes
endif
MODULE = java
LIBRARY_NAME = jsj
REQUIRES = java js applet nspr img util layer
CSRCS = \
jsjava.c \
jsStubs.c \
$(NULL)
JRI_GEN = netscape.javascript.JSObject netscape.javascript.JSException
ifdef JAVA_OR_OJI
CSRCS += jsjsa.c \
stubs.c \
jsj_nodl.c \
$(NULL)
EXPORTS = jsjava.h \
$(JRI_GEN_DIR)/netscape_javascript_JSObject.h \
$(JRI_GEN_DIR)/netscape_javascript_JSException.h \
$(NULL)
else
EXPORTS = jsjava.h \
$(NULL)
endif
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk
######################################################################
# Generate jsj_nodl.c (so that you can check it in)
# These make rules only works on IRIX...sigh
ifeq ($(OS_ARCH),IRIX)
jsj_nodl.c: $(OBJDIR)/stubs.o Makefile $(DEPTH)/config/nodl.pl
rm -f $@
$(PERL) $(DEPTH)/config/nodl.pl "jsj_nodl_tab" \
`nm -Bn $(OBJDIR)/stubs.o | egrep Java_.*_stub | awk '{print $$3;}'` > $@
endif
ifdef JAVA_OR_OJI
$(OBJDIR)/stubs.o: \
$(JRI_GEN_DIR)/netscape_javascript_JSObject.c \
$(JRI_GEN_DIR)/netscape_javascript_JSException.c \
$(NULL)
else
$(OBJDIR)/stubs.o:
endif
export:: install

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

@ -1,31 +1,19 @@
THE ENTIRE CONTENTS OF THIS DIRECTORY HAS BEEN DELETED.
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
Replacement code is in mozilla/js/src/liveconnect.
----------------------------------------------------------------------
This directory previously contained the implementation of LiveConnect,
which is the marketing term for the glue between Java and JavaScript
that allows each language implementation to access the methods and
fields of the other one.
This directory contains the implementation of LiveConnect, which is
the marketing term for the glue between Java and JavaScript that
allows each language implementation to access the methods and fields
of the other one.
This code relies heavily on unpublished APIs to Netscape's Java VM and
hence will not work with any other VM. A new version is currently
being crafted that does not use these hooks, but instead makes use of
the Java Native Interface (JNI), which is JavaSoft's defined way of
communicating with a Java VM. (This code does not use JNI because it
predates the JNI and JNI's predecessor, JRI.)
This code relied heavily on unpublished APIs to Netscape's Java VM and
hence will not work with any other VM. This code has been entirely
supplanted by the code in mozilla/js/src/liveconnect, that makes use
of the Java Native Interface (JNI), which is JavaSoft's de facto
standard way of communicating with a Java VM. (The old code does not
use JNI because it predated the existence of the JNI.)

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

@ -1,65 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
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 $(DEPTH)/config/rules.mk
JAVA_SOURCEPATH = $(DEPTH)/js/jsj/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 ../$(OBJDIR)/*.o \
| egrep "Java.*_stub" | awk '{ print $$3; }' | sort > found_natives
diff found_natives natives_list
FORCE:

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

@ -1,70 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @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 = $(DEPTH)/js/jsj/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 ../$(OBJDIR)/*.o \
| egrep "Java.*_stub" | awk '{ print $$3; }' | sort > found_natives
diff found_natives natives_list
FORCE:

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

@ -1,77 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
IGNORE_MANIFEST=1
#
#//------------------------------------------------------------------------
#//
#// Makefile to build the JavaScript-Java tree
#//
#//------------------------------------------------------------------------
DEPTH = ..\..\..
JAVA_SOURCEPATH=$(DEPTH)\js\jsj\classes
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
include <$(DEPTH)\config\config.mak>
JMOZ = \
netscape/javascript \
$(NULL)
all::
MODULE=java
JMODS=netscape/javascript
JDIRS=$(JMODS)
JAR_JSJ=jsj10.jar
JAR_JSJ_CLASSES=$(JMODS)
JARS=$(JAR_JSJ)
include <$(DEPTH)\config\rules.mak>
!ifdef JAVA_OR_OJI
$(JAR_JSJ):
cd $(JAVA_DESTPATH)
@echo +++ building/updating $@
$(ZIP_PROG) -$(COMP_LEVEL)qu $@ META-INF\build
-for %i in ($(JAR_JSJ_CLASSES:/=\)) do @$(ZIP_PROG) -$(COMP_LEVEL)qu $@ %i\*.class
cd $(MAKEDIR)
jars: $(JARS)
install:: jars
!endif
javadoc:
-mkdir $(XPDIST)\javadoc 2> NUL
echo $(JAVADOC) -sourcepath . -d $(XPDIST)\javadoc $(JDIRS:/=.)
$(JAVADOC) -sourcepath . -d $(XPDIST)\javadoc $(JDIRS:/=.)

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

@ -1,73 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
package netscape.javascript;
/**
* JSException is an exception which is thrown when JavaScript code
* returns an error.
*/
public
class JSException extends Exception {
String filename;
int lineno;
String source;
int tokenIndex;
/**
* Constructs a JSException without a detail message.
* A detail message is a String that describes this particular exception.
*/
public JSException() {
super();
filename = "unknown";
lineno = 0;
source = "";
tokenIndex = 0;
}
/**
* Constructs a JSException with a detail message.
* A detail message is a String that describes this particular exception.
* @param s the detail message
*/
public JSException(String s) {
super(s);
filename = "unknown";
lineno = 0;
source = "";
tokenIndex = 0;
}
/**
* Constructs a JSException with a detail message and all the
* other info that usually comes with a JavaScript error.
* @param s the detail message
*/
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;
}
}

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

@ -1,150 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/* 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
* floatValue 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, Float,
* 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;
/**
* initialize
*/
private static native void initClass();
static {
SecurityManager.enablePrivilege("UniversalLinkAccess");
SecurityManager.enablePrivilege("UniversalPropertyRead");
System.loadLibrary(System.getProperty("netscape.jsj.dll", "jsj"));
SecurityManager.revertPrivilege();
initClass();
}
/**
* it is illegal to construct a JSObject manually
*/
private JSObject() {}
/**
* 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();
}

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

@ -1,37 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/**
* 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);
}

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

@ -1,63 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
package netscape.javascript.adapters;
import netscape.javascript.*;
import netscape.application.Target;
/**
* JSTargetAdapter is used in JavaScript code to deliver target
* commands to a JavaScript object.
*/
public final class JSTargetAdapter implements Target {
/* the real target object in JavaScript */
private JSObject jsObj;
/**
* construct a new JSTargetAdapter for a given JSObject
*/
public JSTargetAdapter(JSObject jsObj) {
this.jsObj = jsObj;
}
/**
* Check to see whether the JavaScript object has an ["on" + command]
* member, and if so invoke it with the data parameter.
*/
public void performCommand(String command, Object data) {
if (jsObj == null)
return;
Object member = jsObj.getMember("on" + command);
if (member == null)
return;
Object[] args;
args = new Object[1];
args[0] = data;
try {
jsObj.call("on" + command, args);
} catch (Exception e) {
System.out.println("Exception: " + e);
e.printStackTrace();
}
}
}

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

@ -1,95 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/*
* PropertyChangeAdapter.java
*
*/
package netscape.javascript.adapters;
import netscape.javascript.JSObject;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
/**
* PropertyChangeAdaptor allows PropertyChangeEvents to be handled in JavaScript.
* It implements java.beans.PropertyChangeListener which is required in order to
* order to catch PropertyChangeEvents, but impossible to do in JavaScript due to
* Java's type safe implementation. Once the event is caught, it is passed along
* to a JavaScript method on a JavaScript object (JSObject). This method is
* "onChange" by default, or an arbitrary method name can be supplied.
*/
public class PropertyChangeAdapter implements PropertyChangeListener {
/**
* Construct a PropertyChangeAdaptor for given JavaScript object.
* propertyChange events will be relayed to a method called onChange on
* the JavaScript object. This onChange method must have a single parameter,
* which is a java.beans.PropertyChangeEvent object.
*/
public PropertyChangeAdapter( JSObject oJS ) {
moJSObject = oJS;
}
/**
* Construct a PropertyChangeAdaptor for given JavaScript object.
* propertyChange events will be relayed to a the specified method on
* the JavaScript object. The method must have a single parameter, which
* is a java.beans.PropertyChangeEvent object.
*/
public PropertyChangeAdapter( JSObject oJS, String sJSMethodName ) {
moJSObject = oJS;
msJSMethodName = sJSMethodName;
}
/**
* propertyChange() is called by a source component (bean) when any of
* its "bound" properties are altered. We catch it and call a JavaScript
* method so that handling code can occur using user's JavaScript.
*/
public void propertyChange( PropertyChangeEvent oEvent ) {
if ( null != moJSObject ) {
// don't try to call mehtod which does not exist!
Object oMethod = moJSObject.getMember( msJSMethodName );
if ( null != oMethod ) {
// pass oEvent as single parameter
Object[] aArgs = new Object[1];
aArgs[0] = oEvent;
try {
moJSObject.call( msJSMethodName, aArgs );
} catch (Exception ex) {
System.out.println("Exception: " + ex);
ex.printStackTrace();
}
}
}
}
//-------------------------------------------------------------
// member variables
// ---------- static variables --------------------------------
public static final String gsDefaultJSMethodName = "onChange";
// ---------- instance variables ------------------------------
private String msJSMethodName = gsDefaultJSMethodName;
private JSObject moJSObject = null;
}

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

@ -1,5 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
jsjava.h

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

@ -1,627 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/* FIXME remove when pure JRI if possible */
#include "oobj.h"
#include "interpreter.h"
#include "tree.h"
#include "jsapi.h"
#include "jsjava.h"
#include "jscntxt.h" /* for cx->savedErrors */
#include "jri.h"
#include "prmon.h" /* for PR_XLock and PR_XUnlock */
#include "prprf.h" /* for PR_snprintf */
#include "prthread.h"
#include "prlog.h"
#ifdef JAVA
#define IMPLEMENT_netscape_javascript_JSObject
#include "netscape_javascript_JSObject.h"
#ifndef XP_MAC
#include "netscape_javascript_JSException.h"
#else
#include "n_javascript_JSException.h"
#endif
#endif
#ifdef NSPR20
extern PRLogModuleInfo* Moja;
#define debug PR_LOG_DEBUG
#endif /* NSPR20 */
#define JAVA_JS_STACK_SIZE 8192
typedef struct {
JSErrorReporter errReporter;
} JSSavedState;
static void
js_throwJSException(JRIEnv *env, char *detail)
{
#ifdef JAVA
struct java_lang_String* message =
JRI_NewStringPlatform(env,
(const jbyte *) detail,
(jint) strlen(detail),
(const jbyte *) NULL,
(jint) 0);
struct netscape_javascript_JSException* exc =
netscape_javascript_JSException_new_1(env,
class_netscape_javascript_JSException(env),
/*Java_getGlobalRef(env, js_JSExceptionClass),*/
message);
JRI_Throw(env, (struct java_lang_Throwable*)exc);
#endif /* JAVA */
}
/***********************************************************************/
static bool_t
enterJS(JRIEnv *env,
struct netscape_javascript_JSObject* self,
JSContext **cxp, JSObject **jsop, JSSavedState *saved)
{
#ifndef JAVA
return JS_FALSE;
#else
char *err;
JSJ_EnterJS();
/* check the internal pointer for null while holding the
* js lock to deal with shutdown issues */
if (jsop &&
(! self ||
! (*jsop = (JSObject *)
get_netscape_javascript_JSObject_internal(env, self)))) {
/* FIXME use a better exception */
JRI_ThrowNew(env, JRI_FindClass(env, "java/lang/Exception"),
"not a JavaScript object");
JSJ_ExitJS();
return FALSE;
}
/* PR_LOG(Moja, debug, ("clearing exceptions in ee=0x%x", env)); */
exceptionClear((ExecEnv *)env);
if (! (*cxp = JSJ_CurrentContext(env, &err))) {
JSJ_ExitJS();
if (err) {
js_throwJSException(env, err);
free(err);
}
return FALSE;
}
jsj_ClearSavedErrors(*cxp);
saved->errReporter = JS_SetErrorReporter(*cxp, js_JavaErrorReporter);
return TRUE;
#endif
}
static bool_t
exitJS(JRIEnv *env,
struct netscape_javascript_JSObject* self,
JSContext *cx, JSObject *jso, JSSavedState *saved)
{
#ifndef JAVA
return JS_FALSE;
#else
/* restore saved info */
JS_SetErrorReporter(cx, saved->errReporter);
js_JSErrorToJException(cx, (ExecEnv*)env);
JSJ_ExitJS();
if (exceptionOccurred((ExecEnv*)env))
return FALSE;
return TRUE;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(struct java_lang_Object *)
native_netscape_javascript_JSObject_getMember(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
struct java_lang_String *name)
{
#ifndef JAVA
return NULL;
#else
JSContext *cx;
JSObject *jso;
JSSavedState saved;
const char *cstr;
struct java_lang_Object *member;
jsval val;
int cost = 0;
if (!enterJS(env, self, &cx, &jso, &saved))
return NULL;
if (! name ||
! (cstr = JRI_GetStringPlatformChars(env, name,
NULL, 0))) {
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength))) {
*/
/* FIXME this should be an error of some sort */
js_throwJSException(env, "illegal member name");
member = NULL;
goto do_exit;
}
if (! JS_GetProperty(cx, jso, cstr, &val) ||
! js_convertJSValueToJObject(/*FIXME*/(HObject**)&member, cx, val,
0, 0, JS_FALSE, &cost))
member = NULL;
do_exit:
if (!exitJS(env, self, cx, jso, &saved))
return NULL;
return member;
#endif
}
/***********************************************************************/
/* public native getSlot(I)Ljava/lang/Object; */
JRI_PUBLIC_API(struct java_lang_Object *)
native_netscape_javascript_JSObject_getSlot(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
jint slot)
{
#ifndef JAVA
return NULL;
#else
JSContext *cx;
JSObject *jso;
JSSavedState saved;
struct java_lang_Object *member;
jsval val;
int cost = 0;
if (!enterJS(env, self, &cx, &jso, &saved))
return NULL;
if (! JS_GetElement(cx, jso, slot, &val) ||
! js_convertJSValueToJObject(/*FIXME*/(HObject**)&member, cx, val,
0, 0, JS_FALSE, &cost))
member = NULL;
if (!exitJS(env, self, cx, jso, &saved))
return NULL;
return member;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(void)
native_netscape_javascript_JSObject_setMember(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
struct java_lang_String *name,
struct java_lang_Object *value)
{
#ifdef JAVA
JSContext *cx;
JSObject *jso;
JSSavedState saved;
const char *cstr;
jsval val;
if (!enterJS(env, self, &cx, &jso, &saved))
return;
if (! name ||
! (cstr = JRI_GetStringPlatformChars(env, name,
NULL, 0))) {
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength))) {
*/
js_throwJSException(env, "illegal member name");
goto do_exit;
}
if (js_convertJObjectToJSValue(cx, &val, (HObject *)value) &&
JS_SetProperty(cx, jso, cstr, &val)) {
}
/* PR_LOG(Moja, debug,
("JSObject.setMember(%s, 0x%x)\n", cstr, value)); */
do_exit:
exitJS(env, self, cx, jso, &saved);
return;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(void)
native_netscape_javascript_JSObject_setSlot(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
jint slot,
struct java_lang_Object *value)
{
#ifdef JAVA
JSContext *cx;
JSObject *jso;
JSSavedState saved;
jsval val;
if (!enterJS(env, self, &cx, &jso, &saved))
return;
if (js_convertJObjectToJSValue(cx, &val, (HObject *)value) &&
JS_SetElement(cx, jso, slot, &val)) {
}
/* PR_LOG(Moja, debug,
("JSObject.setSlot(%d, 0x%x)\n", slot, value)); */
exitJS(env, self, cx, jso, &saved);
return;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(void)
native_netscape_javascript_JSObject_removeMember(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
struct java_lang_String * name)
{
JSContext *cx;
JSObject *jso;
JSSavedState saved;
#ifdef JAVA /* only referenced if defined */
const char *cstr;
#endif
if (!enterJS(env, self, &cx, &jso, &saved))
return;
#ifdef JAVA
if (! name ||
! (cstr = JRI_GetStringPlatformChars(env, name,
NULL, 0))) {
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength);
*/
/* FIXME this should be an error of some sort */
js_throwJSException(env, "illegal member name");
goto do_exit;
}
JS_DeleteProperty(cx, jso, cstr);
#endif
/* PR_LOG(Moja, debug,
("JSObject.removeMember(%s)\n", cstr)); */
#ifdef JAVA /* only referenced if defined */
do_exit:
#endif
exitJS(env, self, cx, jso, &saved);
return;
}
/***********************************************************************/
JRI_PUBLIC_API(struct java_lang_Object *)
native_netscape_javascript_JSObject_call(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
struct java_lang_String *method,
jobjectArray args)
{
#ifndef JAVA
return NULL;
#else
JSContext *cx;
JSObject *jso;
JSSavedState saved;
const char *cstr;
struct java_lang_Object *ret;
int total_argc, argc, i;
jsval *argv;
jsval rval;
int cost = 0;
if (!enterJS(env, self, &cx, &jso, &saved))
return NULL;
if (! method ||
! (cstr = JRI_GetStringPlatformChars(env, method,
NULL, 0))) {
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength))) {
*/
/* FIXME this should be an error of some sort */
js_throwJSException(env, "illegal member name");
ret = NULL;
goto do_exit;
}
if (args) {
total_argc = JRI_GetObjectArrayLength(env, args);
argv = sysMalloc(total_argc * sizeof(jsval));
} else {
total_argc = 0;
argv = 0;
}
for (argc = 0; argc < total_argc; argc++) {
jref arg = JRI_GetObjectArrayElement(env, args, argc);
if (!js_convertJObjectToJSValue(cx, argv+argc, (HObject*)arg))
goto cleanup_argv;
JS_AddRoot(cx, argv+argc);
}
if (! JS_CallFunctionName(cx, jso, cstr, argc, argv, &rval) ||
! js_convertJSValueToJObject((HObject **) &ret, cx, rval,
0, 0, JS_FALSE, &cost)) {
ret = NULL;
}
cleanup_argv:
for (i = 0; i < argc; i++)
JS_RemoveRoot(cx, argv+i);
sysFree(argv);
do_exit:
if (!exitJS(env, self, cx, jso, &saved))
return NULL;
return ret;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(struct java_lang_Object *)
native_netscape_javascript_JSObject_eval(
JRIEnv* env,
struct netscape_javascript_JSObject* self,
struct java_lang_String *s)
{
#ifndef JAVA
return NULL;
#else
JSContext *cx;
JSObject *jso;
JSSavedState saved;
const char *cstr;
int cstrlen;
struct java_lang_Object *ret;
jsval rval;
int cost = 0;
JSPrincipals *principals;
char *codebase;
if (!enterJS(env, self, &cx, &jso, &saved))
return NULL;
if (! s ||
! (cstr = JRI_GetStringPlatformChars(env, s,
NULL, 0))) {
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength))) {
*/
/* FIXME this should be an error of some sort */
js_throwJSException(env, "illegal eval string");
ret = NULL;
goto do_exit;
}
/* subtract 1 for the NUL */
/*
* FIXME There is no JRI_GetStringPlatformLength (what a misnomer, if there
* were!), but JRI_GetStringPlatformChars does NUL-terminate the encoded
* string, so we trust that no charset encoding ever uses a NUL byte as
* part of a multibyte sequence and just call strlen.
*/
cstrlen = strlen(cstr);
principals = js_GetJSPrincipalsFromJavaCaller(cx, 0);
codebase = principals ? principals->codebase : NULL;
if (! JS_EvaluateScriptForPrincipals(cx, jso, principals, cstr, cstrlen,
codebase, 0, &rval) ||
! js_convertJSValueToJObject((HObject**)&ret, cx, rval,
0, 0, JS_FALSE, &cost)) {
ret = NULL;
}
do_exit:
if (!exitJS(env, self, cx, jso, &saved))
return NULL;
return ret;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(void)
native_netscape_javascript_JSObject_finalize(
JRIEnv* env,
struct netscape_javascript_JSObject* self)
{
#ifdef JAVA
JSContext *cx;
JSObject *jso;
JSSavedState saved;
/* FIXME if enterJS fails here we have a memory leak! */
if (!enterJS(env, self, &cx, &jso, &saved))
return;
js_RemoveReflection(cx, jso);
if (!exitJS(env, self, cx, jso, &saved))
return;
return;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(struct java_lang_String *)
native_netscape_javascript_JSObject_toString(
JRIEnv* env,
struct netscape_javascript_JSObject* self)
{
JSContext *cx;
JSObject *jso;
JSSavedState saved;
#ifdef JAVA /* only referenced if defined */
JSString *jsstr;
char *cstr;
#endif
struct java_lang_String *ret = NULL;
if (!enterJS(env, self, &cx, &jso, &saved))
return NULL;
#ifdef JAVA
if ((jsstr = JS_ValueToString(cx, OBJECT_TO_JSVAL(jso))) &&
(cstr = JS_GetStringBytes(jsstr))) {
ret = JRI_NewStringPlatform(env,
(const jbyte *) cstr,
(jint) JS_GetStringLength(jsstr),
NULL, 0);
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength);
*/
} else {
/* FIXME could grab the clazz name from the JSObject */
ret = JRI_NewStringPlatform(env,
(const jbyte *) "*JSObject*",
(jint) strlen("*JSObject*"),
NULL, 0);
/* XXX - temporarily replace arguments so we can compile
(const jbyte *) cx->charSetName,
(jint) cx->charSetNameLength);
*/
}
#endif
if (!exitJS(env, self, cx, jso, &saved))
return NULL;
return ret;
}
/***********************************************************************/
JRI_PUBLIC_API(struct netscape_javascript_JSObject*)
native_netscape_javascript_JSObject_getWindow(
JRIEnv* env,
struct java_lang_Class* clazz,
struct java_applet_Applet* hint)
{
#ifndef JAVA
return NULL;
#else
struct netscape_javascript_JSObject *ret = NULL;
JSContext *cx;
JSSavedState saved;
JSObject *jso;
if (!JSJ_IsEnabled()) {
js_throwJSException(env, "Java/JavaScript communication is disabled");
return 0;
}
if (!enterJS(env, NULL, &cx, NULL, &saved))
return NULL;
jso = JSJ_GetDefaultObject(env, (jobject) hint);
if (exceptionOccurred((ExecEnv *)env))
goto out;
ret = (struct netscape_javascript_JSObject *)
js_ReflectJSObjectToJObject(cx, jso);
out:
if (!exitJS(env, NULL, cx, NULL, &saved))
return NULL;
return ret;
#endif
}
/***********************************************************************/
JRI_PUBLIC_API(void)
native_netscape_javascript_JSObject_initClass(
JRIEnv* env,
struct java_lang_Class* myClazz)
{
#ifdef JAVA
struct java_lang_Class* clazz;
/* this is to initialize the field lookup indices, and protect
* the classes from gc. */
clazz = use_netscape_javascript_JSObject(env);
MakeClassSticky((struct Hjava_lang_Class*)clazz);
clazz = use_netscape_javascript_JSException(env);
MakeClassSticky((struct Hjava_lang_Class*)clazz);
/* this does nothing if somebody else has already set
* stuff up (i.e. client or server) */
JSJ_InitStandalone();
#endif
}

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

@ -1,49 +0,0 @@
; The contents of this file are subject to the Netscape Public License
; Version 1.0 (the "NPL"); you may not use this file except in
; compliance with the NPL. You may obtain a copy of the NPL at
; http://www.mozilla.org/NPL/
;
; Software distributed under the NPL is distributed on an "AS IS" basis,
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
; for the specific language governing rights and limitations under the
; NPL.
;
; The Initial Developer of this code under the NPL is Netscape
; Communications Corporation. Portions created by Netscape are
; Copyright (C) 1998 Netscape Communications Corporation. All Rights
; Reserved.
LIBRARY JSJ1640.DLL
EXETYPE WINDOWS
PROTMODE
DESCRIPTION 'Netscape 16-bit JavaScript-Java Library'
CODE LOADONCALL MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 8192
EXPORTS
_JSJ_CurrentContext
_JSJ_EnterJS
_JSJ_ExitJS
_JSJ_FindCurrentJSContext
_JSJ_Finish
_JSJ_GetDefaultObject
_JSJ_Init
_JSJ_InitContext
_JSJ_InitStandalone
_JSJ_IsCalledFromJava
_JSJ_IsEnabled
_JSJ_IsSafeMethod
_js_GetJSPrincipalsFromJavaCaller
_js_JSErrorToJException
_js_JavaErrorReporter
_js_ReflectJObjectToJSObject
_js_ReflectJSObjectToJObject
_js_RemoveReflection
_js_convertJObjectToJSValue
_js_convertJSValueToJObject
_jsj_ClearSavedErrors
_sajsj_GetDefaultObject

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

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// Version stamp for this .DLL
#include <windows.h>
#include <ver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4 // major, minor, release (alpha 1), build #
PRODUCTVERSION 4
FILEFLAGSMASK 0
FILEFLAGS 0 // final version
FILEOS VOS_DOS_WINDOWS16
FILETYPE VFT_DLL
FILESUBTYPE 0 // not used
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
BEGIN
VALUE "CompanyName", "Netscape Communications Corporation\0"
VALUE "FileDescription", "Netscape 16-bit JavaScript-Java Module\0"
VALUE "FileVersion", "4.0\0"
VALUE "InternalName", "JSJ1640\0"
VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0"
VALUE "LegalTrademarks", "Netscape, Mozilla\0"
VALUE "OriginalFilename","JSJ1640.DLL\0"
VALUE "ProductName", "NETSCAPE\0"
VALUE "ProductVersion", "4.0\0"
END
END
END

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

@ -1,50 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/* Automatically generated file; do not edit */
#include "prtypes.h"
#include "prlink.h"
extern void Java_netscape_javascript_JSObject_initClass_stub();
extern void Java_netscape_javascript_JSObject_getMember_stub();
extern void Java_netscape_javascript_JSObject_getSlot_stub();
extern void Java_netscape_javascript_JSObject_setMember_stub();
extern void Java_netscape_javascript_JSObject_setSlot_stub();
extern void Java_netscape_javascript_JSObject_removeMember_stub();
extern void Java_netscape_javascript_JSObject_call_stub();
extern void Java_netscape_javascript_JSObject_eval_stub();
extern void Java_netscape_javascript_JSObject_toString_stub();
extern void Java_netscape_javascript_JSObject_getWindow_stub();
extern void Java_netscape_javascript_JSObject_finalize_stub();
PRStaticLinkTable jsj_nodl_tab[] = {
{ "Java_netscape_javascript_JSObject_initClass_stub", Java_netscape_javascript_JSObject_initClass_stub },
{ "Java_netscape_javascript_JSObject_getMember_stub", Java_netscape_javascript_JSObject_getMember_stub },
{ "Java_netscape_javascript_JSObject_getSlot_stub", Java_netscape_javascript_JSObject_getSlot_stub },
{ "Java_netscape_javascript_JSObject_setMember_stub", Java_netscape_javascript_JSObject_setMember_stub },
{ "Java_netscape_javascript_JSObject_setSlot_stub", Java_netscape_javascript_JSObject_setSlot_stub },
{ "Java_netscape_javascript_JSObject_removeMember_stub", Java_netscape_javascript_JSObject_removeMember_stub },
{ "Java_netscape_javascript_JSObject_call_stub", Java_netscape_javascript_JSObject_call_stub },
{ "Java_netscape_javascript_JSObject_eval_stub", Java_netscape_javascript_JSObject_eval_stub },
{ "Java_netscape_javascript_JSObject_toString_stub", Java_netscape_javascript_JSObject_toString_stub },
{ "Java_netscape_javascript_JSObject_getWindow_stub", Java_netscape_javascript_JSObject_getWindow_stub },
{ "Java_netscape_javascript_JSObject_finalize_stub", Java_netscape_javascript_JSObject_finalize_stub },
{ 0, 0, },
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,170 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
#ifndef _jsjava_h_
#define _jsjava_h_
#include "jsapi.h"
/*
* Java <-> JavaScript reflection
*/
/* FIXME change everything to JRI style */
#ifndef _OOBJ_H_
typedef struct HObject HObject;
typedef struct ClassClass ClassClass;
typedef struct ExecEnv ExecEnv;
#endif
/* FIXME should be obtained from jri.h */
#ifndef JRI_H
typedef struct JRIEnvInterface JRIEnvInterface;
typedef const JRIEnvInterface* JRIEnv;
#endif
#ifndef JNI_H
typedef struct _jobject *jobject;
#endif
/***********************************************************************
*
* this callback table is used to export functions to jsjava.c
*/
typedef struct {
int (*isEnabled)(void);
JRIEnv * (*currentEnv)(JSContext *);
JSContext * (*currentContext)(JRIEnv *, char **errp);
void (*enterJS)(void);
void (*exitJS)(void);
void * (*jsClassLoader)(JSContext *, const char *codebase);
JSPrincipals *
(*getJSPrincipalsFromJavaCaller)(JSContext *cx,
int callerDepth);
JSObject * (*getDefaultObject)(JRIEnv *env, jobject hint);
} JSJCallbacks;
/***********************************************************************
*
* these functions are provided by jsjava.c
*/
/* call to initialize a javascript context and toplevel object for use
* with JSJ */
PR_EXTERN(JSBool)
JSJ_Init(JSJCallbacks *callbacks);
#if defined(JAVA) || defined(OJI)
/* this is called by JSObject.initClass to initialize the default
* glue if jsjava has been loaded into java.exe as a DLL. it does
* nothing if the client or server has already initialized us */
PR_EXTERN(void)
JSJ_InitStandalone();
/* shut down java-javascript reflection */
PR_EXTERN(void)
JSJ_Finish(void);
/* call to initialize a javascript context and toplevel object for use
* with JSJ */
PR_EXTERN(JSBool)
JSJ_InitContext(JSContext *cx, JSObject *obj);
/* tells whether the js<->java connection can be used */
PR_EXTERN(int)
JSJ_IsEnabled(void);
/* Java threads call this to find the JSContext to use for
* executing JavaScript */
PR_EXTERN(JSContext *)
JSJ_CurrentContext(JRIEnv *env, char **errp);
/* Java threads call this before executing JS code (to preserve
* run-to-completion in the client */
PR_EXTERN(void)
JSJ_EnterJS(void);
/* Java threads call this when finished executing JS code */
PR_EXTERN(void)
JSJ_ExitJS(void);
/* gets a default netscape.javascript.JSObject from a java object */
PR_EXTERN(JSObject *)
JSJ_GetDefaultObject(JRIEnv *env, jobject hint);
/*
* When crawling the Java stack, this indicates that the next frames
* are in JavaScript
*/
struct methodblock;
PR_EXTERN(JSBool)
JSJ_IsSafeMethod(struct methodblock *mb);
PR_EXTERN(JSBool)
JSJ_IsCalledFromJava(JSContext *cx);
/* find the current JSContext, if possible. if cxp is null,
* the caller may attempt to infer the JSContext from the
* classloader */
PR_EXTERN(void)
JSJ_FindCurrentJSContext(JRIEnv *env, JSContext **cxp, void **loaderp);
/* extract the javascript object from a netscape.javascript.JSObject */
PR_EXTERN(JSObject *)
JSJ_ExtractInternalJSObject(JRIEnv *env, HObject* jso);
/* provided for use by java calling javascript: */
PR_EXTERN(JSObject *)
js_ReflectJObjectToJSObject(JSContext *cx, HObject *jo);
extern JSObject *
js_ReflectJClassToJSObject(JSContext *cx, ClassClass *clazz);
PR_EXTERN(HObject *)
js_ReflectJSObjectToJObject(JSContext *cx, JSObject *mo);
/* this JS error reporter saves the error for JSErrorToJException */
PR_EXTERN(void)
js_JavaErrorReporter(JSContext *cx, const char *message, JSErrorReport *error);
/* if there was an error in JS, throw the corresponding JSException */
PR_EXTERN(void)
js_JSErrorToJException(JSContext *cx, ExecEnv *ee);
PR_EXTERN(void)
js_RemoveReflection(JSContext *cx, JSObject *mo);
PR_EXTERN(JSBool)
js_convertJObjectToJSValue(JSContext *cx, jsval *vp, HObject *ho);
PR_EXTERN(JSBool)
js_convertJSValueToJObject(HObject **objp, JSContext *cx,
jsval v, char *sig, ClassClass *fromclass,
JSBool checkOnly, int *cost);
PR_EXTERN(JSPrincipals *)
js_GetJSPrincipalsFromJavaCaller(JSContext *cx, int callerDepth);
PR_EXTERN(void)
jsj_ClearSavedErrors(JSContext *cx);
#endif /* defined(JAVA) || defined(OJI) */
#endif /* _jsjava_h_ */

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

@ -1,222 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/*
* stand-alone glue for js<->java
* this is used as a default if the host does not override
* the glue.
*/
#if defined(JAVA)
#include "jsapi.h"
#include "jri.h"
#include "jriext.h"
#include "jsjava.h"
#ifndef NSPR20
#include "prglobal.h"
#endif
#include "prthread.h"
#include "prmon.h"
#include "prlog.h"
#include "prcmon.h"
#ifndef NSPR20
#define WAIT_FOREVER LL_MAXINT
#else
#define WAIT_FOREVER PR_INTERVAL_NO_TIMEOUT
#endif
static JSTaskState *jsjiTask = 0;
static PRMonitor *jsmon = NULL;
/*
* callbacks to make js<->java glue work
*/
/**
* Liveconnect callback.
* Called to determine if Java is enabled
*
*/
PR_STATIC_CALLBACK(int)
sajsj_IsEnabled(void)
{
return (int)PR_TRUE;
}
static JSClass sajsj_global_class = {
"global", 0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
static JSObject *globalObject = NULL;
static JSContext *globalContext = NULL;
/*
* callback to find the JSContext for a particular JRIEnv
* here, this just returns the only JSContext we have.
* in the client, it looks up the java call stack for one?
*/
PR_STATIC_CALLBACK(JSContext *)
sajsj_CurrentContext(JRIEnv *env, char **errp)
{
*errp = 0;
return globalContext;
}
PR_STATIC_CALLBACK(JRIEnv *)
sajsj_CurrentEnv(JSContext *cx)
{
/* FIXME insurance? */
JRIEnv *env = JRI_GetCurrentEnv();
PR_ASSERT(env);
return env;
}
/*
* callbacks to maintain run-to-completion in the client
* and thread-safety in the standalone java.
*/
PR_STATIC_CALLBACK(void)
sajsj_EnterJS(void)
{
/* should ensure that only one thread can use the same
* context / object space at once */
PR_EnterMonitor(jsmon);
}
PR_STATIC_CALLBACK(void)
sajsj_ExitJS(void)
{
PR_ExitMonitor(jsmon);
}
PR_STATIC_CALLBACK(JSPrincipals *)
sajsj_getJSPrincipalsFromJavaCaller(JSContext *cx, int callerDepth)
{
return NULL;
}
PR_IMPLEMENT(JSObject *)
sajsj_GetDefaultObject(JRIEnv *env, jobject hint)
{
return globalObject;
}
static JSJCallbacks sajsjCallbacks = {
sajsj_IsEnabled,
sajsj_CurrentEnv,
sajsj_CurrentContext,
sajsj_EnterJS,
sajsj_ExitJS,
NULL,
sajsj_getJSPrincipalsFromJavaCaller,
sajsj_GetDefaultObject,
};
static void
sajsj_InitLocked()
{
JRIEnv *env;
/* if jsj has already been initialized, we don't do this
* standalone jsj setup, and none of the stuff in this
* file gets used */
if (!JSJ_Init(&sajsjCallbacks))
return;
jsjiTask = JS_Init(8L * 1024L * 1024L);
jsmon = PR_NewMonitor();
globalContext = JS_NewContext(jsjiTask, 8192);
PR_ASSERT(globalContext);
globalObject = NULL;
JS_AddRoot(globalContext, &globalObject);
globalObject = JS_NewObject(globalContext, &sajsj_global_class,
NULL, NULL);
if (!globalObject) {
PR_ASSERT(globalObject);
goto trash_cx;
}
if (!JS_InitStandardClasses(globalContext, globalObject))
goto trash_cx;
if (!JSJ_InitContext(globalContext, globalObject))
goto trash_cx;
env = JRI_GetCurrentEnv();
PR_ASSERT(env);
return;
trash_cx:
JS_DestroyContext(globalContext);
globalContext = NULL;
/* FIXME error codes? */
return;
}
PR_IMPLEMENT(void)
JSJ_InitStandalone()
{
static int initialized = -1;
if (initialized == 1)
return;
PR_CEnterMonitor(&initialized);
switch (initialized) {
case -1:
/* we're first */
initialized = 0; /* in progress */
PR_CExitMonitor(&initialized);
/* do it */
sajsj_InitLocked();
PR_CEnterMonitor(&initialized);
initialized = 1;
PR_CNotifyAll(&initialized);
break;
case 0:
/* in progress */
PR_CWait(&initialized, WAIT_FOREVER);
break;
case 1:
/* happened since the last check */
break;
}
PR_CExitMonitor(&initialized);
if (!jsjiTask)
return; /* FIXME fail loudly! */
return;
}
#endif /* defined (JAVA) */

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

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
//
// JSJConfig.Prefix
//
// Global prefix file for the JSJ project.
//
//
#include "MacPrefix.h"
#include "JSJConfig.h"

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

@ -1,20 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/* Nuthin' to do. */

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

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
//
// JSJDebug.Prefix
//
// Global prefix file for the JSJDebug project.
//
//
#include "MacPrefix_debug.h"
#include "JSJConfig.h"

Двоичные данные
js/jsj/macbuild/JSJ_PPC.mcp

Двоичный файл не отображается.

Двоичные данные
js/jsj/macbuild/JSJ_PPCDebug.mcp

Двоичный файл не отображается.

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

@ -1,186 +0,0 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
IGNORE_MANIFEST=1
#//------------------------------------------------------------------------
#//
#// Makefile to build the Java reflections of JavaScript objects
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..
include <$(DEPTH)/config/config.mak>
#!ifdef JAVA_OR_OJI
DIRS = classes
#!endif
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=jsj$(MOZ_BITS)$(VERSION_NUMBER)
PDBFILE=$(DLLNAME).pdb
MAPFILE = $(DLLNAME).map
RESFILE = jsj1640.res
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAKE_OBJ_TYPE = DLL
!if "$(MOZ_BITS)" == "16"
DEFFILE = $(DLLNAME).def
!endif
!ifdef JAVA_OR_OJI
LLIBS=$(LIBNSPR) $(DIST)\lib\jrt$(MOZ_BITS)$(VERSION_NUMBER).lib \
$(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib
!else
LLIBS=$(LIBNSPR) $(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib
!endif
!if "$(MOZ_BITS)"=="32" && defined(MOZ_DEBUG) && defined(GLOWCODE)
LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib
!endif
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
!ifdef JAVA_OR_OJI
OBJS= \
.\$(OBJDIR)\jsStubs.obj \
.\$(OBJDIR)\jsjava.obj \
.\$(OBJDIR)\jsjsa.obj \
.\$(OBJDIR)\stubs.obj \
!if "$(MOZ_BITS)" == "16"
.\$(OBJDIR)\jsj_nodl.obj \
!endif
$(NULL)
!else
OBJS= \
.\$(OBJDIR)\jsjava.obj \
.\$(OBJDIR)\jsStubs.obj \
$(NULL)
!endif # JAVA_OR_OJI
#
#//------------------------------------------------------------------------
#//
#// install headers
#//
#//------------------------------------------------------------------------
INSTALL_DIR=$(PUBLIC)\js
INSTALL_FILE_LIST= \
jsjava.h
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
JRI_GEN= \
netscape.javascript.JSObject \
netscape.javascript.JSException \
$(NULL)
MODULE = java
!ifdef JAVA_OR_OJI
EXPORTS = \
$(JRI_GEN_DIR)/netscape_javascript_JSObject.h \
$(JRI_GEN_DIR)/netscape_javascript_JSException.h \
$(NULL)
!endif
#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LINCS=$(LINCS) -I_jri \
-I$(PUBLIC)\js \
-I$(PUBLIC)\java \
$(NULL)
#!ifdef SERVER_BUILD
#LLIBS=$(DIST)/lib/httpdlw.lib $(DIST)/lib/libsjboot.lib
#!endif
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
export:: $(DLL) INSTALL_FILES
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber::
$(RM_R) _jri
!ifdef JAVA_OR_OJI
.\$(OBJDIR)\stubs.obj: \
$(JRI_GEN_DIR)\netscape_javascript_JSObject.c \
$(JRI_GEN_DIR)\netscape_javascript_JSException.c \
$(NULL)
!endif
####
# this bit of extreme scariness came from the js/src makefile
# reproduced here since that's where jsjava.c lives now...
!if ("$(MOZ_BITS)" == "16")
#//
#// Win16 Hoovers SO BAD!!!
#//
!if !defined(MOZ_DEBUG)
#//
#// We must turn off codeview debug info so jni.c can build.
#// Otherwise the linker gives errors about data in the $SYMBOLS
#// segment being beyond a segment boundary.
#//
$(OBJDIR)\jsjava.obj: jsjava.c
@$(CC) @<<$(CFGFILE)
-c
-Od
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(*B).c
<<KEEP
!endif
!endif

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

@ -1,44 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* ** */
/*
!!! WARNING: If you add files here, be sure to:
1. add them to the Metrowerks project
2. edit Makefile and makefile.win to add a dependency on the .c file
!!! HEED THE WARNING.
*/
#if !defined(XP_MAC)
#if defined (JAVA) || defined(OJI)
#define IMPLEMENT_netscape_javascript_JSObject
#define IMPLEMENT_netscape_javascript_JSException
#ifndef XP_MAC
#include "_jri/netscape_javascript_JSObject.c"
#include "_jri/netscape_javascript_JSException.c"
#else
#include "netscape_javascript_JSObject.c"
#include "n_javascript_JSException.c"
#endif
void _java_javascript_init(void) { }
#endif /* defined (JAVA) */
#endif /* !defined(XP_MAC) */