Bug 154613 - Web Inspector: Setting serializes Infinity as null
Summary: Web Inspector: Setting serializes Infinity as null
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks: 154561
  Show dependency treegraph
 
Reported: 2016-02-23 15:41 PST by Matt Baker
Modified: 2016-02-24 17:41 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2016-02-23 15:41:59 PST
* SUMMARY
Setting serializes Infinity as null.

According to the ECMA-262 spec (page 473 Note 4):
"Finite numbers are stringified as if by calling ToString(number). NaN and Infinity regardless of sign are represented as the String null."

There isn't a need for serializing NaN at the moment. TimelineRuler however, needs to serialize Infinity in order to persist the "nothing is selected" ruler selection state, which is represented by a selection interval of [0, Infinity).

*NOTES
This can be added by augmenting JSON.stringify in Utilities.js, or by adding a special case in WebInspector.Setting.
Comment 1 Radar WebKit Bug Importer 2016-02-23 15:42:22 PST
<rdar://problem/24802960>
Comment 2 Timothy Hatcher 2016-02-23 15:47:55 PST
We could also store that "entire range selected" state as a bool and restore [0, Infinity] on load from settings.
Comment 3 Matt Baker 2016-02-23 15:50:23 PST
(In reply to comment #2)
> We could also store that "entire range selected" state as a bool and restore
> [0, Infinity] on load from settings.

That is a possible solution. I'll try this, as well as MAX_VALUE as an alternative to Infinity in TimelineRuler code go with the cleaner solution.
Comment 4 Matt Baker 2016-02-24 17:41:21 PST
Using Number.MAX_VALUE instead of Infinity solved the issue.