New in Rhino 1.6R6

  • Revision slug: New_in_Rhino_1.6R6
  • Revision title: New in Rhino 1.6R6
  • Revision id: 143771
  • Created:
  • Creator: Norrisboyd
  • Is current revision? No
  • Comment

Revision Content

Rhino 1.6R6 adds several new features.

JavaScript 1.5 features

Rhino now supports the remaining JavaScript 1.5 features that hadn't been implemented in previous Rhino versions.

JavaScript 1.5: "strict" mode with new warning messages

See Tackling JavaScript strict warnings for a description of JavaScript script mode.

Briefly, Rhino reports warnings in strict mode for

  • assignments to undefined variables
  • references to undefined properties
  • inconsistent return statements in a function
  • duplicate parameter names
  • variables that hide parameters
  • assignment in a conditional (Note: you can suppress this warning by including an extra set of parentheses around the assignment)
  • trailing comma in object initializer (Note: this is always a full error in Rhino)
  • indirect calls to eval
  • useless expressions

To enable strict mode for the Rhino shell, add <tt>-strict</tt> to the command line. If you are using the API directly, set the Context feature <tt>FEATURE_STRICT_MODE</tt>.

It's also possible to cause all warnings to be treated as errors. Add <tt>-fatal-warnings</tt> to the shell command line or set the Context feature <tt>FEATURE_WARNING_AS_ERROR</tt>.

See {{template.Bug(378790)}} for nitty gritty details.

JavaScript 1.5: Getters and Setters

See Defining Getters and Setters in the JavaScript 1.5 Reference.

JavaScript 1.5: <tt>const</tt> keyword

See const in the JavaScript 1.5 Reference.

New E4X Implementation using Java 1.5 DOM

