Closed Bug 1239506 Opened 8 years ago Closed 8 years ago

console formatter should format 'nan' as 'NaN'

Categories

(DevTools :: Console, defect)

44 Branch
defect
Not set
normal

Tracking

(firefox47 verified)

RESOLVED FIXED
Firefox 47
Tracking Status
firefox47 --- verified

People

(Reporter: coreyf, Assigned: bgrins)

Details

(Whiteboard: [console-spec])

Attachments

(1 file, 1 obsolete file)

For some reason, Firefox formats "not a number" value as 'nan' sometimes in the console. For the sake of consistency, this should probably be styled as 'NaN'.

https://github.com/whatwg/console/blob/master/NOTES.md#float-formatter


Firefox:

```
console.log("%f", "fo")
nan
```

Chrome:

```
console.log("%f", "fo")
NaN
```
Whiteboard: [console-spec]
Attached patch console-nan.patch (obsolete) — Splinter Review
Andrea, this fixes the problem but I'm not sure if it's the best option.  Switching to AppendFloat instead of AppendFormatString also fixes it but then I don't think we can keep the `mantissa` functionality.  FWIW the mantissa syntax isn't supported by Chrome or in the lastest spec: https://console.spec.whatwg.org/#formatting-no-ui
Attachment #8712345 - Flags: feedback?(amarchesini)
Attachment #8712345 - Flags: feedback?(amarchesini) → feedback+
Comment on attachment 8712345 [details] [diff] [review]
console-nan.patch

Review of attachment 8712345 [details] [diff] [review]:
-----------------------------------------------------------------

Alright, flagging for review.  Here's a try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=38c25d87584d
Attachment #8712345 - Flags: review?(amarchesini)
Actually, switched to AppendFloat for nan case to get rid of hardcoded string.  I'm assuming this behavior is defined across platforms, I guess try will show
Attachment #8712345 - Attachment is obsolete: true
Attachment #8712345 - Flags: review?(amarchesini)
Attachment #8712712 - Flags: review?(amarchesini)
Attachment #8712712 - Flags: review?(amarchesini) → review+
https://hg.mozilla.org/mozilla-central/rev/24320d1e9d99
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
Assignee: nobody → bgrinstead
I have reproduced this bug on Nightly 46.0a1 (2016-01-13) on ubuntu 14.04 LTS, 32 bit!

The bug's fix is now verified on Latest Developer Edition 47.0a2!

Build ID: 20160323004040
User Agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0
QA Whiteboard: [bugday-20160323]
I have reproduced this bug with Firefox nightly 46.0a1(build id:20160113030208)on
windows 7(64 bit)

I have verified this bug as fixed with Firefox aurora 47.0a2(build id:20160323004040)
User Agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: