Details
-
Enhancement
-
Resolution: Fixed
-
P3
-
8
-
None
-
b98
-
generic
-
generic
-
Verified
Description
When a script is evaluated thanks to ScriptEngine.eval, the evaluated script global acquires a "context" property. This property references a ScriptContext.
If this context is modified (e.g.: context = function doIt(){}) then the script execution is broken.
This should be clearly documented.
Testcase, print becomes undefined:
var se = new javax.script.ScriptEngineManager();
var e = se.getEngineByName("nashorn");
e.eval("print('context ' + context);context = function(){}; print('Never reached');");
If this context is modified (e.g.: context = function doIt(){}) then the script execution is broken.
This should be clearly documented.
Testcase, print becomes undefined:
var se = new javax.script.ScriptEngineManager();
var e = se.getEngineByName("nashorn");
e.eval("print('context ' + context);context = function(){}; print('Never reached');");