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

JSON.stringify does not work on ScriptObjectMirror objects

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b120
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        When JSON.stringify is called on a ScriptObjectMirror, we get undefined value. JSON.stringify is used as debug aid by nashorn users. ScriptObjectMirror being not handled by JSON.stringify makes it difficult.

        D:\src\jdk9-dev\build\windows-x86_64-normal-server-release\images\jdk\bin>.\jjs
        jjs> SM = javax.script.ScriptEngineManager
        [JavaClass javax.script.ScriptEngineManager]
        jjs> e = new SM().getEngineByName("nashorn")
        jdk.nashorn.api.scripting.NashornScriptEngine@23348b5d
        jjs> JSON.stringify(e.eval("({ foo: 343 })")) === undefined
        true
        jjs>

        This issue was reported by Eric Pederson via nashorn-dev alias.

        See also: http://mail.openjdk.java.net/pipermail/nashorn-dev/2016-May/006162.html

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  sundar Sundararajan Athijegannathan
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: