Граф коммитов

665 Коммитов

Автор SHA1 Сообщение Дата
nboyd%atg.com ec341691ee Patch from beard@netscape.com to fix 56879. 2000-10-23 14:30:40 +00:00
nboyd%atg.com 024a61b8eb Fix bug 56185. 2000-10-12 16:10:55 +00:00
nboyd%atg.com dbbc5437de Fix bug 56158 2000-10-12 14:59:19 +00:00
beard%netscape.com 4966a3bd51 Outer class loader support, using ClassManager. 2000-10-12 06:30:29 +00:00
beard%netscape.com db34dd11a5 Map all exceptions to just return null. 2000-10-10 18:14:20 +00:00
nboyd%atg.com 4a13805f10 More javadoc. 2000-10-10 14:58:47 +00:00
beard%netscape.com 0adc2a998b Added ClassManager.java. 2000-10-09 18:16:06 +00:00
beard%netscape.com c45770cc40 Manages interactions with outer class loaders. 2000-10-09 17:43:51 +00:00
nboyd%atg.com 890b3a1a48 Add support for new Ant-based buildfile. 2000-10-06 16:26:17 +00:00
nboyd%atg.com d8cbaa15f2 Remove reference that javadoc couldn't find 2000-10-06 16:25:36 +00:00
nboyd%atg.com f8476f784b Reformat code. 2000-10-06 16:25:14 +00:00
nboyd%atg.com ac09dd90be Allow superclass to appear anywhere in the list of classes in the JavaAdapter argument list. 2000-10-03 18:34:02 +00:00
beard%netscape.com f6acc78141 avoid an infinite loop on EOF. 2000-10-03 06:23:11 +00:00
nboyd%atg.com f294ddcb34 Avoid creating multiple wrappers. 2000-10-02 20:46:08 +00:00
nboyd%atg.com 7a015db6df Do cheap test first. 2000-10-02 17:10:00 +00:00
nboyd%atg.com d52574f9e0 Allow null returns from SecuritySupport methods if someone only
wants to implement LiveConnect filtering
2000-09-29 13:49:47 +00:00
nboyd%atg.com f9df3eebdf Miscellaneous formatting changes. 2000-09-25 14:07:45 +00:00
nboyd%atg.com cca63b74af Drop unneeded references. 2000-09-25 14:06:47 +00:00
nboyd%atg.com 7c22356d9a Fix enum.js regression. 2000-09-25 14:04:20 +00:00
nboyd%atg.com 26a444c83d Expand javadoc. 2000-09-18 18:38:02 +00:00
nboyd%atg.com 358852ab05 Remove old-style debug codegen. 2000-09-18 17:57:02 +00:00
nboyd%atg.com 7f1be5b439 Better error message for common error. 2000-09-18 17:28:59 +00:00
nboyd%atg.com 5e562540ba Fix infinite loop in new code. 2000-09-12 17:06:15 +00:00
nboyd%atg.com f61a4fa629 Fix bug 49350 2000-09-11 15:12:04 +00:00
nboyd%atg.com 20778e1dde version with debugger directories 2000-09-11 14:10:23 +00:00
nboyd%atg.com 95389f0d7e Better javadoc 2000-08-30 13:41:15 +00:00
nboyd%atg.com c03250308b Fix bug 48930: work around a MS JIT bug. 2000-08-22 17:04:21 +00:00
nboyd%atg.com 561cf27d98 Fix bug 49325. 2000-08-21 15:56:15 +00:00
nboyd%atg.com 06f16c883f Fix class path 2000-08-21 15:51:57 +00:00
beard%netscape.com e4a813ca47 added debugger classes. 2000-08-19 02:42:05 +00:00
nboyd%atg.com aad3b49e2b Fix for bug 49302 2000-08-17 12:37:32 +00:00
nboyd%atg.com 40ff06028a Fix 49301. 2000-08-17 12:28:46 +00:00
nboyd%atg.com 9a21820390 Merge changes from EXP_DEBUGGER branch into tip.
Implements simple command-line debugger for scripts.
2000-08-15 15:54:46 +00:00
nboyd%atg.com faa5b161dc fix 47859 2000-08-09 20:23:50 +00:00
nboyd%atg.com c65fc2d8fd Fix 47859 2000-08-09 20:22:37 +00:00
nboyd%atg.com 0667cc6b4b Fix javadoc. 2000-07-31 21:19:05 +00:00
nboyd%atg.com 091e5f848f Experimental changes for debugger. 2000-07-27 14:54:13 +00:00
rogerl%netscape.com 54e6f7c03f Patch from Norris :
A Rhino user has complained about concurrency problems in the interpreter,
and I think the attached diff fixes some problems that could be caused if
the same interpreted function or script was called simultaneously from
two different threads.
2000-07-26 23:04:14 +00:00
nboyd%atg.com a0e64bea0b Fix 45928 NativeDate uses getDeclaredConstructor instead of getConstructor 2000-07-21 17:13:09 +00:00
beard%netscape.com 7a1c2d350a Added ClassOutput.java, WrapHandler.java. 2000-07-18 01:29:34 +00:00
nboyd%atg.com 22adf6c37b Fix javadoc error. 2000-07-17 14:08:28 +00:00
nboyd%atg.com 0a9b985a17 Deprecate FlattenedObject. 2000-07-07 14:41:35 +00:00
nboyd%atg.com a1f493ab08 Remove obsolete references to NodeFactory. 2000-07-05 17:08:26 +00:00
nboyd%atg.com fdeea4b93b Subject:
Re: Rhino1.5.R1: problems with multithreaded embedded application.
        Date:
             Mon, 03 Jul 2000 14:38:56 -0400
       From:
             Norris Boyd <nboyd@atg.com>
 Organization:
             Art Technology Group
         To:
             Fergus Gallagher <Fergus.Gallagher@orbisuk.com>
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1




You found a bug in Rhino; I wonder if others have been running into the same thing.

The problem is with a class called LazilyLoadedCtor. I wrote this class to reduce the
time
required by initStandardObjects by only creating standard objects when the associated
constructors are first accessed. The problem is that this class was not threadsafe.
I've
made changes to that class, and to ScriptableObject as well. The design of dynamic
properties calling getters and setters (which LazilyLoadedCtor uses) didn't really
allow
any way for the getter/setter to replace itself without a thread hazard. I've now
extended
setters so that they can return a value which replaces the getter/setter to avoid this
problem.

Thanks for finding this problem. There have been a couple of other reports of problems
in
this area, so I hope this will fix them.

The patch follows.

--N

Index: LazilyLoadedCtor.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/LazilyLoadedCtor.java,v
retrieving revision 1.1
diff -u -r1.1 LazilyLoadedCtor.java
--- LazilyLoadedCtor.java 2000/02/29 21:34:37 1.1
+++ LazilyLoadedCtor.java 2000/07/03 18:31:03
@@ -58,9 +58,12 @@
     }

     public Object getProperty(ScriptableObject obj) {
-        obj.delete(ctorName);
         try {
-            ScriptableObject.defineClass(obj, Class.forName(className));
+            synchronized (obj) {
+                if (!isReplaced)
+                    ScriptableObject.defineClass(obj, Class.forName(className));
+                isReplaced = true;
+            }
         }
         catch (ClassNotFoundException e) {
             throw WrappedException.wrapException(e);
@@ -83,11 +86,14 @@
         return obj.get(ctorName, obj);
     }

-    public void setProperty(ScriptableObject obj, Object val) {
-        obj.delete(ctorName);
-        obj.put(ctorName, obj, val);
+    public Object setProperty(ScriptableObject obj, Object val) {
+        synchronized (obj) {
+            isReplaced = true;
+            return val;
+        }
     }

     private String ctorName;
     private String className;
+    private boolean isReplaced;
 }
Index: ScriptableObject.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/ScriptableObject.java,v
retrieving revision 1.17
diff -u -r1.17 ScriptableObject.java
--- ScriptableObject.java 2000/03/13 17:12:36 1.17
+++ ScriptableObject.java 2000/07/03 18:31:04
@@ -246,11 +246,21 @@
                             break;
                         }
                     }
-                    getterSlot.setter.invoke(start, arg);
+                    Object v = getterSlot.setter.invoke(start, arg);
+                    if (getterSlot.setterReturnsValue) {
+                        slots[slotIndex].value = v;
+                        if (!(v instanceof Method))
+                            slots[slotIndex].flags = 0;
+                    }
                     return;
                 }
                 Object[] args = { this, actualArg };
-                getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                Object v = getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                if (getterSlot.setterReturnsValue) {
+                    slots[slotIndex].value = v;
+                    if (!(v instanceof Method))
+                        slots[slotIndex].flags = 0;
+                }
                 return;
             }
             catch (InvocationTargetException e) {
@@ -1183,6 +1193,7 @@
         slot.delegateTo = delegateTo;
         slot.getter = getter;
         slot.setter = setter;
+        slot.setterReturnsValue = setter != null && setter.getReturnType() !=
Void.TYPE;
         slot.value = null;
         slot.attributes = (short) attributes;
         slot.flags = flags;
@@ -1551,6 +1562,7 @@
     Object delegateTo;  // OPT: merge with "value"
     Method getter;
     Method setter;
+    boolean setterReturnsValue;
 }




Fergus Gallagher wrote:

> I am having problems getting my head around contexts and scopes and my
> multi-threaded application fall over.
>
> If I set "global=false" the following code used a per-thread
> initStandardObject() and this seems to work.  But when I set
> "global=true", the global "parentScope" is used and I get some wierd
> errors.
>
> If I change "__CODE__.slice(0,5)" to
> 1. "__CODE__" - works
> 2. "__CODE__.substring(0,5)" - fails
> 3. "__CODE__.toString()" - works
>
> Any help appreciated.
>
> Fergus
>
> ===== Test.java =========================================
> import java.io.*;
> import org.mozilla.javascript.*;
>
> public class Test implements Runnable {
>         private Script script;
>         private Scriptable parentScope;
>         private String __CODE__="ABCDEFGHIJK";
>         private boolean global = true;
>         private static Context globalContext = null;
>         public Test() throws Exception {
>                 String js= "java.lang.System.out.println(__CODE__.slice(0,5));";
>                 globalContext.setCompileFunctionsWithDynamicScope(false);
>                 parentScope = globalContext.initStandardObjects(null);
>                 StringReader sr = new StringReader(js);
>                 script = globalContext.compileReader(parentScope, sr, "(compiled)",
> 1,null);
>         }
>
>         public void run() {
>                 try {
>                         Context context = Context.enter();
>                         Scriptable threadScope;
>                         if (global) {
>                                 threadScope = context.newObject(parentScope);
>                                 threadScope.setPrototype(parentScope);
>                                 threadScope.setParentScope(null);
>                         } else {
>                                 threadScope = context.initStandardObjects(null);
>                         }
>                         threadScope.put("__CODE__",threadScope,__CODE__);
>                         script.exec(context,threadScope);
>                 }
>                 catch (Exception e) {
>                         System.err.println(e.getClass().getName()+":
"+e.getMessage());
>                 }
>                 finally {
>                         Context.exit();
>                 }
>         }
>
>         public static void main(String args[]) throws Exception {
>         globalContext = Context.enter();
>                 Test me = new Test();
>                 int count=10;
>                 Thread[] threads = new Thread[count];
>                 for (int i=0; i<count; i++) {
>                         Thread t = new Thread(me);
>                         threads[i] = t;
>                         t.start();
>                 }
>                 for (int i=0; i<count; i++) {
>                         threads[i].join();
>                 }
>                 Context.exit();
>         }
> }
>
> ==== OUTPUT ===============================================
> ABCDE
> ABCDE
> org.mozilla.javascript.EcmaError: undefined is not a function.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> ===========================================================
>
> The number and type of exceptions is highly variable from run to run -
> anywhere from 1-9 out of 10.
> The EcmaError in particular only happens occasionally.
>
> --
> Fergus Gallagher          Tel: +44 (20) 8 987 0717
> Orbis                     Fax: +44 (20) 8 742 2649
> The Swan Centre           email: Fergus.Gallagher@orbisuk.com
> Fishers Lane              Web: http://www.orbisuk.com
> London W4 1RX / UK
2000-07-03 18:40:35 +00:00
nboyd%atg.com e7359ce462 Fix javadoc warning 2000-06-21 15:49:14 +00:00
nboyd%atg.com 4242e00f01 Wrapping a class produces a NativeJavaClass. 2000-06-15 14:00:31 +00:00
nboyd%atg.com 999f43aaec Fix bug 42097 2000-06-14 13:39:44 +00:00
nboyd%atg.com 341e3b8ddf Begin 1.5R2 effort.
Commit the following contributions:
* Andi Vajda's changes to allow embedders to capture the generated bytecode (and thus control
generated class names).
* Marshall Cline's changes to allow embedders to override the default Java object wrapping
behavior
* Kurt Westerfeld's change to handle calling static methods better
2000-06-13 14:33:54 +00:00
rogerl%netscape.com 0b4dc2b357 Added check for FORMAT characters in new unicode cr/lf handling code. 2000-06-12 17:56:05 +00:00
nboyd%atg.com bd67f54d28 Fix formatting. 2000-06-07 14:51:08 +00:00
nboyd%atg.com fc46786bff Fix the following problem:
Subject:
        Odd behaviour on placement of .jar files?!
   Date:
        Mon, 05 Jun 2000 10:46:08 -0700
   From:
        John Raykowski <xski@xski.org>
     To:
        nboyd@atg.com




Hello,

I didn't want to post this directly as a rhino bug 'coz I think it may
be more of a JDK thing, but I thought I'd toss it to you as well.

The goal is to create a JavaScript object that implements a Java
interface. Straightforward enough and the example on the page using
ActionListener works without a hitch.  However, when I try to do the
same with my own interface, I get an error message: error instantiating
({0}): class {1} is interface or abstract (coming from
NativeJavaClass.construct).

Here's where it gets a bit strange.  Normally, I run with the jar files
in jre/lib/ext.  When I remove the rhino files from jre/lib/ext and
reference them explicitly on the commandline with the -cp option, it
works as expected and my script can implement the interface just fine.
Go figure.

Anyhoo, there ya go.  Like I said, I think its a JDK issue, but I
thought you'd be interested.  The attached zipfile contains a set of
sample code to demonstrate this problem.

Thanks heaps,

-jmr
2000-06-07 14:50:47 +00:00
nboyd%atg.com faea4ed119 Fix "in" operator for compiled mode. 2000-06-01 23:40:29 +00:00
nboyd%atg.com 4d4458bd63 Add column number and line source information to the EcmaError object. 2000-06-01 17:30:28 +00:00
nboyd%atg.com 4a72992ae8 check for null scope 2000-05-30 21:50:44 +00:00
nboyd%atg.com 9cc29b7e22 Fix bug 40844 2000-05-29 16:57:13 +00:00
nboyd%atg.com a50280a77b Fix bug 39906 2000-05-28 19:01:24 +00:00
nboyd%atg.com d092952991 for Java methods, print the signatures of the overloaded methods in a comment when
the JavaScript function wrapper's toString method is called
2000-05-28 04:25:07 +00:00
nboyd%atg.com 0074ca5edf Remove unused constructor. 2000-05-23 21:03:50 +00:00
nboyd%atg.com 108f81d6ac Fix up bug where direct calls were getting the parent scope when they shouldn't have,
resulting in a NullPointerException on the following code when run on the MS VM with -opt 9:

var testcases = getTestCases();

function getTestCases() {
    return new Boolean(new MyObject(true));
}

function MyObject( value ) {
    this.value = value;
    this.valueOf = new Function( "return this.value" );
    return this;
}
2000-05-23 20:59:13 +00:00
rogerl%netscape.com e562e8eb21 Fix bug #39309 - parameters must be AnyType, also vars used before def. 2000-05-23 00:06:24 +00:00
nboyd%atg.com b76123f465 Fix formatting. 2000-05-22 03:03:37 +00:00
nboyd%atg.com 85a7b4aa6c Fix 38590. 2000-05-22 00:10:10 +00:00
beard%netscape.com f82644b580 added on run handler 2000-05-17 20:02:17 +00:00
beard%netscape.com ebd9cea0c3 Removing obsolete project file. This is supplanted by js.mcp.xml. 2000-05-17 20:01:08 +00:00
rogerl%netscape.com 02d34752cd Bug #39034. Fixed stupid logic that broke \n, sorry. 2000-05-15 21:48:00 +00:00
beard%netscape.com 95c604b7cc added jsc/Main.java. 2000-05-12 06:23:43 +00:00
rogerl%netscape.com 1f1c369c98 Bug #38384, fix from norris (which I tweaked a little) to handle a bug in
recursive reseting of the thisObj in InterpreterData.
2000-05-10 22:03:15 +00:00
rogerl%netscape.com 178e8e9fc7 Bug #31316, didn't reset paren state after failed alt. 2000-05-09 23:47:18 +00:00
rogerl%netscape.com 732442c367 Bug #32937, toLocaleString added to Number class. 2000-05-09 23:46:13 +00:00
rogerl%netscape.com a912f99c10 Bug #22866, support \u2028 \u2029 line terminators 2000-05-09 23:44:49 +00:00
norris%netscape.com 3300d508c9 Fix bug of IndexOutOfRangeException for
function query(query, text) {}
2000-05-05 16:38:16 +00:00
norris%netscape.com 26d7203e07 Make NativeJavaPackage.class optional. 2000-05-05 16:37:40 +00:00
norris%netscape.com afafee3288 Add missing files. 2000-05-03 22:00:22 +00:00
norris%netscape.com 6e0e18c45e Clean up; remove need for synchronize 2000-05-03 21:55:09 +00:00
norris%netscape.com 9bf723214b Fix bug: All the standard object constructors were showing up as enumerable properties of the global object. 2000-05-02 17:36:47 +00:00
norris%netscape.com ff5f45db12 Propagate changes from 1.21.2.3 into tip. 2000-04-27 18:39:10 +00:00
norris%netscape.com a0d8c78c2d Allow multiple uses of importClass on the same class. 2000-04-26 23:47:15 +00:00
norris%netscape.com a5493a0353 Fix bug 37317. 2000-04-26 23:33:25 +00:00
norris%netscape.com 70aa69f0a0 Fix NullPointerException caused by clearing cache 2000-04-26 22:48:48 +00:00
norris%netscape.com 600d365e30 Patch from Matthias Radestock <rade@logee.com>:
Subject:
             JavaAdapter return type conversion
        Date:
             Wed, 19 Apr 2000 12:12:47 +0100
       From:
             Matthias Radestock <rade@logee.com>
 Organization:
             Logee
         To:
             norris@netscape.com
         CC:
             mccabe@netscape.com, beard@netscape.com, rogerl@netscape.com




