Closed
Bug 275378
Opened 20 years ago
Closed 20 years ago
Literal RegExp in case block gives syntax error
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla1.8alpha6
People
(Reporter: martin.zvieger, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(3 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 The JavaScript engine gives a syntax error - the problem is also in Mozilla 1.7.3 Minimal example which demonstrates the behaviour: // Paste this stuff in some *.js file and load the page var tmpString= "XYZ"; // works /ABC/.test(tmpString); var tmpVal= 1; if (tmpVal == 1) { // works /ABC/.test(tmpString); } switch(tmpVal) { case 1: { // works /ABC/.test(tmpString); } break; } switch(tmpVal) { case 1: // fails with syntax error /ABC/.test(tmpString); break; } Reproducible: Always
Updated•20 years ago
|
Component: JavaScript Console → JavaScript Engine
Product: Firefox → Core
Version: unspecified → Trunk
Comment 1•20 years ago
|
||
Comment 2•20 years ago
|
||
martijn.martijn, please check " Reassign bug to owner and QA contact of selected component " when changing the component of bugs.
Assignee: bugs → general
QA Contact: firefox.js-console → pschwartau
Comment 3•20 years ago
|
||
Confirmed on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a6) Gecko/20041219 Firefox/1.0+ (stipe)
Assignee | ||
Comment 4•20 years ago
|
||
Assignee: general → brendan
Status: UNCONFIRMED → ASSIGNED
Attachment #169243 -
Flags: review?(shaver)
Assignee | ||
Comment 5•20 years ago
|
||
Old bug, easy fix. /be
Assignee | ||
Comment 6•20 years ago
|
||
Not blocker, just put parentheses around the regexp to work around the bug. /be
Severity: blocker → major
Assignee | ||
Comment 7•20 years ago
|
||
timeless, feel free to nominate for active branches. /be
Assignee | ||
Comment 8•20 years ago
|
||
$ cvs ci -m"Twiddle TSF_OPERAND when peeking after switch case label, to scan regexp literal at start of labeled statement (275378, tachyonal r=shaver)." jsparse.c Checking in jsparse.c; /cvsroot/mozilla/js/src/jsparse.c,v <-- jsparse.c new revision: 3.117; previous revision: 3.116 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment on attachment 169243 [details] [diff] [review] fix Exactly as I imagined it! r=shaver
Attachment #169243 -
Flags: review?(shaver) → review+
Comment 10•19 years ago
|
||
Martin, with your permission this test case will be added to the javascript test library.
Reporter | ||
Comment 11•19 years ago
|
||
(In reply to comment #10) > Created an attachment (id=174892) [edit] > js1_5/Regress/regress-275378.js > Martin, with your permission this test case will be added to the javascript > test library. Go with it...
Comment 12•19 years ago
|
||
js1_5/Regress/regress-275378.js checked in.
Updated•19 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•