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

A Possible Issue of Keyword “this”

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      A DESCRIPTION OF THE PROBLEM :
      #Testcase:
      var foo = function () {
      function callbackfn() {
      print(this);
      }
      return [11].reduce(callbackfn, 1);
      };
      foo();

      #Command:
      ./nashorn/jdk-12.0.1/bin/jjs --language=es6 --no-deprecation-warning=true testcase.js

      #Output:
      Undefined

      #Expected output:
      [object global]

      #Description:
      When running the above testcase, the keyboard "this" in line 3 should be a global object. However, Nashorn outputs "Undefined" while other JS engines such as v8, spiderMonkey, chakra, javascriptCore output "œ[object global]". Is it an issue of Nashorn?


        Attachments

          Activity

            People

            • Assignee:
              hannesw Hannes Wallnoefer
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: