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

734 Коммитов

Автор SHA1 Сообщение Дата
nboyd%atg.com b42e37107b Try to tweak getting the change propagated to the web site. 2001-08-03 13:55:31 +00:00
nboyd%atg.com 9e1e01f617 New version number. 2001-08-01 20:46:46 +00:00
nboyd%atg.com 3df003a114 Update for 1.5R2 release. 2001-07-30 19:30:07 +00:00
nboyd%atg.com a0b6deb251 Updates for 1.5R2. 2001-07-27 14:12:03 +00:00
nboyd%atg.com bf90b94ec7 Subject:
Re: Rhino 1.5R2 release candidate
        Date:
             Fri, 13 Jul 2001 22:52:43 -0700
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             Norris Boyd <nboyd@atg.com>
  References:
             1




Hi Norris,

Attached are some (final?) changes to the debugger:

- Display NativeCall objects as "[object Call]" in this/locals tree-tables
- Fixed "Go to Function" to highlight the target function in the source
window
- Synchronized ContextListener implementation
- Added slightly more useful tooltips to the tool bar

Note I modified files from today's rhinoTip.zip.  Hopefully they were
identical to those in the cvs release branch.

Chris
2001-07-14 17:17:35 +00:00
nboyd%atg.com bd4398308e Subject:
Rhino: deal with all Throwables in Interpreter.interpret
        Date:
             Thu, 12 Jul 2001 14:27:34 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




The attached patch modifies the catch code in Interpreter.interpret to
catch general Throwable exceptions to allow cleanup after throwing an
Error instance from Context.observeInstructionCount.
===================
Subject:
             Rhino: change of InterpreterData.itsLineNumberTable from Hahstable to
             UintHash
        Date:
             Thu, 12 Jul 2001 15:51:38 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




The patch linetable_patch changes InterpreterData.itsLineNumberTable
from Hahstable to UintHash and debug/DebuggableScript.java to return
int[] array instead of Enumeration. It was run produced via
diff -ru javascript.0 javascript

The patch debugger_patch contains update for
toolsrc/org/mozilla/javascript/tools/debugger/Main.java to reflect above
api changes.
===============================
Subject:
             Rhino: patch not to store VariableTable in InterpreterData
        Date:
             Thu, 12 Jul 2001 16:34:18 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




The patch removes the "VariableTable itsVariableTable" field from
InterpreterData so it would not be stored in
InterpretedFunction/InterpretedScript and could be garbage collected
after interpreter byte code generation is finished. The usage of
theData.itsVariableTable it Interpreter.interpret is replaced by
accessing argNames/argCount fields from the passed NativeFunction.
2001-07-13 13:53:40 +00:00
nboyd%atg.com 08f4af156e Fix bug:
Subject:
             Fatal error executing in IBM J9 VM
 Resent-Date:
             Mon, 9 Jul 2001 15:35:32 -0700 (PDT)
 Resent-From:
             mozilla-jseng@mozilla.org
        Date:
             9 Jul 2001 15:33:38 -0700
        From:
             bdemchak@tpsoft.com (Barry Demchak)
 Organization:
             http://groups.google.com/
          To:
             mozilla-jseng@mozilla.org
  Newsgroups:
             netscape.public.mozilla.jseng




Hi --

I've encountered an error in either Rhino or the IBM J9 VM's runtime
support -- I'm not sure which -- but the end result is an unhandled
exception. I'm quite willing to believe that it's already been dealt
with. If so, will someone point me to the solution?

I'm using: IBM's J9 on Windows 2000,
           IBM's IDE v1.3 on Windows 2000,
           Rhino v1.5 from mozilla.org

The exception is java.lang.StringIndexOutOfBoundsException.

It occurs in Context.getSourcePositionFromStack just after the call to
RuntimeException.printStackTrace. The code is expecting a code
reference that looks something like "(Example.js:50)" where "50" is
the line number. (I gather that's what the Sun VM returns???)

Instead, J9 is returning a code reference that looks like:
"java.lang.RuntimeException\n\n\n\nStack trace:\n\n
java/lang/Throwable.<int>()V\n\n" etc, etc, etc.

The error occurs because the Colon variable's value is less than the
Open variable's value in Context.getSourcePositionFromStack. When the
s.substring is evaulated, there's a negative string length ... boom.

I've patched an "if" statement in the getSourcePositionFromStack code
so that instead of:

if (c == '\n' && open != -1 && close != -1 && colon != -1)

I have:

if (c == '\n' && open != -1 && close != -1 && colon != -1 && open <
colon && colon < close)

Certainly, there's a better fix, but it's sufficient to keep me going.

So, I have several questions ... being new to open source and this
forum:

1) Is this a real bug ... a real Rhino bug??
2) Has this already been found?
3) Has this already been fixed?
4) If not, what's the proper protocol for reporting it?
5) What's the proper protocol for fixing it?

This shows up *very* quickly when trying to run a script under J9.
When it occurs, Rhino is trying to issue a warning about some shady
JavaScript code.

If this is a real bug and hasn't been fixed, I would infer that there
aren't a lot of people trying to run this under J9. Would that be a
fair statement? If so, can anyone comment as to why that would be??

Thanks!
2001-07-12 00:07:27 +00:00
nboyd%atg.com 0ee98640dd Subject:
Rhino: Fixes for catch in Interpreter.interpret
        Date:
             Wed, 11 Jul 2001 19:06:46 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




Hi, Norris!

When doing that instruction counting implementation, I managed to mess
up code in the catch statement in Interpreter.interpret.

First for some reason I assumed that for a general RuntimeException the
previous code do not run finally statements but only script catch code.
Of cause this was wrong: that code skipped catch for arbitrary exception
while calling finally.

This is a reasonable behavior especially given the fact that arbitrary
RuntimeException may only arise from, say, bugs, other exceptions should
be wrapped to JavaScriptException.

Second I removed calls to debug.handleExceptionThrown...

The attached patch restores the original catch/finally logic and re-adds
calls to debug.handleExceptionThrown.

I will later update it that catch to handle Error as well to allow
cleanup after throwing an Error instance from
Context.observeInstructionCount , but restoration should go first.

Regards, Igor
2001-07-12 00:06:27 +00:00
nboyd%atg.com f7a0fa338c Fix bug 49286 "try/catch within JavaScript not working as expected"
Also, accept patches from Igor:

Subject:
             Rhino: UintMap optimization
        Date:
             Fri, 06 Jul 2001 13:14:49 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




Hi, Norris!

Currently omj.Node uses Hashtable to map int property types to
objects/integer. In my opinion this is very inefficient: to store single
int property it creates 5 objects: one for property Hahstable, 2 Integer
wrappers for property/value, array to sore Hahstable slots and Hashtable
slot itself. To fix this I added omj.UintMap class that can map
non-negative integers to objects or integers and modified omj.Node to
use it. The class is a hashtable implementation that uses one int[] and
one Object[] arrays to store keys/values and Object[] array is not
created if the map contains only integers.

To take full advantage of omj.UintMap code has to be modified to use
Node.getIntProp/Node.putIntProp to store int properties, but even in
this form it is a win.

I can provide patches to use Node.getIntProp/Node.putIntProp and UintMap
for InterpreterData.itsLineNumberTable if this is OK.

Regards, Igor
2001-07-10 17:30:16 +00:00
nboyd%atg.com 5e9bc346cb Date:
Mon, 02 Jul 2001 12:58:44 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




Hi, Norris!

It turned out that in our browser implementation we need to be able to
abort too-long-running scripts. I implemented that for interpreter mode
via instruction counter callback. This callback is called at branch
points after instruction counter reach certain threshold as you
suggested once in mozilla-jseng mail list. The attached patch adds to
Context.java:
        public int getInstructionObserverThreshold() {
                return instructionThreshold;
        }

        public void setInstructionObserverThreshold(int threshold) {
                instructionThreshold = threshold;
        }

        protected void observeInstructionCount(int instructionCount) {}
...
        int instructionCount;
        int instructionThreshold;


where observeInstructionCount is a callback that should be overwritten
in a custom Context to observe execution.

Then as long as instructionThreshold is not 0 modifications to
Interpreter.java increase instructionCount at branches/function
calls/catch blocks and call cx.observeInstructionCount when it reaches
instructionThreshold. I also replaces 3 catch statements in
Interpreter.interpret for EcmaError, JavaScriptException and
RuntimeException by single one to reduce code duplication.

The patch lacks documentation in Context.java but I would add that later
if the patch is ok.

Regards, Igor

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


Subject:
        Re: Working for Rhino
   Date:
        Tue, 3 Jul 2001 10:41:42 +0200
   From:
        felix.meschberger@day.com
     To:
        Norris Boyd <nboyd@atg.com>




Hi Norris,

Well, I couldn't wait ;-) Here are my diffs :

   LazilyLoadedCtor: Make class and constructor public for use on my host
   objects
   NodeTransformer : Replace checks for "arguments" by call to
   checkActivationNeeded() in Context
   Context: Add the name list proposed as a hashtable with
   adder/checker/remover methods

Hope this helps. Regards
Felix
2001-07-05 02:08:14 +00:00
nboyd%atg.com 61f8164eba Fix following bug:
Subject:
             Re: Rhino: [[DefaultValue]] missing for Call object
 Resent-Date:
             Mon, 2 Jul 2001 08:52:07 -0700 (PDT)
 Resent-From:
             mozilla-jseng@mozilla.org
        Date:
             Mon, 02 Jul 2001 11:49:59 -0400
        From:
             Norris Boyd <nboyd@atg.com>
 Organization:
             Art Technology Group
          To:
             Christopher Oliver <coliver@mminternet.com>
         CC:
             mozilla-jseng@mozilla.org
  References:
             1




I believe the correct result of the script should be

[object global]
[object Object]
[object global]

The activation object (which goes by the name of "Call" for historical
reasons) should never be the 'this' value in a function call. See "10.1.6
Activation Object" in the ECMA spec.

I'll look at fixing the problem for Rhino. If there's agreement on my
analysis, someone should fix this for Spidermonkey too.

--N

Christopher Oliver wrote:

> Hi,
>
> function a() {
>     function b() {
>          print(this);
>     }
>     this.f = function() {
>          print(this);
>          b();
>     }
>     b();
> }
>
> var a = new a();
> a.f();
>
> Running the above script with SpiderMonkey produces:
>
> [object global]
> [object Object]
> [object Call]
>
> Running with Rhino produces the following exception:
>
> uncaught JavaScript exception: undefined: Cannot find default value for
> object. (line 3)
>
> This is due to a bug in org.mozilla.javascript.NativeCall which doesn't
> implement toString or valueOf or override getDefaultValue.
> However, even after I hacked in an implementation of getDefaultValue in
> NativeCall, Rhino still produces a different result then spidermonkey:
>
> [object Call]
> [object Object]
> [object Call]
2001-07-03 02:19:51 +00:00
nboyd%atg.com 079d7bea96 Subject:
Re: Bug in RhinoTip
 Resent-Date:
             Sat, 30 Jun 2001 11:45:38 -0700 (PDT)
 Resent-From:
             mozilla-jseng@mozilla.org
        Date:
             Sat, 30 Jun 2001 20:54:21 +0200
        From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
          To:
             nboyd@atg.com
         CC:
             Christopher Oliver <coliver@mminternet.com>, mozilla-jseng@mozilla.org
  References:
             1




Christopher Oliver wrote:

> Hi,
>
> I noticed the following in today's rhinoTip:
>
> js> throw 100
> js: uncaught JavaScript exception: java.lang.Object@5d601f
>
> js> throw 200
> js: uncaught JavaScript exception: java.lang.Object@5d601f
>
> js> throw i = 100
> js: uncaught JavaScript exception: 100



The attached patch to omj/Interpreter.java fixes that: I forgot to check
for stack[stackTop] == DBL_MARK during throw when implemented
interpreter optimization to minimize number of created Double instances.

I think that example should go to the test suite in a form like:
try { throw 100; } catch (ex) { return ex == 100; }

Regards, Igor
2001-07-02 14:00:00 +00:00
nboyd%atg.com 9a8d2c2e41 In case of exceptions creating optimizer, just use interpreter. 2001-07-02 13:59:09 +00:00
nboyd%atg.com 99d9b052fd More liberal rules for default value conversions for java objects. 2001-07-02 13:58:17 +00:00
nboyd%atg.com b7d911651e Subject:
Bugfix to Rhino Debugger
        Date:
             Sat, 30 Jun 2001 06:09:44 -0700
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             nboyd@atg.com




Hi Norris,

Attached is a fix to a problem I encountered with the Rhino debugger.
Apparently some recent changes to the engine broke the debugger because
the debugger wasn't  acquiring a Context before making certain engine
calls like ScriptableObject.getIds().  You can see this by stepping
through the "enum.js" example and expanding the variable "elements".
The below exception trace will be printed on the debugger console.  The
attached file should fix this problem.

Chris

Subject:
             Another fix to VariableModel.java
        Date:
             Sat, 30 Jun 2001 07:33:51 -0700
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             nboyd@atg.com




Hi Norris,

I modified this file to always call Context.toString() to display a
variable's value in the the tree table.  Previously it only called it
for Scriptables and the toString() method of the object otherwise.  This
caused for example JavaScript "2" to be displayed as "2.0".

Chris
2001-07-02 13:55:20 +00:00
nboyd%atg.com ddaaaa90cc Updates from Christopher Oliver. 2001-07-02 13:50:23 +00:00
nboyd%atg.com a3ebe88fb9 Subject:
Rhino: speed optimization in omj/Interpreter.java
        Date:
             Tue, 26 Jun 2001 21:06:56 +0200
       From:
             Igor Bukanov <igor@icesoft.no>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




Hi, Norris!

The attached Interpreter_patch contains a speed optimization patch that
tries to avoid creation of Double objects by keeping a parallel stack
for double values: instead of putting Double to the stack, DBL_MRK is
put and the real value is put to double stack (sDbl). Then when reading
stack with DBL_MRK, the double value from the double stack is used
wrapped to Double object when necessary. In addition local and vars
arrays are merged to stack array.

The attached before.txt and after.txt contain results of typical runs of
mozilla/js/benchmarks/all_bench.js before and after optimization on my
PC: Athlon 650/Red Hat 7.0/JDK 1.3.0 from Sun .

In number of cases the optimization actually slow down the executionby
5-10% (I guess due to the checks for DBL_MRK), but mostly it is a nice
sped up often by factor of 2 ot more with overall optimization win: 267
versus 218 seconds.

I guess it is possible to apply the same optimization to the optimizer
package, but in our browser we use strictly interpreter mode. Also by
changing signature of call/construct methods in Scriptable it is
possible to avoid creation of almost all objects currently allocated
during method calls, but that is for far future.

Regards, Igor
2001-06-28 14:28:19 +00:00
nboyd%atg.com 83d7acfbb7 Hi Norris, Simon,
I looked into this somewhat and I noticed the following:

1) There is a bug in Interpreter.java, line 1695. It sets the variable "i" to
the line number of the special call, but overwrites it on line 1699.  It then
passes this value to ScriptRuntime.callSpecial
2) In "generateScriptICode" in Interpreter.java the variable
itsData.itsSourceFile fails to be set to itsSourceFile.  This causes a null
source file name to be passed to handleCompilationDone when "Widget.js" is
compiled.  That is why you
initially see "<stdin>, line 6" when the debugger comes up (the debugger
interprets a null source name as "stdin").  I simply modified it as follows
(this might not be the right thing to do?):

  private InterpretedScript generateScriptICode(Context cx,
                                                  Scriptable scope,
                                                  Node tree,
                                                  Object securityDomain)
    {
        itsSourceFile = (String) tree.getProp(Node.SOURCENAME_PROP);
        itsData.itsSourceFile = itsSourceFile;
        ...

and that corrected the problem.

However there seems to be no way for the debugger to detect that the script
passed to handleCompilationDone() is the argument of an "eval()". So I modifed
NativeGlobal.evalSpecial() to munge the filename to indicate this (by appending
"(eval)" to it).  That way a separate window is created in the debugger to hold
the compiled eval code.  This is probably not be the best way to solve the
problem.

I have attached the files I modified.

Cheers,

Chris

Simon Massey wrote:

> Christopher,
>
> Attached is the code that trips the debugger up. The debugger comes up. You
minimize the console to reveal Widget.js file window. You click 'Go'. The
Widget.js window looses all the code in it and is just replaced by the evaluated
code:
>
>   this.invokedByEval()
>
> The rhino tip I have is rhino15R2pre.zip
>
> I am running it with the command:
>
> start javaw org.mozilla.javascript.tools.debugger.JSDebugger -f Widget.js -f
Main.js
>
> using the JVM:
>
>   java version "1.3.0"
>   Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
>   Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
>
> on Win2k.
>
> Just in case you are wondering why on earth my code wants to do this, it is
because I want to do some introspection. The real Widget invokes all its methods
that have a particular substring in their names:
>
>         for( key in this ){
>                 if( key.indexOf('reflect') == 0 ){
>                         var evalStr = "this."+key+"()";
>                         eval(evalStr);
>                 }
>         }
>
> Thanks for the great code. I have the real Widget stabilized and am happily
using the debugger on my other files.
>
> Thanks again!
>
> Simon Massey
>
2001-06-19 19:27:21 +00:00
nboyd%atg.com 114f43ccd6 Replace instances of append("x") with append('x') on StringBuffers,
removing the need for String object instances.
2001-06-14 17:42:44 +00:00
nboyd%atg.com e361382eb3 Mark deprecated. 2001-06-14 17:40:00 +00:00
nboyd%atg.com 2b5795b8f3 Subject:
jsdoc.js - added simple support for methods
   Date:
        Thu, 14 Jun 2001 09:12:26 +0100 (GMT Daylight Time)
   From:
        Simon Massey <simon_massey@hotmail.com>
     To:
        <nboyd@atg.com>






First off let me say thanks a lot for rhino. It is a really excellent piece
of software.

I am writing a large piece of js for making Excel2000 htm interactive on IE
and other browser such as Netscape6. Use a alot of code OO using methods
along the lines of:

  /**
   * Constructor
   */
  function Type(x){
   this.x = x;
  }

  /**
   * Method
   */
  Type.prototype.getX = function(){
   return x;
  }

  var type = new Type('a');
  var a = type.getX();

I have added to jsdoc.js so that finds and documents the method
declarations.

Attached is my modified jsdoc.js and a sample of the html that it generates
for the some of our proprietry :-( "Axel" code.

As an aside have you seen the job that www.blox.com have done on making a
dhtml spreadsheet? Bet they wished they could use exceptions in Netscape4!

Looking forward to the production JSDebugger. The tip version is great. It
does however seem to trash the view that it has of a file when an eval call
is made in that file. Is there a work around or will I have to wait till
the production version?

Thanks Again!

Simon Massey
2001-06-14 17:38:37 +00:00
nboyd%atg.com 374c7af66a Fix bug 85880 2001-06-14 17:37:18 +00:00
nboyd%atg.com c6c8d7500a Names should be final. 2001-06-12 20:35:48 +00:00
nboyd%atg.com bf31ffb5f8 Add archive info 2001-06-11 14:16:18 +00:00
nboyd%atg.com 665e7e9e9e This adds the hasFeature method to Context and modifies
NativeDate.getYear to use
cx.hasFeature(Context.FEATURE_NON_ECMA_GET_YEAR) for the behavior check.
2001-06-07 16:09:57 +00:00
nboyd%atg.com 1e71ac75ba Clean up classloader usage to use the thread's context class loader. 2001-06-07 16:04:33 +00:00
nboyd%atg.com fb69c14ae4 Patches from Igor:
-----
The patch adds to NativeArray.put a check for (this == start) so the
length field or a dense array element would not be updated if this !=
start. The following script exposes the problem:


function Test() { }

var array = new Array(0, 0); // Trigger dense mode
Test.prototype = array;

var test = new Test();

array[0] = 1;
test[0] = 2;

print(array[0]); // Should print 1, not 2
-----
When initially I switched NativeDate to use IdScritable, I made
toGMTString just an alias to toUTCString. Later I realized that it could
cause troubles if someone would check Date.prototype.toGMTString.name to
get "toUTCString" so I made the code to allocate a separated IdFunction
to toUTCString. Now when I read ecma 3 appendixes I see that the initial
behavior is what actually Ecma 3 requires. Here is an extract from B.2.6:

The Function object that is the initial value of
Date.prototype.toGMTString is the same Function
object that is the initial value of Date.prototype.toUTCString.

Sometimes doing nothing is the best solution...

The attached patch fixes that and inlines many 1-3 lines functions as
optimization that java compilers typically do not want to do...
2001-06-05 17:39:58 +00:00
nboyd%atg.com 8214f675ca The patch applies the following optimization to TokenStream:
1. Keyword search via Java Hahstable is replaced by explicit "switch"
code generated by idswitch tool. It not only speed up keyword search and
eliminates all Integer objects created to hold keyword tokens and
corresponding Hahstable structures, but it also reduces code size due to
very poor array initialization support in JVM.

2. It replaces the isXDigit method by xDigitToInt that either converts
its argument to 0..15 or returns -1 if it is not a hex digit and updates
the method usage accordingly The patch updates NativeGlobal.js_unescape
to reflect this usage change.
2001-06-04 13:59:30 +00:00
nboyd%atg.com 1f68a2a9d8 Have doc reference nested apidocs. 2001-06-04 13:58:51 +00:00
nboyd%atg.com 9249a305b5 Add new CounterTest example. 2001-06-01 15:26:45 +00:00
nboyd%atg.com 69580206c7 Patch from Igor:
In the attached patch I added documentation, did some inlining in the
get method implementation to gain some speed and overrode defineProperty
so it plays better with id-based properties.
2001-05-31 14:44:21 +00:00
nboyd%atg.com 1be6c5fc8f For backwards compatibility keep an old method name used by
Batik and possibly others.
2001-05-30 17:29:42 +00:00
nboyd%atg.com 481aa41f03 Add new FAQ, remove obsolete one. 2001-05-29 15:11:17 +00:00
nboyd%atg.com 8b34980fb3 Patches from Igor:
-----
The patch fixes a bug in getIds method where the assignment "result =
tmp" was missed, adds the public method activateIdMap(int maxId) to
IdScriptable and changes setAttributes method not to allow setting of
attributes that are less restrictive then ones returned by
getIdDefaultAttributes. That was supposed to be the case and the patch
makes it explicit.
-----
The patch makes BaseFunction.setImmunePrototypeProperty public so it can
be called from other packages (regexp).
-----
The patch switches NativeRegExp and NativeRegExpCtor to use
IdScriptable. It also changes code in a few places to passes Context and
RegExpImpl directly instead of using Context.getCurrentContext().

The patch also fixes a bug when

for (var i in RegExp) { print(i); }

would not include $1..$9 in the output in violation with Ecma. It was
caused by not overriding ScriptableObject.getIds in
NativeRegExpCtor.
2001-05-29 14:07:49 +00:00
beard%netscape.com ab5da9f316 Added mozilla/js/rhino/src/org/mozilla/javascript/BaseFunction.java source file. 2001-05-29 13:48:46 +00:00
nboyd%atg.com d589083a1e Patches from Igor:
-----
The patch changes NativeCall to use IdScriptable. This is done mostly
for uniformity with other Native* classes plus it would allow to call
NativeCall.init directly and make NativeCall package private.
-----
The patch changes NativeScript to use id-based properties. Due to
inheritance from NativeFunction, id support requires to take into
account the fact that there are instance ids available from
BaseFunction. This is the reason to use "int prototypeIdShift" instead
of "boolean prototypeFlag" so it can store instance id offset.

The patch updates ScriptRuntime.callOrNewSpecial to check against
IdFunction and not FunctionObject for the Script exec method where it
also add finally clause to make sure that Context.exit would always be
called after Context.enter in the evalScript method.
-----
After converting NativeScript and NativeFunction to use IdScriptable,
they get scope argument directly as a parameter of execMethod call, so
cx.ctorScope is not used any more. The patch removes code to set/unset
cx.ctorScope.
-----
[This patch depends on conversion of NativeScript and NativeCall to use
IdScriptable and the patch to remove access of ctorScope from
FunctionObject]

The patch changes Context.initStandardObjects to call NativeCall.init
and NativeScript.init directly plus it unrolls the lazily initialization
loop. Due to rather poor support of an array initialization in Java byte
code, it actually decreases code size while eliminating are creation of
array object. The patch also removes ctorScope field as unused.
-----
The patch makes sure that ids used by NativeGlobal are visible only in
the object instance that initializes global scope and removes some junk
white space at line ends.
-----
To use the idswitch tool to generate map for strings that can not be
part of Id_ Java identifier like $*, I added code to the tool to look
for "// #string=...#" in the id definition line. The attached README
file also contains some documentation about the tool and should go to
idswitch directory.

The patch was made from toolsrc/org/mozilla/javascript/tools via:
cvs diff -u > idswitch_patch
2001-05-25 13:24:17 +00:00
nboyd%atg.com c23c5d3729 Patches from Igor:
----
The patch changes Notification to extend from BaseFunction and adjusts
Context, FunctionObject and NativeScript accordingly.
----
The patch changes BaseFunction.jsConstructor to use the scope argument
passed to execMethod instead of using cx.ctorScope. This argument is
null in this case because when calling execMethod IdFunction.construct
does not set cx.ctorScope because scope is passed to execMethod as argument.
2001-05-24 13:38:12 +00:00
nboyd%atg.com 0aa0daf081 This patch renames in IdFunction the methodName field into functionName
and ads getFunctionName method to match NativeFunction.
2001-05-22 12:51:21 +00:00
nboyd%atg.com a388953fef This patch fixes the bug when global With object was set to With
prototype and not With constructor, makes id for constructor property
visible only in a prototype instance and removes the unused scopeInit
function.
2001-05-22 12:51:02 +00:00
nboyd%atg.com 357263c927 The patch adds new class org.mozilla.javascript.BaseFunction as a base
for classes implementing the Function interface and switch
IdFunction.java to use it. The code in BaseFunction to serve as
Function.prototype is not used yet. The patch modifies NativeCall so it
can be used against BaseFunction.

The patch was made from org/mozilla directory via
diff -uN javascript.0 javascript > BaseFunction_patch
2001-05-22 12:50:26 +00:00
nboyd%atg.com e4294421c9 This patch changes NativeError.java to store message and name properties
in fields of the object itself instead of using the standard property
hashtable in ScriptableObject.java. This saves 3 object instances per
NativeError (2 slot entries and hashtable array itself) and given the
fact that NativeGlobal defines a few permanent Error instances, it is
visible saving even after taking into account code size increase.

The change also gives a good test of IdScriptable implementation.

-----

This patch introduces the uniform decompile method for NativeFunction
and IdFunction with the signature:

public String decompile(Context cx, int indent, boolean justbody)

instead of NativeFunction.decompile(int indent, boolean toplevel,
boolean justbody) and IdScriptable.toStringForScript(Context cx) and
replaces the special treatment of NativeJavaMethod in
NativeFunction.jsFunction_toString by overriding decompile in
NativeJavaMethod

-----

This patch adds getFunctionName to NativeFunction to return function
name and replaces few places with jsGet_name usage by getFunctionName

The patch was made via
diff -ru javascript.0 javascript > name_patch
from org/mozilla directory
2001-05-21 15:04:54 +00:00
nboyd%atg.com 35caf7c2bb Subject:
Rhino: behavior update for IdScriptable subclasses
        Date:
             Fri, 18 May 2001 11:45:00 +0200
       From:
             Igor Bukanov <igor.bukanov@windriver.com>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




The attached patch introduces separation between id-base properties in
prototype instances and the rest of objects so it is possible to
allocate some ids for each instance and the rest only for prototype. The
patch adds to each descendants of IdScriptable a special prototypeFlag
which set to true only if object serves as a global prototype and all
methods that check/return ids first check for that flag. (This is the
reason for the patch size: diff is not very well in dealing with
indentation changes.)

In this way ids for prototype properties are completely hidden from
potential subclasses and there is no need to define methods like
getMaximumId in most cases, only if some ids present in each instance,
IdScriptable.maxInstanceId should be overridden to return max id present
in each instance.

The patch also replaces 2 boolean fields in IdScriptable by bit masks in
the setupFlag field.
2001-05-19 17:39:50 +00:00
nboyd%atg.com 81543cd446 Fix problem in the following mail:
Subject:
             Embedding Rhino in an Applet
 Resent-Date:
             Thu, 17 May 2001 14:53:05 -0700 (PDT)
 Resent-From:
             mozilla-jseng@mozilla.org
        Date:
             Thu, 17 May 2001 16:39:14 -0700
        From:
             "Chester Kustarz II" <chester@monkey.org>
 Organization:
             monkey.org
          To:
             mozilla-jseng@mozilla.org
  Newsgroups:
             netscape.public.mozilla.jseng




Hello, I am trying to find a scripting language with an interpreter that I
can embed in an applet in order to run test scripts inside the applet. I
have already tried TCL-based Jacl and they do not support running inside an
applet. I then downloaded the Rhino/JS interpreter but am having trouble
getting it to run inside the browser (IE 5.5). Here is the exception I am
getting:

com.ms.security.SecurityExceptionEx[org/mozilla/javascript/ScriptRuntime.<cl
init>]: Reflective access to class java.lang.Thread prohibited.
 at com/ms/security/permissions/ReflectionPermission.check
 at com/ms/security/PolicyEngine.deepCheck
 at com/ms/security/PolicyEngine.checkPermission
 at com/ms/security/StandardSecurityManager.chk
 at com/ms/security/StandardSecurityManager.checkMemberAccess
 at java/lang/Class.checkMemberAccess
 at java/lang/Class.getDeclaredMethod
 at org/mozilla/javascript/ScriptRuntime.<clinit>
 at org/mozilla/javascript/ScriptableObject.getExclusionList
 at org/mozilla/javascript/ScriptableObject.defineClass
 at org/mozilla/javascript/Context.initStandardObjects
 at org/mozilla/javascript/Context.initStandardObjects
 at RhinoShellApplet.init
 at com/ms/applet/AppletPanel.securedCall0
 at com/ms/applet/AppletPanel.securedCall
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.run
 at java/lang/Thread.run
com.ms.security.SecurityExceptionEx[org/mozilla/javascript/Context.initStand
ardObjects]: Unable to access system property:
org.mozilla.javascript.JavaAdapter
 at com/ms/security/permissions/PropertyPermission.check
 at com/ms/security/PolicyEngine.shallowCheck
 at com/ms/security/PolicyEngine.checkCallersPermission
 at com/ms/security/StandardSecurityManager.chk
 at com/ms/security/StandardSecurityManager.checkPropertyAccess
 at java/lang/System.getProperty
 at org/mozilla/javascript/Context.initStandardObjects
 at org/mozilla/javascript/Context.initStandardObjects
 at RhinoShellApplet.init
 at com/ms/applet/AppletPanel.securedCall0
 at com/ms/applet/AppletPanel.securedCall
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.run
 at java/lang/Thread.run
2001-05-18 15:31:49 +00:00
nboyd%atg.com 26ebaa0c66 Fix bug 80322. 2001-05-17 19:02:55 +00:00
nboyd%atg.com f269df764c Mail gateway info. 2001-05-17 18:36:59 +00:00
nboyd%atg.com 9214262d1e Just remove commented-out "final". 2001-05-17 17:29:19 +00:00
nboyd%atg.com e4c32e2c7b Fix bug 78706 2001-05-16 14:07:00 +00:00
beard%netscape.com 57509c3b22 Removed:
ScopeInitializer.java
2001-05-16 01:10:19 +00:00
nboyd%atg.com 937f24e4f6 2 additional issues:
1. In that patch I forgot to remove "import org.mozilla.classfile.*" and
simply catch Exception in newInvokerMaster which is not a good practice.
The attached patch FunctionObject_patch fixes that and removes other
unused imports.

2. In org.mozilla.classfile.DefiningClassLoader defineClass method first
tries to call via ClassManager the defineClass method in a class loader
that loaded DefiningClassLoader itself. But this would define new
classes in that class loader so they would not be subject of the garbage
collection until a classloader that loads DefiningClassLoader would go
away even if a DefiningClassLoader instance is gone. The
DefiningClassLoader_patch removes that and simply calls super.defineClass.

The patch also change the order of class search in loadClass so the
loader first looks for a class among its defined classes and only after
that in parent loaders.

Regards, Igor
2001-05-16 00:24:37 +00:00
sfraser%netscape.com 55b0ea662e Testing, NOT PART OF ANYTHING 2001-05-15 20:57:01 +00:00
nboyd%atg.com f7417f7060 2 additional issues:
1. In that patch I forgot to remove "import org.mozilla.classfile.*" and
simply catch Exception in newInvokerMaster which is not a good practice.
The attached patch FunctionObject_patch fixes that and removes other
unused imports.

2. In org.mozilla.classfile.DefiningClassLoader defineClass method first
tries to call via ClassManager the defineClass method in a class loader
that loaded DefiningClassLoader itself. But this would define new
classes in that class loader so they would not be subject of the garbage
collection until a classloader that loads DefiningClassLoader would go
away even if a DefiningClassLoader instance is gone. The
DefiningClassLoader_patch removes that and simply calls super.defineClass.

The patch also change the order of class search in loadClass so the
loader first looks for a class among its defined classes and only after
that in parent loaders.

Regards, Igor
2001-05-15 16:58:08 +00:00
beard%netscape.com 389c07ab3f Removed: src/org/mozilla/javascript/optimizer/JavaScriptClassLoader.java Added: src/org/mozilla/javascript/optimizer/InvokerImpl.java src/org/mozilla/classfile/DefiningClassLoader.java 2001-05-15 15:41:44 +00:00
nboyd%atg.com 1f98cf7a77 New file, mostly moved from org.mozilla.javascript.optimizer.JavaScriptClassLoader 2001-05-15 13:12:43 +00:00
nboyd%atg.com 0068a15b8a Norris Boyd wrote:
> Igor Bukanov wrote:
>
>
>>Norris Boyd wrote:
>>
>>
>>>The intention was to keep classfile and JavaAdapter optional. Those
>>>dependencies crept in. We can use Invoker optionally--perhaps I should do
>>>some performance numbers to see if it's worth it.
>>>
>>I implemented that patch, it splits Invoker.java into Invoker.java and
>>its implementation in optimizer/InvokerImpl.java The reason to put it
>>into optimizer package is that Invoker is very similar in spirit to
>>NativeScript: it generates classes to speed up access and in this way
>>there is no need to have separated option not to use: one can simply
>>remove optimizer all together.
>>
>
> Yes, that sounds great.
>
>
>>
>>I noticed during implementation that JavaAdapter.DefiningClassLoader and
>>optimizer/JavaScriptClassLoader contains the same code, so maybe they
>>can be moved to org.mozilla.classfile package under one name?
>>
>
> Yes, that sounds like a good change too. Thanks for noticing that.


The update is pretty messy: it touches FunctionObject which I changed to
remove the special treatment of NativeWith in the previous patch, and it
also add/removes files.

Here is a description:
DefiningClassLoader.java should go to org/mozilla/classfile. It is the
same code that was in omj/optimizer/JavaScriptClassLoader.java with
class rename and adding public attribute and correspondingly
omj.optimizer/JavaScriptClassLoader.java should be removed. I guess it
would be nice to preserve logs/history in CVS during the move.

InvokerImpl.java should go to omj/optimizer. It is mostly what
omj.Invoker was.

invoker_changes_patch was generated via
cvs diff -u Invoker.java JavaAdapter.java optimizer/Codegen.java
and contains changes against the current CVS

FunctionObject_invoker_patch was generated via
diff -u ../../mozilla.1/javascript/FunctionObject.java FunctionObject.java
and contains changes against that With patch.

Igor
2001-05-15 13:10:38 +00:00
nboyd%atg.com 928693eace The attached patch makes NativeWith to use IdFunction for its
constructor, removes the special treatment of the With object from
IdScriptable and FunctionObject, adds to IdFunction the
initAsConstructor method similar in spirit to
FunctionObject.addAsConstructor (it is called now from IdScriptable and
NativeWith) and replaces in Context.java lazy initialization of
NativeWith by direct call of NativeWith.scopeInit.
2001-05-15 01:17:51 +00:00
beard%netscape.com 0e8873338f Added idswitch tool sources. 2001-05-14 06:52:39 +00:00
beard%netscape.com 541d6af0f6 Added IdFunctionMaster.java to keep Mac build working. 2001-05-14 06:48:07 +00:00
nboyd%atg.com 8ef49d0abb Hi, Norris!
The attached patch moves the IdFunction.Master interface to the
separated file IdFunctionMaster and eliminates getParentScope from the
interface: it is simpler to set scope explicitly.

The patch assumes the changes in IdFunction.java from the previous patch
  and were produced via:

diff -uP javascript.2000-05-10 javascript

Regards, Igor
2001-05-12 13:15:39 +00:00
nboyd%atg.com 8961afa95f Hi, Norris!
The attached patch allows subclasses of IdScriptable to override
hasIdValur/deleteIdValue and uses lazy initialization for idMapData
array to avoid its creation when an IdScriptable descendant does not
have any functions. The patch also touches NativeMath.java to replace in
its scopeInit method
        super.scopeInit(cx, scope, sealed);
by
        activateIdMap(cx, sealed);
This is the only reason NativeMath needs to call
IdScriptable.scopeInit() which is intended for creation
constructor/prototype pair.

Regards, Igor
2001-05-11 17:41:00 +00:00
nboyd%atg.com 55d31be0bf Update implementation version, make non-final. 2001-05-09 17:57:05 +00:00
nboyd%atg.com 2c7ba42b18 Add idswitch package. 2001-05-09 17:12:07 +00:00
nboyd%atg.com 44b04487cb More rational handling of count. 2001-05-09 14:01:38 +00:00
nboyd%atg.com 16a01c6105 Fix 79568. 2001-05-09 13:59:29 +00:00
beard%netscape.com cdc467d85a Removed ListenerCollection.java, added ListenerArray.java. 2001-05-08 22:56:43 +00:00
beard%netscape.com d34d7267e4 Officially retiring all sources in mozilla/js/rhino/org, in favor of sources in mozilla/js/rhino/src & mozilla/js/rhino/toolsrc. 2001-05-08 22:50:01 +00:00
beard%netscape.com ace78ee37e Officially retiring all sources in mozilla/js/rhino/org, in favor of sources in mozilla/js/rhino/src & mozilla/js/rhino/toolsrc. 2001-05-08 22:28:17 +00:00
nboyd%atg.com 66b3d8aae3 Change use of deprecated method. 2001-05-08 13:51:18 +00:00
nboyd%atg.com 991a880e56 Commit missing messages for new idswitch tool. 2001-05-08 13:42:56 +00:00
nboyd%atg.com 49ee5104a9 Subject:
Rhino: optimization for NativeFunction.java
        Date:
             Mon, 07 May 2001 14:19:59 +0200
       From:
             Igor Bukanov <igor.bukanov@windriver.com>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>

Hi, Norris!

This is the first of 3 patches that are completly independent from each
other.

Currently in NativeFunction its name stored as the first element in the
names array. But this lead to creation of a single element array for
each FunctionObject and for each script function that does not have
arguments or variables. The attached patch splits NativeFunction names
into simple functionName and argNames arrays and adjust code elsewhere
accordingly. This patch can increase memory footprint for anonymous
script functions without arguments because it adds additional field to
each NativeFunction, but I do not think this is a case to worry about.

Regards, Igor
2001-05-08 13:40:22 +00:00
nboyd%atg.com bd685b66b2 Subject: Rhino: execMethod/methodArity cleanup.
Date: Mon, 07 May 2001 14:25:34 +0200
From: Igor Bukanov <igor.bukanov@windriver.com>
Organization: Wind River
To: Norris Boyd <nboyd@atg.com>

The current code that implements execMethod/methodArity for IdFunction
support returns an arbitrary value for id that is not known. This is not
very good behavior because it may hide bugs in the id support and it
also does not allow to distinguish ids that are used for function  from
ids used for properties like String.length.

To fix this I changed semantic of the methodArity method to return -1
for an unknown/non-method id and added code to throw an exception for
bad ids. This change requires to adjust all NativeSomething objects that
use IdScriptabl and after a release all such interface changes would be
no go, but is not a release yet, right?

I also eliminated the "IdFunction f" argument from
IdFunction.Master.methodArity and the tagId field from IdFunction. When
I wrote  the initial code for IdFunction.java, I added that just to be
able to use same id number in a class that implements IdFunction.Master
and its descendants via checking idTag. But that does not work in
general because IdScriptable can use id for non-function fields as well
so to avoid id clashes another way should be used. For example, if
someone would like to extend NativeMath to support more functionality,
he can use:

class Math2: extends NativeMath {
     private static idBase;

     {
         if (idBase == 0) idBase = super.getMaximumId();
     }

      public int methodArity(int methodId) {
          switch (methodId - idBase) {
             case Id_foo: return 2;
             case Id_bar: return 3;
         }
         return super.methodArity(methodId);
     }

      public Object execMethod
          (int methodId, IdFunction f,
           Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
          throws JavaScriptException
      {
          switch (methodId - idBase) {
             case Id_foo: return ...;
             case Id_bar: return ...;
         }
          return super.execMethod(methodId, f, cx, scope, thisObj, args);
     }

      protected int getMaximumId() { return idBase + MAX_ID; }

      protected String getIdName(int id) {
          switch (id - idBase) {
             case Id_foo: return "for";
             case Id_bar: return "bar";
         }
         return super.getIdName(id);
     }
     ...
     private static final int
         Id_foo = 1,
         Id_bar = 2,
         MAX_ID = 2;

etc.


Note that a simpler solution to make MAX_ID field public in NativeMath
and write in Math2:
     private static final int
         Id_foo = NativeMath.MAX_ID + 1,
         Id_bar = NativeMath.MAX_ID + 2,
         MAX_ID = NativeMath.MAX_ID + 2;

does not work because in this way adding any new id to NativeMath would
break binary compatibility with Math2.
2001-05-08 13:36:16 +00:00
nboyd%atg.com 9129bdc5d6 Subject:
Rhino: fix for race conditions in listeners code in Context.java
        Date:
             Mon, 07 May 2001 14:22:57 +0200
       From:
             Igor Bukanov <igor.bukanov@windriver.com>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>

The current code for listeners and contextListeners in Context.java is
not race condition free. If contextListeners Vector would be modified
during context event firing loops, the code can produce
index-out-of-bounds exception. The problem with listeners array is more
subbtle and comes from the fact that ListenerCollection.java uses code like:
         for(Enumeration enum = getAllListeners();enum.hasMoreElements();) {
             Object listener = enum.nextElement();
             if(iface.isInstance(listener)) {
                 array.addElement(listener);
             }
         }
where getAllListeners() uses Vector.elements to get element enumeration.
But to work with such enumeration in a thread safe way, one has to
synchronized against Vector, otherwise between enum.hasMoreElements()
and enum.nextElement() the last element can be removed.

Initially I thought to fix ListenerCollection and use it for
contextListeners as well, but then I realized that in its current form
ListenerCollection is very inefficient (it produces too many objects
just to get simple array to fire events), so I wrote ListenerArray.java
and use it in Context.java. It makes life simpler and shrinks code as well.
2001-05-08 13:33:43 +00:00
nboyd%atg.com e4bf1b6548 Fix problems noted in following mail:
Subject:
        rhino bug(s)
   Date:
        Mon, 30 Apr 2001 23:07:00 -0700
   From:
        Mike Dixon <MDixon@placeware.com>
     To:
        nboyd@atg.com




hi.  i'm a happy rhino user, and just stumbled across what looks like a
pretty basic bug in the property stuff on ScriptableObject...  (i'm running
1.5, but it looks like this code hasn't changed in CVS.)  since it looks
like you're actively developing (even though it's been a while since
1.5...) i figured you might be interested -- apologies if i missed a more
formal bug reporting process...

the symptom was that i got a "Hashtable internal error" thrown from
getSlotToSet.  reading the code, here's what i think could happen:

- create a new object (slots.length is initially 5)
- add 3 properties
- delete those 3 properties

(now count == 0, and slots[i] == REMOVED for 3 values of i)

- add 2 more properties

now assume that you're unlucky, and that these two hash to different values
than the first three; now you have 2 elements of slots[] containing real
slots, and the other three containing REMOVED.

now what happens when you try to create another slot?  getSlotToSet is only
willing to put something in a null slot[], and you haven't got one, so you
get the internal error.

writing this message encouraged me to try to write a test case to reproduce
it, and in fact it's trivial:

   js> x={}; x.a=x.b=x.c=1; delete x.a; delete x.b; delete x.c; x.d=x.e=1
   1
   js> x.whatever=1
(boom)

by the way, while reading the code i also noticed what looks like another,
less consequential bug: addSlot increments count before deciding to grow
the table, which is done with a recursive call, which will cause count to
be incremented again -- right?  as far as i can tell, setting count too big
will only cause it to grow the table a little early next time, so it
doesn't really matter, but it looks wrong.

                                                        .mike.
2001-05-06 23:56:34 +00:00
nboyd%atg.com a426bf2e85 New updates from Igor. 2001-05-05 18:25:00 +00:00
beard%netscape.com 9c797b19b6 Allow building with javac from JDK 1.1.8. 2001-05-04 22:41:12 +00:00
nboyd%atg.com 3d11fc509c Make the debugger's main class be Main.java to match convention. 2001-05-04 15:22:10 +00:00
nboyd%atg.com a89f7ff632 Re-apply changes since repository copy. 2001-05-04 15:20:26 +00:00
beard%netscape.com e58e72baa7 Now builds two sub-projects, jscore.mcp, jstools.mcp and merges the resulting jar files into js.jar. This uses the new source tree organization. 2001-05-01 17:24:48 +00:00
beard%netscape.com 9499e65b11 Builds org.mozilla.javascript.tools.* classes. 2001-05-01 17:19:16 +00:00
beard%netscape.com 3f651fabb5 Builds core org.mozilla.* classes. 2001-05-01 17:18:14 +00:00
beard%netscape.com 29d9c8b87e Reverted back to old directory structure. 2001-04-27 22:57:30 +00:00
beard%netscape.com 5a22dc57e8 Restore revision history. 2001-04-27 19:45:52 +00:00
beard%netscape.com ad25062b57 Restore revision history. 2001-04-27 19:37:39 +00:00
beard%netscape.com 7475f14841 Restore revision history. 2001-04-27 18:57:38 +00:00
beard%netscape.com 3f57dc791f Reconstructed using new rhino/src and rhino/toolsrc directory organization. 2001-04-25 22:32:20 +00:00
nboyd%atg.com 96688e7cd8 Finish javadoc fix. 2001-04-25 17:11:34 +00:00
nboyd%atg.com fead2a0852 Fix javadoc with new directory structure. 2001-04-25 14:36:15 +00:00
nboyd%atg.com 32d98dbdc2 UPdate name of debugger main class. 2001-04-25 13:46:46 +00:00
nboyd%atg.com ee9e0cc866 Fix javadoc generation. 2001-04-25 00:24:18 +00:00
nboyd%atg.com a895548450 Make the default just build core. 2001-04-24 21:06:34 +00:00
nboyd%atg.com f80a784ecb Move files to rhino/toolsrc. 2001-04-24 20:43:37 +00:00
nboyd%atg.com 1944203c68 Move files to rhino/toolsrc 2001-04-24 20:42:14 +00:00
nboyd%atg.com 823e33c1e7 Move files to rhino/src. 2001-04-24 20:39:47 +00:00
nboyd%atg.com ef919d6f1e Somehow removed these right after I added them. 2001-04-24 20:36:58 +00:00
nboyd%atg.com 711c087f8e Massive reconfiguration of the cvs directory structure:
mozilla/js/rhino/org is now distributed between
mozilla/js/rhino/src and mozilla/js/rhino/toolsrc.
The build.xml has been split in three.
Docs now live in the project directory.

These changes mean that the cvs directories mirror the distribution and thus a distribution
will build the same way as a cvs build.
2001-04-24 20:31:31 +00:00
nboyd%atg.com e97e80635e Break dependency between core and tools. 2001-04-24 18:08:46 +00:00
nboyd%atg.com b6331020dc Igor's latest patches, with some regression fixes. 2001-04-24 12:57:45 +00:00
nboyd%atg.com 8584f9aa43 Convert to IdScriptable form.
Patch from Igor.
2001-04-20 14:29:56 +00:00
beard%netscape.com 426dfab4d7 loadClassName: use current class loader to find classes, before calling Class.forName(). 2001-04-19 17:31:34 +00:00
nboyd%atg.com 5199af3051 Latest patches from Igor. 2001-04-19 12:52:39 +00:00
beard%netscape.com e183541072 Removed hard tabs, removed unnecessary cast, (Scriptable)null. 2001-04-18 20:50:58 +00:00
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