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

        There are no Sub-Tasks for this issue.

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

              Created:
              Updated:
              Resolved: