Last Comment Bug 309840 - Regular expression /[/]/ gives "unterminated character class" error
: Regular expression /[/]/ gives "unterminated character class" error
Status: VERIFIED FIXED
: verified1.8
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Blake Kaplan (:mrbkap) (please use needinfo!)
:
Mentors:
javascript:alert(/[/]/.exec("foo/bar"))
: 212822 224988 235508 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-23 19:33 PDT by Jesse Ruderman
Modified: 2006-08-04 12:17 PDT (History)
9 users (show)
brendan: blocking1.8b5+
bob: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Allow / in char classes (1.86 KB, patch)
2005-09-27 10:57 PDT, Blake Kaplan (:mrbkap) (please use needinfo!)
brendan: review+
shaver: superreview+
asa: approval1.8b5+
Details | Diff | Review

Description Jesse Ruderman 2005-09-23 19:33:25 PDT
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b5) Gecko/20050923
Firefox/1.4

Firefox gives an "unterminated character class" error on the regular expression
/[/]/.  Safari and Opera 8.5 accept it.

I noticed this because a regular expression containing [/] appears in 
http://msdn.microsoft.com/workshop/code/browdata.js, which was mentioned in 
bug 309695 comment 9.
Comment 1 Bob Clary [:bc:] 2005-09-23 20:24:59 PDT
->all/all.

This is technically invalid. <http://bclary.com/2004/11/07/ecma-262#a-7.8.5>. I
have some raw data on top sites I can mine for how common this is in the wild.
Comment 2 Brendan Eich [:brendan] 2005-09-23 20:26:27 PDT
This is entirely contrary to ECMA-262 Edition 3, and to its regexp progenitor,
Perl.  However, mrbkap expressed sympathy, however fleeting under my withering
counterattack ;-). He wins this no-prize.

I'm quite interested in bclary's top site spidering results.

/be
Comment 3 Bob Clary [:bc:] 2005-09-23 21:52:15 PDT
I've been running scans of the top 69 sites 1 level deep (usually ~100 pages per
site) and haven't seen an instance of this error. This doesn't imply that the
error is rare. It has been a reoccuring issue over the years, especially on MS
sites. I could run a 2 level scan if you think it would be worth it, but it
would take a few days.
Comment 4 Blake Kaplan (:mrbkap) (please use needinfo!) 2005-09-23 23:02:50 PDT
I think if we want this, we want it for Firefox 1.5.
Comment 5 Jesse Ruderman 2005-09-25 19:54:07 PDT
I searched for bugs with comments containing "unterminated character class" and
found these:

Open tech evang bugs: bug 235508, bug 224988 (Microsoft), bug 212822

Bugs with discussion: bug 89586, bug 173067, bug 212822
Comment 6 Mike Connor [:mconnor] 2005-09-26 21:57:53 PDT
Need a fix this week if this is going to make it.
Comment 7 Blake Kaplan (:mrbkap) (please use needinfo!) 2005-09-27 10:57:08 PDT
Created attachment 197590 [details] [diff] [review]
Allow / in char classes
Comment 8 Mike Shaver (:shaver -- probably not reading bugmail closely) 2005-09-27 11:31:31 PDT
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

sr=shaver
Comment 9 Asa Dotzler [:asa] 2005-09-30 12:03:02 PDT
we're not going to hold the release for this but if it comes to us with full
reviews and it's low risk, we can talk.
Comment 10 Brendan Eich [:brendan] 2005-10-03 11:26:27 PDT
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

Yeah, this is safe.  The only way to close a character class is with an
unescaped ], and you can't nest character classes, so a boolean suffices.

/be
Comment 11 Blake Kaplan (:mrbkap) (please use needinfo!) 2005-10-03 11:30:44 PDT
Fix checked into trunk.
Comment 12 Brendan Eich [:brendan] 2005-10-03 18:18:04 PDT
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

This fixes a highly dup'ed IE compatibility bug.  It's an extension to ECMA
syntax	that's allowed by Section 16.  I'm approving it so that we can get it
into 1.8b5 / Firefox 1.5b2.

/be
Comment 13 Brendan Eich [:brendan] 2005-10-03 18:18:36 PDT
Don't forget to set fixed1.8 when this lands on the branch tonight.

/be
Comment 14 Blake Kaplan (:mrbkap) (please use needinfo!) 2005-10-03 21:29:35 PDT
Checked into MOZILLA_1_8_BRANCH.
Comment 15 Jesse Ruderman 2005-10-05 12:37:58 PDT
*** Bug 235508 has been marked as a duplicate of this bug. ***
Comment 16 Jesse Ruderman 2005-10-05 12:38:56 PDT
*** Bug 212822 has been marked as a duplicate of this bug. ***
Comment 17 Olivier Cahagne 2005-10-05 13:54:58 PDT
*** Bug 224988 has been marked as a duplicate of this bug. ***
Comment 18 Bob Clary [:bc:] 2005-10-09 19:39:07 PDT
Checking in regress-309840.js;
/cvsroot/mozilla/js/tests/ecma_3/RegExp/regress-309840.js,v  <--  regress-309840.js
initial revision: 1.1
done

obsoletes js1_5/Regress/regress-173067.js
Comment 19 :Gavin Sharp [email: gavin@gavinsharp.com] 2005-11-30 07:57:26 PST
*** Bug 318303 has been marked as a duplicate of this bug. ***
Comment 20 Bob Clary [:bc:] 2006-04-04 15:43:31 PDT
verified fixed 200604-1 1.8.0.2, 1.8, 1.9a1 win/mac/linux
Comment 21 Bob Clary [:bc:] 2006-08-04 12:17:42 PDT
note to self: ecma_3/RegExp/regress-309840.js timed out on peach 1.8 debug browser, but not on prune. Could not reproduce manually.

Note You need to log in before you can comment on or make changes to this bug.