Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024970 André Bargull's list on Sep 17, 2013
  3. JDK-8048071

eval within 'with' statement does not use correct scope if with scope expression has a copy of eval

    XMLWordPrintable

Details

    • Sub-task
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • 9
    • 9
    • core-libs
    • None
    • b22
    • generic
    • generic

    Backports

      Description

        print((function(global){
            var x = 1;
            with(global) {
                eval("eval('var x=0')");
            }
            return x;
        })(this));
        print("typeof x?" + typeof x);

        Expected:
        0
        typeof x? undefined

        Actual:
        1
        typeof x? number


        print((function(global){
           var x = 1;
           with({eval: global.eval}) {
               eval("eval('var x=0')");
           }
           return x;
        })(this));
        print("typeof x? " + typeof x);

        Expected:
        0
        typeof x? undefined


        Actual:
        1
        typeof x? number

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: