Closed
Bug 614931
Opened 14 years ago
Closed 14 years ago
Number.toLocaleString adds trailing NULL-byte
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla2.0b9
Tracking | Status | |
---|---|---|
blocking2.0 | --- | betaN+ |
People
(Reporter: jandem, Assigned: bzbarsky)
References
Details
(Keywords: regression, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
2.82 KB,
patch
|
Details | Diff | Splinter Review |
--- js> (3.14).toLocaleString() "3.14\0" js> (3.14).toLocaleString().length 5 --- I only see this in the shell (OS X, x86/x64, GCC 4.2.1). Tinderbox browser build works OK. Can anybody reproduce?
Assignee | ||
Comment 1•14 years ago
|
||
Yes, I can reproduce. I don't see how this could possibly not happen everywhere, though. The code added in bug 446494 is just broken: 760 size = digits + (*nint ? strlen(nint + 1) + 1 : 0); 761 if (*nint == '.') 762 size += decimalLength; It needs to take out the "+1" after the strlen call, as far as I can see, since it's accounting for the decimalLength separately... Brian, am I just missing something?
Blocks: 446494
Keywords: regression
Comment 2•14 years ago
|
||
bz: Yeah, looks like you're right. Removing that + 1 doesn't regress the other case, either. r=me :)
Assignee | ||
Comment 3•14 years ago
|
||
The reason this doesn't happen in the browser is that the browser impl of cx->localeCallbacks->localeToUnicode goes through intl code, which I bet treats that null byte as the actual end of string.
Assignee | ||
Comment 4•14 years ago
|
||
Attachment #495762 -
Flags: review?(brendan)
Assignee | ||
Updated•14 years ago
|
Assignee: general → bzbarsky
Priority: -- → P3
Whiteboard: [need review]
Comment 5•14 years ago
|
||
Comment on attachment 495762 [details] [diff] [review] Number.toLocaleString shouldn't miscumpute the string length. size is simply the wrong name -- it's the canonical name (along with nbytes) for a size_ allocation size, not net length in scaled elements. Suggest len, length, or buflen instead. r=me with that. /be
Attachment #495762 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 6•14 years ago
|
||
OK, will rename to buflen. Is this something I should try to get in for 2.0, given that it doesn't affect browser?
Comment 7•14 years ago
|
||
Note that this probably does affect some parts of the browser (XPCOM components, maybe JS modules?), given bug 441370.
Assignee | ||
Comment 8•14 years ago
|
||
That's a dup of bug 616841, which is a blocker. So it really won't be much of a problem. But ok, I'll try to get this landed.
Assignee | ||
Updated•14 years ago
|
Attachment #495762 -
Attachment is obsolete: true
Assignee | ||
Comment 9•14 years ago
|
||
Assignee | ||
Comment 10•14 years ago
|
||
Given the comments in bug 616841, we're not likely to fix it in various contexts like workers... So this should probably block.
blocking2.0: --- → ?
Assignee | ||
Updated•14 years ago
|
Whiteboard: [need review] → [need approval]
Assignee | ||
Updated•14 years ago
|
Attachment #499363 -
Flags: approval2.0?
Updated•14 years ago
|
blocking2.0: ? → betaN+
Assignee | ||
Updated•14 years ago
|
Whiteboard: [need approval] → [need landing]
Assignee | ||
Updated•14 years ago
|
Attachment #499363 -
Flags: approval2.0?
Assignee | ||
Comment 11•14 years ago
|
||
Pushed http://hg.mozilla.org/tracemonkey/rev/921fb4d04aca and then pushed http://hg.mozilla.org/tracemonkey/rev/e02379fdaf42 for the test.
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b9
Assignee | ||
Updated•14 years ago
|
Whiteboard: [need landing]
Assignee | ||
Updated•14 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: fixed-in-tracemonkey
Comment 12•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/e02379fdaf42?revcount=500 http://hg.mozilla.org/mozilla-central/rev/921fb4d04aca
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•