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

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

    XMLWordPrintable

Details

    • Enhancement
    • Status: Closed
    • P3
    • Resolution: Fixed
    • 8
    • 8
    • core-libs
    • 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');");

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: