WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
288832
[JSC] `RegExp#[Symbol.search]` should throw `TypeError` when `lastIndex` isn't writable
https://bugs.webkit.org/show_bug.cgi?id=288832
Summary
[JSC] `RegExp#[Symbol.search]` should throw `TypeError` when `lastIndex` isn'...
Sosuke Suzuki
Reported
2025-02-28 09:10:28 PST
According to the spec[1], `RegExp#[Symbol.search]` writes to the `lastIndex` property of `this` in the following cases: - `lastIndex` is not 0 - The value of `lastIndex` changes before and after calling `RegExpExec` (which occurs when the `g` or `y` flag is enabled) So, if `lastIndex` is not writable and the above conditions are met, a `TypeError` should be thrown. However, in the current JSC implementation, no error is thrown. This patch changes to execute the slow path when `lastIndex` is not writable, ensuring that an error is thrown. [1]:
https://tc39.es/ecma262/#sec-regexp.prototype-%symbol.search
%
Attachments
Add attachment
proposed patch, testcase, etc.
Sosuke Suzuki
Comment 1
2025-02-28 09:12:48 PST
Pull request:
https://github.com/WebKit/WebKit/pull/41631
Radar WebKit Bug Importer
Comment 2
2025-03-07 09:11:22 PST
<
rdar://problem/146488846
>
Sosuke Suzuki
Comment 3
2025-03-18 16:55:02 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/42660
EWS
Comment 4
2025-06-20 09:30:37 PDT
Committed
296443@main
(8657eef539f3): <
https://commits.webkit.org/296443@main
> Reviewed commits have been landed. Closing PR #42660 and removing active labels.
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