Dear Rhino team,

When returning an array from a scripted Java object (i.e. a JS object
that implements a Java interface), no type conversion is performed, ie.
a NativeArray is returned instead of a Java array. Example:

Java:
interface Foo {
        public String[] boo();
        }

JS:
FooI = {
        boo: function() { return ["Boo"];}
        }
myFoo = new Packages.Foo(FooI);
myFoo.boo(); //==> breaks with a ClassCastException


Looking at the JavaAdapter code, there is no code for array conversion.
This is particularly bad because precisely such a conversion *does*
happen when calling a Java method from JS. So we end up with a
discrepancy.

See attachment for a patch to fix this and little test program. The
patch works by calling the coerceType function on NativeJavaObject,
which is the function responsible for doing the conversion when calling
from JS to Java. I've simplified the code so that this function gets
called for all non-primitive return type, not just arrays. There are
probably more efficient solutions but I'm not a Java bytecode hacker.


Matthias
PS: I didn't open a bug for this because I wasn't sure whether you guys
would agree that this is indeed a problem ;)





public interface JSReturnTest {

  public boolean returnBoolean();
  public char returnChar();
  public int returnInt();
  public String returnString();
  public org.mozilla.javascript.Scriptable returnScriptable();
  public Object returnObject();
  public boolean[] returnBooleanA();
  public char[] returnCharA();
  public int[] returnIntA();
  public String[] returnStringA();
  public org.mozilla.javascript.Scriptable[] returnScriptableA();
  public Object[] returnObjectA();
  public Object[][] returnObjectAA();
}




Index: JavaAdapter.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/JavaAdapter.java,v
retrieving revision 1.21
diff -r1.21 JavaAdapter.java
54c54,59
<
---
>
>     public static Object convertResult(Object result, String classname)
>     throws ClassNotFoundException {
>         return NativeJavaObject.coerceType(Class.forName(classname),
>                                            result);
>     }
467,474c472,474
<         } else  if (retType.equals(String.class)) {
<             cfw.add(ByteCode.INVOKESTATIC,
<                     "org/mozilla/javascript/Context",
<                     "toString", "(Ljava/lang/Object;)",
<                     "Ljava/lang/String;");
<             cfw.add(ByteCode.ARETURN);
<         } else if (retType.equals(Scriptable.class)) {
<             cfw.add(ByteCode.ALOAD_0);  // load 'this' to find scope from
---
>         } else {
>             String retTypeStr = retType.getName();
>             cfw.addLoadConstant(retTypeStr);
476,477c476,477
<                     "org/mozilla/javascript/Context",
<                     "toObject",
---
>                     "org/mozilla/javascript/JavaAdapter",
>                     "convertResult",
479,500c479,480
<                      "Lorg/mozilla/javascript/Scriptable;)",
<                     "Lorg/mozilla/javascript/Scriptable;");
<             cfw.add(ByteCode.ARETURN);
<         } else {
<             // If it is a wrapped type, cast to Wrapper and call unwrap()
<             cfw.add(ByteCode.DUP);
<             cfw.add(ByteCode.INSTANCEOF, "org/mozilla/javascript/Wrapper");
<             // skip 3 for IFEQ, 3 for CHECKCAST, and 5 for INVOKEINTERFACE
<             cfw.add(ByteCode.IFEQ, 11);
<             cfw.add(ByteCode.CHECKCAST, "org/mozilla/javascript/Wrapper");
<             cfw.add(ByteCode.INVOKEINTERFACE,
<                     "org/mozilla/javascript/Wrapper",
<                     "unwrap", "()", "Ljava/lang/Object;");
<
<             // If Undefined, return null
<             cfw.add(ByteCode.DUP);
<             cfw.add(ByteCode.INSTANCEOF, "org/mozilla/javascript/Undefined");
<             // skip 3 for IFEQ, 1 for ACONST_NULL, 1 for ARETURN
<             cfw.add(ByteCode.IFEQ, 5);
<             cfw.add(ByteCode.ACONST_NULL);
<             cfw.add(ByteCode.ARETURN);
<
---
>                     "Ljava/lang/String;)",
>                     "Ljava/lang/Object;");
502,503c482
<             String retTypeStr = retType.getName().replace('.', '/');
<             cfw.add(ByteCode.CHECKCAST, retTypeStr);
---
>             cfw.add(ByteCode.CHECKCAST, retTypeStr.replace('.', '/'));



   testpatch.js

               Name:
                     testpatch.js
                Type:
                     JavaScript Program (application/x-javascript)
             Encoding:
                     7bit
2000-04-24 19:36:51 +00:00
norris%netscape.com 2c9997aaf4 Clean up new methods. 2000-04-20 23:08:07 +00:00
rogerl%netscape.com d2674e90be Added ASSERT cases to FixNext child handling. 2000-04-20 23:00:37 +00:00
norris%netscape.com 07735d8e89 Fix build error. 2000-04-20 22:36:46 +00:00
norris%netscape.com 721391dfa7 Subject:
contextClassloader problem in ScriptRuntime.java
   Date:
        Tue, 11 Apr 2000 09:45:36 -0400
   From:
        "Howard Lin" <howard@softcom.com>
     To:
        "Norris Boyd" <norris@netscape.com>
    CC:
        "Andrew Wason" <aw@softcom.com>




Hi, Norris, we are trying to create a Java class in JavaScript. When security manager is on, everything works fine. But when security
manager is off, we got an error saying the "... is not defined". The problem is that in ScriptRuntime.java, when security is on,
getContextClassLoader is null due to SecurityException and Class.forName is used to find the class, which works fine. When security
is off, ContextClassLoaderMethod is invoked to find the class. Since we use a separate thread to load third party jar files,
ContextClassLoaderMethod will throw a ClassNotFound exception.

To illustrate this problem, I wrote a simple applet, evaluating a simple js file in its paint method, which is running on a separate thread.
When security is off, I got the following:

ReferenceError: "Global" is not defined.
        at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:
494)
        at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java, Compile
d Code)
        at org.mozilla.javascript.Interpreter.interpret(Interpreter.java, Compil
ed Code)
        at org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:
67)
        at org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:
54)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:739)
        at test.evaluate(test.java:26)
        at test.paint(test.java:16)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:117)
        at java.awt.Component.dispatchEventImpl(Component.java:2447)
        at java.awt.Container.dispatchEventImpl(Container.java:1035)
        at java.awt.Component.dispatchEvent(Component.java:2307)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
        at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
1)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)

When security is on, it runs fine. Or if the code moved to init method, it works fine regardless of security. We are using JDK 1.2.2.

Howard
2000-04-20 19:53:16 +00:00
norris%netscape.com b27bb891d9 Add line number information. 2000-04-19 23:24:04 +00:00
rogerl%netscape.com f07ec29168 Added hasOwnProperty, propertyIsEnumerable, isPrototypeOf to Object. 2000-04-19 22:32:50 +00:00
norris%netscape.com d23d359cba Add missing method for 1.4R3 compatibility. 2000-04-18 16:53:28 +00:00
norris%netscape.com 564f1dca5b Fix bug where a bean property can conflict with a method name. 2000-04-18 16:52:00 +00:00
norris%netscape.com 3ef540f70d Fix bug:
var a = Math.abs;
  a(-245);

  gets the following error :

  org.mozilla.javascript.EvaluatorException: Method "abs" called on
  incompatible object.
2000-04-18 16:34:36 +00:00
rogerl%netscape.com d8559be163 Fxied oboscure bug when user defines function Object(), the next new Object
gets a stack crash looking for the prototype. (bug #32174)
2000-04-13 17:58:18 +00:00
norris%netscape.com 144d256be4 Fix bug 33841. 2000-04-12 17:30:32 +00:00
norris%netscape.com 1a915ed08b Remove obsolete statement from javadoc. 2000-04-11 18:24:08 +00:00
norris%netscape.com 171751afcb Update javadoc 2000-04-11 18:22:36 +00:00
norris%netscape.com ea63971f10 Fix bug 33239. 2000-03-24 23:06:02 +00:00
norris%netscape.com 4b10c5a00b fix NullPointerException 2000-03-16 22:43:03 +00:00
norris%netscape.com 6513a8feb0 clean up regressions in test suite from last fix 2000-03-15 19:40:53 +00:00
norris%netscape.com 884167f722 Fix regressions caused by support for function expression statements. 2000-03-15 17:18:12 +00:00
norris%netscape.com 9cca0a1352 31251 NervousText.js applet doesn't work 2000-03-14 01:20:45 +00:00
beard%netscape.com 855f2ed7a8 added mozilla/js/rhino/org/mozilla/javascript/tools/jsc/Main.java 2000-03-14 00:24:23 +00:00
norris%netscape.com 092098261a generalize on number of threads, add synchronization point so test case behaves as advertised 2000-03-13 21:45:02 +00:00
norris%netscape.com 068e84c7d4 Implement distinction between function statements, function expressions, and function expression-statements. 2000-03-13 18:27:42 +00:00
norris%netscape.com a05b7af158 Fix 31639 Oldstyle Java property method names no longer work with defineClass 2000-03-13 17:12:36 +00:00
norris%netscape.com b1bb0c6e43 Make Wrapper an API class. 2000-03-10 20:55:36 +00:00
rginda%netscape.com c66d2fe108 Removing debug output 2000-03-10 19:06:36 +00:00
mccabe%netscape.com 3f8b45f3f4 Replace some ternary expressions
step += (InLeapYear(t) ? 29 : 28);

with the form

    if (InLeapYear(t))
        step += 29;
    else
        step += 28;

to work around an apparent JRE bug in which the code always returns 28.
2000-03-10 02:05:41 +00:00
beard%netscape.com 3d929551f5 now includes all of the optimizer classes 2000-03-10 01:05:28 +00:00
norris%netscape.com c567ae6df2 javadoc comment. 2000-03-10 01:03:59 +00:00
beard%netscape.com 789e50b184 imports js.mcp.xml into js-all.mcp 2000-03-10 01:03:58 +00:00
norris%netscape.com d121bdcda7 Fix command line 2000-03-09 23:33:06 +00:00
norris%netscape.com 6b2aea0f90 Add html page for the NervousText applet. 2000-03-09 23:06:54 +00:00
norris%netscape.com cd8ce490e8 Fixes for NervousText example. 2000-03-09 21:50:14 +00:00
norris%netscape.com ec66213a10 Try to fix Solaris/Linux failures. 2000-03-09 21:46:42 +00:00
rogerl%netscape.com 85f0dbf22b Put NonGreedy back in. 2000-03-09 02:39:58 +00:00
rogerl%netscape.com 1a509a268e Fixed handling of {1,} quantifiers 2000-03-08 01:24:55 +00:00
rogerl%netscape.com 08a7900333 Reduced stack usage for greedy matching. 2000-03-08 01:08:32 +00:00
norris%netscape.com 140fe5ab49 Clean up debugging interfaces. 2000-03-03 21:46:44 +00:00
norris%netscape.com fa21a5c8da Clean up examples to use current jsFunction_ and jsGet_ method forms. 2000-03-03 19:15:51 +00:00
rogerl%netscape.com 9f37d04d49 Added lineTerminator test back into \s & \S atoms 2000-03-03 19:07:16 +00:00
norris%netscape.com 08455904ae Fix js1_2/function/Function_object.js 2000-03-03 17:18:49 +00:00
rogerl%netscape.com 271ec11a32 Switch to using new DToA stuff for numberToString(). 2000-03-02 00:30:01 +00:00
rogerl%netscape.com f704383014 Fix endian bug for BigInteger constructor. 2000-03-01 23:25:23 +00:00
rogerl%netscape.com 94975b3a1c Hmm, better do that negate. 2000-03-01 22:20:48 +00:00
rogerl%netscape.com 684459eed5 Oops, remove debugging hack. 2000-03-01 22:20:09 +00:00
rogerl%netscape.com c9d7bb356f Fixing Unicode ECMA 3 compliance issues 2000-03-01 22:15:35 +00:00
rogerl%netscape.com 0123e33bfd Fixing Unicode ECMA 3 compliance issues.
Fixed bug in $ handling for ECMA 3 (don't support \$)
2000-03-01 22:14:34 +00:00
norris%netscape.com a74b41a9c1 Fix bug 6063. 2000-03-01 21:35:38 +00:00
norris%netscape.com c2e981fdf2 Switch back to using getDeclaredMethods--I was able to get it working with a
security manager.
2000-03-01 18:26:43 +00:00
beard%netscape.com a0c7e9ebf2 importable XML project file for CWPro5 (with CWPro4 Java Tools) 2000-03-01 01:12:20 +00:00
beard%netscape.com 1a942c72f1 CWPro5 format project (using CWPro4 Java tools). 2000-03-01 01:00:38 +00:00
beard%netscape.com 5cf73aa879 added LazilyLoadedCtor.java 2000-03-01 00:57:29 +00:00
norris%netscape.com d111d58045 1. Implement a new method of Context that allows embedders to disable or clear cached items
2. Change from using Class.getDeclaredMethods to Class.getMethods since the former may cause
   security problems. Implement a cache to ameleorate the possible performance degredation.
3. Add a new class to lazily load constructors to improve performance
2000-02-29 21:35:45 +00:00
norris%netscape.com fc2ff1cb84 Remove reference to parent scope for Java methods. This was resulting in dangling
references that were never released to a large pool of objects.
2000-02-29 17:27:56 +00:00
norris%netscape.com aea0fb6d79 Guard against possible NullPointerException if the Context has not been properly entered. 2000-02-28 18:40:34 +00:00
norris%netscape.com dfb69c7a8d Some users with JDK 1.1 but JDK 1.2 security were getting NullPointerExceptions here. 2000-02-28 18:38:37 +00:00
norris%netscape.com b5a79f600f Fix warning. 2000-02-28 18:32:19 +00:00
norris%netscape.com a54067df23 Generalize error test to catch any catches appearing after a catch-all. 2000-02-28 18:28:45 +00:00
norris%netscape.com 851e9b0870 Enable catchguard with new 'if' syntax.
Implement check.
2000-02-24 19:35:22 +00:00
rogerl%netscape.com 3726b9fb19 Ported toFixed, toExponential & toPrecision to NativeNumber from C sources. 2000-02-23 18:46:36 +00:00
norris%netscape.com c4a75c3727 Fix wrapping of InvocationTargetException. Thanks to Kurt Westerfeld for pointing this out. 2000-02-18 17:38:11 +00:00
norris%netscape.com 656a44d953 Add equals() and equalsIgnoreCase() to the String object, at the suggestion of Tom Beauvais <tbeauvais@bowstreet.com> 2000-02-18 17:37:27 +00:00
rogerl%netscape.com 011ec66cec Added decode/encode URI handling. 2000-02-18 00:22:02 +00:00
norris%netscape.com 695ad099fa Fix cases of LiveConnected classes that have a field and methods with the same name.
Also clean up Bean properties, making implementation more efficient.
2000-02-17 22:32:37 +00:00
norris%netscape.com a0b34a5bc1 Remove untrue comment. 2000-02-17 22:31:43 +00:00
norris%netscape.com f051596d19 Update implementation version. 2000-02-17 22:31:16 +00:00
norris%netscape.com 3a479188da Add support for dynamic scopes and fix remaining test failures in the tip. 2000-02-16 17:40:53 +00:00
norris%netscape.com 6d54dce0ca Avoid static never-released reference to streams; causes problems for Patrick Beard's use of the shell. 2000-02-15 17:08:31 +00:00
norris%netscape.com 4187c3d263 Fix contributors list. 2000-02-15 00:09:58 +00:00
beard%netscape.com b49ea8f4c9 added DTOA.java 2000-02-09 23:15:27 +00:00
rogerl%netscape.com 49e2fdfbfb Changed implementation of toString(<base>) to use Waldemar's code from
SpiderMonkey.
2000-02-09 19:52:31 +00:00
norris%netscape.com e221b94f7b Remove unused private method. 2000-01-31 18:49:07 +00:00
norris%netscape.com 97ca106067 Propagate changes from Rhino150R1_BRANCH. 2000-01-27 17:35:29 +00:00
norris%netscape.com da933ad300 Propagate changes from 1.5 branch. 2000-01-26 18:57:00 +00:00
beard%netscape.com 8d01d34630 changed all "try { s = (Scriptable) obj; } catch (ClassCastException e) {...}" to "if (obj instanceof Scriptable) { ... }". This will generally be more efficient NOT to use exception handling where instanceof will do. 2000-01-22 04:41:30 +00:00
beard%netscape.com 7e8572925e fix case for anonymous functions. 2000-01-22 03:28:04 +00:00
norris%netscape.com 7092bd508b Fix ecma_3/ExecutionContexts/10.1.3.js
r=rogerl
2000-01-20 20:59:56 +00:00
rogerl%netscape.com be8d0da3f8 Bug #24023, infinite loop in interpreter when catch clause has a throw.
This was caused by a previous bug fix in which I moved the try stack
decrement to the end of the catch clause because it was getting skipped
by the final statement in the try block (which is always a goto around the
catch block). Better is to make sure the endTry is the statment just before
that goto, and do the try stack decrement in the catch the way god intended.
2000-01-19 22:50:27 +00:00
rogerl%netscape.com 3d19609d66 Bug #23609 - optimization in IRFactory for post-increment was incomplete. 2000-01-19 19:32:45 +00:00
norris%netscape.com a2be2fadf4 Fix icode printing for call opcodes. 2000-01-19 18:38:42 +00:00
norris%netscape.com 913e66ba3c Propagate fix from branch. 2000-01-06 16:28:43 +00:00
rogerl%netscape.com 329f23093b Need to update the value of newly created closure. 1999-12-24 00:49:44 +00:00
rogerl%netscape.com 0b84cb0f44 Clean-up message text 1999-12-23 00:16:07 +00:00
norris%netscape.com 881d203b8f Fix Counter example. 1999-12-16 22:49:50 +00:00
norris%netscape.com 7d795f197b Make it possible to report multiple errors. 1999-12-16 18:47:27 +00:00
norris%netscape.com a155377984 Remove unused member variable. 1999-12-09 23:37:18 +00:00
beard%netscape.com f32c492fc7 fixes case where an InterpretedFunction has both a closure and needs an activation. 1999-12-09 22:05:09 +00:00
rogerl%netscape.com d5a5a0e7fc smaller faster better - it'll probably burn up on entry. 1999-12-09 00:26:09 +00:00
rogerl%netscape.com 7b2b34b4b3 Added 'flat' argument to NewRegExp to force literal interpretation of
entire string.
1999-12-08 01:48:03 +00:00
rogerl%netscape.com b75ab1c96c Needed a quick-and-dirty constructor from a string. 1999-12-08 01:47:13 +00:00
rogerl%netscape.com bcf6134bde Added 'flat' argument to NewRegExp to force literal interpretation of
entire string.
Fixed String.replace to not coerce first arg to regexp.
Fixed behaviour of replace w.r.t. $
1999-12-08 01:46:43 +00:00
rogerl%netscape.com 4ce70bbabb Added 'flat' argument to NewRegEXp to force literal interpretation of
entire string.
1999-12-08 01:44:08 +00:00
norris%netscape.com 698b9afdab Fix ecma_3/ExecutionContexts/10.1.4-1.js 1999-12-06 19:03:21 +00:00
beard%netscape.com a0069ee91f removed NativeClosure.java. 1999-12-04 00:32:16 +00:00
norris%netscape.com 65135b7a4a Fix instanceof. 1999-12-04 00:21:41 +00:00
norris%netscape.com f1b3d47cb2 eval() called indirectly should throw an EvalError 1999-12-03 23:44:58 +00:00
norris%netscape.com db8bea4b84 Fix ecma_2/Exceptions/exception-006.js 1999-12-03 23:32:46 +00:00
norris%netscape.com 9971f38d08 Fix regressions. 1999-12-03 21:50:42 +00:00
rogerl%netscape.com 93db42fecd Switch to ECMA error. 1999-12-03 02:58:29 +00:00
rogerl%netscape.com 42ee9bb786 Don't let Undefined prototype be assigned to new objects, revert to Object
instead. Also, detect Undefined prototype in hasInstance and bail.
1999-12-03 00:10:36 +00:00
norris%netscape.com c4c76975f6 Fix the following bug:
Subject:
            Rhino request URGENT
       Date:
            Thu, 02 Dec 1999 15:58:40 -0500
      From:
            slobo@espialgroup.com
        To:
            Norris Boyd <norris@netscape.com>
 References:
            1 , 2




Hello Norris

In Rhino, the following script gives the error : "function does not always return a value" during the parsing phase. The script
runs perfectly fine in Netscape 4.61. It is an urgent requirement. Many thanks in advance.

Steven

///////////////////////////////////////////////////////SCRIPT  BEGIN  ///////////////////////////////////////////////
function test (a) {
  this.arg = a;
  if (a>20)
        return;
  return this;
}

//print = alert;

function joe() {
a = new test (20);
print (a.arg);


a = new test (25);
print (a.arg);
}

joe();
///////////////////////////////////////////////////////SCRIPT   END  ///////////////////////////////////////////////
1999-12-03 00:04:46 +00:00
norris%netscape.com 403430a7d3 EvaluatorExceptions should set an exit error code. 1999-12-02 19:12:34 +00:00
norris%netscape.com 413a71493b Pass a scope to ScriptRuntime.call so we can throw EcmaErrors if need be. 1999-12-02 18:17:22 +00:00
rogerl%netscape.com a75fb74671 Added missing null scope parameter. 1999-12-02 01:33:22 +00:00
rogerl%netscape.com a7e0325cf6 Passing scope down into parser/IRFactory/NodeTransformer so that syntax
errors can be packaged as ECMA Error objects.
1999-12-02 01:16:02 +00:00
rogerl%netscape.com 741cf4ed39 Bug #19980 - insist on curly-brace after catch block rather than just
accepting it - forces error that allows catch block to span lines for
interactive input.
1999-12-01 23:12:58 +00:00
norris%netscape.com 051daf4abf Fix js1_3/regress/in-001.js 1999-12-01 18:43:12 +00:00
norris%netscape.com 459c97e38a Fix test ecma_2/Exceptions/string-001.js 1999-12-01 18:05:49 +00:00
rogerl%netscape.com acd3c7ef86 Call createFunctionObject on closure created InterpretedFunction objects
so they can be real JS objects like they're supposed to be -with prototypes
and everything.
1999-12-01 02:45:58 +00:00
norris%netscape.com 92b89b162f anal: fix indentation 1999-11-30 23:54:51 +00:00
norris%netscape.com d6faee6812 delete of non-reference just evaluates to true. 1999-11-23 17:36:17 +00:00
norris%netscape.com 0912f3ec41 Add ConversionError and make it work for undefined.foo. 1999-11-23 17:30:31 +00:00
norris%netscape.com 54e442adf3 Remove commented-out code. 1999-11-23 17:29:53 +00:00
norris%netscape.com eb5865d934 Fix formatting. 1999-11-23 17:29:34 +00:00
norris%netscape.com 504a2557ce Fix test failures:
ecma_2/Exceptions/expression-020.js
js1_4/Regress/date-001-n.js
js1_4/Regress/toString-001-n.js
1999-11-22 23:48:06 +00:00
norris%netscape.com ce59129ab9 Fix
Testcase ecma_2/Exceptions/expression-020.js failed
Failure messages were:
result = this.eval("NaN") (threw No exception thrown) = NaN FAILED! expected: Passed
1999-11-22 19:35:59 +00:00
norris%netscape.com c6f15cb391 'thisArg' could be null, so use 'fun' for scope. 1999-11-22 19:35:20 +00:00
norris%netscape.com 865f66a07b Fix ecma_2/Expressions/instanceof-003-n.js
ScriptRuntime::instanceOf now needs a scope parameter that it can use to construct an exception object
1999-11-20 00:19:00 +00:00
norris%netscape.com 0a7318f579 argument.caller shouldn't be defined in the default version 1999-11-19 23:02:52 +00:00
rginda%netscape.com 57279e1a51 * Global.java
Cleared global.exitCode in quit() just to be safe.
* Main.java
  Adjusted exit code constants to match the js and xpcshells.
1999-11-17 20:26:17 +00:00
norris%netscape.com b15e2970b0 Make -f semantics match those of the C engine. 1999-11-17 00:04:17 +00:00
norris%netscape.com 9e1cbbe40a Add contributor. 1999-11-16 23:58:11 +00:00
norris%netscape.com a79f73f658 rginda's changes for having quit() take an exit code. 1999-11-16 23:57:23 +00:00
rogerl%netscape.com a097356fa8 Removed NativeClosure 1999-11-09 18:24:40 +00:00
norris%netscape.com e054a08198 Fix 18229: Bogus class file names being generated on Windows 1999-11-08 17:24:10 +00:00
norris%netscape.com 5d10d91ea2 Unify evaluation code to improve consistency and improve code size. 1999-11-05 22:18:24 +00:00
norris%netscape.com 4ad45bf1ec Remove JSuncaughtExceptionLine, use an error reporter to report line number info instead. 1999-11-05 21:48:05 +00:00
norris%netscape.com 634fa1c351 Improve performance of the non-error call code. 1999-11-05 21:23:10 +00:00
rogerl%netscape.com 6ab8568b72 Removed - not an ECMA thing and supplanted by a different mechanism. 1999-11-04 00:01:00 +00:00
rogerl%netscape.com 5d229c958c Fix back-reference parsing from going too far in source string 1999-11-04 00:00:14 +00:00
rogerl%netscape.com dc6e27e8c1 Replaced Closure object with FunctionObject clone 1999-11-03 23:59:35 +00:00
rogerl%netscape.com 1c6d67c9a5 Removed NativeClosure 1999-11-03 23:58:51 +00:00
rogerl%netscape.com c00cc220c6 Fix nested finally endless loop.
Replaced Closure object with FunctionObject clone.
1999-11-03 23:57:56 +00:00
rogerl%netscape.com 6bbeaa9db5 Add closure support 1999-11-03 23:56:28 +00:00
rogerl%netscape.com dbb9b495e3 Removing NativeClosure 1999-11-03 23:55:59 +00:00
rogerl%netscape.com 20d55df771 Added Kurt Westerfeld's fix for 'undefined is not a function' message. 1999-11-02 22:52:10 +00:00
rogerl%netscape.com 6e901af5e4 More RegExp back reference specification mucking about. 1999-11-02 20:04:57 +00:00
rogerl%netscape.com 7a7398396f Fixed up for Java vs. ECMA definitions in edge cases 1999-11-02 20:04:16 +00:00
norris%netscape.com f0b53fc5a9 Fix spelling of contributor's name. 1999-10-28 17:43:43 +00:00
rogerl%netscape.com 366a39bbe2 Error message for apply argument type 1999-10-27 22:17:44 +00:00
rogerl%netscape.com 59bbd1a9d3 ECMA handling of undefined args for call & apply. 1999-10-27 22:17:05 +00:00
rogerl%netscape.com 32feff141e Handle LINE & SOURCEFILE in dumpIcode
Fix bug in multiple try/catch clauses after a catch - the tryStackTop was
being decremented twice.
1999-10-27 22:16:15 +00:00
rogerl%netscape.com a9a28082b7 Handle missing arg in match_or_replace 1999-10-27 22:14:46 +00:00
rogerl%netscape.com 15224ec833 ECMA specified handling of NaN inputs for max & min 1999-10-27 22:11:43 +00:00
rogerl%netscape.com b0c98b8d85 Subsumed ConversionError into TypeError 1999-10-27 22:10:36 +00:00
norris%netscape.com 1f601534d6 Remove method duplication in NativeGlobal.
Add javadoc comments to EcmaError.
1999-10-26 17:22:23 +00:00
norris%netscape.com 75ae8940c1 Get filename and line number into uncaught exception reports. 1999-10-26 17:06:12 +00:00
norris%netscape.com 728f196c9d Add contributors. 1999-10-25 17:52:48 +00:00
norris%netscape.com 1e83296930 Add license text. 1999-10-25 17:41:49 +00:00
norris%netscape.com a99ffc094a Add license boilerplate. 1999-10-25 17:36:20 +00:00
norris%netscape.com 0c4c8abe96 Should get ReferenceError exception for name not found. 1999-10-25 16:41:24 +00:00
norris%netscape.com 83dbb689c3 Add contributors. 1999-10-25 16:40:30 +00:00
beard%netscape.com 46b516f102 synched. 1999-10-22 22:39:51 +00:00
beard%netscape.com cb627fa9be changed SharedGlobal.java to Global.java 1999-10-22 22:39:23 +00:00
norris%netscape.com 5f112b7933 Changes for improved errors-as-exceptions handling. 1999-10-22 22:02:58 +00:00
norris%netscape.com ecae26d52e Use simpler, more widely applicable structure for global. Also avoids test failure for Function called as a function. 1999-10-22 22:00:21 +00:00
norris%netscape.com b8da22d58f A NativeString object shouldn't be unwrapped to a primitive. 1999-10-22 21:58:54 +00:00
norris%netscape.com 2b172afa00 Fix formatting. 1999-10-22 16:58:30 +00:00
norris%netscape.com c9c2bb3492 Fix javadoc 1999-10-22 16:56:56 +00:00
norris%netscape.com aec69cc2f4 Fixed bug. We weren't loading classes in bottom-up dependency order.
Subject:
            Re: another getClassLoader exception
       Date:
            Mon, 18 Oct 1999 22:01:24 -0400
      From:
            Andrew Wason <aw@softcom.com>
        To:
            norris@netscape.com (Norris Boyd)
        CC:
            Howard Lin <howard@softcom.com>
 References:
            1 , 2




At 05:03 PM 10/18/99 -0700, Norris Boyd wrote:
>Are you still seeing this problem?


Yes.  I just did a CVS update to get the latest stuff and we still have
this problem.

I wrote a standalone sample program that duplicates the problem.  Run
JSSupport and you should get this exception:

defineClass org.mozilla.javascript.gen.c2
Exception in thread "main" java.lang.NoClassDefFoundError:
org/mozilla/javascript/gen/c1
         at java.lang.ClassLoader.resolveClass0(Native Method)
         at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
         at
JSSupport$MySecuritySupport$DataClassLoader.loadClass(JSSupport.java:89)
         at JSSupport$MySecuritySupport.defineClass(JSSupport.java:47)
         at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java,
Compiled Code)
         at org.mozilla.javascript.Context.compile(Context.java:1761)
         at org.mozilla.javascript.Context.compile(Context.java:1691)
         at org.mozilla.javascript.Context.compileReader(Context.java:810)
         at org.mozilla.javascript.Context.evaluateReader(Context.java:725)
         at org.mozilla.javascript.Context.evaluateString(Context.java:692)
         at JSSupport.<init>(JSSupport.java:20)
         at JSSupport.main(JSSupport.java:9)



Andrew



>--N
>
>Andrew Wason wrote:
>
> > At 04:54 PM 10/12/99 -0700, Norris Boyd wrote:
> > >I just checked in changes so that the class calling ScriptRuntime (c5
> in your
> > >case) will load the class itself using the normal Java classloading
> mechanism
> > >rather than an explicit call to the class loader. I pushed the bits up
> to the
> > >ftp site, but it takes a bit to propagate.
> >
> > I get this exception now (debugging statements are from my code):
> >
> > SecuritySupport.defineClass org.mozilla.javascript.gen.c5
> > DataClassLoader.loadClass org.mozilla.javascript.gen.c5
> > DataClassLoader.loadClass org.mozilla.javascript.gen.c4
> > using default loader com.softcom.realjava.PluginClassLoader@da9486a0
> > java.lang.NoClassDefFoundError: org/mozilla/javascript/gen/c4
> >          at java.lang.ClassLoader.resolveClass0(Native Method)
> >          at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
> >          at
> >
> com.softcom.realjava.plugins.RealJavaScript$RealJavaScriptSecuritySupport$Da
> > taClassLoader.loadClass(RealJavaScript.java:410)
> >          at
> >
> com.softcom.realjava.plugins.RealJavaScript$RealJavaScriptSecuritySupport.de
> > fineClass(RealJavaScript.java:352)
> >          at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java,
> > Compiled Code)
> >          at org.mozilla.javascript.Context.compile(Context.java:1761)
> >          at org.mozilla.javascript.Context.compile(Context.java:1691)
> >          at org.mozilla.javascript.Context.compileReader(Context.java:810)
> >
> > So when c5 is being loaded by my SecuritySupport, it also needs to load c4.
> > I decompiled org.mozilla.javascript.gen.c5 and it's constant pool
> > references CLASS org.mozilla.javascript.gen.c4, so c5 is dependent on c4
> > being loadable.  Is the problem that c5 is being loaded before the
> > optimizer has defined c4?
> >
> > I get the above exception for some classes and not others.  It seems
> > consistent that I always get it for classes with dependencies on other
> > optimizer classes that haven't been generated yet.
> >
> > Andrew
> >
> > --
> > Andrew Wason
> > SoftCom, Inc.
> > aw@softcom.com

