Closed
Bug 225550
Opened 21 years ago
Closed 21 years ago
RegExp toSource/toString return an invalid empty RE
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.6beta
People
(Reporter: thomas, Assigned: brendan)
Details
(Keywords: js1.5, Whiteboard: [ bug 226045 has been filed against Rhino for this same issue])
Attachments
(1 file)
2.23 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6a) Gecko/20031029 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6a) Gecko/20031029 If I create an empty regular expression object an call toString or toSource on it, I get "//" as the result. This isn't a valid RE string, since it's the start of a comment: var re = new RegExp // create an empty RE var reSrc = re.toString() // gives "//" var re2 = eval(reSrc) // gives "undefined" instead of an empty RE object We should better return "/(?:)/" in this special case, as mentioned in ECMA262-3 7.8.5. Reproducible: Always Steps to Reproduce: Most browsers (Mozilla, IE, Opera, iCab) show this behaviour, but a change for this special case probably won't break any compatibility (I'm considering this fix for iCab, too).
Comment 1•21 years ago
|
||
Confirming for consideration -
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•21 years ago
|
||
.
Assignee | ||
Comment 3•21 years ago
|
||
Simple and direct. /be
Assignee | ||
Comment 4•21 years ago
|
||
Checked in. /be
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Hi, Not happening in Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031113 in windows.
Assignee | ||
Comment 6•21 years ago
|
||
Wellander3: what, do you think I have a time machine, and can go back to yesterday and check in for the build dated 20031113? Please. /be
Status: RESOLVED → VERIFIED
Updated•21 years ago
|
Whiteboard: [ bug 226045 has been filed against Rhino for this same issue]
You need to log in
before you can comment on or make changes to this bug.
Description
•