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

Wrong 'this' bound to eval call within a function when caller's 'this' is a Java object

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • None

        function func(arg) {
          (function() { print(eval('this')); }).call(arg);
        }

        func(this);
        func({});
        func({ toString: function() "foo" });
        func(new java.lang.Vector());

        Expected:

        [object global]
        [object Object]
        foo
        []

        Last one is toString value on empty Vector instance


        Actual output:

        [object global]
        [object Object]
        foo
        [object global]

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

                Created:
                Updated:
                Resolved: