Bug 16459 - REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
Summary: REGRESSION: assertion failure with regexp with \B in a case-ignoring characte...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P1 Blocker
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2007-12-15 19:55 PST by Darin Adler
Modified: 2007-12-16 17:32 PST (History)
2 users (show)

See Also:


Attachments
patch (7.95 KB, patch)
2007-12-15 20:39 PST, Darin Adler
mjs: review-
Details | Formatted Diff | Diff
patch, this time matching behavior of Gecko rather than the ECMAScript spec (7.14 KB, patch)
2007-12-16 15:52 PST, Darin Adler
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2007-12-15 19:55:44 PST
We get an assertion compiling this regular expression:

    /|[x\B-\u00b5]/i;

<rdar://problem/5646361>
Comment 1 Darin Adler 2007-12-15 20:28:39 PST
The issue is specific to the use of the "\B" escape sequence inside a character class. It's supposed to be an error to do that.
Comment 2 Darin Adler 2007-12-15 20:39:49 PST
Created attachment 17924 [details]
patch
Comment 3 Alexey Proskuryakov 2007-12-16 12:46:15 PST
I haven't looked at the spec yet, but in Firefox, javascript:alert(/|[x\B-\u00b5]/) doesn't raise an error. Perhaps the test and/or ChangeLog should mention that this is an intentional difference in behavior.
Comment 4 Darin Adler 2007-12-16 13:08:19 PST
(In reply to comment #3)
> I haven't looked at the spec yet, but in Firefox,
> javascript:alert(/|[x\B-\u00b5]/) doesn't raise an error. Perhaps the test
> and/or ChangeLog should mention that this is an intentional difference in
> behavior.

We could also have \B mean just "B" in character classes if that matches the other browsers. That's a simple change.
Comment 5 Maciej Stachowiak 2007-12-16 15:11:27 PST
Comment on attachment 17924 [details]
patch

Marking r- per Alexey's comment - it would be better to match other browsers for this case. (If that's hard to do right away, we can file a follow-up bug.)
Comment 6 Darin Adler 2007-12-16 15:52:25 PST
Created attachment 17942 [details]
patch, this time matching behavior of Gecko rather than the ECMAScript spec
Comment 7 Darin Adler 2007-12-16 15:56:18 PST
(In reply to comment #5)
> it would be better to match other browsers
> for this case. (If that's hard to do right away, we can file a follow-up bug.)

It was easy to do. I haven't tested IE yet, though.
Comment 8 Maciej Stachowiak 2007-12-16 16:37:48 PST
Comment on attachment 17942 [details]
patch, this time matching behavior of Gecko rather than the ECMAScript spec

r=me
Comment 9 Darin Adler 2007-12-16 17:32:21 PST
Committed revision 28785.
Committed revision 28787.