console.log("%s", null); should log "null"

RESOLVED FIXED in Firefox 10

Status

()

Firefox
Developer Tools
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: ted, Assigned: dchan)

Tracking

unspecified
Firefox 10
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-fx-team])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
Currently console.log("%s", null); raises an error. It should just log "null".
(Assignee)

Comment 1

6 years ago
I'm assuming we would also want this to work for undefined?

console.log("%s", undefined) -> "undefined"
Assignee: nobody → dchan+bugzilla
(Assignee)

Comment 2

6 years ago
Created attachment 565332 [details] [diff] [review]
convert arg to string

This should work.

String(undefined) -> "undefined"
String(null) -> "null"
Attachment #565332 - Flags: feedback?
Comment on attachment 565332 [details] [diff] [review]
convert arg to string

Looks good. Thank you!

Please add a test so we won't cause regressions down the road.
Attachment #565332 - Flags: feedback? → feedback+
(Assignee)

Comment 4

6 years ago
Created attachment 565361 [details] [diff] [review]
[in-fx-team] added testcase

HUDService.jsm doesn't appear to be affected by this bug. I didn't see any reference to the format specifics in the code. Fixing ConsoleAPI.js also fixed the errors that were appearing in WebConsole "args.shift() is null".
Attachment #565332 - Attachment is obsolete: true
Attachment #565361 - Flags: review?(mihai.sucan)
(In reply to David Chan [:dchan] from comment #4)
> Created attachment 565361 [details] [diff] [review] [diff] [details] [review]
> added testcase
> 
> HUDService.jsm doesn't appear to be affected by this bug. I didn't see any
> reference to the format specifics in the code. Fixing ConsoleAPI.js also
> fixed the errors that were appearing in WebConsole "args.shift() is null".

That's right, parameter substitution is implemented completely in ConsoleAPI.js. This bug is really my fault from bug 614586, so thank you for fixing it!
Comment on attachment 565361 [details] [diff] [review]
[in-fx-team] added testcase

Thank you for your quick fix! Much appreciated.
Attachment #565361 - Flags: review?(mihai.sucan) → review+

Updated

6 years ago
Whiteboard: [land-in-fx-team]
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
Comment on attachment 565361 [details] [diff] [review]
[in-fx-team] added testcase

https://hg.mozilla.org/integration/fx-team/rev/6c66a420067c

Thanks for the fix, David!
Attachment #565361 - Attachment description: added testcase → [in-fx-team] added testcase
https://hg.mozilla.org/mozilla-central/rev/6c66a420067c
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 10

Updated

5 years ago
Duplicate of this bug: 704014
Duplicate of this bug: 715077

Updated

5 years ago
Duplicate of this bug: 720462
You need to log in before you can comment on or make changes to this bug.