Summary: | Web Inspector: JSON prettifier does not correctly handle negative numbers | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Antoine Quint <graouts> | ||||||||
Component: | Web Inspector | Assignee: | Joseph Pecoraro <joepeck> | ||||||||
Status: | CLOSED DUPLICATE | ||||||||||
Severity: | Normal | CC: | bburg, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | Safari 9 | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Attachments: |
|
Created attachment 270573 [details]
Testcase
Created attachment 270574 [details]
Supporting resource for test case
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. *** This bug has been marked as a duplicate of bug 134007 *** |
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.