Opened 4 years ago

Last modified 17 months ago

#1879 new defect

Reliably serialize NaN values

Reported by: historic_bruno Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Core engine Keywords:


In #1828, it was discovered the cause of serialization test failure was Spidermonkey using different values internally for NaN. According to ECMAScript-262, there is only a single NaN value which can have different internal representation depending on the implementation. Because this might vary on different systems and even the same system in JIT vs. non-JIT paths, we should probably canonize it when serializing so it doesn't cause an OOS or serialization test failure.

Related problem: the debug serializer doesn't handle NaN or Infinity, so a simple text diff won't reveal these errors. For floating-point values in the engine, we can fix that by completing the canonfloat() function. For script vals, it's a bit more difficult because we use JS_Stringify, which per the JSON spec doesn't allow NaN or Infinity (replacing them with null).

Change History (3)

comment:1 Changed 4 years ago by ben

In 13322:

Fixes serialization test failure caused by CmpFoundation?'s buildMultiplier property sometimes being NaN (which can assume different internal values in Spidermonkey). For now, NaN cannot be reliably serialized. Fixes #1828, refs #1879

comment:2 Changed 3 years ago by Yves

  • Owner set to Yves
  • Status changed from new to assigned

I'm taking this ticket because I currently work with SpiderMonkey and Serialization which is both related and I will probably run into that problem too (or figure out it's solved now).

comment:3 Changed 17 months ago by Yves

  • Owner Yves deleted
  • Status changed from assigned to new
Note: See TracTickets for help on using tickets.