Needs to enforce and document that global "context" and "engine" can't be modified when running via jsr223

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • None
    • b98
    • generic
    • generic
    • Verified

      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');");

            Assignee:
            Sundararajan Athijegannathan
            Reporter:
            Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: