Closed
Bug 514808
Opened 16 years ago
Closed 14 years ago
Regex whitespace character class deficiencies
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a1
People
(Reporter: kangax, Assigned: wesongathedeveloper)
References
()
Details
Attachments
(2 files)
|
2.77 KB,
patch
|
dmandelin
:
review+
|
Details | Diff | Splinter Review |
|
3.45 KB,
patch
|
Details | Diff | Splinter Review |
As per ES3 (see 15.10.2.12), /\s/ should match both WhiteSpace (7.2) and LineTerminator (7.3). WhiteSpace is defined to include characters from Unicode "Zs" category (besides "standard" - x09, x0B, x0C, x20 and xA0). Firefox (contrary to, say, latest WebKit and Chrome) fails some of these characters. See <http://thinkweb2.com/projects/prototype/whitespace-deviations/> for a full results table.
A test is available online at: <http://yura.thinkweb2.com/rcornford_whitespace_test.html>
Thank you.
| Reporter | ||
Comment 1•16 years ago
|
||
It's also worth mentioning that `String.prototype.trim` seems to rely on the same character set that is matched by (faulty) /\s/. I suppose, fixing /\s/ will also make `trim` fully compliant.
| Assignee | ||
Comment 2•16 years ago
|
||
This bug is fixed in trunk. Should it be marked as wanted in older branches?
Comment 3•16 years ago
|
||
Which patch fixed this?
| Assignee | ||
Comment 4•16 years ago
|
||
From what I gather, it could only be the patch in bug 406271. See http://hg.mozilla.org/mozilla-central/rev/b837948c1daf
This is interesting because the WhiteSpaceRanges[] constant array at http://mxr.mozilla.org/mozilla-central/source/js/src/jsregexp.cpp?&mark=3548-3571#3552 appears to be incomplete even though all the tests at <http://yura.thinkweb2.com/rcornford_whitespace_test.html> pass.
| Assignee | ||
Comment 5•16 years ago
|
||
Ignore comment 2, it's broken in trunk if javascript.options.jit.content = false
| Assignee | ||
Comment 6•16 years ago
|
||
Assignee: general → wesongathedeveloper
Status: NEW → ASSIGNED
Attachment #400921 -
Flags: review?(brendan)
Comment 7•16 years ago
|
||
Comment on attachment 400921 [details] [diff] [review]
Patch
I'm traveling and hoping to bounce this review to Dave or Luke. Dave, if you need bounce, then Luke is "it". Thanks,
/be
Attachment #400921 -
Flags: review?(brendan) → review?(dmandelin)
Comment 8•16 years ago
|
||
Comment 9•16 years ago
|
||
Comment on attachment 400921 [details] [diff] [review]
Patch
Looks good. r+ with the test case added that I just attached.
Attachment #400921 -
Flags: review?(dmandelin) → review+
| Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Updated•16 years ago
|
Whiteboard: [c-n: tracemonkey]
| Assignee | ||
Updated•16 years ago
|
Status: ASSIGNED → NEW
Comment 10•16 years ago
|
||
One of the shorter stays in the tracemonkey checkin-needed queue at only three months, but still: land it in tracemonkey or admit you can't be bothered and wontfix it.
Comment 11•16 years ago
|
||
(In reply to comment #10)
> One of the shorter stays in the tracemonkey checkin-needed queue at only three
> months, but still: land it in tracemonkey or admit you can't be bothered and
> wontfix it.
tone not welcome. checkin-needed noted.
Comment 12•16 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/8a44551a28c1
http://hg.mozilla.org/tracemonkey/rev/787d5fbc1f80
Status: NEW → ASSIGNED
Keywords: checkin-needed
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [c-n: tracemonkey] → fixed-in-tracemonkey
Target Milestone: --- → mozilla1.9.3a1
Version: 1.9.1 Branch → Trunk
Comment 13•16 years ago
|
||
I backed this out to fix an orange tinderbox.
Whiteboard: fixed-in-tracemonkey
| Assignee | ||
Comment 14•15 years ago
|
||
(In reply to comment #13)
> I backed this out to fix an orange tinderbox.
How do I find out which tests failed with this patch?
Comment 15•15 years ago
|
||
Hey there, it may be too late to find the logs at this point. I can send it to the tryserver[0] tomorrow and see what we get. I'll post the logs here.
[0] https://wiki.mozilla.org/Build:TryServer
| Assignee | ||
Comment 16•15 years ago
|
||
(In reply to comment #15)
> Hey there, it may be too late to find the logs at this point. I can send it to
> the tryserver[0] tomorrow and see what we get. I'll post the logs here.
>
> [0] https://wiki.mozilla.org/Build:TryServer
Would it be possible for you to do the same for bug 529386? (not sure what the protocol is for requesting these logs seeing as I don't have commit access).
| Assignee | ||
Comment 17•15 years ago
|
||
Robert, any word on this bug?
Comment 18•14 years ago
|
||
This is the cause of most of the failures on http://samples.msdn.microsoft.com/ietestcenter/Javascript/ES15.5.html (one's really a test bug, rest are about this). The test is basically this:
assertEq(("\n\r\u2028\u2029" +
"\t\n\v\f\r \x85\xA0\u1680\u180E\u2000\u2001\u2002" +
"\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A" +
"\u2028\u2029\u202F\u205F\u3000\uFEFF").trim(),
"");
That said, I'm not completely sure the test is right, because it seems to want U+0085 as a Unicode space, but at least the GNOME character map utility says it isn't. There are other differences, too:
js> ("\t\n\v\f\r \x85\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029" +
"\u202F\u205F\u3000\uFEFF").split("").filter(function(s) {
return s.trim() !== "";
})
["\x85", "\u1680", "\u180E", "\u202F", "\u205F"]
U+205F is a space per the character map, so at least some of these are probably correct even if it turns out U+0085 is not. Someone who actually knows this Unicode stuff should (ideally) investigate.
...and yet another bug forgotten. How do we end up doing this? :-(
| Reporter | ||
Comment 19•14 years ago
|
||
U+0085 is from Cc category (Other, Control), not Zs (Separator, Space). The latter one is what ES5 considers a whitespace.
It does look like a bug in a test.
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 20•14 years ago
|
||
Whiteboard: [inbound]
Comment 21•14 years ago
|
||
Updated•14 years ago
|
Whiteboard: [inbound]
You need to log in
before you can comment on or make changes to this bug.
Description
•