Rhino 1.6R1 is the new major release of Rhino. It supports ECMAScript for XML (E4X) as specified by <ahref="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMA 357</a> standard. E4X is a set of language extensions adding native XML support for JavaScript without affecting the existing code base. <ahref="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/E4X/e4x_example.js">E4X example</a> demonstrates various E4X constructions and their usage in JavaScript code.
This version of Rhino should be binary compatible with the current embeddings that use only public <ahref="apidocs/index.html">API</a> unless the code use the previously deperected classes as documented <ahref="#Rhino1.5R1-deprecation-removal">below</a>. Please report any incompatibilitiy issues to <ahref="http://bugzilla.mozilla.org/enter_bug.cgi?product=Rhino">Bugzilla</a>.
The E4X code was donated to the Rhino project by <ahref="http://www.bea.com/">BEA</a> and developed by staff from <ahref="http://www.bea.com/">BEA</a> and <ahref="http://www.agiledelta.com/">AgileDelta</a>.
It uses <ahref="http://xmlbeans.apache.org/">XMLBeans</a> library to implement E4X runtime. The implementation was tested against versions 1.0.2 and 1.0.3 of XMLBeans. Please make sure that <tt>xbean.jar</tt> is avaialble on the classpath if you use E4X in your scripts.
Now all Rhino execption classes are derived from <ahref="apidocs/org/mozilla/javascript/RhinoException.html"><tt>org.mozilla.javascript.RhinoException</tt></a> which extends <tt>java.lang.RuntimeException</tt>.
The class gives the uniform way to access information about the script origin of the exception and simplifies execption handling in Rhino embeddings.
</p>
<p>
See <ahref="http://bugzilla.mozilla.org/show_bug.cgi?id=244492">Bugzilla 244492</a> for details.
The interpreter mode in Rhino does not limit any longer the script size or code complexity. It should be possible to execute any script as long as JVM resources allow so.
See <ahref="http://bugzilla.mozilla.org/show_bug.cgi?id=244014">Bugzilla 244014</a> and <ahref="http://bugzilla.mozilla.org/show_bug.cgi?id=256339">Bugzilla 256339</a> for details.
The interpreter mode in Rhino implements tail call elimination to avoid excessive stack space consumption when a function returns result of a call to another function.
</p>
<p>
See <ahref="http://bugzilla.mozilla.org/show_bug.cgi?id=257128">Bugzilla 257128</a>.
</p>
<h4>Experimental support for continuations in the interpreter</h4>
The interpreter mode in Rhino contains an experimental support for continuations. It is based on the original implementation of Christopher Oliver and ideas from <ahref="http://sisc.sourceforge.net/">SISC</a> project. To enable the continuation support make sure that the interpreter mode is selected when you use Rhino through <ahref="apidocs/org/mozilla/javascript/Context.html#setOptimizationLevel(int)">setting</a> the optimization level to -1 or if you use <ahref="shell.html">shell</a> by passing <tt>-opt -1</tt> to the shell command line.
<tt>JavaImporter</tt> is a new global constructor that allows to omit explicit package names when scripting Java:
</p>
<pre>
var SwingGui = JavaImporter(Packages.javax.swing,
Packages.javax.swing.event,
Packages.javax.swing.border,
java.awt.event,
java.awt.Point,
java.awt.Rectangle,
java.awt.Dimension);
...
with (SwingGui) {
var mybutton = new JButton(test);
var mypoint = new Point(10, 10);
var myframe = new JFrame();
...
}
</pre>
<p>
Previously such functionality was available only to embeddings that used <ahref="apidocs/org/mozilla/javascript/ImporterTopLevel.html"><tt>org.mozilla.javascript.ImporterTopLevel</tt></a> class as the top level scope. The class provides additional <tt>importPackage()</tt> and <tt>importClass()</tt> global functions but their extensive usage has tendency to pollute the global name space with names of Java classes
</p>
<p>
See <ahref="http://bugzilla.mozilla.org/show_bug.cgi?id=245882">Bugzilla 245882</a> for details.
<ahref="apidocs/org/mozilla/javascript/ContextFactory.html"><tt>org.mozilla.javascript.ContextFactory</tt></a> provides new API for customization of <tt>org.mozilla.javascript.Context</tt> and ensures that application-specific Context subclasses will always be used when Rhino runtime needs to create Context instances.
<tt>Date.now()</tt> function which is a SpiderMonkey extension to ECMAScript standard is available now in Rhino. The function returns number of milliseconds passed since 1970-01-01 00:00:00 UTC.
See documentation for <ahref="apidocs/org/mozilla/javascript/optimizer/ClassCompiler.html"><tt>org.mozilla.javascript.optimizer.ClassCompiler</tt></a> that provides replacement for ClassNameHelper and ClassRepository.