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

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

        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

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

                Created:
                Updated:
                Resolved: