Closed Bug 1322035 Opened 4 years ago Closed 4 years ago
Exp last Index not set after test method call
Product: Firefox → Core
https://dxr.mozilla.org/mozilla-central/source/js/src/irregexp/RegExpParser.cpp#1840-1863 Apparently this optimization should be more restricted. If trailing pattern can match empty string, we shouldn't strip leading ".*" or, just that we shouldn't strip it if `global || sticky`
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
We just checked the length of the pattern to see there's other pattern after ".*", and relied on the pattern after that matches to correct position. but it doesn't match because the pattern could match to empty string. So, stopped applying the optimization for test with global/sticky. using global/sticky RegExp for test should be unusual, so this won't hurt performance for common case.
Attachment #8816754 - Flags: review?(hv1989)
Comment on attachment 8816754 [details] [diff] [review] Do not strip leading .* pattern in RegExp.prototype.test with global/sticky flags. Review of attachment 8816754 [details] [diff] [review]: ----------------------------------------------------------------- Makes sense. Thanks for the testcases!
Attachment #8816754 - Flags: review?(hv1989) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/82aeade4d0073cd0c2da2d61543fe0a50430cfbb Bug 1322035 - Do not strip leading .* pattern in RegExp.prototype.test with global/sticky flags. r=h4writer
You need to log in before you can comment on or make changes to this bug.