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

Array.prototype.pop, push, and reverse didn't call ToObject on their argument

    XMLWordPrintable

Details

    Description

      A DESCRIPTION OF THE PROBLEM :
      #Testcase:
      var foo = function(){
            Array.prototype.pop.call(false);
            print("here");
      };
      foo();

      #Command:
      ./nashorn/jdk-13.0.1/bin/jjs --no-syntax-extensions=true --no-deprecation-warning=true testcase.js

      #Output:
      testcase.js:2 TypeError: false is not an Object.

      #Expected output:
      here

      #Description:
      According to ES standard , when running this testcase, false should be converted to the Object in line 2, but nashorn threw a TypeError exception:false is not an Object.
      The references are as follows:
      http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.3.4.4
      http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.4.4.6


      Attachments

        Activity

          People

            attila Attila Szegedi
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: