Possible scope leak in Nashorn
Attila Szegedi
attila.szegedi at oracle.com
Tue Dec 10 10:10:21 PST 2013
Hm… I'll let Sundar chime in whether we intend to support JSON.stringify on ScriptObjectMirror objects. My first impression is that we should, but there might be some subtle semantic issues. JSObject has isArray, so we can correctly decide whether to serialize an object as {} or [].
Attila.
On Dec 10, 2013, at 5:52 PM, André Bargull <andrebargull at googlemail.com> wrote:
>> Thanks, I adapted the code to use ScriptUtils.wrap() and encountered a
>> strange situation where JSON.stringify returns undefined for a valid JS
>> object. Maybe another scope problem?
>>
>> Here is a reproducer:https://gist.github.com/purplefox/7893408
>
> No, it's not a scope problem. JSON.stringify isn't able to process ScriptObjectMirror objects, see ll. 263-270 in NativeJSON.java [1].
>
> - André
>
> [1] http://hg.openjdk.java.net/nashorn/jdk8/nashorn/file/tip/src/jdk/nashorn/internal/objects/NativeJSON.java
More information about the nashorn-dev
mailing list