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

          Activity

          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/c24beef07d1b
          User: sundar
          Date: 2016-05-18 08:38:51 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/c24beef07d1b User: sundar Date: 2016-05-18 08:38:51 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/c24beef07d1b
          User: lana
          Date: 2016-05-25 17:36:18 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/c24beef07d1b User: lana Date: 2016-05-25 17:36:18 +0000

            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: