[webkit-reviews] review requested: [Bug 41614] RegExp constructor should throw a SyntaxError if invalid flags are specified : [Attachment 62187] Patch

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


Kent Hansen <kent.hansen at nokia.com> has asked  for review:
Bug 41614: RegExp constructor should throw a SyntaxError if invalid flags are
specified
https://bugs.webkit.org/show_bug.cgi?id=41614

Attachment 62187: Patch
https://bugs.webkit.org/attachment.cgi?id=62187&action=review

------- Additional Comments from Kent Hansen <kent.hansen at nokia.com>
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.


More information about the webkit-reviews mailing list