Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 937b1dde4169fcf3e7d28b7f22884c6f30092640
      
https://github.com/WebKit/WebKit/commit/937b1dde4169fcf3e7d28b7f22884c6f30092640
  Author: Cole Carley <[email protected]>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    R Source/WebCore/page/QuirkMatch.cpp
    R Source/WebCore/page/QuirkMatch.h
    M Source/WebCore/page/QuirkTable.cpp
    M Source/WebCore/page/QuirkTable.h
    M Source/WebCore/page/Quirks.cpp
    A Source/WebCore/page/URLMatch.cpp
    A Source/WebCore/page/URLMatch.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    R Tools/TestWebKitAPI/Tests/WebCore/QuirkMatch.cpp
    M Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp
    A Tools/TestWebKitAPI/Tests/WebCore/URLMatch.cpp

  Log Message:
  -----------
  [Quirks] Make QuirkMatch a generic URL matcher
https://bugs.webkit.org/show_bug.cgi?id=322857
rdar://186099985

Reviewed by Brent Fulgham.

QuirkMatch is almost a generic URL matcher, but it has ties to the
way we want to match for site specific Quirks. This refactor
severs those ties, which results in a flexible new URLMatch class.

The refactor also simplified the implementation of the URLMatch
class. The site specific Quirk matching logic is now held in a
small wrapper class called QuirkURLMatch.

This patch was motivated by the inability to use the old QuirkMatch
class with just a singular URL, which is needed for the static
Quirks declared in Quirks.h.

Tests: Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp
       Tools/TestWebKitAPI/Tests/WebCore/URLMatch.cpp

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/QuirkTable.cpp:
(WebCore::QuirkURLMatch::matches const):
(WebCore::resolveSiteSpecificQuirks):
* Source/WebCore/page/QuirkTable.h:
(WebCore::QuirkURLMatch::QuirkURLMatch):
(WebCore::QuirkURLMatch::embeddedDocument):
(WebCore::QuirkURLMatch::embeddedDocumentInTopMatch):
* Source/WebCore/page/Quirks.cpp:
* Source/WebCore/page/URLMatch.cpp: Renamed from 
Source/WebCore/page/QuirkMatch.cpp.
(WebCore::URLMatchContext::registrableDomain const):
(WebCore::URLMatchContext::domainWithoutPublicSuffix const):
(WebCore::evaluateURLEnvironment):
(WebCore::URLMatch::RefinementSet::matchesPathPattern const):
(WebCore::URLMatch::RefinementSet::matches const):
(WebCore::URLMatch::matchesURL const):
(WebCore::URLMatch::matches const):
* Source/WebCore/page/URLMatch.h: Renamed from Source/WebCore/page/QuirkMatch.h.
(WebCore::URLMatchContext::URLMatchContext):
(WebCore::URLPatternList::URLPatternList):
(WebCore::URLPatternList::isEmpty const):
(WebCore::URLPatternList::contains const):
(WebCore::URLPatternList::containsMatching const):
(WebCore::URLRefinement::pathContains):
(WebCore::URLRefinement::pathStartsWith):
(WebCore::URLRefinement::pathOrFragmentContains):
(WebCore::URLRefinement::hostIs):
(WebCore::URLRefinement::smallScreen):
(WebCore::URLRefinement::tubularApp):
(WebCore::URLRefinement::lensApp):
(WebCore::URLMatch::domain):
(WebCore::URLMatch::host):
(WebCore::URLMatch::hostOrSubdomainOf):
(WebCore::URLMatch::anyTopLevelDomain):
(WebCore::URLMatch::anyURL):
(WebCore::URLMatch::when):
(WebCore::URLMatch::exceptWhen):
(WebCore::URLMatch::setPathPattern):
(WebCore::URLMatch::applyRefinement):
(WebCore::URLMatch::URLMatch):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/QuirkMatch.cpp: Removed.
* Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp:
(TestWebKitAPI::resolveQuirksForTopURL):
(TestWebKitAPI::resolveQuirksForEmbeddedDocument):
(TestWebKitAPI::matchesTopURL):
(TestWebKitAPI::matchesEmbeddedDocument):
(TestWebKitAPI::TEST_F(QuirksTest, TopURLMatchIgnoresTheDocumentURL)):
(TestWebKitAPI::TEST_F(QuirksTest, 
EmbeddedDocumentMatchesTheDocumentURLNotTheTopURL)):
(TestWebKitAPI::TEST_F(QuirksTest, 
EmbeddedDocumentInTopMatchRequiresBothURLsToMatch)):
(TestWebKitAPI::TEST_F(QuirksTest, EmbeddedMatchesNeverApplyToTheTopDocument)):
(TestWebKitAPI::TEST_F(QuirksTest, EmbeddedQuirksResolveFromTheDocumentURL)):
* Tools/TestWebKitAPI/Tests/WebCore/URLMatch.cpp: Added.
(TestWebKitAPI::matchesURL):
(TestWebKitAPI::TEST(URLMatchTest, DomainMatchesRegistrableDomain)):
(TestWebKitAPI::TEST(URLMatchTest, DomainUnderstandsMultiLabelPublicSuffixes)):
(TestWebKitAPI::TEST(URLMatchTest, DomainsMatchesAnyPatternInTheList)):
(TestWebKitAPI::TEST(URLMatchTest, HostMatchesExactHostOnly)):
(TestWebKitAPI::TEST(URLMatchTest, HostOrSubdomainOfRespectsLabelBoundaries)):
(TestWebKitAPI::TEST(URLMatchTest, HostOrSubdomainOfCoversShardedHosts)):
(TestWebKitAPI::TEST(URLMatchTest, AnyTopLevelDomainMatchesEveryPublicSuffix)):
(TestWebKitAPI::TEST(URLMatchTest, PathContainsMatchesAnywhereInThePath)):
(TestWebKitAPI::TEST(URLMatchTest, PathStartsWithIsAnchored)):
(TestWebKitAPI::TEST(URLMatchTest, PathOrFragmentContainsSearchesBoth)):
(TestWebKitAPI::TEST(URLMatchTest, EnvironmentIsANDedWithTheSiteMatch)):
(TestWebKitAPI::TEST(URLMatchTest, 
AnyURLMatchesEverySiteWithoutFurtherRefinement)):
(TestWebKitAPI::TEST(URLMatchTest, ExceptWhenCarvesOutPagesOfAMatchedSite)):
(TestWebKitAPI::TEST(URLMatchTest, ExceptWhenCarvesOutHostsOfAMatchedSite)):
(TestWebKitAPI::TEST(URLMatchTest, ExceptWhenCarvesOutASingleHost)):
(TestWebKitAPI::TEST(URLMatchTest, HostIsNarrowsAMatchToOneHost)):
(TestWebKitAPI::TEST(URLMatchTest, 
ExceptWhenAndTheMatchKeepSeparateRefinements)):
(TestWebKitAPI::TEST(URLMatchTest, EnvironmentStacksWithAPathRefinement)):
(TestWebKitAPI::TEST(URLMatchTest, HostsWithoutAPublicSuffixFallBackToTheHost)):
(TestWebKitAPI::TEST(URLMatchTest, URLsWithoutAHostMatchNothing)):
(TestWebKitAPI::TEST(URLMatchTest, ContextDerivesValuesFromItsURL)):
(TestWebKitAPI::TEST(URLMatchTest, ContextCachesDerivedValues)):

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



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

Reply via email to