Commit graph

5 commits

Author SHA1 Message Date
davidot
9921f80817 LibJS: Fix that non-double numbers from JSON were truncated to i32 2022-10-23 15:48:45 +02:00
Luke Wilde
da25ac0d48 AK: Treat empty string as invalid JSON
Previously we would treat the empty string as `null`. This caused
JavaScript like this to fail:
```js
var object = {};
try {
    object = JSON.parse("");
} catch {}
var array = object.array || [];
```
Since `JSON.parse("")` returned null instead of throwing, it would set
`object` to null and then try and use it instead of using the default
backup value.
2022-07-10 23:31:48 +02:00
serenitydev
23c72c6728 AK: Fix userland parsing of rounded floating point numbers
Parse JSON floating point literals properly,
No longer throwing a SyntaxError when the decimal portion
of the number exceeds the capacity of u32.

Added tests to AK/TestJSON and LibJS/builtins/JSON/JSON.parse
2022-02-16 07:22:51 -05:00
ForLoveOfCats
71ab8fb757 LibJS: Add in-tree test for Json parsing of negative zeros
This mirrors the cases in `built-ins/JSON/parse/text-negative-zero` in
test262
2022-01-19 21:51:09 +00:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js (Browse further)