Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JSON] JSON.stringify(undefined) panics #509

Closed
croraf opened this issue Jun 18, 2020 · 4 comments · Fixed by #512
Closed

[JSON] JSON.stringify(undefined) panics #509

croraf opened this issue Jun 18, 2020 · 4 comments · Fixed by #512
Assignees
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Milestone

Comments

@croraf
Copy link
Contributor

croraf commented Jun 18, 2020

In Chrome it returns "undefined".

But in the spec https://tc39.es/ecma262/#sec-json.stringify it says:
image

In boa it panics:

thread 'main' panicked at 'internal error: entered unreachable code: Symbols and Undefined JSON Values depend on parent type', boa/src/builtins/value/mod.rs:264:17
@croraf croraf added the bug Something isn't working label Jun 18, 2020
@n14little
Copy link
Contributor

I'll look into this.

@HalidOdat HalidOdat added the builtins PRs and Issues related to builtins/intrinsics label Jun 19, 2020
@croraf
Copy link
Contributor Author

croraf commented Jun 19, 2020

Behavior in chrome (we should probably have tests for the below cases):
image

@n14little
Copy link
Contributor

n14little commented Jun 19, 2020

@croraf
For your JSON.stringify({ a: undefined }); case, there is this test on master.
For your JSON.stringify() case, there is this test on master.
The JSON.stringify(undefined) case is being addressed in #512
And for your JSON.stringify([6, undefined, 7]) case, there is this test on master.

@croraf
Copy link
Contributor Author

croraf commented Jun 19, 2020

Oh. I now see NOTE 5 in the spec exactly explains how JSON.stringify(undefined) should be returned.

@Razican Razican added this to the v0.9.0 milestone Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants