Bug 258603 - Harmonize the hosts/domain name testing in Quirks
Summary: Harmonize the hosts/domain name testing in Quirks
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 17
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 267623 260938
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-27 22:40 PDT by Karl Dubost
Modified: 2024-01-16 23:53 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Dubost 2023-06-27 22:40:19 PDT
Currently the Quirks.cpp file has a couple of different ways of testing for the domain name of a site where the Quirk should apply. 
https://github.com/WebKit/WebKit/blame/main/Source/WebCore/page/Quirks.cpp

This is probably due to layer of history. 
It would probably be better to choose a "better"/more recent way of doing things. 

top domain equality
   equalLettersIgnoringASCIICase(host, domain)
   host == domain

partial_domain end
   host.endsWithIgnoringASCIICase(partial_domain)
   host.endsWith(partial_domain)

partial_domain start
   startsWithLettersIgnoringASCIICase(host, domain)
   host.toString()).startsWith(partial_domain)


There is also 
   topPrivatelyControlledDomain(host.toString()).startsWith("expedia."_s))


The recommended way is probably to use
   class WebCore::RegistrableDomain and its methods

see
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/RegistrableDomain.h
https://github.com/WebKit/WebKit/blob/main/Tools/TestWebKitAPI/Tests/WebCore/RegistrableDomain.cpp
Comment 1 Radar WebKit Bug Importer 2023-06-27 22:40:31 PDT
<rdar://problem/111433802>
Comment 2 Karl Dubost 2023-11-06 21:41:41 PST
How do we improve this a bit more. 
In Bug 260938 isDomain() was created
but probably, there is a need for more generic functions.