Bug 267623 - Quirks.cpp: Fix and extend domain method
Summary: Quirks.cpp: Fix and extend domain method
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari 17
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 258603
  Show dependency treegraph
 
Reported: 2024-01-16 23:45 PST by Karl Dubost
Modified: 2024-01-23 23:46 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Dubost 2024-01-16 23:45:19 PST
bool Quirks::isDomain(const String& domainString) const
{
    return RegistrableDomain(m_document->topDocument().url()).string() == domainString;
}

was added with 
Bug 260938
https://github.com/WebKit/WebKit/pull/17329

but it broke at least one Quirk Bug 267569

Indeed 
Quirks::isDomain("www.example.com") will return false
Quirks::isDomain("example.com") will return true

because RegistrableDomain(m_document->topDocument().url()).string()
returns only the top domain.

So probably we need something along

Quirks::isFullDomain("www.example.com") matches only www.example.com
Quirks::isTopDomain("example.com")      matches only example.com

And maybe something along 
Quirks::isSubDomain("example.com") matching everything *.example.com

Real names to be determined.
Comment 1 Anne van Kesteren 2024-01-17 05:43:39 PST
isDomain should be renamed to isRegistrableDomain or maybe even topLevelDocumentRegistrableDomainIs.

However it's not clear you want isRegistrableDomain to begin with here. After all, it can lead to bug 267569 happening. I would expect these to be useful:

- topLevelDocumentDomainIs
- topLevelDocumentDomainIsSubDomainOf / topLevelDocumentDomainEndsWith
Comment 2 Radar WebKit Bug Importer 2024-01-23 23:46:14 PST
<rdar://problem/121499128>