CLOSED DUPLICATE of bug 134007 153830
Web Inspector: JSON prettifier does not correctly handle negative numbers
https://bugs.webkit.org/show_bug.cgi?id=153830
Summary Web Inspector: JSON prettifier does not correctly handle negative numbers
Antoine Quint
Reported 2016-02-03 05:02:13 PST
Created attachment 270572 [details] Screenshot The following JSON: {"someNegativeNumbers":[-8,-6,-3]} is prettified as: { "someNegativeNumbers": [ - 8, - 6, - 3] } Note the space between the "-" and the actual number value. This prettified JSON is invalid.
Attachments
Screenshot (243.11 KB, image/png)
2016-02-03 05:02 PST, Antoine Quint
no flags
Testcase (343 bytes, text/html)
2016-02-03 05:02 PST, Antoine Quint
no flags
Supporting resource for test case (34 bytes, application/json)
2016-02-03 05:03 PST, Antoine Quint
no flags
Antoine Quint
Comment 1 2016-02-03 05:02:48 PST
Created attachment 270573 [details] Testcase
Antoine Quint
Comment 2 2016-02-03 05:03:09 PST
Created attachment 270574 [details] Supporting resource for test case
Radar WebKit Bug Importer
Comment 3 2016-02-03 05:04:21 PST
Radar WebKit Bug Importer
Comment 4 2016-02-03 05:04:22 PST
Joseph Pecoraro
Comment 5 2016-02-03 15:59:45 PST
Yep, this was a known issue with the JavaScript pretty printer. CodeMirror used to tokenize -/+ as part of the number and then stopped. One pro is that it now sees this as an operator that we can reason about, on the minus side we weren't reasoning about it very carefully. Basically always treating +/- as binary operators. I have a hack that makes an effort to better handle unary numbers. I saw no performance regression.
Joseph Pecoraro
Comment 6 2016-02-03 16:04:22 PST
*** This bug has been marked as a duplicate of bug 134007 ***
Note You need to log in before you can comment on or make changes to this bug.