Bug 211607 - [Quirks] Add a helper function to match top level domains.
Summary: [Quirks] Add a helper function to match top level domains.
Status: RESOLVED DUPLICATE of bug 260938
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-07 19:29 PDT by zalan
Modified: 2023-11-23 14:39 PST (History)
7 users (show)

See Also:


Attachments
Patch (8.09 KB, patch)
2020-05-07 19:33 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2020-05-07 19:29:17 PDT
auto host = m_document->topDocument().url().host();
return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com");

is a common pattern we have in Quirks class.
Comment 1 zalan 2020-05-07 19:33:50 PDT
Created attachment 398828 [details]
Patch
Comment 2 zalan 2020-05-07 19:35:46 PDT
In some cases m_document->url() is used instead of m_document->topDocument().url(). Some investigation is needed whether they are intentional.
Comment 3 Simon Fraser (smfr) 2020-05-07 20:22:35 PDT
Comment on attachment 398828 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398828&action=review

> Source/WebCore/page/Quirks.cpp:74
> +bool Quirks::matchesTopLevelDomain(StringView hostNameToMatch) const

I think this name needs to make it clear that it looks at topDocument.

> Source/WebCore/page/Quirks.cpp:-807
> -    auto host = m_document->url().host();

This was not topDocument. Bug?
Comment 4 zalan 2020-05-07 20:24:16 PDT
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 398828 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=398828&action=review
> 
> > Source/WebCore/page/Quirks.cpp:74
> > +bool Quirks::matchesTopLevelDomain(StringView hostNameToMatch) const
> 
> I think this name needs to make it clear that it looks at topDocument.
Any suggestions?

> 
> > Source/WebCore/page/Quirks.cpp:-807
> > -    auto host = m_document->url().host();
> 
> This was not topDocument. Bug?
Yes.
Comment 5 Darin Adler 2020-05-08 14:40:17 PDT
Comment on attachment 398828 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398828&action=review

>>> Source/WebCore/page/Quirks.cpp:74
>>> +bool Quirks::matchesTopLevelDomain(StringView hostNameToMatch) const
>> 
>> I think this name needs to make it clear that it looks at topDocument.
> 
> Any suggestions?

topDocumentMatchesTopLevelDomain
Comment 6 Karl Dubost 2023-11-23 14:39:59 PST
it has been done in https://github.com/WebKit/WebKit/pull/17329
with Bug 260938

*** This bug has been marked as a duplicate of bug 260938 ***