WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
16514
RegExp properties should not depend on RegExp.input
https://bugs.webkit.org/show_bug.cgi?id=16514
Summary
RegExp properties should not depend on RegExp.input
Kevin Millikin
Reported
2007-12-19 04:26:10 PST
Changing RegExp.input should not change RegExp.lastMatch, RegExp.$1, etc. In Safari 523.13: 'This seems like the right behavior'.match(/right/); RegExp.lastMatch; // == 'right' RegExp.input = 'Whereas this one is wrong, yo'; RegExp.lastMatch; // == 'wrong'
Attachments
Test case
(282 bytes, text/html)
2007-12-19 05:49 PST
,
David Kilzer (:ddkilzer)
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2007-12-19 05:49:21 PST
Created
attachment 17989
[details]
Test case MSIE 7 and Firefox 2.0.0.11 report "right" in both cases (as expected). Opera 9.24 reports "undefined" in both cases (apparently doesn't support these properties on their RegExp object). A local debug build of WebKit
r28828
with Safari 3.0.4 (523.12) on Mac OS X 10.4.11 (8S165) reports "right" and "wrong".
David Kilzer (:ddkilzer)
Comment 2
2007-12-19 05:51:51 PST
Not a regression from Safari 2.0.4 as it reports "undefined" for both values.
Kevin Millikin
Comment 3
2007-12-19 06:09:42 PST
Thanks for looking into this. It looks like all the deprecated properties of the RegExp constructor (lastMatch, leftContext, rightContext, lastParen, and $1 through $9) are computed lazily based on RegExp.input. However, RegExp.input is not necessarily the last matching subject string.
Gavin Barraclough
Comment 4
2011-09-06 22:30:36 PDT
Looks like this is a very old bug; this works fine in ToT.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug