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

An issue in "for-in" statement while using splice(), pop() and shift() methods

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      #Testcase:
      var NISLFuzzingFunc = function(){
           var e = ["a", "b", "c"];
          for (var n in e){
              print(n < e.length);
              e.splice(n,1);
          }
      };
      NISLFuzzingFunc();

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

      #Output:
      true
      true
      false

      #Expected output:
      true
      true

      #Description
      The for-in statement is executed unexpectedly when using splice() method to update the array. There are the same situations when using method pop() and shift().


        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: