Bug 16459

Summary: REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
Product: WebKit Reporter: Darin Adler <darin>
Component: JavaScriptCoreAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Blocker CC: ap, eric
Priority: P1 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
patch
mjs: review-
patch, this time matching behavior of Gecko rather than the ECMAScript spec mjs: review+

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.