Skip to content

Releases: mozilla/rhino

Rhino 1.7.8 Release Candidate 1

22 Dec 20:43
Compare
Choose a tag to compare
Pre-release

This is a release candidate for Rhino 1.7.8, suitable for testing. Please try it out!

Most important changes in this release:

  • JavaScript objects are no longer (somewhat) thread-safe by default
  • Rhino is resistant to "hash flooding" attacks
  • Rhino is only supported for Java 8 and up
  • Rhino only builds with Gradle.

The primary change in this release is that the object storage format has changed
for objects derived from ScriptableObject (which is nearly all objects).

First, objects are no longer thread-safe by default. (They were thread-safe previously, but
not in a way that we could prove was 100 percent correct in all cases.) We do not believe
that the vast majority of Rhino code depended on this capability.

The feature flag Context.FEATURE_THREAD_SAFE_OBJECTS may be used to enable locking on all
objects by default in case it is needed. Furthermore, the built-in "sync" function is still
supported, which can be used to wrap a function in a similar way to the "synchronized" keyword
in Java.

Second, when an object grows to a large number of properties, the native hash table implementation
is replaced with java.util.HashMap. This more complex (but slightly slower) hash implementation
is resistant to hash collisions. This makes Rhino in general resistant to "hash flooding" attacks.

Rhino now depends on Java 8. It also works on Java 9, although a few tests are currently breaking
around Date parsing and UTF-8 encoding.

Additional changes:

Issue 290 Resist hash flooding attacks
Issue 303 Arrow function position set error
Issue 323 Possible OutOfMemory due to
infinite loop on parsing
Issue 341 Objects are only thread-safe when
feature is enabled
Issue 351 Function-level use-strict breaks
backward compatibility
Issue 357 Array.sort() can throw
ArrayIndexOutOfBoundsException
Issue 295 Change WrapFactory to only wrap
"true" primitive types and not subclasses.
PR102 Fix regexp parsing for "/0{0/"
PR108 Attach jsdoc nodes to function params.
PR 169 Enable calling default method
on Java 8.
PR322 Fix static array functions
PR353 Member box call error.
PR355 Support array-like parameters to
Function.prototype.apply().

Rhino 1.7.7.2

27 Sep 23:07
Compare
Choose a tag to compare

This release contains fixes for a few important bugs that have caught Rhino users out in the
field.

  • Do not throw a Java exception from array.prototype.sort() no matter how weird the user-supplied
    comparator function is. This is a major difference between JavaScript and Java and has caused
    us to avoid using "Arrays.sort" on JavaScript arrays.
  • Fix incorrect offsets in the "DataView" class.

It also includes several other fixes:

  • Always append a column number to V8-style stack traces. (Unfortunately it is always "0".)
  • Support Object.is and Object.assign.
  • Make the Symbol implementation match the spec (for VERSION_ES6 and up only).
  • Avoid throwing internal Java exceptions for certain native objects in "toJSON".
  • Allow subclassing of ContinuationPending.
  • For VERSION_ES6 and up, sort properties in the spec-defined order (int property names
    first).
  • Fix stack overflow in string concatenation.
  • Improve performance of ConsString.toString

The next release is likely to be 1.7.8.

Rhino 1.7.7.1

01 Feb 18:29
Compare
Choose a tag to compare

This release fixes a few critical bugs that were affecting code in the field:

  • Improve String.prototype.repeat to work more efficiently and to not overflow
  • Fix CallSite.isNative() and isTopLevel() so that they do not throw fatal errors
  • Replace the implementation of the "YearFromTime" internal method for the Date class to avoid large CPU loops

Specific Changes:

  • Formatting issue with SourceReader.
  • Fix CallSite.isNative() and isTopLevel() to not throw.
  • Make String.prototype.repeat not overflow for large values, and change code style a bit.
  • Add tests from 1.7.7.
  • Add Gradle code from 1.7.7.
  • Replace YearFromTime with code from jsdate.cpp to avoid long CPU loops.

Rhino 1.7.7

17 Jun 18:08
Compare
Choose a tag to compare

Major changes in this release:

Release 1.7.7

Specific changes:

  • Issue 202 Initial support for ECMA Script 6 "method definitions".
  • Issue 201 Make sure that all native Error instances can be converted
    to JSON.
  • Issue 184 Fix compile encoding errors.
  • Issue 178 Support build using Gradle (build using Ant is still
    supported but will be removed in a future release.)
  • Issue 176 Add ScriptRuntime.throwCustomError to make it easier
    to re-throw Java exceptions
  • Issue 166 Support many ES6 additions to the Math class.
  • Issue 165 Support many ES6 additions to the Number class.
  • Issue 163 Support ES6 additions to the String class.

Thanks to everyone who contributed!

Rhino 1.7.6

15 Apr 20:44
Compare
Choose a tag to compare

Merged many of the outstanding pull requests in the GitHub repo.

High-level changes include the following:

  • Many compatibility fixes for Date, Array, String, and others (André Bargull)
  • Array.find() and findIndex() (Evgeny Shepelyuk)
  • String.trimLeft() and trimRight() (Travis Ennis)
  • AST and "toSource" fixes (tntim96)
  • Support for V8 Error extensions, including Error.captureStackTrace (Greg Brail)
  • Support for typed arrays (Greg Brail)
  • Support for attaching "external data" as the indexed properties of any object (Greg Brail)

André Bargull (60):

  • NativeDate: Date.length and Date.UTC.length is 7
  • NativeDate: Fix bug 732779 (Date.prototype.setXXX functions don't evaluate all parameters)
  • NativeDate: Date.prototype.toJSON uses [[GET]] to obtain the "toISOString" property
  • add js_toISOString method to format date values in ISO-8601 Extended Format with expanded year representation if necessary
  • NativeDate: Update Date.parse to support simplified ISO 8601 Extended Format [15.9.1.15]
  • Fix indentation in NativeDate.java
  • NativeError: Error.prototype.name and Error.prototype.message are not enumerable
  • NativeError: 15.11.2.1 and 15.11.4.4 updates
  • Arguments: arguments object should not have its own 'constructor' property, instead it inherits 'constructor' through its prototype
  • Arguments: 'callee', 'caller' and 'length' properties can be redefined for the arguments object
  • BaseFunction: Function.prototype.toString arity is 0
  • BaseFunction: The 'prototype' property on function instances can be redefined
  • BaseFunction: The 'arguments' property can be redefined for function instances
  • NativeArray: Check [[Extensible]] flag for dense-array case in [[Put]]
  • NativeArray: Remove (invalid) round-trips to ScriptRuntime when getting/setting elements
  • NativeArray: Follow spec more closely for Array.isArray and Array.prototype.concat
  • NativeArray: Array.prototype.{indexOf, lastIndexOf} bug fixes
  • NativeArray: Array.prototype.sort bug fixes (bug 728286)
  • NativeArray: Multiple changes to ensure specification algorithms are followed more closely
  • TopLevel,NativeGlobal,ScriptRuntime: Add cache for native error objects
  • NativeNumber: Handle case when precision is Infinity for Number.prototype.{toFixed,toExponential,toPrecision}
  • NativeObject: Object.prototype.toLocaleString uses [[Get]] to retrieve 'toString' property
  • NativeObject: Handle undefined arguments in Object.prototype.{hasOwnProperty,propertyIsEnumerable}
  • NativeString: String.prototype.replace arity is 2 instead of 1
  • NativeString: Handle undefined arguments in String.prototype.slice
  • ScriptRuntime: Fix range check to follow spec in numberToString()
  • ScriptRuntime: Set-up proto and parent-scope for TypeErrorThrower function
  • ScriptableObject: Object.defineProperties needs to make sure to call [[Get]] exactly once for each property entry
  • NativeRegExp: Handle undefined arguments in compile and exec
  • NativeRegExp: Report error if a RegExp flag is used more than once
  • NativeRegExp: RegExp.prototype.compile arity is 2
  • NativeRegExp: RegExp.prototype.lastIndex is lazily evaluated and may be set to non-writable as well
  • NativeRegExpCtor: arity of RegExp constructor is 2
  • NativeRegExpCtor: RegExp.prototype.{multiline,star,input,underscore} properties can be re-defined
  • RegExpImpl: Multiple changes for String.prototype.{match,search,replace,split}
  • Remove obsolete test case js1_2/function/regexparg-2-n.js
  • update test case doctests/arguments.doctest now that the arguments object inherits the 'constructor' property through its prototype
  • NativeRegExp: Make octal escape sequences match web reality
  • RegExpImpl: String.prototype.split with separator=undefined no longer treated as separator='undefined'
  • Fix indentation
  • Context: remove duplicate code in Context#newObject()
  • Context: Use StackTraceElement API to traverse stack-trace
  • NativeArray: address review comment from hns
  • Updated tests files per instructions in o.m.j.tests.MozillaSuiteTest
  • Patch for Bug 783797 ("Function calls across multiple global scopes are not handled properly")
  • Silence warnings in ClassFileWriter
  • Add missing @deprecated annotations
  • Add missing @OverRide annotations
  • Add missing generic type info to deprecatedsrc/
  • Add missing generic type info to toolsrc/
  • Add missing generic type info to testsrc/
  • Add missing generic type info to src/
  • Fix invalid JavaDoc links
  • Replace StringBuffer with StringBuilder if possible
  • Address review comments from hns
  • Generators save and later restore the current stack when processing the 'yield' operation. Our current implementation for restoring the stack unfortunately confuses the Java classfile verifier, so at class load time a VerifierError is thrown. This happens because the verifier can no longer ensure that the proper types are placed on the stack, since the stack-state is saved in a simple Object[]. Re-ordering a few operations is only necessary so the verifier will again accept the generated class. But this is only done for generators because it creates slightly less efficient code compared to the standard case.
  • Add doctest and update comments with proper bug number
  • Patch for Bug 782363 ("Increment/Decrement alters const variables")
  • Patch for Bug 780458 ("Math.IEEEremainder makes ToInt32 slow for non-integer values") (V8):
  • Patch for Bug 789277 ("JSC: "missing ; after statement" message prints out for the line after the problem one")

C. Scott Ananian (1):

  • Don't swallow empty lines in doctest; split lines on Mac/Windows/Unix.

Edison (2):

  • Add working directory support to "runCommand"
  • Add working directory support to "runCommand"

Elliott Baron (1):

  • Add manpage for Rhino shell.

Evgeny Shepelyuk (2):

  • find and findIndex initial impl
  • Improving test framework + one JUnit class = one JS suite + reporting JS stacktrace on error + load function is available in JS + separate file for JS assertions

Gregory Brail (31):

  • Update versions for next iteration.
  • Update README for release notes.
  • Change benchmark output so we can "plot" it in Maven.
  • Fix code cleanup fix that broke the Java 6 build.
  • Fix benchmark output file format again.
  • Re-run ID map on NativeString.
  • Manually add .gitignore additions from @sghill.
  • Added a bit more to the README including content from @shirishp
  • Add a NOTICE with the V8 copyright message.
  • Move anba's new DoubleConversion code into the package with the rest of the code derived from V8.
  • Remove retrotranslator code to generate 1.4-compatible bytecode. Switch bytecode generation to Java 6.
  • Remove code and build artifacts pointing to the "old E4X" implementation, based on XML Beans.
  • Remove unused XML beans-based E4X implementation.
  • One last vestige of XML Beans.
  • Re-generate ID map on NativeArray.
  • Initial checkin of typed arrays and tests from V8. Fix bad capitalization.
  • Fix some integer encoding and add more test cases.
  • Switch typed array tests to use Evgeny's framework for running them. Make them work only with version 1.8.
  • Make typed arrays only appear in 1.8.
  • Add List implementation for all native arrays.
  • Add "Error" to the set of standard Error constructors that could go down the new code path to create an error.
  • Complete List implementation for typed arrays. Write typed array unit tests for the List implementation.
  • Do not double-initialize Error.
  • Make loading of typed array classes lazy. Rename Java classes so that the names are more consistent.
  • Support for V8-style stack trace support: Error.prepareStackTrace Error.captureStackTrace Error.stackTraceLimit And "V8" format stack traces.
  • Improve efficiency of NativeError via pre-cached Method objects and reduced number of default fields.
  • Make "stack" non-enumerable until generated.
  • Add "setExternalArrayData" to ScriptableObject to allow array data to be stored outside the core object.
  • Set default version in shell to "180".
  • Add method to both get and set external array data.
  • Add "initSafeStandardObjects" to create standard objects with no Java class access whatsoever.

Ievgenii.Shepeliuk (2):

  • `findIndex' implementation
  • more V8 compatibility

Raymond Auge (1):

  • rhino exits the JVM even when run as a subshell of another java shell - bug-835147

Travis Ennis (2):

  • Added the Javascript 1.8 String methods trimLeft and trim Right.
  • Added the Javascript 1.8 String methods trimLeft and trimRight.

sainaen (1):

  • Add 'LanguageVersion' annotation. Make 1.8 default version for 'ScriptsTestsBase'

sghill (1):

  • removing old .cvsignore files

tntim96 (5):

Rhino 1.7R5

30 Jan 00:42
Compare
Choose a tag to compare

January 30, 2015

This release contains fixes that have been sitting in the master branch for some time -- see the releases notes below.

The next release will be 1.8.0, and it will include many existing pull requests.

André Bargull (24):

  • Add missing license header to DefineClassMapInheritance.java
  • Remove invalid UTF-8 encoded unicode replacement characters (EF BF BD)
  • Add missing entries
  • Bug 772011: Decompiler does not add curly brackets for labelled statements
  • Add fix for bug-772833 (comment copied over from Parser::condExpr1 in frontend/Parser.cpp)
  • Fix bug 686806: - trailing commas aren't allowed in object/array literals per JSON spec - avoid using Integer.parseInt() to parse unicode escape sequences since parseInt() also accepts non-ASCII digits - also avoid using Character.isDigit() in readNumber() for the very same reason - readString() always created a StringBuilder instance to collect the input data, obviously this is actually only necessary when the input contains escaped characters. Therefore I've changed readString() to take the same approach as used in jsonparser.cpp - the JSON number specification is stricter than Double.parseDouble(), for example Double.parseDouble() accepts the input string '10.'. To ensure only valid JSON number literals are passed to Double.parseDouble(), readNumber() was refactored to perform the necessary input validation.
  • Patch for bug 774083.
  • Patch for Bug 688023:
  • Fix broken test cases which relied on the old (and erroneous) toSource() output
  • Patch bug 685403
  • Patch for bug 637811:
  • Fix bug 773573: Search for first curly bracket after closing parentheses to take account of object destructuring parameters
  • Simple doctest for bug 773573
  • Array.prototype.sort performed an unchecked cast from long to int without any overflow checks, this may result in a negative length which then throws a NegativeArraySizeException in Java, cf. js1_5/Array/regress-157652.js . A similar problem was found in NativeJSON, so I've handled that as well
  • Add explicit cast to int to ensure previous behaviour is retained
  • Calls must not be special-calls and reference-calls at the same time, cf. js1_5/Regress/regress-319391.js for a test case
  • Enable js1_5/Regress/regress-319391.js for MozillaSuiteTest
  • Patch for Bug 728286
  • Add test case
  • Patch for Bug 778549
  • Add missing overflow detection when processing RegExp character class pattern
  • Patch for Bug 780147:
  • Patch for Bug 608235 ("Incorrect error message for undefined[undefined]")
  • Patch for Bug 784358 ("Defining const variable within eval() throws redeclaration error")

Evgeny Shepelyuk (1):

  • fix xmlbeans url

Gregory Brail (10):

  • Add JUnit-based benchmarks that we can automate in Jenkins.
  • Extract zipped-up tests into a directory and check them in that way.
  • Extracted the stuff that was formerly in testsrc/tests.tar.gz.
  • Add XML output for EMMA coverage reports.
  • Fix character encoding tests to work on Mac.
  • Add output to benchmarks that can work with the Jenkins "Measurement Plots" plugin. This replaces the former output from the "SunSpider" and "V8" benchmarks.
  • Add files for Maven deployment.
  • README update.
  • Update README for other tests.
  • Fix E4X test 13.4.4.24 which was failing on Java 8 due to different HashMap iteration ordering.

Hannes Wallnoefer (8):

  • Unwrap Synchronizer in BaseFunction.toSource().
  • Override ScriptableObject.isEmpty in NativeArray
  • Reduce concurrency level / memory footprint in concurrent class cache hash maps
  • Return null for unhandled JavaAdapter methods
  • Make JavaAdapter work with abstract base classes and protected constructors
  • Change build version to 1_7R5pre
  • Extract code to create JS error from Java exception into separate ScriptRuntime method
  • Reduce invocation magic in ShellConsole JLine support classes

Kyle Cronin (2):

  • Patch for Bug 827538
  • Patch for Bug 738388

Rhino 1.7R4

11 Oct 06:29
Compare
Choose a tag to compare

June 18, 2012

  • Update license to MPL 2.0
  • Make string concatenation with + fast
  • Java class generation updates and fixes
  • Faster number to string conversion
  • Several RegExp fixes
  • RegExp performance improvements
  • ES5 compliance fixes
  • Improved interpreter performance
  • Improved CommonJS module implementation
  • JavaScript 1.8 generator expressions
  • Many Parser and AST fixes
  • Use JavaScript 1.7 as default version in Rhino shell
  • JavaAdapter improvements
  • Fixes in JS to Java access
  • Include Mozilla test suite

A list of bugs that were fixed since the previous release.