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

734 Коммитов

Автор SHA1 Сообщение Дата
nboyd%atg.com 1f40b84b6c Hi, Norris!
I attach optimization patch for NativeDate that makes all js... methods
private, removes passing of unnecessary parameters and replaces
checkInstance by realThis call with false as the third parameter.


Regards, Igor

Hi, Norris!

Here is another small optimization for NativeDate in DayFromMonth method
where it replaces arrays by few ifs.

Regards, Igor
2001-04-17 13:54:45 +00:00
nboyd%atg.com 39f51f6c80 Subject:
Rhino: patch for IdScriptable.java and question about useDynamicScope
        Date:
             Mon, 16 Apr 2001 17:55:19 +0200
       From:
             Igor Bukanov <igor.bukanov@windriver.com>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




Hi, Norris!

Here is a patch to IdScriptable.java that fixes sealed semantic and
makes Something.prototype.constructor to behave just as having DONTENUM
attribute, not DONTENUM|READONLY|PERMANENT. It also renames
seal_function to sealFunctions.

I also have a following question. I added nextInstanceCheck to
IdScriptable.java and its usage in realThis in NativeDate to emulate
code from FunctionObject where it looks up prototype in search for
NativeSomething instance if useDynamicScope is true. But could you
describe why it is necessary? I can understand why doing something like

var proto = new Date();
function Test() { }
Test.prototype = proto;
var test = new Test();
print(test.getDay()); // same as proto.getDay()

would be useful in ceratain situations, but what it has to do with
shared scopes?

Regards, Igor
2001-04-16 19:29:48 +00:00
nboyd%atg.com c83b74d6be Updates from Igor. 2001-04-11 23:29:23 +00:00
nboyd%atg.com 474433c5db Need to pop activation stack. 2001-04-11 23:28:47 +00:00
nboyd%atg.com 096c704d7a Fixes from Igor. 2001-04-11 13:44:09 +00:00
nboyd%atg.com dfea48c35c Fix race condition in method. 2001-04-11 13:43:07 +00:00
nboyd%atg.com 5425d1691b Make default for generatingDebug flag be true for compilation and false for interpretation. 2001-04-11 13:42:26 +00:00
nboyd%atg.com 77435b1a17 New file from Igor. 2001-04-10 14:21:24 +00:00
nboyd%atg.com 64bdadc1e0 Add Igor's changes to make generation of id strings by tool. 2001-04-10 13:20:02 +00:00
beard%netscape.com 479d30c766 Synchronized with latest sources. 2001-04-10 07:09:43 +00:00
nboyd%atg.com a717446397 Remove SecuritySupport code that doesn't apply to the Invoker case. 2001-04-10 01:47:50 +00:00
nboyd%atg.com 48141e355a Revert default of generatingDebug back to false to fix regressions. 2001-04-09 23:52:04 +00:00
nboyd%atg.com 517b2d35e4 Fix NPE. 2001-04-09 23:43:19 +00:00
nboyd%atg.com a867dbf67d Subject:
Minor fix to JSDebugger
        Date:
             Wed, 28 Mar 2001 16:34:24 -0800
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             nboyd@atg.com




Hi Norris,

Attached is a minor fix to the JSDebugger GUI that causes the tool-bar buttons to all have the same width.
I checked out and modified a file from CVS today.  See the screenshot below.

Cheers,

Chris
2001-03-29 01:44:45 +00:00
nboyd%atg.com 8adfb2b57f Fix problem where errors wouldn't get source positions. 2001-03-28 14:42:37 +00:00
nboyd%atg.com 0173c9bc63 Fix 73555. 2001-03-27 14:01:53 +00:00
nboyd%atg.com 53f72f3639 Fix bug 72921. 2001-03-22 21:56:12 +00:00
nboyd%atg.com 5f7badd05f Print name of function in toString 2001-03-12 19:05:36 +00:00
nboyd%atg.com 77fee58f07 Infinity/Math.min(0,-0) should produce -Infinity 2001-03-12 16:53:02 +00:00
nboyd%atg.com dfacb25c9f Close thread hazard hole. 2001-03-12 14:55:47 +00:00
nboyd%atg.com f1901fba16 More changes from Igor. 2001-03-10 11:51:15 +00:00
nboyd%atg.com 4e07e9b5bf Add method to set security support after creation. 2001-03-10 11:50:50 +00:00
matthias%sorted.org 712e352a43 replicated SpiderMonkey fix for bug 67773 2001-03-06 13:57:01 +00:00
matthias%sorted.org 8d348ad77e * made shell.Global a subclass of ImporterTopLevel
* fixed ImporterTopLevel constructor - it now calls
cx.initStandardObjects before defining any functions. The old
constructor is still around for backwards compatibility.
2001-03-05 08:46:10 +00:00
nboyd%atg.com 534fc4e412 More changes from Igor. 2001-03-01 19:28:37 +00:00
matthias%sorted.org ebbd7aaa6c fixed two instances where prefix match would return undefined instead of null 2001-03-01 16:52:23 +00:00
matthias%sorted.org 6413b694ba getInstance now uses ScriptableObject.getProperty instead of
Scriptable.get. This way Global can (again) be used in prototype
chain.
2001-03-01 13:33:55 +00:00
nboyd%atg.com a91023590b Commit new scheme for builtin objects, courtesy of
Igor Bukanov <igor@icesoft.no>. This new scheme is
faster and consumes less memory.
2001-02-26 16:16:46 +00:00
nboyd%atg.com 3f5e828b80 Change ClassOutput to take a top-level boolean parameter. 2001-02-26 15:32:15 +00:00
nboyd%atg.com b02120e058 Add top-level boolean parameter so ClassOutput implementors can determine
which class to load to execute a script.
2001-02-26 15:28:17 +00:00
nboyd%atg.com 446ea9e8da Real fix for last problem. 2001-02-22 14:45:10 +00:00
nboyd%atg.com 25a2852250 Subject:
Rhino Context.setTargetClassFileName() null pointer exception
        Date:
             Tue, 20 Feb 2001 15:28:20 -0800
       From:
             "Ryan Manwiller" <rdm@europa.com>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




I'm setting the file name to compile to a file. However, on subsequent
compiles, I don't want to compile to a file, so I tried
setTargetClassFileName(null). This causes a NullPpinterException in
OptClassNameHelper.setTargetClassFileName(OptClassNameHelper.java:76)

It seems that Context.setTargetClassFileName() should check for null.

Thanks
2001-02-21 02:08:05 +00:00
nboyd%atg.com 82bd85bfce Fix for problem:
Subject:
             Rhino Exception Handling: Inconsistency btw Old/New Versions of 1.5
        Date:
             Mon, 05 Feb 2001 06:07:07 -0800
       From:
             Timothy Bergeron <bergeron@resumerabbit.com>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




I've been using Rhino for about a year with almost no problems. However,
I downloaded the latest Rhino tip (rhino15R2pre) and discovered a
significant difference in exception handling.

I rely heavily on JavaScript code like the following:

try {
   var em  = new ExceptionMaker();
   em.npe();  // method throws a java.lang.NullPointerException
   //em.ae();  // method throws a Packages.AutomationException
}
catch (e if (e instanceof java.lang.NullPointerException)) {
   java.lang.System.out.println("Caught a NullPointerException");
   e.printStackTrace();
}
catch (e if (e instanceof Packages.AutomationException)) {
   java.lang.System.out.println("Caught an AutomationException");
}
catch (e) {
   java.lang.System.out.println("Caught an unexpected exception: "+e);
}
finally {
   java.lang.System.out.println("Finally!");
}

Previous Rhino versions worked as expected. The exception thrown from
within the host object would be caught and the appropriate actions could
be taken.

With the most recent tip, the thrown exceptions simply are not caught
within the JavaScript. They propagate back to the Java function invoking
the (in my case) Context.evaluateReader() method.

Running the above JS fragement with the older tip displayed the
following stack trace (when the NullPointerException was caught):

Rhino Version: JavaScript-Java 1.5 release 1 2000 03 15
Caught a NullPointerException
java.lang.NullPointerException
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at java.lang.RuntimeException.<init>(RuntimeException.java:39)
        at
java.lang.NullPointerException.<init>(NullPointerException.java:45)
        at ExceptionMaker.jsFunction_npe(ExceptionMaker.java:13)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:497)
        at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1205)
        at org.mozilla.javascript.gen.c1.call(exception.js:3)
        at org.mozilla.javascript.gen.c1.exec(exception.js)
        at
org.mozilla.javascript.Context.evaluateReader(Context.java:739)
        at js.main(js.java:14)
Finally!

When run with the latest tip, the output is:

Rhino Version: JavaScript-Java 1.5 release 1 2000 03
15                                          Finally!
Exception in thread "main" java.lang.NullPointerException
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at java.lang.RuntimeException.<init>(RuntimeException.java:39)
        at
java.lang.NullPointerException.<init>(NullPointerException.java:45)
        at ExceptionMaker.jsFunction_npe(ExceptionMaker.java:13)
        at inv2.invoke()
        at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:843)
        at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:486)
        at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1199)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.gen.c1.exec(Unknown Source)
        at
org.mozilla.javascript.Context.evaluateReader(Context.java:778)
        at js.main(js.java:14)

Curiously, both Rhino versions seem to be returning the same string from
Context.getImplementionVerison();

Anyway, the results from the two runs are clearly different: In the
first case, the exception is thown, the correct catch block is invoked
(hence the stace trace), and the finally block is invoked. In the second
case, the exception is thrown, the finally block is invoked, and the
exception is handled by the calling Java method rather than being
handled by the JavaScript code.

After some research, it appears this change was introducted by a
modification to FunctionObject.call()  (See
http://bugzilla.mozilla.org/show_bug.cgi?id=64788) which used to have:

       try {
            Object result = (method != null)
                            ? method.invoke(thisObj, invokeArgs)
                            : ctor.newInstance(invokeArgs);
            return hasVoidReturn ? Undefined.instance : result;
        }

but now has:

            Object result = method == null ?
ctor.newInstance(invokeArgs)
                                           : doInvoke(thisObj,
invokeArgs);

If I comment out the new code and replace it with the old, the expected
exception handling returns. Is this just an oversight or the new
expected behavior? Are there any negative side effects (other then the
speed decrease in method invocation) if I use the latest tip but use the
old method invocation procedure in FunctionObject.call() rather than the
new?
2001-02-08 18:56:58 +00:00
nboyd%atg.com e5473d8fda Subject:
Re: [Rhino in Java] compiling .js to class file gives "bad local" error
        Date:
             Wed, 31 Jan 2001 09:41:45 +0100
       From:
             "Sylvia E. Schleutermann" <ses@h-m-s.com>
 Organization:
             .hms Health Management Systems
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1 , 2




I have found out some more. Looking really quickly over the JVM specs, I
found that
indeed the astore-command requires that the variables index be below 128.
However,
the book also said that if more index space is needed, a "wide" command can
be used to
be able to address up to 65xxx variables.
Question: is there a possibility to integrate this "wide"-command into the
class compiler?
Some option, that can be set?  Or am I on the wrong tracks?

Please help, since I want to avoid spreading the script over many classes to
avoid the
size limitation. Cheers, Sylvia


Sylvia E. Schleutermann <ses@h-m-s.com> wrote in message
news:956sv9$9g53@secnews.netscape.com...
> I have found out that it is definitely the number of variables.
> I removed all variables and then the script compiled into class files
> with one base class and inner classes for each function in the script.
>
> What is the limitation exactly, i.e. does anyone know how many (global)
> variables
> I can use? Or is there some other kind of work around?
>
> Cheers, Sylvia
>
>
> Sylvia E. Schleutermann <ses@h-m-s.com> wrote in message
> news:956qtv$6kh3@secnews.netscape.com...
> > Hello,
> > when compiling a *.js file to class file, I get a "bad local" runtime
> > exception.
> > Stepping through the source, the following happens in reverse order:
> >
> > Codegen.xstore (75, 58, 209)
> >     -> in the switch - default case, there is a comparison
> >         for local (=209), which is compared to Byte.MAX_VALUE (=127).
> >         When greater, the above exception is thrown.
> >
> > Codegen.astore (209)
> >     -> calls Codegen.xstore (ByteCode.ASTORE_0, ByteCode.ASTORE, 209)
> >
> > Codegen.generatePrologue (<context>, <tree>, true, -1) // -1 is
> > directParameterCount
> >     -> sets itsZeroArgArray = getNewWordLocal(); // here, the 209 is
> > produced
> >     -> calls astore (itsZeroArgArray)
> >
> > From what I can read from the source code, the 209 seems to be a counter
> for
> > "locals", perhaps
> > local variables?? The function that is being compiled does initialize
many
> > variables - would it help
> > to move the initialize code out of the function into separate code
blocks?
> >
> > The function looks like this
> >
> > function rule_Disclaimer()
> > {
> >     try { VAR1 = <init code 1>;} catch (exception) { VAR1 = <default
init
> > code 1>; }
> >     try { VAR2 = <init code 2>;} catch (exception) { VAR2 = <default
init
> > code 2>;}
> >         ... (about 58 such variables)
> >
> >     var cond = true;
> >
> >     < rest of code>
> > }
> >
> > When I compile the script for interpreted mode, all works well. The
> > variables VAR1 to VAR58 are to be global
> > variables (global to the whole script).
> >
> > I appreciate any help! Thanks, Sylvia
> >
> >
>
>
2001-02-02 15:20:03 +00:00
matthias%sorted.org f39acf5399 introduced "sync" helper function for converting a Javascript function
into a Java-style synchronized method
2001-01-31 13:05:21 +00:00
matthias%sorted.org e5ae12e585 added support for implementing Java-style synchronized methods in Javascript 2001-01-31 13:02:42 +00:00
matthias%sorted.org 4aee7d25d7 added support for incremental/prefix matching of regular
expressions. The method "prefix" on a RegExp behaves exactly the same
as the "exec" method except it returns "undefined" if the match failed
because there was an insufficient number of characters in the
input. E.g.
/^foo/.prefix("foo")	=> ["foo"] (just like exec)
/^foo/.prefix("fox")	=> null (just like exec)
/^foo/.prefix("fo")	=> undefined (whereas exec returns null)
2001-01-30 16:38:21 +00:00
nboyd%atg.com 42056e97d4 Fix bug:
Subject:
             [Rhino] Question
        Date:
             Tue, 30 Jan 2001 20:18:21 +0900
       From:
             "get21" <get21@secsm.org>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




I found something unusual to me when I hacking the Rhino source code.

In tagify method of NativeString Class,

When it adds tag to its string(this.string), it does not use quotation
marks.

For example, the result of tagify("A HREF", "A", value) in
jsFunction_link(String value) is

<A HREF=Some Value>Original String Value</A>

Not,

<A HREF="Some Value">Original String Value</A>

This question might sound silly, but I'm curious why.

Thanks in advance,

Nam

--
email : get21@secsm.org
home : http://get21.secsm.org
phone : 011-9092-1802
2001-01-30 13:47:19 +00:00
nboyd%atg.com 362492aef1 ECMA mandates a ToPrimitive on Date constructor arguments that we didn't have. 2001-01-25 19:56:54 +00:00
matthias%sorted.org f989805f9a cleaned up indentation. no code changes. 2001-01-25 18:46:38 +00:00
nboyd%atg.com 665f459571 Move Invoker out as a top-level class so that it doesn't get javadoc'd
with FunctionObject (it must be public).
2001-01-24 15:49:21 +00:00
nboyd%atg.com 6ddf348d98 Alternative fix for problem in the following email:
Subject:
        minor Rhino bug
   Date:
        Tue, 23 Jan 2001 13:14:51 -0800
   From:
        dave russo <d-russo@ti.com>
     To:
        nboyd@atg.com
    CC:
        d-russo@ti.com




Norris,

While using the new Rhino debugger (from the latest tip) I started to get "No
Context associated with current Thread" exceptions when expanding host objects
in the "Context:" debugger window.

In looking at the code, I discovered that NativeObject.toString seems to assume
that Context.getContext() may return null.  In fact, getContext() always returns
a non-null context or throws an exception.

I changed NativeObject.toString to never throw an exception (see below) and this
eliminated the problem I was seeing (of course).

It would be nice to incorporate this in a future Rhino tip or, if this change is
inappropriate, any guidance would be appreciated.  Thanks in advance.

I changed NativeObject.toString to:

    public String toString() {
        try {
            Context cx = Context.getContext();
            return jsFunction_toString(cx, this, null, null);
        }
        catch (Exception e) {
            return "[object " + getClassName() + "]";
        }
    }

from:

   public String toString() {
        Context cx = Context.getContext();
        if (cx != null)
            return jsFunction_toString(cx, this, null, null);
        else
            return "[object " + getClassName() + "]";
    }
2001-01-24 15:16:37 +00:00
nboyd%atg.com 389c4e220e Subject:
Re: Small usage simplification for Rhino
       Date:
            Tue, 23 Jan 2001 16:01:42 +0100
      From:
            Igor Bukanov <igor@icesoft.no>
        To:
            Norris Boyd <nboyd@atg.com>
 References:
            1 , 2 , 3 , 4




Norris Boyd wrote:

> Thanks. I've patched in your changes and checked it into CVS.

I also looked at other places with similar pattern of few lines of
common code to construct error messages. The following was occurred too
often not to avoid temptations to move it to a separated function:

NativeGlobal.constructError(
Context.getContext(), "TypeError",
ScriptRuntime.getMessage1("msg.default.value", arg),
this)

It can be replaced by
NativeGlobal.typeError1("msg.default.value", arg, this)

There are other similar usages but they are not to frequent to bother
with code reduction because even the above replacement saves just 200
bytes in uncompressed jars (it is expensive to introduce new methods in
Java).

In any case, if you think it makes any sense, patches are attached. They
are made via
diff -cbB javascript.orig javascript > patch_context
diff -bB javascript.orig javascript > patch_std
from org/mozilla directory.

Regards, Igor
2001-01-23 19:35:35 +00:00
nboyd%atg.com 1a357f5fda Fix problem:
Subject:
        Recent rhino broke security support
   Date:
        Tue, 23 Jan 2001 08:07:45 -0500
   From:
        "Kurt Westerfeld" <kurt@managedobjects.com>
     To:
        "Norris Boyd" <nboyd@atg.com>


Norris.....I like the changes made to FunctionObject to do method invocation
much faster.  Very slick.

Problem tho: this mechanism does not veer into the security support plugin
on context for defining a class.  This is crucial do creating event adapter
code later in applet environments.

I'm going to look into this, but perhaps you could probably make the changes
faster than I.

Unfortunately for us, we found this problem yesterday at a customer site.
:-(  Shame on us.

________________________________________________________________________
  Kurt Westerfeld
  Senior Software Architect
  Managed Objects
  mailto:kwester@ManagedObjects.com
  703.770.7225
  http://www.ManagedObjects.com

  Managed Objects: manage technology > rule business
2001-01-23 17:48:41 +00:00
nboyd%atg.com 8ed55e98dd Fix formatting 2001-01-23 14:24:39 +00:00
rogerl%netscape.com 3d250fdec1 More fixes for #64285 - i had mis-merged from SpiderMonkey. 2001-01-22 22:30:37 +00:00
nboyd%atg.com e737c6d867 Subject:
Re: Small usage simplification for Rhino
       Date:
            Mon, 22 Jan 2001 20:32:12 +0100
      From:
            Igor Bukanov <igor@icesoft.no>
        To:
            Norris Boyd <nboyd@atg.com>
 References:
            1 , 2




Norris Boyd wrote:

> Sounds like a good change to reduce codesize. I'll take the patches for the
> changes.
>
> Thanks,
> Norris

I made this patch, the files in the attachment were produced via:
diff -bB javascript.orig javascript -c > patch_context
and
diff -bB javascript.orig javascript > patch_std

run from org/mozilla directory.

This patch reduces uncopressed Rhino jar by 3K.

>
> Igor Bukanov wrote:
>
>
>> Hi, Noris!
>>
>> To shorten/cleanup usage of getMessage and reportRuntimeError methods
>> from org/mozilla/javascript/Context.java I suggest to add few utility
>> methods like
>>
>>      static String getMessage0(String messageId) {
>>          return getMessage(messageId, null);
>>      }
>>
>>      static String getMessage1(String messageId, Object arg1) {
>>          Object[] arguments = {arg1};
>>          return getMessage(messageId, arguments);
>>      }
>>
>>      static String getMessage2(String messageId, Object arg1, Object arg2) {
>>          Object[] arguments = {arg1, arg2};
>>          return getMessage(messageId, arguments);
>>      }
>>
>>      static String getMessage3
>>          (String messageId, Object arg1, Object arg2, Object arg3) {
>>          Object[] arguments = {arg1, arg2, arg3};
>>          return getMessage(messageId, arguments);
>>      }
>>
>> and
>>
>>      static EvaluatorException reportRuntimeError0(String messageId) {
>>          return reportRuntimeError(getMessage0(messageId));
>>      }
>>
>>      static EvaluatorException reportRuntimeError1
>>          (String messageId, Object arg1)
>>      {
>>          return reportRuntimeError(getMessage1(messageId, arg1));
>>      }
>>
>>      static EvaluatorException reportRuntimeError2
>>          (String messageId, Object arg1, Object arg2)
>>      {
>>          return reportRuntimeError(getMessage2(messageId, arg1, arg2));
>>      }
>>
>>      static EvaluatorException reportRuntimeError3
>>          (String messageId, Object arg1, Object arg2, Object arg3)
>>      {
>>          return reportRuntimeError(getMessage3(messageId, arg1, arg2,
>> arg3));
>>      }
>>
>> This allows to write, for example, instead of
>>
>>               Object[] args = { Integer.toString(base) };
>>               throw Context.reportRuntimeError(getMessage
>>                                                ("msg.bad.radix", args));
>> simply
>>               throw Context.reportRuntimeError1(
>>                   "msg.bad.radix", Integer.toString(base));
>>
>> which is not only easy to read but also generates less code.
>>
>> I attach my patch to Context.java to implement this plus a patch to
>> ScriptRuntime.java that utilizes the additions. The patches are in
>> standard and context versions.
>>
>> If you think that this make sense to incorporate, I can send a patch
>> that utilizes this everywhere.
>>
>>   ------------------------------------------------------------------------
>>                                  Name: patch.context.Context.java
>>    patch.context.Context.java    Type: Plain Text (text/plain)
>>                              Encoding: base64
>>
>>                              Name: patch.std.Context.java
>>    patch.std.Context.java    Type: Plain Text (text/plain)
>>                          Encoding: base64
>>
>>                                        Name: patch.context.ScriptRuntime.java
>>    patch.context.ScriptRuntime.java    Type: Plain Text (text/plain)
>>                                    Encoding: base64
>>
>>                                    Name: patch.std.ScriptRuntime.java
>>    patch.std.ScriptRuntime.java    Type: Plain Text (text/plain)
>>                                Encoding: base64
>>
>>               Name: all.zip
>>    all.zip    Type: Zip Compressed Data (application/x-zip-compressed)
>>           Encoding: base64
2001-01-22 20:28:34 +00:00
rogerl%netscape.com aeca31a7bd Merged Monkey bits, fix for bug #57631, /()/ was parsed incorrectly. 2001-01-18 23:39:00 +00:00
rogerl%netscape.com bbcf08a5c3 Merged changes from Monkey - see bug #64285. 2001-01-18 22:49:11 +00:00
nboyd%atg.com 08a188c69b Subject:
[Fwd: My Mistake in ScriptRuntime method]]]
   Date:
        Tue, 16 Jan 2001 15:48:26 +0100
   From:
        Igor Bukanov <igor@icesoft.no>
     To:
        Norris Boyd <nboyd@atg.com>




Hi, Norris!

With my previous patch to fix in
org/mozilla/javascript/ScriptRuntime.java Integer.MIN_VALUE as index
problem I also added a bug to the unrelated code: I tried to minimize
object creation and unfortunately that untested "optimization" slippet
into my patch as well.

I replaced the lines 290, 291 in toNumber(String s) method from

String sub = s.substring(start, end+1);
if (sub.equals("Infinity"))

to

if (s.regionMatches(start, "Infinity", 0, 8))

But that should be
if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))

Sory for troubles, Igor





290c290
<             if (s.regionMatches(start, "Infinity", 0, 8))
---
>             if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))
2001-01-16 20:20:36 +00:00
nboyd%atg.com b3d6830b8b Expand tutorial. 2001-01-16 15:24:23 +00:00
nboyd%atg.com 4d54695ee1 Fix 64788 Make method invocation 10x faster with following code.... 2001-01-14 01:19:58 +00:00
beard%netscape.com 0ef1cd4d6e Keeping up with current Rhino sources. Removed Frame.java, Added DebugFrame.java, DebuggableEngineImpl.java. 2001-01-12 20:42:17 +00:00
nboyd%atg.com bbae607060 Update comment; operator is part of ECMA. 2001-01-12 16:30:04 +00:00
nboyd%atg.com 1e13a69fde Add removeThreadLocal method. 2001-01-12 16:29:26 +00:00
nboyd%atg.com 8ca97fa895 Fix infinite loop in example. 2001-01-12 16:28:36 +00:00
nboyd%atg.com b8ac59c406 Subject:
Re: Debugger problem
        Date:
             Mon, 08 Jan 2001 14:16:30 -0800
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             Kurt Westerfeld <kurt@ManagedObjects.com>
         CC:
             Norris Boyd <nboyd@atg.com>
  References:
             1 , 2 , 3




