[Webkit-unassigned] [Bug 210671] New: Web Inspector: REGRESSION(r242018): using `RegExp.prototype.test` with a global `RegExp` will ignore one potential match after each successful match

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 17 13:58:17 PDT 2020


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

            Bug ID: 210671
           Summary: Web Inspector: REGRESSION(r242018): using
                    `RegExp.prototype.test` with a global `RegExp` will
                    ignore one potential match after each successful match
           Product: WebKit
           Version: WebKit Local Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: drousso at apple.com
                CC: inspector-bugzilla-changes at group.apple.com
        Depends on: 192527

```
    let x = /script/gi;
    console.log(x.test("script")); // true
    console.log(x.test("script")); // false
    console.log(x.test("script")); // true
    console.log(x.test("script")); // false
```

this is due to the nature of `lastIndex`, which is set when using a global `RegExp` (see 12.a in <https://tc39.es/ecma262/#sec-regexpbuiltinexec>)


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=192527
[Bug 192527] Web Inspector: provide a way to make searches case sensitive or use a regular expression
-- 
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/20200417/fa1c5ecb/attachment.htm>


More information about the webkit-unassigned mailing list