Since Rhino 1.6R1, Rhino has used the Apache XMLBeans library to support E4X. In Rhino 1.6R6 the E4X support has been rewritten to rely solely on the DOM3 APIs supported natively by Java 1.5. (Pre-1.5 users can use DOM3 using Java's endorsed standards override mechanism if they have a DOM3-capable XML parser.) As of this release, the XMLBeans implementation remains the default if XMLBeans classes are found on the classpath; otherwise, the native DOM implementation is used if DOM3 is present. If neither XMLBeans nor DOM3 are present, E4X is not available.

Integration with Java security architecture

Rhino 1.6R6 adds org.mozilla.javascript.PolicySecurityController as a concrete implementation of an org.mozilla.javascript.SecurityController and the preferred way of integrating with Java security architecture. When no security controller is in use, generated classes and scripts run in the ProtectionDomain of Rhino classes. Wrapped access to system properties and creation of class loaders into AccessController.doPrivileged() to nicely play in secured environments.

Test Drivers

Rhino now comes with test drivers written in Java. These drivers can be used to test Rhino if you are making any changes to the core engine. They are designed to use the tests shared with the C-based SpiderMonkey engine in mozilla/js/tests in CVS.

See Running the Rhino tests for details on how to execute the tests using JsDriver.

Support for calling Java methods and constructors with variable argument lists

Java J2SE 5 added support for variable argument lists in constructors and methods. Rhino 1.6R6 now supports calling these methods and constructors using variable argument lists. For example,

java.lang.System.out.format("%3.1f%s\n", 1.6, "R6");

prints <tt>1.6R6</tt>.

See {{template.Bug(382457)}} for more details.

Bug fixes

This list shows all the bugs (and enhancements) fixed in Rhino 1.6R6.



Norrisboyd 07:03, 13 June 2007 (PDT)

Revision Source

<p>Rhino 1.6R6 adds several new features.
</p>
<h2 name="JavaScript_1.5_features">JavaScript 1.5 features</h2>
<p>Rhino now supports the remaining JavaScript 1.5 features that hadn't been implemented in previous Rhino versions.
</p>
<h3 name="JavaScript_1.5:_.22strict.22_mode_with_new_warning_messages">JavaScript 1.5: "strict" mode with new warning messages</h3>
<p>See <a class="external" href="http://www.javascriptkit.com/javatutors/serror.shtml">Tackling JavaScript strict warnings</a> for a description of JavaScript script mode. 
</p><p>Briefly, Rhino reports warnings in strict mode for
</p>
<ul><li> assignments to undefined variables
</li><li> references to undefined properties
</li><li> inconsistent return statements in a function
</li><li> duplicate parameter names
</li><li> variables that hide parameters
</li><li> assignment in a conditional (<i>Note: you can suppress this warning by including an extra set of parentheses around the assignment</i>)
</li><li> trailing comma in object initializer (<i>Note: this is always a full error in Rhino</i>)
</li><li> indirect calls to eval
</li><li> useless expressions
</li></ul>
<p>To enable strict mode for the Rhino shell, add <tt>-strict</tt> to the command line. If you are using the API directly, set the Context feature <tt>FEATURE_STRICT_MODE</tt>.
</p><p>It's also possible to cause all warnings to be treated as errors. Add <tt>-fatal-warnings</tt> to the shell command line or set the Context feature <tt>FEATURE_WARNING_AS_ERROR</tt>. 
</p><p>See {{template.Bug(378790)}} for nitty gritty details.
</p>
<h3 name="JavaScript_1.5:_Getters_and_Setters">JavaScript 1.5: Getters and Setters</h3>
<p>See <a class="external" href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Creating_New_Objects:Defining_Getters_and_Setters">Defining Getters and Setters</a> in the JavaScript 1.5 Reference.
</p>
<h3 name="JavaScript_1.5:_const_keyword">JavaScript 1.5: <tt>const</tt> keyword</h3>
<p>See <a class="external" href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Statements:const">const</a> in the JavaScript 1.5 Reference.
</p>
<h2 name="New_E4X_Implementation_using_Java_1.5_DOM"> New E4X Implementation using Java 1.5 DOM </h2>
<p>Since Rhino 1.6R1, Rhino has used the Apache XMLBeans library to support E4X.  In Rhino 1.6R6 the E4X support has been rewritten to rely solely on the DOM3 APIs supported natively by Java 1.5.  (Pre-1.5 users can use DOM3 using Java's endorsed standards override mechanism if they have a DOM3-capable XML parser.)  As of this release, the XMLBeans implementation remains the default if XMLBeans classes are found on the classpath; otherwise, the native DOM implementation is used if DOM3 is present.  If neither XMLBeans nor DOM3 are present, E4X is not available.
</p>
<h2 name="Integration_with_Java_security_architecture"> Integration with Java security architecture </h2>
<p>Rhino 1.6R6 adds org.mozilla.javascript.PolicySecurityController as a concrete 
implementation of an org.mozilla.javascript.SecurityController and the 
preferred way of integrating with Java security architecture.
When no security controller is in use, generated classes and scripts run in
the ProtectionDomain of Rhino classes.
Wrapped access to system properties and creation of class loaders into
AccessController.doPrivileged() to nicely play in secured environments.
</p>
<h2 name="Test_Drivers"> Test Drivers </h2>
<p>Rhino now comes with test drivers written in Java. These drivers can be used to test Rhino if you are making any changes to the core engine. They are designed to use the tests shared with the C-based SpiderMonkey engine in mozilla/js/tests in CVS.
</p><p>See <a href="en/Running_the_Rhino_tests">Running the Rhino tests</a> for details on how to execute the tests using JsDriver.
</p>
<h2 name="Support_for_calling_Java_methods_and_constructors_with_variable_argument_lists"> Support for calling Java methods and constructors with variable argument lists </h2>
<p>Java J2SE 5 added support for variable argument lists in constructors and methods. Rhino 1.6R6 now supports calling these methods and constructors using variable argument lists. For example,
</p>
<pre>java.lang.System.out.format("%3.1f%s\n", 1.6, "R6");
</pre>
<p>prints <tt>1.6R6</tt>.
</p><p>See {{template.Bug(382457)}} for more details.
</p>
<h2 name="Bug_fixes"> Bug fixes </h2>
<p>This <a class="external" href="https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&amp;short_desc_type=allwordssubstr&amp;short_desc=&amp;product=Rhino&amp;target_milestone=1.6R6&amp;long_desc_type=substring&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=&amp;bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;resolution=FIXED&amp;emailassigned_to1=1&amp;emailtype1=exact&amp;email1=&amp;emailassigned_to2=1&amp;emailreporter2=1&amp;emailqa_contact2=1&amp;emailtype2=exact&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=|bug">list</a> shows all the bugs (and enhancements) fixed in Rhino 1.6R6.
</p><p><br>
</p>
<hr>
<p><a href="User:Norrisboyd">Norrisboyd</a> 07:03, 13 June 2007 (PDT)
</p>
Revert to this revision