[Webkit-unassigned] [Bug 288832] New: [JSC] `RegExp#[Symbol.search]` should throw `TypeError` when `lastIndex` isn't writable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 28 09:10:28 PST 2025


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

            Bug ID: 288832
           Summary: [JSC] `RegExp#[Symbol.search]` should throw
                    `TypeError` when `lastIndex` isn't writable
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: aosukeke at gmail.com

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%

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20250228/73737963/attachment.htm>


More information about the webkit-unassigned mailing list