Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8011086

Specification fails (outside test262)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • None

      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

        1.
        Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.length is not 0 Sub-task Closed Sundararajan Athijegannathan  
        2.
        Object.isExtensible(Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get) should be false Sub-task Closed Sundararajan Athijegannathan  
        3.
        Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.hasOwnProperty("prototype") should be false Sub-task Closed Sundararajan Athijegannathan  
        4.
        Array.prototype.slice and Array.prototype.splice should not call user defined valueOf of start, end arguments more than once Sub-task Closed Sundararajan Athijegannathan  
        5.
        Array.prototype.join and Array.prototype.toString do not throw TypeError on null, undefined Sub-task Closed Sundararajan Athijegannathan  
        6.
        Data prototype methods and constructor do not call user defined toISOString, valueOf methods per spec. Sub-task Closed Sundararajan Athijegannathan  
        7.
        RegExp.prototype.test() does not call valueOf on lastIndex property as per the spec. Sub-task Closed Sundararajan Athijegannathan  
        8.
        When using Object.defineProperty on arrays, PropertyDescriptor's property accessors are invoked multiple times Sub-task Closed Sundararajan Athijegannathan  
        9.
        "".split(undefined,{valueOf:function(){throw 2}}) does not throw exception Sub-task Closed Sundararajan Athijegannathan  
        10.
        Arrays with missing elements are not properly sorted Sub-task Closed Sundararajan Athijegannathan  
        11.
        Function("}),print('test'),({") should throw SyntaxError Sub-task Closed Sundararajan Athijegannathan  
        12.
        JSON parsing issues with escaped strings, octal, decimal numbers Sub-task Closed Sundararajan Athijegannathan  
        13.
        Parsing issue with decodeURIComponent Sub-task Closed Sundararajan Athijegannathan  

            sundar Sundararajan Athijegannathan
            jlaskey Jim Laskey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: