[Webkit-unassigned] [Bug 41614] RegExp constructor should throw a SyntaxError if invalid flags are specified

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 21 08:50:30 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=41614


Kent Hansen <kent.hansen at nokia.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #62187|                            |review?
               Flag|                            |




--- Comment #2 from Kent Hansen <kent.hansen at nokia.com>  2010-07-21 08:50:30 PST ---
Created an attachment (id=62187)
 --> (https://bugs.webkit.org/attachment.cgi?id=62187)
Patch

I could split the refactoring to move flags parsing out of the RegExp ctor into a separate commit, if that's preferred.

I made the error message generic to keep things simple; arguably "Invalid flag 'x'" is better, but it'd require dynamic (de)allocation of the error message, which RegExp::m_constructionError is not made for.

Actually, the whole process of flag validation/error reporting could be decoupled completely from the RegExp class, i.e. it wouldn't be possible to create a RegExp with invalid flags. But that would require modifying all the callsites of regExpCache->lookupOrCreate() to call some other create-regexp-but-maybe-not function and change the error handling according. Not sure if that would really be an improvement.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list