Some more spec-compliance bugs

Jim Laskey (Oracle) james.laskey at oracle.com
Fri Mar 29 10:14:26 PDT 2013


Thanks André.  I created JDK-8011086 to umbrella these bugs.  They may later be broken down to sub-tasks.

External bug reporting is in the works but I'm not sure what the target date is.  Submitting to this e-mail is the way to go for the time being.

BTW: Many of us are taking a long weekend (starting today), so responses will be slow.

Cheers,

-- Jim



On 2013-03-29, at 1:48 PM, André Bargull <andrebargull at googlemail.com> wrote:

> Here are some more edge cases from the ECMAScript specification which aren't correctly implemented in Nashorn. Let me know if you need any specific information why the current implementation is not spec-compliant. But I think fixing the bugs should be straight forward, most times just following the exact algorithm steps is required.  (The new bug tracker is still not available, is it?)
> 
> - André
> 
> 
> function defLen(arr, len, f) { Object.defineProperty(arr, "length", {value: {valueOf: function(){ f && f(); return len }}}); }
> a = [], defLen(a, 1, function() {defLen(a, 10); Object.defineProperty(a, "5", {value: 'test', writable: true, configurable: true})})
> print(a[5] + " - " + a.length)
> => this should print "undefined - 1" instead of "test - 1" (see https://bugs.ecmascript.org/show_bug.cgi?id=1200)
> 
> Object.defineProperty([], "length", Object.defineProperty({},"configurable",{get: function(){print("configurable"); return false}}))
> => should print "configurable" only once
> 
> Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.length
> => returns 1, but should return 0
> 
> Object.isExtensible(Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get)
> => returns true, but should return false
> 
> Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.hasOwnProperty("prototype")
> => returns true, but should return false
> 
> "".split(undefined,{valueOf:function(){throw 2}})
> => this should throw an exception, but currently doesn't
> 
> Array.prototype.join.call(null,{toString:function(){throw 2}})
> => toString() executed instead of TypeError thrown due to null-this
> 
> [,void 0].sort().hasOwnProperty("1")
> => reports true but should be false
> 
> [].slice({valueOf:function(){print("get-start")}}, {valueOf:function(){print("get-end")}})
> => prints "get-start|end" twice but should only be once
> 
> [].splice({valueOf:function(){print("get-start")}})
> => prints "get-start" twice but should only be once
> 
> (new Date).setFullYear({valueOf:function(){print("year"); return NaN}}, {valueOf: function(){print("month"); return NaN}})
> => should print "year" and "month"
> 
> (d = new Date(), d.toISOString = function(){return "test"}, d.toJSON())
> => should return "test"
> 
> Function("}),print('test'),({")
> => should throw a SyntaxError exception, currently prints "test"
> 
> JSON.parse('"\\a"')
> JSON.parse("0.")
> JSON.parse("08")
> => should throw SyntaxError exceptions
> 
> (re = RegExp(), re.lastIndex = {valueOf:function(){print("lastIndex"); return 0}}, re.test(""))
> => should print "lastIndex"
> 
> decodeURIComponent("%C0%80")
> => should throw an URIError exception



More information about the nashorn-dev mailing list