Closed
Bug 226045
Opened 21 years ago
Closed 21 years ago
RegExp toSource/toString return an invalid empty RE
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R5
People
(Reporter: pschwartau, Assigned: igor)
Details
Attachments
(1 file)
963 bytes,
patch
|
Details | Diff | Splinter Review |
SpiderMonkey recently changed the behavior of toString() and toSource()
when applied to a RegExp object with an empty pattern. Do we want
Rhino to stay in synch?
This is the Rhino analogue of bug 225550 against SpiderMonkey.
The testcases for this are:
mozilla/js/testsecma_2/RegExp/properties-001.js
mozilla/js/testsjs1_2/regexp/toString.js
Here is a comparison of the current SpiderMonkey and Rhino:
RHINO:
[/] java org.mozilla.javascript.tools.shell.Main
Rhino 1.5 release 5 0000 00 00
js> (new RegExp).toString();
//
js> (new RegExp).toSource();
//
SPIDERMONKEY:
[//d/JS_TRUNK/mozilla/js/src/WINNT4.0_DBG.OBJ] ./js
js>
js> (new RegExp).toString();
/(?:)/
js> (new RegExp).toSource();
/(?:)/
The new approach lets eval() turn this string back into the empty regexp.
The old approach doesn't work, since "//" is a comment, not a regexp.
Reporter | ||
Comment 1•21 years ago
|
||
Oops, those tests are
mozilla/js/tests/ecma_2/RegExp/properties-001.js
mozilla/js/tests/js1_2/regexp/toString.js
Assignee | ||
Comment 3•21 years ago
|
||
Assignee | ||
Comment 4•21 years ago
|
||
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 5•21 years ago
|
||
Verified FIXED.
The above testcases used to fail in both the compiled and interpreted
modes of Rhino. Now they pass in both -
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•