Kurt, Norris,

Yes, with the change to the shell this should be possible.  The problem before
was that if you loaded the same file with different relative path names, two
different windows in the debugger were created because everything (windows,
breakpoints, etc) is keyed off the source name.

The attached file contains the fix (and includes the workaround for
Desktop.getSelectedFrame).

There are still some bugs in transferring focus between the windows in the
Desktop.  I haven't had time to track down the problem or a solution.

Chris

Kurt Westerfeld wrote:

> I would point out that "Source Name" of a script isn't necessarily a
> filename.  In our system, scripts are run remotely from a script library
> that has no file system backing.  Canonicalizing the file names is really
> unnecessary.
>
> Can't you just modify JSDebugger to not care what the name of the file is?
> If access to the original script is unavailable except through the file
> system, I'd be surprised.
>
> ----- Original Message -----
> From: Christopher Oliver <coliver@mminternet.com>
> To: Kurt Westerfeld <kurt@ManagedObjects.com>
> Cc: Norris Boyd <nboyd@atg.com>
> Sent: Sunday, January 07, 2001 2:23 AM
> Subject: Re: Debugger problem
>
> > Hi Kurt,
> >
> > I rather would say that it is a problem with the processFile method in the
> > shell's Main class.  If you change the current working directory or the
> value
> > of the System property "user.dir" after compiling a script, relative path
> names
> > can become ambiguous.  Norris, would it be ok to modify the shell to
> > "canonicalize" the names of files it compiles?  That way the source name
> that
> > shows up in the stack and in DebuggableScript will always be unique.  For
> > example:
> >
> > public static void processFile(Context cx, Scriptable scope,
> >                                    String filename)
> >     {
> >             Reader in = null;
> >             try {
> >                 in = new PushbackReader(new FileReader(filename));
> >                 int c = in.read();
> >                 // Support the executable script #! syntax:  If
> >                 // the first line begins with a '#', treat the whole
> >                 // line as a comment.
> >                 if (c == '#') {
> >                     while ((c = in.read()) != -1) {
> >                         if (c == '\n' || c == '\r')
> >                             break;
> >                     }
> >                     ((PushbackReader) in).unread(c);
> >                 } else {
> >                     // No '#' line, just reopen the file and forget it
> >                     // ever happened.  OPT closing and reopening
> >                     // undoubtedly carries some cost.  Is this faster
> >                     // or slower than leaving the PushbackReader
> >                     // around?
> >                     in.close();
> >                     in = new FileReader(filename);
> >                 }
> >                 filename = new java.io.File(filename).getCanonicalPath();
> > <<<====== Add this
> >             }
> >             catch (FileNotFoundException ex) {
> >                 Context.reportError(ToolErrorReporter.getMessage(
> >                     "msg.couldnt.open",
> >                     filename));
> >                 exitCode = EXITCODE_FILE_NOT_FOUND;
> >                 return;
> >             } catch (IOException ioe) {
> >                 globalState.getErr().println(ioe.toString());
> >             }
> >
> >             // Here we evalute the entire contents of the file as
> >             // a script. Text is printed only if the print() function
> >             // is called.
> >             evaluateReader(cx, scope, in, filename, 1);
> >     }
> >
> >
> > Attached is *my* latest version of the debugger code.  Norris, have you
> made
> > any progress on cvs commit priveledges?  The attached version fixes a
> number of
> > GUI bugs:
> >
> > 1) If you undocked the Variables window and popped up the Context
> combo-box and
> > then closed the window with the system menu, the Context pop-up was not
> cleaned
> > up properly.
> > 2) The first time you minimize a file window it appeared to dissappear
> when you
> > tried to restore it.  This was due to the fact that I forgot to "pack" its
> > contents and as a result its requested size was 0x0.
> >
> > I also added a menu item to toggle whether to break on exceptions and one
> which
> > allows you to open (and compile) a JavaScript file without actually
> executing
> > it.
> >
> > I have also attached a Word document with some basic documentation for the
> > Debugger.
> >
> > Note that this version also includes all the changes to support debugging
> > scripts in the AWT dispatch thread.
> >
> > Chris
> >
> > Kurt Westerfeld wrote:
> >
> > > Hello.  I ran into a null pointer exception in JSDebugger tonight, and I
> > > thought I'd drop you a note.
> > >
> > > The problem line is 2336, where a breakpoint is hit.  To simulate, load
> the
> > > debugger using the command line syntax on a file that has not been
> resolved
> > > to cannonical path.
> > >
> > > Example,
> > >
> > >      jshell -debug -f \myfile.fs
> > >
> > > At any rate, the "handleCompilationDone" routine takes \myfile.fs and
> turns
> > > it into a canonical path.  If you hit a breakpoint in this file and say
> > > "go", when the breakpoint hits the file is not found, because the same
> > > canonical path resolution is not done.  The resolution seems dubious,
> since
> > > it is only done in the compilation done callback, but I don't know the
> best
> > > way to suggest a fix since it seems that code had some purpose.
> > >
> > > Anyway, thought you'd wanna know.
> > >
> > > ________________________________________________________________________
> > >   Kurt Westerfeld
> > >   Senior Software Architect
> > >   Managed Objects
> > >   mailto:kwester@ManagedObjects.com
> > >   703.770.7225
> > >   http://www.ManagedObjects.com
> > >
> > >   Managed Objects: manage technology > rule business
> >



   JSDebugger.java

                    Name:
                          JSDebugger.java
                    Type:
                          Java Class File (java/*)
                 Encoding:
                          base64
2001-01-09 14:10:40 +00:00
nboyd%atg.com 864bb13d47 Missed checkin of new file. 2001-01-09 13:39:22 +00:00
nboyd%atg.com cbf2c6d0b4 Clean up debug APIs.
* Make use of DebuggableEngine interface to keep Context API smaller
* Change org.mozilla.javascript.debug.Frame to DebugFrame to avoid
  confusion with java.awt.Frame
2001-01-08 21:41:25 +00:00
nboyd%atg.com 05afc92b5d Fix for 1.1 compatibility. 2001-01-08 14:34:21 +00:00
nboyd%atg.com db930451b8 Fix classloader problem from last checkin. 2001-01-08 02:13:28 +00:00
nboyd%atg.com 1de208b764 Canonicalize file names to help debugger. 2001-01-08 02:12:52 +00:00
nboyd%atg.com 59adb03eb5 Latest changes from Chris Oliver. 2001-01-08 01:43:28 +00:00
nboyd%atg.com cb3ce5e5aa Revert to old object identity for equality per ECMA. 2001-01-08 01:03:23 +00:00
nboyd%atg.com 0298ab90eb For == use .equals after unwrapping. 2001-01-05 20:00:47 +00:00
nboyd%atg.com 07b81a65d3 Fix bug 64397. 2001-01-05 19:15:59 +00:00
nboyd%atg.com 0e1266c7d4 Email thread describing change:
Subject:
             Re: Rhino bug - Wrapper ??
        Date:
             Fri, 05 Jan 2001 03:46:11 +0530
       From:
             Mukund Balasubramanian <mukund@cs.stanford.edu>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1 , 2 , 3 , 4 , 5 , 6




That works too,
    Should I assume that this would be a part of the next tip ? I agree with the
part about
overloading code too.

    Anyways, thanks a load for your help and just tell me if I could be of any
help in any other
respects of the rhino project.

ThanX,

Mukund Balasubaramanian

Norris Boyd wrote:

> Actually, I was considering removing the unwrapping code from
NativeJavaConstructor. I was
> suprised that it was there. The code dates from before we implemented proper
method and
> constructor overloading in Rhino. It's the overloading code that should have
the responsibility
> for unwrapping.
>
> Does this patch work for you:
>
> Index: NativeJavaObject.java
> ===================================================================
> RCS file:
/cvsroot/mozilla/js/rhino/org/mozilla/javascript/NativeJavaObject.java
> ,v
> retrieving revision 1.29
> diff -u -r1.29 NativeJavaObject.java
> --- NativeJavaObject.java       2000/11/13 22:10:32     1.29
> +++ NativeJavaObject.java       2001/01/04 21:33:55
> @@ -673,6 +673,12 @@
>
>                  return Result;
>              }
> +            else if (value instanceof Wrapper) {
> +                value = ((Wrapper)value).unwrap();
> +                if (type.isInstance(value))
> +                    return value;
> +                reportConversionError(value, type);
> +            }
>              else {
>                  reportConversionError(value, type);
>              }
>
> This handles the case where the object is both a Scriptable and a Wrapper.
>
> --N
>
> Mukund Balasubramanian wrote:
>
> > Yes they do implement Scriptable.
> >     From my preliminary inspection of the code, findFunction seems to be
preceediong the
> > coerceType call and I presume findFunction call is going to fail if the
arguments are
> > wrapped (bad types mismatching signature).
> >     The constructor case DOES go through an explicit unwrapping stage as
shown by the cut
> > and paste code. My question is whether the same preamble in NativeJavaMethod
is a valid bug
> > fix.
> >
> > ThanX,
> >
> > Mukund Balasubramanian
> >
> > Norris Boyd wrote:
> >
> > > Do your objects that implement Wrapper also implement Scriptable? From
simple inspection
> > > of the code I'd think that both the constructor and method cases would go
through
> > > NativeJavaMethod.coerceType, which should unwrap. However, Scriptable
objects are picked
> > > off and handled before any unwrapping is considered.
> > >
> > > --N
> > >
> > > Mukund Balasubramanian wrote:
> > >
> > > > Yup,
> > > >     Here it is - Line numbers 173-178 are cut and paste from
> > > > NativeJavaConstructor.java inside NativeJavaMethod.java
> > > >
> > > > /*** Call in NativeJavaMethod.java
> > > >     public Object call(Context cx, Scriptable scope, Scriptable thisObj,
> > > >                        Object[] args)
> > > >         throws JavaScriptException
> > > >     {
> > > >         // Eliminate useless args[0] and unwrap if required
> > > >         for (int i = 0; i < args.length; i++) {
> > > >             if (args[i] instanceof Wrapper) {
> > > >                 args[i] = ((Wrapper)args[i]).unwrap();
> > > >             }
> > > >         }
> > > >
> > > >   // Find a method that matches the types given.
> > > >         if (methods.length == 0) {
> > > > ****/
> > > >
> > > > Is this correct ? I presume it is because of the fact that the
constructor
> > > > does this.
> > > >
> > > > Any luck with my other question regarding generalizing the WrapHandler
to all
> > > > objects (including those returned by scriptable) and not only those
returned
> > > > through nativeJava***
> > > >
> > > > ThanX,
> > > >
> > > > Mukund Balasubramanian
> > > >
> > > > Norris Boyd wrote:
> > > >
> > > > > Could you post your proposed patch?
> > > > >
> > > > > Thanks,
> > > > > Norris
> > > > >
> > > > > Mukund Balasubramanian wrote:
> > > > >
> > > > > > Hi all,
> > > > > >     I am trying to play around with writing a custom WrapHandler for
my
> > > > > > Java objects in Rhino. I found WrapHandler very useful.
> > > > > >     Now I am stuck at a point where, even though my wrappers
implement
> > > > > > "Wrapper", they get unwrapped only on calles to Constructors using
> > > > > > Liveconnect. Normal methods dont seem to be doing any unwrapping.
> > > > > > Managed to build rhino with a bug fix (cut and paste code from
> > > > > > NativeJavaConstructor to NativeJavamethod), and it works.
> > > > > >     Just wanted to verify if it is a known bug (while I wait for
> > > > > > bugzilla to mail me a passwd).
> > > > > >
> > > > > > BTW, also found something interesting, WrapHandler gets called only
when
> > > > > > the object is returned from NativeJava***, not ANY Object. Is that
the
> > > > > > way it is supposed to work ??
> > > > > >
> > > > > > ThanX for any help,
> > > > > >
> > > > > > Mukund Balasubramanian
2001-01-05 01:17:51 +00:00
mccabe%netscape.com ce1033908e Oops. Removing unneeded 'System.err.println("foo")'. 2001-01-04 00:03:00 +00:00
mccabe%netscape.com 9f3e15aaf5 Fix to 64149.
Propagate lexer fixes from Monkey to accept (and warn) about 008 as well as just 08.
2001-01-03 23:36:33 +00:00
nboyd%atg.com 2e691de2e6 Get rid of BSF file in Rhino code. Just rely upon building BSF ourselves for now. 2001-01-03 20:54:37 +00:00
nboyd%atg.com e86e0fd5b5 Nope, 8 was right. 2000-12-20 13:31:59 +00:00
nboyd%atg.com 4674ece3c9 Off by one error fixed. 2000-12-18 19:32:00 +00:00
nboyd%atg.com cdc056a04a Add ContextListener to API classes. 2000-12-18 19:30:26 +00:00
nboyd%atg.com 87a029eeb9 Fix bug:
Subject:
             [Rhino] Script compiler bug?
        Date:
             Tue, 12 Dec 2000 22:08:23 GMT
       From:
             dave russo <d-russo@ti.com>
 Organization:
             Deja.com
 Newsgroups:
             netscape.public.mozilla.jseng




The following script does not seem to compile properly (using Rhino
1.5R1):

test.js:
var test = {};
test.foo = function () { print('foo')}
test.bar = function () { print('bar')}

After compiling test.js ("java org.mozilla.javascript.tools.jsc.Main
test.js"):

js> loadClass('test')
js> test.foo()
bar
js> load('test.js')
js> test.foo()
foo

Note that changing test.js to read:

var test = {};
test.foo = function foo() { print('foo')}
test.bar = function bar() { print('bar')}

Works around the problem.  Is there a problem with anonymous functions?


Sent via Deja.com
http://www.deja.com/
2000-12-13 15:17:24 +00:00
nboyd%atg.com 2504e1cfd0 Missed call to "in" needing parameter change. 2000-12-13 14:47:27 +00:00
nboyd%atg.com c87949e3b4 Support single-letter bean properties. 2000-12-12 20:29:06 +00:00
nboyd%atg.com 70ff180f2f Fix test case failures with RegExp constructor (new tests) 2000-12-12 15:19:36 +00:00
nboyd%atg.com 4f6ace3554 Fix ArrayIndexOutOfBoundsException on "new RegExp()" 2000-12-12 14:51:55 +00:00
nboyd%atg.com 5e0b2ebaed Fix 62559, 58479 2000-12-12 14:35:38 +00:00
nboyd%atg.com 619fce4329 fix javadoc 2000-12-12 01:48:53 +00:00
nboyd%atg.com 073df548cd Fix bug where "a = new Array[3]" would produce an IndexOutOfBoundsException 2000-12-10 18:33:52 +00:00
mccabe%netscape.com ef122d5552 Fix to 58120 - Rhino's Date.prototype.setYear wasn't converting from internal UTC time to local time before working with the date, resulting in new dates that were off by the current timezone offset. Adding a LocalTime call fixes it.
Thanks to David Flanagan <david@oreilly.com> for catching this.
2000-12-07 09:21:45 +00:00
nboyd%atg.com 20c82f88e9 Add construction of Counter from Java 2000-12-05 16:42:39 +00:00
nboyd%atg.com 108f24ebcf Fix bug 61979 2000-12-05 16:06:20 +00:00
nboyd%atg.com 86d5be2297 Fix bug 60093 2000-12-05 16:04:32 +00:00
mccabe%netscape.com 2dbc59dbed Remove unused property definitions and fix some errors that had crept in. 2000-11-29 23:32:53 +00:00
mccabe%netscape.com 0c5501eef0 Twiddle Make usage message. 2000-11-29 22:36:06 +00:00
mccabe%netscape.com 559fa4d1eb Restore toplevel Makefile (with an added note in the usage message about it's new limitations wrt debugger and bsf) and update the js library makefile to account for changed files. 2000-11-28 21:24:41 +00:00
nboyd%atg.com e297628504 Fix bug 61267. 2000-11-28 16:23:24 +00:00
beard%netscape.com a6859a2ef4 Keep JDK 1.1 compatible. 2000-11-27 23:40:15 +00:00
nboyd%atg.com bf6799f305 Sense JDK1.3 dependencies. 2000-11-27 22:23:40 +00:00
nboyd%atg.com b3de2be49d Add hasProperty and use it for the 'in' operator 2000-11-27 17:46:56 +00:00
nboyd%atg.com 26ab0bb603 Fix 19734, accepting patch 2000-11-27 15:13:35 +00:00
nboyd%atg.com 0c163f803c Switch to ant for building. 2000-11-27 15:04:48 +00:00
nboyd%atg.com 0c1b050f8c Add debugger contribution from Christopher Oliver. 2000-11-27 15:00:45 +00:00
beard%netscape.com 456312842b importable XML project for CWPro6. 2000-11-23 04:27:33 +00:00
beard%netscape.com 07a119a7ed removed import of non-existent org.mozilla.javascript.tools.debugger.* package. 2000-11-23 04:24:34 +00:00
nboyd%atg.com e2c5be11b5 * Add ContextListener interface
* Add ability to access shell functions from compiled scripts, and to
  add shell functions to embedded apps more easily
2000-11-22 15:00:05 +00:00
nboyd%atg.com 428ac32f72 Merge debugger changes into trunk. 2000-11-20 16:16:32 +00:00
nboyd%atg.com 439a621e0a Fix for updated filename. 2000-11-20 14:44:56 +00:00
nboyd%atg.com 0d26acf3ed timestamping file 2000-11-18 02:24:06 +00:00
nboyd%atg.com ec7864e0d5 Add support in Rhino for BSF without the bsfengines.jar. 2000-11-18 02:14:46 +00:00
nboyd%atg.com 571a5c5624 Fix 60184, and add SwingApplication.js example, with change
to shell to prevent early exit.
2000-11-17 13:05:46 +00:00
nboyd%atg.com 88a011def8 Subject:
[Rhino] importPackage() when not in Rhino shell?
        Date:
             Tue, 14 Nov 2000 09:37:39 -0000
       From:
             "Benjamin Geer" <geerb@midas-kapiti.com>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




The importPackage() and importClass() functions provided by the Rhino shell
seems as if they would be very generally useful.  Unless I've missed
something, they don't seem to be available to scripts compiled using the
JavaScript compiler, or to scripts that are run using Script.exec().  Is
there any chance these functions could be made available for all scripts to
use?  This would save a lot of typing; one could then always write a = new
Foo() instead of a = new Package.com.baz.bar.foo.Foo().

--Benjamin Geer
2000-11-14 20:10:42 +00:00
nboyd%atg.com 0c77e5b5dc Update javadoc. 2000-11-14 20:08:53 +00:00
nboyd%atg.com f66f393b8d Fix bug:
slobo@espial.com wrote:
>
> Hello Mike
>
> In the following test case, tester returns "undefined cat" in Rhino
> while in NN it returns "meow cat".
>
> Thanks
>
> Steven
>
> /////////////////////////////////////////////////////////////////////
> function tester(nest){
>     var nest = nest+" cat";
>     alert(nest);
>     // nest now contains the value undefined.
> }
>
> tester("meow");
2000-11-14 13:30:55 +00:00
nboyd%atg.com d550dceb79 Subject:
More changes to support non NativeJavaObject wrappers
   Date:
        Fri, 03 Nov 2000 17:56:38 +0100
   From:
        Igor Bukanov <igor@icesoft.no>
     To:
        nboyd@atg.com




Hi, Norris,

In post 1.5 rhino one can introduce own wrappers for arbitrary Java
objects. But I think to fully support this
org.mozilla.javascript.ScriptRuntime should be changes as well: its eq
and shallow_eq contain references to NativeJavaObject, this should be
replaced at least to Wrapper (see the atached patch). Even better
solution would be to add to WrapHandler methods to compare wrappers: I
can send a patch for that as well.

There is a small usability problem as well: if
org.mozilla.javascript.JavaMembers would be public I do not need to copy
it to a package with non NativeJavaObject.java wrapper.

Regards, Igor
2000-11-13 22:10:35 +00:00
nboyd%atg.com 629043f2b8 Clean up debug APIs 2000-11-07 03:20:56 +00:00
mccabe%netscape.com ca67aac5d5 Fix to 58008. Add missing ECMA-specified fuctions Date.prototype.toDateString, toTimeString, toLocaleDateString, toLocaleTimeString. Commoned some code to toLocale_helper and date_format.
Also make several formerly class static variables lazily initialized.
2000-11-03 21:28:49 +00:00
nboyd%atg.com c82387d076 Upgrade to Ant 1.2 and remove deprecated tasks. 2000-11-01 18:43:55 +00:00
nboyd%atg.com 2a73169e97 Fix bug 57060 for/in loop enumerates array elements as numbers, not strings 2000-10-30 19:46:02 +00:00
nboyd%atg.com 0470e048ab Fix bugs:
56318  function literals with names don't work right
57045  negative integers as object properties: weird behavior
58479  functions defined within conditional phrases are always crea
2000-10-30 19:34:11 +00:00
nboyd%atg.com 13c17e9f43 Fix formatting 2000-10-29 18:07:26 +00:00
nboyd%atg.com af79f7675a Add javadoc. 2000-10-27 20:17:56 +00:00
nboyd%atg.com 577b2d7b62 Fix tree and icode printing. 2000-10-27 20:17:19 +00:00
nboyd%atg.com 116febeef1 Subject:
[Rhino] Optimization for OptRuntime.thisGet
        Date:
             Mon, 23 Oct 2000 17:50:53 +0200
       From:
             Hannes Wallnoefer <hannes@helma.at>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




I found a little oddity in
org.mozilla.javascript.optimizer.OptRuntime.thisGet().

get() is called twice on thisObj, once right at the beginning, and once
when starting to walk down the prototype chain. Below is what I think
this should look like - the prototype walk now begins with thisObj's
prototype, if it exists.

Also, (thisObj == null) was checked only after thisObj.get() was called,
so I moved that up in front.

Hannes
PS: I just made the changes in the news msg editor, so there may be
stupid mistakes.
2000-10-23 17:48:27 +00:00
nboyd%atg.com 006574d547 Subject:
updated Global, Main and ImporterTopLevel
   Date:
        Mon, 23 Oct 2000 14:37:45 +0100
   From:
        Matthias Radestock <matthias@lshift.net>
     To:
        nboyd@atg.com




Norris,

I've made some more changes to shell.Main and shell.Global in order to
reduce their mutual dependency, enable "quit" and get "load" to operate
in the local scope.

see attachments for updated .diffs.


Matthias.
2000-10-23 15:55:42 +00:00
beard%netscape.com 26cffce30e Fixed typo in package target. 2000-10-23 15:44:05 +00:00
nboyd%atg.com ca002f3c20 Fix 56883. 2000-10-23 14:31:05 +00:00
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