Closed
Bug 574344
Opened 14 years ago
Closed 6 years ago
"new RegExp(string)" incorrectly conceived; incorrect conception incorrectly implemented
Categories
(Tamarin Graveyard :: Library, defect)
Tamarin Graveyard
Library
Tracking
(Not tracked)
RESOLVED
WONTFIX
Future
People
(Reporter: lhansen, Unassigned)
References
Details
In the third variant of RegExp::RegExp() in RegExpObject.cpp there's a song and dance to handle the AS3 expression "new RegExp(re.toString())", or, if you like, a single string argument passed to the RegExp constructor. Basically the code scans the input string looking for a trailing ".../flags" segment, from which it extracts the flags.
Doing so is in no way required by ECMAScript, so this is an AS3 thing.
Anyway the functionality is incorrectly implemented, because it does not properly strip the string that was just parsed: if we try "new RegExp("/abc/i")", which is the gist of the mechanism supported, the regular expression that's constructed will have the pattern "/abc/i" and the flags string "i", and indeed the regex is printed as "//abc/i/i".
If the functionality were properly supported it would of course provide the pattern "abc" and the flags string "i".
The parsing is incorrect in another way as well; properly parsing web-compatible regular expressions requires context sensitivity, for example, the regular expression /abc[/]def/i is parsed by all major browsers but would be mangled by this particular subparser in Tamarin.
My vote is to not fix this, but to remove the functionality for newer content, with a version-check of course (and maybe fix the docs if they document this behavior).
BTW Ecma requires "new RegExp(re)" to work where re is a regular expression; so far as I can tell we support that correctly. It also requires an empty flags string to be supplied if the second argument is not passed to the RegExp constructor and the first argument is not a RegExp instance - ie, Tamarin is Ecma-incompatible here.
Flags: flashplayer-needsversioning+
Blocks: regex-upgrade
Flags: flashplayer-qrb+
Flags: flashplayer-injection-
Target Milestone: --- → Future
Comment 1•6 years ago
|
||
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•