--
Andrew Wason
SoftCom, Inc.
aw@softcom.com



   JSSupport.java

                  Name:
                         JSSupport.java
                   Type:
                         Java Source File (text/java)
                Encoding:
                         base64
1999-10-19 16:38:23 +00:00
norris%netscape.com 3700676b23 Fix following problem:
Subject:
        another getClassLoader exception
   Date:
        Tue, 12 Oct 1999 10:39:26 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com (Norris Boyd)
    CC:
        Howard Lin <howard@softcom.com>




Norris,

It looks like the classes the optimizer generates call
ScriptRuntime.defineFunction which calls getClassLoader.  This throws a
SecurityException.

java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader )
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java
, Compiled Code)
at java.security.AccessController.checkPermission(AccessController.java,
Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled
Code)
at java.lang.Class.getClassLoader(Class.java, Compiled Code)
at
org.mozilla.javascript.ScriptRuntime.defineFunction(ScriptRuntime.java:2045)
at org.mozilla.javascript.gen.c5.initScript(order.js)
at org.mozilla.javascript.gen.c5.exec(order.js)
at org.mozilla.javascript.Context.evaluateReader(Context.java:728)
[...]



Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-12 23:54:03 +00:00
norris%netscape.com 809bf6aa85 Remove redundant import. 1999-10-12 21:46:50 +00:00
norris%netscape.com bc2eb782ee Fix release date, add contributor. 1999-10-12 16:52:13 +00:00
norris%netscape.com 11fd4bbe0e Fix bug:
Subject:
        optimizer SecurityException
   Date:
        Mon, 11 Oct 1999 17:37:51 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com (Norris Boyd)
    CC:
        Howard Lin <howard@softcom.com>




We use our own SecuritySupport implementation in Rhino.  This is properly
getting called by the optimizer to generate new classes (e.g.
org.mozilla.javascript.gen.c5 etc.)

However, after defining the class, Codegen.compile calls getClassLoader()
on the new class.  The default SecurityManager doesn't allow
getClassLoader() to be called and so an exception is thrown:

java.lang.RuntimeException: Malformed optimizer package
java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader )
        at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:138)
        at org.mozilla.javascript.Context.compile(Context.java:1761)
        at org.mozilla.javascript.Context.compile(Context.java:1691)
        at org.mozilla.javascript.Context.compileReader(Context.java:810)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:725)
        [...]

This is kind of a pain to duplicate outside of our application, but if you
require a test case I can create one.

Codegen is attempting to call loadClass() after it uses
SecuritySupport.defineClass().  Our SecuritySupport calls loadClass()
internally in its defineClass() implementation.  This is what JavaAdapter
expects.

This is from Codegen.compile():

                         if (securitySupport == null) {
                             if (Context.isSecurityDomainRequired())
                                 throw new SecurityException("Required " +
                                             "security context missing");
                             if (classLoader == null)
                                 classLoader = new JavaScriptClassLoader();
                             clazz = classLoader.defineClass(name, classFile);
                         } else {
                             clazz = securitySupport.defineClass(name,
classFile,
                                                                 securityDom
securityDomain);
                         }
                         ClassLoader loader = clazz.getClassLoader();
                         clazz = loader.loadClass(name);


This is from JavaAdapter.createAdapterClass():


         SecuritySupport ss = cx.getSecuritySupport();
         if (ss != null)  {
             Object securityDomain = cx.getSecurityDomainForStackDepth(-1);
             return ss.defineClass(adapterName, bytes, securityDomain);
         } else {
             if (classLoader == null)
                 classLoader = new MyClassLoader();
             classLoader.defineClass(adapterName, bytes);
             return classLoader.loadClass(adapterName, true);
         }


So JavaAdapter is assuming SecuritySupport.defineClass() will call
ClassLoader.loadClass() on the new class, while Codegen is assuming it
needs to call ClassLoader.loadClass() on the class defined by
SecuritySupport.defineClass().

These should be made consistent, and in both cases it should be assumed
that SecuritySupport will both define and load the class.


Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-11 22:48:13 +00:00
rogerl%netscape.com a5bd278835 Fixed 14060 - calling exec on java methods was gettmg caught by exec
trapping nonsense.
1999-10-08 22:55:33 +00:00
norris%netscape.com 41f9794d2f Fix 15711 Can't call java.lang.Class methods from JS 1999-10-07 18:27:21 +00:00
norris%netscape.com 6757acf35a Subject:
Re: NPL vs. MPL
       Date:
            Wed, 06 Oct 1999 18:30:34 -0400
      From:
            "Ian D. Stewart" <idstewart@softhome.net>
        To:
            Norris Boyd <norris@netscape.com>
 References:
            1 , 2 , 3




Norris Boyd wrote:

  Great. So I'd like to change this copyright text

  /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
  4 -*-
   *
   * The contents of this file are subject to the Mozilla Public License
   * Version 1.0 (the "MozPL"); you may not use this file except in
   * compliance with the MozPL.  You may obtain a copy of the MozPL at
   * http://www.mozilla.org/NPL/
   *
   * Software distributed under the MozPL is distributed on an "AS IS"
  basis,
   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  MozPL
   * for the specific language governing rights and limitations under the
   * MozPL.
   *
   * The Initial Developer of this code under the MozPL is Ian D. Stewart.

   * Portions created by Ian D. Stewart are Copyright (C) 1998, 1999
   * Ian D. Stewart.
   * All Rights Reserved.
   */

  to this:

  /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
  4 -*-
   *
   * The contents of this file are subject to the Netscape 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/NPL/
   *
   * Software distributed under the License is distributed on an "AS
   * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
   * implied. See the License for the specific language governing
   * rights and limitations under the License.
   *
   * The Original Code is ListenerCollection, released
   * May 15, 1998.
   *
   * The Initial Developer of the Original Code is Ian D. Stewart.
   * Portions created by Ian D. Stewart are Copyright (C) 1998, 1999
   * Ian D. Stewart.
   * Rights Reserved.
   *
   * Contributor(s):
   * Ian D. Stewart
   *
   * Alternatively, the contents of this file may be used under the
   * terms of the GNU Public License (the "GPL"), in which case the
   * provisions of the GPL are applicable instead of those above.
   * If you wish to allow use of your version of this file only
   * under the terms of the GPL and not to allow others to use your
   * version of this file under the NPL, indicate your decision by
   * deleting the provisions above and replace them with the notice
   * and other provisions required by the GPL.  If you do not delete
   * the provisions above, a recipient may use your version of this
   * file under either the NPL or the GPL.
   */

  Can you give me your approval for this change?

Make it so.


Ian
1999-10-07 16:57:01 +00:00
rogerl%netscape.com 0b5779e73c More errors-as-exceptions stuff 1999-10-06 23:55:33 +00:00
norris%netscape.com 032b7f4436 More license wrangling: fix the release date (1999, not 1998). 1999-10-06 21:52:17 +00:00
beard%netscape.com 5eebed5f4a added EcmaError.java, NativeError.java 1999-10-06 21:07:04 +00:00
norris%netscape.com 55b6742fed Update contributors, add some license text. 1999-10-06 20:50:04 +00:00
norris%netscape.com 52141616b0 Make sure creation of class loader is inside a try block to handle security exceptions. 1999-10-06 17:39:48 +00:00
rogerl%netscape.com a881374871 Added version 150, changed version testing in regexp 1999-10-06 00:10:27 +00:00
rogerl%netscape.com fe413b9972 Errors as exceptions working from generated code. 1999-10-05 19:44:24 +00:00
mccabe%netscape.com 1fbb1a0a36 Initial checkin of TestScan.java, a simple driver for generating and printing various kinds of parse trees, and for profiling scanning, parsing and compiling. 1999-10-05 03:47:04 +00:00
dmose%mozilla.org 0f48266224 update license boilerplate to NPL dual w/GPL, r=norris@netscape,a=norris@netscape.com 1999-10-05 01:42:01 +00:00
dmose%mozilla.org 9d7478e8be update license boilerplate to NPL dual w/GPL, r=norris@netscape,a=norris@netscape.com 1999-10-05 00:44:05 +00:00
rogerl%netscape.com 079188169c First cut at errors as exceptions - These changes should be benign since
the errors are being wrapped by runtime exceptions and still need to be
explicitly caught (this is happening in the interpreter, but not in
generated code).
1999-10-05 00:21:07 +00:00
norris%netscape.com 4c4cc4d82a Fix up makefiles; previous patch was mis-applied. 1999-10-04 21:31:21 +00:00
norris%netscape.com b1ecbb62ba Fix bug found by Andrew Wason (see below).
Problem was that one transformation of a node to GETVAR wasn't protected by a check of inWithStatement().

======================================
Subject:
        multiple scopes
   Date:
        Fri, 01 Oct 1999 12:39:14 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




When I create two scopes, and one scope evaulates a string in the other
scope, it works.  However, if I do this while handling an exception thrown
within a JavaAdapter method, it fails with an exception.

Run the attached Java program with the two script files.  scope1.js
evaluates a string "printMessage" in the scope of scope2.js.  This returns
a function object which is then invoked.  This works in 3 cases, but fails
in the 4th (in the catch in the JavaAdapter).  Even in the 4th case where
it fails, printing the function object looks normal.

Am I doing something wrong, or is there a bug here?

java CrossScope scope1.js scope2.js

Outside of JavaAdapter
works before exception
works after exception
Inside of JavaAdapter
works before exception
Caught exception
pma=
function printMessage(msg) {
     java.lang.System.out.println(msg);
}

Exception in thread "main" org.mozilla.javascript.JavaScriptException:
org.mozilla.javascript.EvaluatorException: The undefined value has no
properties.
         at
org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException
.java:61)
         at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java,
Compiled Code)
         at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1256)
         at org.mozilla.javascript.Interpreter.interpret(Interpreter.java,
Compiled Code)
         at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:49)
         at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:37)
         at org.mozilla.javascript.Context.evaluateReader(Context.java:697)
         at CrossScope.<init>(CrossScope.java:30)
         at CrossScope.main(CrossScope.java:10)


Thanks,
Andrew

import java.io.*;
import org.mozilla.javascript.*;

public class CrossScope {
	private Context m_jsContext;
	private Scriptable m_scope1;
	private Scriptable m_scope2;

	public static void main(String args[]) throws Exception {
		new CrossScope(args[0], args[1]);
	}

	private CrossScope(String strFile1, String strFile2) throws Exception {
		// Associate Context with main thread
		m_jsContext = Context.enter();
                m_jsContext.setOptimizationLevel(-1);

		// Init scope1, expose Scope object
  		m_scope1 = m_jsContext.initStandardObjects(new ImporterTopLevel());
		m_scope1.put("Scope", m_scope1, this);

		// Init scope2
		m_scope2 = m_jsContext.initStandardObjects(new ImporterTopLevel());

		// Run script in scope2
		Reader r2 = new FileReader(strFile2);
		m_jsContext.evaluateReader(m_scope2, r2, strFile2, 1, null);

		// Eval input JS in scope1 - it can in turn eval JS over in scope2
		Reader r1 = new FileReader(strFile1);
		Object obj = m_jsContext.evaluateReader(m_scope1, r1, strFile1, 1, null);
		if (obj instanceof Throwable)
			((Throwable)obj).printStackTrace();

		m_jsContext.exit();
	}

	public Object scope1Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope1, str, "scope1EvalString", 1, null);
			cx.exit();
			return objResult;
	}

	public Object scope2Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope2, str, "scope2EvalString", 1, null);
			cx.exit();
			return objResult;
	}
}


// Scope1

importPackage(java.lang);

System.out.println("Outside of JavaAdapter");

try {
	var pm = Scope.scope2Eval("printMessage");
	pm("works before exception");
	System.arraycopy(null, 5, null, 5, 100);
} catch (e) {
	var pma = Scope.scope2Eval("printMessage");
	pma("works after exception");
}

var obj = new Runnable() {
	run: function() {
		System.out.println("Inside of JavaAdapter");
		try {
			var pm = Scope.scope2Eval("printMessage");
			pm("works before exception");
			System.arraycopy(null, 5, null, 5, 100);
		} catch (e) {
			System.out.println("Caught exception");
			var pma = Scope.scope2Eval("printMessage");
			System.out.println("pma=" + pma);
			pma("works after exception");
		}
	}
};

obj.run();



// Scope2

function printMessage(msg) {
	java.lang.System.out.println(msg);
}
1999-10-04 18:27:30 +00:00
norris%netscape.com 9169791d48 Contribution from Andrew Wason:
Subject:
        optimizer Makefiles
   Date:
        Fri, 01 Oct 1999 14:50:05 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




Norris,

Here are patches to the Rhino Makefiles to build the optimizer package and
the jsc compiler.  They also fix a problem with "gmake clean".

Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-01 22:58:48 +00:00
norris%netscape.com cf9f713ecb \t doesn't work on Windows. 1999-10-01 22:56:30 +00:00
beard%netscape.com 978fa797c2 fixed output directory 1999-09-29 16:11:58 +00:00
beard%netscape.com 1803aa06ab fixed source folder name 1999-09-29 16:10:25 +00:00
beard%netscape.com d54d7ae821 build debugger with CW Pro 4. 1999-09-29 16:07:22 +00:00
beard%netscape.com cf51c97bad builds the optimizer using CW Pro 4. 1999-09-29 15:55:29 +00:00
norris%netscape.com edd009bad1 Add example of classfile generation. 1999-09-27 23:21:01 +00:00
norris%netscape.com 40f1ee60cc Changes for classfile generation. 1999-09-27 23:17:29 +00:00
rogerl%netscape.com 854aa7f8a3 Better error handling for interpreter. 1999-09-27 17:47:51 +00:00
rogerl%netscape.com 4953124561 Changes from Kurt Westerfield to improve error messages from Interpreter
by passing line/file data through bytecode.
1999-09-27 17:47:05 +00:00
rogerl%netscape.com 861193d030 Stash originating source file for error reporting 1999-09-27 17:45:26 +00:00
rogerl%netscape.com 0f93133878 ECMA 3 array length error handling. 1999-09-27 17:44:30 +00:00
rogerl%netscape.com 4238d6f520 Execute exec in the global scope. 1999-09-27 17:43:40 +00:00
rogerl%netscape.com 08abcd5436 New tokens to support better error messages from Interpreter. 1999-09-27 17:43:07 +00:00
beard%netscape.com 9675752f93 Fixed looking up 'length' property in Function objects: needed to look up prototype chain for zero arguments. Cleaned up some more, always storing Boolean.TRUE in local hash tables, rather than the method, methodKey or methodName. 1999-09-25 09:24:23 +00:00
beard%netscape.com 620e43cd95 Added ClassSignature, a key for caching generated adapter classes. Now passing superName, rather than superClass to constructor generation methods. 1999-09-25 08:11:24 +00:00
beard%netscape.com 38ef2b2d81 Fixed generateSuper when override has void return type. 1999-09-25 01:37:32 +00:00
norris%netscape.com e6517361c6 Shorten name to make Mac developers happy. 1999-09-24 21:05:41 +00:00
norris%netscape.com d51c86ce41 Patches from Kurt Westerfeld for JavaScript property access to JavaBeans.
Subject:
        Re: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class with duplicate field/method]
   Date:
        Mon, 13 Sep 1999 20:57:32 -0400
   From:
        "Kurt Westerfeld" <kurt@westerfeld.com>
     To:
        "Norris Boyd" <norris@netscape.com>




I do have a patch for this, but it is intermixed with some other changes
that I have implemented for the get/set on Java instances (per my LC3
proposal).  The bug requires changes that are a little involved actually;
basically it seems that when getting the default value for a "field and
methods" (which combines the same-named entities), the prototype of the
parent scope is deref-ed, and the parent scope is null.  Hence, the scope
must be passed into the the cloned field and method values.

Also, the NativeJavaClass implementation passed "false" for isStatic on the
constructor of the FieldAndMethods Hashtable, which results in classes
having instance methods.  Bad.  I haven't filed a bug on that yet.
Additionally, I fixed a couple other NullPointerException nigglies thrown in
when exceptions are propagated in the same area.  Finally, when getting the
default value for the field, it is helpful to convert a Scriptable to string
when that is requested (as when typing in the console).

I am attaching the changed files.  The LC3++ code can be removed if you
want, which I can do for you but it will take a little longer.  What is your
preference?

-----Original Message-----
From: Norris Boyd <norris@netscape.com>
To: Kurt Westerfeld <kurt@westerfeld.com>
Date: Monday, September 13, 1999 4:54 PM
Subject: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class
with duplicate field/method]


>Kurt,
>
>Is this the bug that your patch fixes?
>
>Thanks,
>Norris
>
1999-09-24 20:41:43 +00:00
norris%netscape.com 250df9809f Propagate files from old netscape code. 1999-09-24 20:05:59 +00:00
norris%netscape.com ec0d89055e Implement the "cast" of java class objects so that js objects in java adapters can
use 'this' for the implemented java interface.
1999-09-24 18:20:08 +00:00
beard%netscape.com b0a911e500 Added "generateSuper" which generates a method called "super$method()" which when called calls "super.method()." This is provided to support full sub-classing of Java classes from JavaScript. 1999-09-24 18:17:05 +00:00
beard%netscape.com 5185946b51 added a prototype field, so that a wrapped JavaAdapter can preserve the delegate object's original prototype chain. 1999-09-24 16:52:23 +00:00
beard%netscape.com 24a3e9d1a9 setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine. 1999-09-24 16:51:25 +00:00
rogerl%netscape.com 167a47ffdb New error for wacky array lengths, ECMA 3 1999-09-23 23:19:00 +00:00
norris%netscape.com faa7950d23 Fix some Array tests in the ecma suite. 1999-09-23 20:37:56 +00:00
rogerl%netscape.com 71eb1ee9d3 Can't assume object in reportConversionError is scriptable, so call more
generic java.object.toString instead.
1999-09-22 22:06:14 +00:00
norris%netscape.com f8b25c9abd Allow a java.lang.String to be converted to a primitive string in getDefaultValue 1999-09-22 16:30:49 +00:00
norris%netscape.com 9a0f128be4 Fix "wapper". 1999-09-22 16:25:21 +00:00
beard%netscape.com d080c25c1d JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. 1999-09-22 08:22:53 +00:00
beard%netscape.com 1b108bb46a JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. Simplified callMethod to only call Context.enter() if methodId property is defined in Scriptable object. 1999-09-22 08:22:47 +00:00
beard%netscape.com 0bb5087bad renamed "name" parameter "adapterName", removed explicit StringBuffer in favor of "adapter" + serial++ for clarity. 1999-09-22 03:54:00 +00:00
beard%netscape.com ee2e476427 changed createAdapterClass() to only generate methods for properties defined in the wrapped object itself, not for properties defined in prototypes. This makes sense, as the prototype for the wrapped object becomes the LiveConnect wrapper, thus prototype properties become inaccessible anyway. 1999-09-22 01:32:05 +00:00
rogerl%netscape.com 2d8fcffd6b (Bug #13416)
Turned off 'super' keyword - was letting through some cut'n'pasted java
code quietly and blowing big chunks out of the codegen/interpreter later.
Anybody know why 'super' had an interesting value here? - there was no
support for it on any path that I could see.
1999-09-20 22:21:24 +00:00
norris%netscape.com 1cd4a572c8 Changes necessary to generate adapter classes to files with associated optimizer package. 1999-09-20 21:16:45 +00:00
norris%netscape.com 04f902243f Fix comments. 1999-09-17 16:38:51 +00:00
norris%netscape.com dcd67f150f fix comment 1999-09-17 16:37:35 +00:00
norris%netscape.com f032d61748 Clearer example. 1999-09-17 06:12:45 +00:00
norris%netscape.com 7e3b0bb1bc Tutorial examples. 1999-09-17 05:54:27 +00:00
norris%netscape.com e549457121 Fix potential NullPointerException. 1999-09-10 18:39:04 +00:00
norris%netscape.com de8bedf312 Two submissions from Kurt Westerfield <kurt@westerfield.com>:
Subject:
        Embedding the shell
   Date:
        Wed, 8 Sep 1999 16:01:44 -0400
   From:
        "Kurt Westerfeld" <kurt@westerfeld.com>
     To:
        "Norris Boyd" <norris@netscape.com>




Norris, please find the attached zip file containing the (minor)
modifications to the Rhino shell module that enables the shell to be
embedded in a host application.

There are two areas of change to be concerned about:

    1. Any and all references to System.in/out/err have been modified to use
Main.in/out/err, which default to System.in/out/err.  Methods to do a setIn,
setOut, and setErr were added.   Note that in/out/err on Main were made
static public, so that the jikes compiler wouldn't complain (I had them as
static protected, but when accessed outside of the package, a warning was
issued).

    2.  The global and sharedGlobal static variables were made protected so
that my app can make use of them (to add extensions after an initial pass
through main()).

That's it.

I have successfully used the facility to drop a remote telnet server into
the shell interpreter, effectively giving our server a remote shell
interpreter.  It's quite nice, as we have a lot of extensions to Rhino
written that blend into our server already.

PS, I am still working on the array issues, but made a lot of progress
today.  I just wanted to get this stuff off my desk.

Thanks!

________________________________________________________________________
  Kurt Westerfeld
  Managed Object Solutions
  2722 Merrilee Drive
  Suite 350
  Fairfax, VA 22031
  Phone: 703.208.3330 x225
  Fax: 703.208.3331
  http://www.mosol.com
  mailto:kurt@mosol.com



   shell.zip

             Name:
                   shell.zip
             Type:
                   Zip Compressed Data (application/x-zip-compressed)
          Encoding:
                   base64


==============================================================================

Subject:
        Rhino Array Source (Fixed)
   Date:
        Thu, 9 Sep 1999 14:12:03 -0400
   From:
        "Kurt Westerfeld" <kurt@mosol.com>
     To:
        "Norris Boyd" <norris@netscape.com>




Attached is NativeJavaObject.java, which seems to now pass the tests supplied to me by you and Scott.  Not a lot of change, but a lot of
testing and thinking was involved. <g>

PS. I also fixed a bug in reportConversionError() which was throwing an IllegalArgumentException inside of the MessageFormat class at times.
It also looks a little nicer (uses formatting from NativeJavaMethod) and closer to the C implementation.




   NativeJavaObject.java

                        Name:
                              NativeJavaObject.java
                         Type:
                              Java Source File (text/java)
                     Encoding:
                              quoted-printable
1999-09-09 18:49:58 +00:00
norris%netscape.com d6d196e334 Long not supported here. Fix up comments so that is clear. 1999-09-02 16:48:20 +00:00