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

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 9
    • Component/s: 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

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

                Created:
                Updated:
                Resolved: