"Scriptable target" argument to Ref.(get|set|has|delete) methods. The idea was
to optimize away in many cases creation of Ref instances, but given that modern
JVM can GC short-lived objects efficiently it does not sound right to have code
complexity now in the hope of slightly more efficient implementation later.
I assume "functionName" in BaseFunction could also undergo a similar treatment
of being replaced with an abstract getFunctionName() method, couldn't it? The
function name is either calculable from other data (FieldAndMethods, overloaded
case of NativeJavaMethod*, NativeJavaConstructor, InterpetedFunction) or fixed
(NativeRegExpCtor) in lots of subclasses.
While investigating how Rhino loads Java packages I came across what
appears to be a "typo" bug in NativeJavaTopPackage.java; a missing
semicolon in a string results in minor performance degradation for
script accessing the java.lang.reflect and java.lang.io packages.
In this way when native code implementing host objects calls Context.jsToJava the exception can be caught in JS and processed in in the same way as exceptions resulting from bad calls to LiveConnect Java objects.
Rhino never claimed to support binary compatibility in the serialized objects and it is better to use the system generated ids always to catch errors about incompatible changes ASAP.
1. IdScriptableObject.maxInstanceId is replaced by overridden getMaxInstanceId()
2. BaseFunction.argumentsProperty is replaced by storing when necessary explicit "arguments" property in ScriptableObject hashmap.
3. NativeFunction.(argNames|argCount|version) is replaced by code that reconstruct the necessary values from embedded in class file or InterpreterData (see bug 264637)
-------- Original Message --------
Subject: RE: www.mozilla.org/rhino: NPL license Messages_fr.properties?
Date: Fri, 8 Oct 2004 13:52:39 -0400
From: Aresteanu, Eugene <eugenea@avivasolutions.com>
To: 'Igor Bukanov' <igor@fastmail.fm>
Hi Igor,
Yes, I agree,
Eugene Aresteanu
Do you agree to change the license as expressed in the license header
for the file:
mozilla/js/rhino/src/org/mozilla/javascript/resources/Messages_fr.properties
located at cvs.mozilla.org:/cvsroot to the following text:
#
# French JavaScript messages file.
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Aviva Inc. code, released March 5, 2004.
#
# The Initial Developer of the Original Code is Aviva Inc.
# Portions created by Aviva Inc. are Copyright (C) 2004 Aviva Inc.
# All Rights Reserved.
#
# Contributor(s):
# Eugene Aresteanu
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the NPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the NPL or the GPL.
The change shall apply only to CVS HEAD version of the file.
-------- Original Message --------
Subject: Re: www.mozilla.org/rhino: Changing the license for Delegator
Date: Fri, 08 Oct 2004 16:08:01 +0100
From: Matthias Radestock <matthias@sorted.org>
To: Igor Bukanov <igor@fastmail.fm>
References: <41668055.2050404@fastmail.fm> <4166830A.3010900@sorted.org> <4166AD80.6070806@fastmail.fm>
Igor Bukanov wrote:
> Thanks, I would like to change the license header from the current:
>
> /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
> 4 -*-
> * The contents of this file are subject to the Mozilla Public License
> * Version 1.1 (the "License"); you may not use this file except in
> * compliance with the License. You may obtain a copy of the License at
> * http://www.mozilla.org/MPL/
> *
> * Software distributed under the License is distributed on an "AS IS"
> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
> * License for the specific language governing rights and limitations
> * under the License.
> *
> * The Original Code is Delegator.java, released Sep 27, 2000.
> *
> * The Initial Developer of the Original Code is Matthias Radestock.
> * <matthias@sorted.org>. Portions created by Matthias Radestock are
> * Copyright (C) 2000 Matthias Radestock. All Rights Reserved.
> *
> * Contributor(s):
> * Redfig Ltd (http://www.redfig.com)
> * LShift Ltd (http://www.lshift.net)
> *
> * Alternatively, the contents of this file may be used under the terms
> * of the GNU Public License (the "GPL License"), in which case the
> * provisions of the GPL License are applicable instead of those
> * above. If you wish to allow use of your version of this file only
> * under the terms of the GPL License and not to allow others to use
> * your version of this file under the MPL, indicate your decision by
> * deleting the provisions above and replace them with the notice and
> * other provisions required by the GPL License. If you do not delete
> * the provisions above, a recipient may use your version of this file
> * under either the MPL or the GPL License.
> */
>
>
> to the following one:
>
>
> /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
> 4 -*-
> *
> * The contents of this file are subject to the Netscape Public
> * License Version 1.1 (the "License"); you may not use this file
> * except in compliance with the License. You may obtain a copy of
> * the License at http://www.mozilla.org/NPL/
> *
> * Software distributed under the License is distributed on an "AS
> * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
> * implied. See the License for the specific language governing
> * rights and limitations under the License.
> *
> * The Original Code is Delegator.java, released Sep 27, 2000.
> *
> * The Initial Developer of the Original Code is Matthias Radestock.
> * <matthias@sorted.org>. Portions created by Matthias Radestock are
> * Copyright (C) 2000 Matthias Radestock. All Rights Reserved.
> *
> * Contributor(s):
> *
> * Matthias Radestock, Redfig Ltd (http://www.redfig.com)
> * Matthias Radestock, LShift Ltd (http://www.lshift.net)
> *
> * Alternatively, the contents of this file may be used under the
> * terms of the GNU Public License (the "GPL"), in which case the
> * provisions of the GPL are applicable instead of those above.
> * If you wish to allow use of your version of this file only
> * under the terms of the GPL and not to allow others to use your
> * version of this file under the NPL, indicate your decision by
> * deleting the provisions above and replace them with the notice
> * and other provisions required by the GPL. If you do not delete
> * the provisions above, a recipient may use your version of this
> * file under either the NPL or the GPL.
> */
>
>
>
> Note that the new version replaces:
>
> * Contributor(s):
> * Redfig Ltd (http://www.redfig.com)
> * LShift Ltd (http://www.lshift.net)
>
> by the following text:
>
> * Contributor(s):
> *
> * Matthias Radestock, Redfig Ltd (http://www.redfig.com)
> * Matthias Radestock, LShift Ltd (http://www.lshift.net)
>
> since Contributors section should contain at lease the name of the
> person contributing.
>
> If it is Ok, then I need your authorisation to perform such license
> change for the following files:
>
> mozilla/js/rhino/src/org/mozilla/javascript/Delegator.java
> mozilla/js/rhino/src/org/mozilla/javascript/.java
>
> located at the CVS repository at cvs.mozilla.org:/cvsroot
>
> The license change shall apply only to the CVS HEAD version of the files.
>
Igor,
that's all fine. Go ahead and make the changes.
Matthias.
References now are represented by the pairs (ref, ref_target) where ref is Ref (former Reference) instance and ref_target is Scriptable to apply the reference for.
To return the pair from Reference creation function Context.scratchRefTarget is used to store the target part.
This change allowed to extend XMLName from Ref eliminating the need for XMLReference.
I changes just added toObject(Contetx cx, Object obj) to
toObjectOrNull(Contetx cx, Object obj) which returns null when obj is undefined
or null. It forces the caller to check to the return status but then much
better error report can be generated since the caller knows the operation that was called upon the undefined or null value.
To implement the function call redirection functionality XMLObject.getExtraMethodSource is added() to return an additional object to use as method source.
List of the affected files:
mozilla/js/rhino/src/org/mozilla/javascript/Callable.java
mozilla/js/rhino/src/org/mozilla/javascript/ClassCache.java
mozilla/js/rhino/src/org/mozilla/javascript/CompilerEnvirons.java
mozilla/js/rhino/src/org/mozilla/javascript/ContextAction.java
mozilla/js/rhino/src/org/mozilla/javascript/ContextFactory.java
mozilla/js/rhino/src/org/mozilla/javascript/Kit.java
mozilla/js/rhino/src/org/mozilla/javascript/Reference.java
mozilla/js/rhino/src/org/mozilla/javascript/SpecialRef.java
mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/GuiCallback.java
mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/test.js
mozilla/js/rhino/xmlimplsrc/org/mozilla/javascript/xmlimpl/XMLReference.java
Please contact igor@runitsoft.com if you have any questions about this.
Signatures in Reference are changed to include Context and reference-related methods in ScriptRuntime accept/return explicit Reference type instead of generic Object as code generation ensure proper type.
2. x..y use explicit reference instead of special descendants mark XMLName:
In this way less code is necessary to support x..y operations and support for .. in non-xml objects is possible.
to check for strict mode.
2. Fix name lokup bug in XMLReference that caused in cases like
foo.(@bar == 'something') to throw runtime exception if bar attribute
does not exist in foo.
perform type conversion checks for methods that do return proper JS type the
type check is done only once in the constructor and if necessary a flag is set
to call WrapFaactory.wrap on method return.
2. Use linked list of read-only REPogState to implement state stack instead of array of struct. It fixes bug 258417 while making creation of back track stack data much cheaper since there is no need to copy read-only structures.
processes breakpoint hit and another breakpoint is met during event processing,
then on Linux recursive invocations of EventQueue.getNextEvent()/dispatchEvent
lead to eventual GUI deadlock. It is easy to observe when the break on function
enter is enabled and a JS function is called that is attached to an action
handler of some button. With recursive bahaviour repeated clicks lead to deeper
and deeper invocation of EventQueue.getNextEvent() and GUI deadlock on Linux.
So to improve debugger stubility I modify Dim.interrupted to ignore calls from
event thread when another invocation of Dim.interrupted already waits for GUI
result.
2. To decrease class and jar bloat I merges various implementations of Runnable
and and other interfaces to single class with switch dispatch. It saved about
6K from js.jar.
2. Removal of never used NativeCall.thisObj field and code to initialize it.
3. Renaming NativeCall.funObj to NativeCall.function for better readability.
1. Fix to pass to debugger wrapped frame.resultDbl if frame.result is DBL_MARK
2. Change Interpreter.interpret to return the properly wrapped result instead of the final frame.
3. Use Object for throwable variable in Interpreter.interpret to avoid multiple casts to Throwable
ScriptableObject to use EvaluatorException instead.
For greater compatibility I also changed ClassDefinitionException to extend
from RuntimeException, not Exception so compilers would not complain about
"catch (ClassDefinitionException ex)" when no ClassDefinitionException is present in the called code.
JavaSriptException now inherits from RhinoException which inherits from RuntimeException and as such it does not necessary to declare it.
Moreover, it is wrong to use it for the documentation purpose since a script can also throw EcmaError and WrappedException and a proper documentation would require to document those exceptions as well. But since almost all Rhino functions can potentially execute script code it means that wast majority of functions would bear the declarations, not only code overriding or calling explicitly Function.call/construct. And then the throw declarations would bring no information if it always would be "throws RhinoException". Thus it is better not to litter sources with the declarations at all.
functions declared inside with statements to ensure that their thisObj
is not with or call scope as required by ECMA-262.
But due the changes to support E4X extensions such situation can only happen
when function is accessed as expression like in
var f = function() { }
...
f()
and typically it is exactly nested the functions that are accessed in this way.
So the patch adds optimized code that always check for proper thisObj to
ScriptRuntime.getValueFunctionAndThis and removes getThis and corresponding parsing/code generation code.
In this way when nested functions are accessed as name or property no checks are done for them and Rhino code slightly shrinks.
Do not scan regexp literals in TokenStream.getToken(). Instead parser will call explicit TokenStream.readRegExp() after it gets / or /= as primary expression. In this way there is no need to use any explicit regexp flags which rather error prone.