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

loadWithNewGlobal should support user supplied arguments from the caller

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • core-libs
    • None
    • b96
    • generic
    • generic
    • Verified

      loadWithNewGlobal API allows a script to be executed in new global scope. But caller script can't pass any argument now. Caller should be able to able to pass one or more arguments to the executed script.

      Example:

      loadWithNewGlobal({
         name: "<code>",

         script:" print(arguments[0]); "+
              " print(arguments[1]); " +
              "print(arguments[2].foo)",
         },
        "hello", 23, { foo: 33}
      );


      Should print:

      hello
      22
      33

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

              Created:
              Updated:
              Resolved: