-
Bug
-
Resolution: Fixed
-
P3
-
None
-
None
-
b29
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8056564 | emb-9 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | master |
JDK-8064189 | 8u45 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | b01 |
JDK-8055736 | 8u40 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | b04 |
JDK-8070426 | emb-8u47 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | team |
Test:
import javax.script.*;
import jdk.nashorn.api.scripting.JSObject;
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = m.getEngineByName("nashorn");
JSObject jsobj = (JSObject) e.eval("({ foo: 23})");
jsobj.eval("print(Object.keys(this))");
jsobj.eval("print(this.foo)");
}
}
Output expected:
foo
23
Output seen
undefined
Clearly, "global" is passed as "this" to the script evaluated by JSObject.eval.
import javax.script.*;
import jdk.nashorn.api.scripting.JSObject;
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = m.getEngineByName("nashorn");
JSObject jsobj = (JSObject) e.eval("({ foo: 23})");
jsobj.eval("print(Object.keys(this))");
jsobj.eval("print(this.foo)");
}
}
Output expected:
foo
23
Output seen
undefined
Clearly, "global" is passed as "this" to the script evaluated by JSObject.eval.
- backported by
-
JDK-8055736 Wrong "this" passed to JSObject.eval call
- Resolved
-
JDK-8056564 Wrong "this" passed to JSObject.eval call
- Resolved
-
JDK-8064189 Wrong "this" passed to JSObject.eval call
- Resolved
-
JDK-8070426 Wrong "this" passed to JSObject.eval call
- Resolved