Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b7fac902847a0415841fc9965941403d2a6401a5
      
https://github.com/WebKit/WebKit/commit/b7fac902847a0415841fc9965941403d2a6401a5
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-08-12 (Wed, 12 Aug 2026)

  Changed paths:
    A JSTests/stress/regexp-unicode-property-escape-ignore-case.js
    M JSTests/test262/config.yaml
    M Source/JavaScriptCore/yarr/YarrPattern.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.h

  Log Message:
  -----------
  [YARR] Unicode property escapes ignore case-insensitivity in u and v modes
https://bugs.webkit.org/show_bug.cgi?id=321422

Reviewed by Yusuke Suzuki.

Character classes are matched without canonicalizing the input, so a class has 
to
carry the case-folding closure of its members when ignoreCase is set. \p{...} 
and
\P{...} handed the generated property table to PatternTerm / append() /
appendInverted() as is, so under /iu and /iv they only matched the exact code
points of the property, and \P{...} complemented before folding even in v mode,
where CharacterComplement applies to the folded set [1][2]:

    /\p{Lu}/iu.test("a")              // false, should be true
    /\P{Ll}/iv.test("A")              // true, should be false
    /[\p{Any}&&\P{Lu}]/iv.test("a")   // true, should be false

YarrPattern::unicodeIgnoreCaseCharacterClassFor() builds and caches the folded
class by feeding the table through 
CharacterClassConstructor::putChar()/putRange().
For \P{...} in u mode, where the complement is taken before folding [3], the 
table
is complemented before and after folding so that the term's invert flag and
appendInverted() keep applying unchanged. coalesceTables() now drops matches 
that
fall inside a range, since putRange() adds case variants without consulting the
ranges and appendInverted() relies on matches and ranges being disjoint.

This also unskips the two test262 regexp-modifiers tests that were disabled for
this bug.

[1]: https://tc39.es/ecma262/#sec-maybesimplecasefolding
[2]: https://tc39.es/ecma262/#sec-charactercomplement
[3]: https://tc39.es/ecma262/#sec-compiletocharset

Test: JSTests/stress/regexp-unicode-property-escape-ignore-case.js

* JSTests/stress/regexp-unicode-property-escape-ignore-case.js: Added.
(shouldBe):
* JSTests/test262/config.yaml:
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::CharacterClassConstructor::putUnicodeIgnoreCase):
(JSC::Yarr::CharacterClassConstructor::coalesceTables):
(JSC::Yarr::invertedCharacterClass):
(JSC::Yarr::YarrPattern::unicodeIgnoreCaseCharacterClassFor):
(JSC::Yarr::YarrPatternConstructor::atomBuiltInCharacterClass):
(JSC::Yarr::YarrPatternConstructor::unicodePropertyCharacterClass):
(JSC::Yarr::YarrPatternConstructor::atomCharacterClassBuiltIn):
* Source/JavaScriptCore/yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::resetForReparsing):

Canonical link: https://commits.webkit.org/319064@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to