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.
->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.
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
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.
I think if we want this, we want it for Firefox 1.5.
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
Need a fix this week if this is going to make it.
Created attachment 197590 [details] [diff] [review] Allow / in char classes
Comment on attachment 197590 [details] [diff] [review] Allow / in char classes sr=shaver
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 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
Fix checked into trunk.
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
Don't forget to set fixed1.8 when this lands on the branch tonight. /be
Checked into MOZILLA_1_8_BRANCH.
*** Bug 235508 has been marked as a duplicate of this bug. ***
*** Bug 212822 has been marked as a duplicate of this bug. ***
*** Bug 224988 has been marked as a duplicate of this bug. ***
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
*** Bug 318303 has been marked as a duplicate of this bug. ***
verified fixed 200604-1 220.127.116.11, 1.8, 1.9a1 win/mac/linux
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.