- Fix XMLToXMLString bug where ancdecls was not updated with a weak ref append
when a namespace strong ref was appended to decls. In ECMA-357, ancdecls is
written out as (AncestorNamespaces U namespaceDeclarations), but here where
ancestorNSes and decls are unioned early into ancdecls, we need to update
the unioned set whenever decls is updated.
- Fix ECMA-357 glitch (suboptimal, arguably not an erratum) in ToXMLString
where XML that uses the default namespace only is converted via toXMLString
into a string serialization that redeclares that namespace using generated
prefixes, for every node in the tree. This is verbose, inefficient, and
unnecessary. A trivial tweak to 10.2.1 Step 12(a), to let namespace.prefix
be the empty string if x.[[Name]].[[Prefix]] is undefined, fixes the bug.
- Const-ipate JSXMLArray * parameters starting with XMLToXMLString's, to be
sure no one appends a strong ref to a weak-ref-holding |in| parameter.
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.
ECMA-357 botch where * or @b or (given valid namespace reference n) n::id
results in undefined, instead of a TypeError.
- Lazily bootstrap AnyName and AttributeName classes, instead of leaving the
former uninitialized, and initializing the latter only if QName is init'ed.
These classes, representing ECMA-357 internal types, must be initialized
in order to string conversion and default value on them to return useful
results. So this change also requires the shared qname_toString to cope
with these classes, which ape QName in having a JSXMLQName as private data.
- Revise Filtering Predicate Expressions bytecode schema to avoid bogo-script
creating in js_FilterXMLObject. With a new JSOP_ENDFILTER bytecode acting
in lieu of JSOP_POPV, but also exiting the nested js_Interpret() call, the
runtime can avoid trying to fake a JSScript for the subsequence of script
bytecode in parens in x.(e), that contains the bytecode for e plus the pop
or endfilter op.
This requires a historic reparameterization of js_Interpret to take the
starting pc! I cleaned up order of declaration, use, and useless init nits
for a few variables while messing with it.
- Based on the above change, fix the decompiler to handle filtered predicate
expressions -- that code was stubbed out till now, and I forgot to go back.
All better now, especially thanks to JSOP_ENDFILTER.
- Also while fixing filtered predicates, eliminate the useless TOK_RP parse
node above the parenthesized expression, to avoid a JSOP_GROUP bytecode.
- Fix js_GetAttributeNameObject so it doesn't take over its QName parameter's
object and rebind it to an object of class AttributeName -- instead, clone
the qn if necessary. This is important to cope with the errata, noticed a
while ago but finally recorded:
9.2.1.2 Step 2(e)(i, ii),
9.2.1.2 Step 7(e)(i),
9.2.1.3 Step 2(b)(ii)(1)(a)
All uses of a.[[Name]] for an attribute a in these sections that pass
that QName object to [[Delete]] must pass an AttributeName cloned from
a.[[Name]]. The [[Name]] internal property is always a QName instance
and never an AttributeName or AnyName instance. But [[Delete]] will
not operate on x.[[Attributes]] when given a QName by these sections,
so a child could be wrongly deleted instead of the attribute of the
same name.
This rework exposed a bug in the XML.prototype.name() impl, where it was
returning an AttributeName, not a QName, for attribute-class XML objects.
Clearly wrong -- the E4X spec makes plain early on that [[Name]] is always
a QName -- but the spec and e4x testsuite seemed to require it due to the
above-noted errata.
effect of ECMA-357, specifically x.namespaceDeclarations() should not include
the default namespace inherited from the <parent> tag wrapped around a string
argument "<x>...</x>" by ToXML, whereas x.inScopeNamespaces() should.
This case implies errata against 10.3.1, 10.4.1, and 13.4.4.24 (at least).
- Consolidate common code in an XMLArrayInsert function, renaming the misnamed
precursor to XMLArrayAddMember. XMLArrayInsert properly notifies any cursors
iterating over the array, fixing for/in and for-each/in bugs such as this:
var l = <><a/><c/><d/></>;
var i = 0;
for each (var x in l) {
print(x.toXMLString());
if (i == 1) l[0] += <b/>;
i++;
}
- Fix the bug induced by this erratum from ECMA-357:
9.2.1.2 step 2(c)(ii) sets _y.[[Parent]] = r_ where _r_ is the result of
[[ResolveValue]] called on _x.[[TargetObject]] in 2(a)(i). This can
result in text parenting text:
var MYXML = new XML();
MYXML.appendChild(new XML("<TEAM>Giants</TEAM>"));
(testcase from Werner Sharp <wsharp@macromedia.com>).
To match insertChildAfter, insertChildBefore, prependChild, and
setChildren, we should silently do nothing in this case.
- Fix PN2X_OUTERMOST not to overlay XSF_CACHE_VALID, causing it to appear to be
set when cx->xmlSettingFlags were "translated" into ParseNodeToXML flags. To
avoid further such stupidity, consolidated all similar flags into XSF_* bits
and eliminated the PN2X_* duals.
- Redo the way the default namespace is inherited by parsed XML from the
<parent> tag under ToXML and ToXMLList, and implicitly inherited in the
js_ParseNodeToXMLObject alternative path to ToXML.
- Handle null prefix (meaning undefined in ECMA-357, that is, no prefix was
passed to the Namespace constructor) and empty prefix (which is normalized
from null for the empty URI "no namespace" case) better in the parsing and
ToXMLString code.
- Fixed a bug in PutProperty where it implements 9.2.1.2 2(c)(vii)(1) (whew!).
Fixed another bug near that which stupidly assumed all XML nodes have names,
leading to an obvious null pointer crash.
This should be the final round of work for bug 246411. With the appropriate
testsuite patches, this passes all tests except e4x/Regress/regress-264369.js
(which probably should be invalidated by a correction to the ECMA-357 spec).
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.