⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242056 in webkit


Ignore:
Timestamp:
Feb 25, 2019, 1:52:56 PM (7 years ago)
Author:
wilander@apple.com
Message:

Introduce and adopt new class RegistrableDomain for eTLD+1
https://bugs.webkit.org/show_bug.cgi?id=194791
<rdar://problem/48179240>

Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.

Source/WebCore:

A new API test was added. Plenty of existing layout tests under
http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.

This patch introduces and adopts a new class called WebCore::RegistrableDomain
which represents a domain's eTLD+1 (effective top level domain plus one) and is
the basis for the term "site," as in same-site. Other popular names include
high-level domain, primary domain, and top privately controlled/owned domain.
Effective top level domains are enumerated on the Public Suffix List
(https://publicsuffix.org).

This class just uses the full domain for when the Public Suffix List cannot help
finding the registrable domain and for WebKit ports that haven't enabled
PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
for the null or unique origin (this matches how these origins were handled
before).

The implementation is a wrapper around a String and the functions and class
members that now make use of this new class used to handle regular String
objects which didn't help much in terms of type safety or guarantees that the
string had already been converted to an eTLD+1.

We've at least two bad bugs in the Storage Access API because of confusion
between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
will prohibit such bugs in the future.

Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
WebCore::RegistrableDomain for partitioning in a later patch.

This patch also enhances parameter naming by:

  • Removing parts that refer to "primary" as in primaryDomain.
  • Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
  • Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
  • Using the term "domain" consistently instead of e.g. "host."
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.cpp:

(WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
(WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):

  • dom/Document.h:
  • html/HTMLAnchorElement.cpp:

(WebCore::HTMLAnchorElement::parseAdClickAttribution const):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::mediaSessionTitle const):

  • loader/AdClickAttribution.cpp:

(WebCore::AdClickAttribution::url const):
(WebCore::AdClickAttribution::referrer const):
(WebCore::AdClickAttribution::toString const):

  • loader/AdClickAttribution.h:

(WebCore::AdClickAttribution::Source::Source):
(WebCore::AdClickAttribution::Source::matches const):
(WebCore::AdClickAttribution::Source::deleteValue):
(WebCore::AdClickAttribution::Destination::Destination):
(WebCore::AdClickAttribution::Destination::matches const):
(WebCore::AdClickAttribution::Destination::deleteValue):

  • loader/ResourceLoadObserver.cpp:

(WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
(WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
(WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
(WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
(WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
(WebCore::ResourceLoadObserver::logFontLoad):
(WebCore::ResourceLoadObserver::logCanvasRead):
(WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
(WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
(WebCore::ResourceLoadObserver::logScreenAPIAccessed):
(WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
(WebCore::ResourceLoadObserver::statisticsForOrigin):
(WebCore::primaryDomain): Deleted.
(WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.

  • loader/ResourceLoadObserver.h:
  • loader/ResourceLoadStatistics.cpp:

(WebCore::ResourceLoadStatistics::encode const):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString const):
(WebCore::ResourceLoadStatistics::merge):
(WebCore::ResourceLoadStatistics::primaryDomain): Deleted.

  • loader/ResourceLoadStatistics.h:

(WebCore::ResourceLoadStatistics::ResourceLoadStatistics):

  • page/Page.cpp:

(WebCore::Page::logNavigation):
(WebCore::Page::mainFrameLoadStarted):

  • page/Page.h:
  • page/PerformanceMonitor.cpp:

(WebCore::reportPageOverPostLoadResourceThreshold):

  • platform/RegistrableDomain.h: Added.

(WebCore::RegistrableDomain::RegistrableDomain):
(WebCore::RegistrableDomain::isEmpty const):
(WebCore::RegistrableDomain::string const):
(WebCore::RegistrableDomain::operator!= const):
(WebCore::RegistrableDomain::operator== const):
(WebCore::RegistrableDomain::matches const):
(WebCore::RegistrableDomain::isolatedCopy const):
(WebCore::RegistrableDomain::isHashTableDeletedValue const):
(WebCore::RegistrableDomain::hash const):
(WebCore::RegistrableDomain::RegistrableDomainHash::hash):
(WebCore::RegistrableDomain::RegistrableDomainHash::equal):
(WebCore::RegistrableDomain::encode const):
(WebCore::RegistrableDomain::decode):

  • platform/network/NetworkStorageSession.cpp:

(WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
(WebCore::NetworkStorageSession::shouldBlockCookies const):
(WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
(WebCore::NetworkStorageSession::removePrevalentDomains):
(WebCore::NetworkStorageSession::hasStorageAccess const):
(WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
(WebCore::NetworkStorageSession::grantStorageAccess):
(WebCore::getPartitioningDomain): Deleted.

  • platform/network/NetworkStorageSession.h:

Source/WebKit:

A new API test was added. Plenty of existing layout tests under
http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.

This patch introduces and adopts a new class called WebCore::RegistrableDomain
which represents a domain's eTLD+1 (effective top level domain plus one) and is
the basis for the term "site," as in same-site. Other popular names include
high-level domain, primary domain, and top privately controlled/owned domain.
Effective top level domains are enumerated on the Public Suffix List
(https://publicsuffix.org).

This class just uses the full domain for when the Public Suffix List cannot help
finding the registrable domain and for WebKit ports that haven't enabled
PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
for the null or unique origin (this matches how these origins were handled
before).

The implementation is a wrapper around a String and the functions and class
members that now make use of this new class used to handle regular String
objects which didn't help much in terms of type safety or guarantees that the
string had already been converted to an eTLD+1.

We've at least two bad bugs in the Storage Access API because of confusion
between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
will prohibit such bugs in the future.

Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
WebCore::RegistrableDomain for partitioning in a later patch.

This patch also enhances parameter naming by:

  • Removing parts that refer to "primary" as in primaryDomain.
  • Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
  • Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
  • Using the term "domain" consistently instead of e.g. "host."

A follow-up patch will continue backwards in call chains to create
WebCore::RegistrableDomain objects as early as possible instead of using strings.
I did not do that work here in the interest of patch size.

  • NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:

(WebKit::domainsToString):
(WebKit::pruneResources):
(WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
(WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
(WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
(WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
(WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
(WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
(WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
(WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
(WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
(WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
(WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
(WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
(WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
(WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
(WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
(WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
(WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
(WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
(WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
(WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
(WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
(WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
(WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
(WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
(WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
(WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
(WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
(WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
(WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
(WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
(WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForRegistrableDomain):
(WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
(WebKit::debugLogDomainsInBatches):
(WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
(WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
(WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
(WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
(WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
(WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
(WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
(WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain): Deleted.
(WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): Deleted.

  • NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
(WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
(WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
(WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
(WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
(WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
(WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
(WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::setLastSeen):
(WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
(WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
(WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
(WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
(WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
(WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
(WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
(WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
(WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
(WebKit::WebResourceLoadStatisticsStore::registrableDomainsWithWebsiteData):
(WebKit::isolatedPrimaryDomain): Deleted.
(WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
(WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted.

  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::logUserInteraction):
(WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
(WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
(WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
(WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
(WebKit::NetworkConnectionToWebProcess::requestStorageAccess):

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkConnectionToWebProcess.messages.in:
  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
(WebKit::NetworkProcess::isGrandfathered):
(WebKit::NetworkProcess::isPrevalentResource):
(WebKit::NetworkProcess::isVeryPrevalentResource):
(WebKit::NetworkProcess::setGrandfathered):
(WebKit::NetworkProcess::setPrevalentResource):
(WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
(WebKit::NetworkProcess::setVeryPrevalentResource):
(WebKit::NetworkProcess::clearPrevalentResource):
(WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
(WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
(WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
(WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
(WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
(WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
(WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
(WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
(WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
(WebKit::NetworkProcess::setLastSeen):
(WebKit::NetworkProcess::hasStorageAccessForFrame):
(WebKit::NetworkProcess::hasStorageAccess):
(WebKit::NetworkProcess::requestStorageAccess):
(WebKit::NetworkProcess::requestStorageAccessGranted):
(WebKit::NetworkProcess::grantStorageAccess):
(WebKit::NetworkProcess::logFrameNavigation):
(WebKit::NetworkProcess::logUserInteraction):
(WebKit::NetworkProcess::hadUserInteraction):
(WebKit::NetworkProcess::clearUserInteraction):
(WebKit::NetworkProcess::removePrevalentDomains):
(WebKit::filterForRegistrableDomains):
(WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
(WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
(WebKit::filterForTopLevelDomains): Deleted.
(WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
(WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData): Deleted.

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • NetworkProcess/NetworkResourceLoader.cpp:

(WebKit::logCookieInformationInternal):

  • NetworkProcess/NetworkSession.cpp:

(WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
(WebKit::NetworkSession::registrableDomainsWithWebsiteData):
(WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
(WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData): Deleted.

  • NetworkProcess/NetworkSession.h:
  • Shared/WebCoreArgumentCoders.cpp:

(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):

  • UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:

(WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
(WebKit::NetworkProcessProxy::isPrevalentResource):
(WebKit::NetworkProcessProxy::isVeryPrevalentResource):
(WebKit::NetworkProcessProxy::setPrevalentResource):
(WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
(WebKit::NetworkProcessProxy::setVeryPrevalentResource):
(WebKit::NetworkProcessProxy::setLastSeen):
(WebKit::NetworkProcessProxy::clearPrevalentResource):
(WebKit::NetworkProcessProxy::logUserInteraction):
(WebKit::NetworkProcessProxy::hasHadUserInteraction):
(WebKit::NetworkProcessProxy::clearUserInteraction):
(WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
(WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
(WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
(WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
(WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
(WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
(WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
(WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
(WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
(WebKit::NetworkProcessProxy::isGrandfathered):
(WebKit::NetworkProcessProxy::setGrandfathered):
(WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
(WebKit::NetworkProcessProxy::hasStorageAccess):
(WebKit::NetworkProcessProxy::requestStorageAccess):
(WebKit::NetworkProcessProxy::grantStorageAccess):
(WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
(WebKit::NetworkProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
(WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.
(WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/Network/NetworkProcessProxy.messages.in:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::logFrameNavigation):
(WebKit::WebPageProxy::requestStorageAccessConfirm):

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed):
(WebKit::WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
(WebKit::WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
(WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.
(WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.

  • UIProcess/WebProcessProxy.h:
  • UIProcess/WebResourceLoadStatisticsStore.messages.in:
  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::isPrevalentResource):
(WebKit::WebsiteDataStore::setPrevalentResource):
(WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
(WebKit::WebsiteDataStore::isVeryPrevalentResource):
(WebKit::WebsiteDataStore::setVeryPrevalentResource):
(WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
(WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
(WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
(WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
(WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
(WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
(WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
(WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
(WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
(WebKit::WebsiteDataStore::clearPrevalentResource):
(WebKit::WebsiteDataStore::setLastSeen):
(WebKit::WebsiteDataStore::hasStorageAccess):
(WebKit::WebsiteDataStore::requestStorageAccess):
(WebKit::WebsiteDataStore::grantStorageAccess):
(WebKit::WebsiteDataStore::logUserInteraction):
(WebKit::WebsiteDataStore::hasHadUserInteraction):
(WebKit::WebsiteDataStore::clearUserInteraction):
(WebKit::WebsiteDataStore::setGrandfathered):
(WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Deleted.

  • UIProcess/WebsiteData/WebsiteDataStore.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::hasStorageAccess):
(WebKit::WebPage::requestStorageAccess):

  • WebProcess/WebProcess.cpp:

(WebKit::m_nonVisibleProcessCleanupTimer):
(WebKit::WebProcess::initializeWebProcess):

Tools:

This patch adds an API test and replaces two instances of
"TopPrivatelyOwnedDomains" with "RegistrableDomains" in message names.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebCore/AdClickAttribution.cpp:

(TestWebKitAPI::TEST):

Changed two strings to make sure the registrable domains are still considered
invalid and pass the test.

  • TestWebKitAPI/Tests/WebCore/RegistrableDomain.cpp: Added.

(TestWebKitAPI::TEST):

  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:

(WTR::InjectedBundle::didReceiveMessageToPage):

Location:
trunk
Files:
2 added
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242051 r242056  
     12019-02-25  John Wilander  <wilander@apple.com>
     2
     3        Introduce and adopt new class RegistrableDomain for eTLD+1
     4        https://bugs.webkit.org/show_bug.cgi?id=194791
     5        <rdar://problem/48179240>
     6
     7        Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
     8
     9        A new API test was added. Plenty of existing layout tests under
     10        http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
     11
     12        This patch introduces and adopts a new class called WebCore::RegistrableDomain
     13        which represents a domain's eTLD+1 (effective top level domain plus one) and is
     14        the basis for the term "site," as in same-site. Other popular names include
     15        high-level domain, primary domain, and top privately controlled/owned domain.
     16        Effective top level domains are enumerated on the Public Suffix List
     17        (https://publicsuffix.org).
     18
     19        This class just uses the full domain for when the Public Suffix List cannot help
     20        finding the registrable domain and for WebKit ports that haven't enabled
     21        PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
     22        for the null or unique origin (this matches how these origins were handled
     23        before).
     24
     25        The implementation is a wrapper around a String and the functions and class
     26        members that now make use of this new class used to handle regular String
     27        objects which didn't help much in terms of type safety or guarantees that the
     28        string had already been converted to an eTLD+1.
     29
     30        We've at least two bad bugs in the Storage Access API because of confusion
     31        between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
     32        will prohibit such bugs in the future.
     33
     34        Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
     35        WebCore::RegistrableDomain for partitioning in a later patch.
     36
     37        This patch also enhances parameter naming by:
     38        - Removing parts that refer to "primary" as in primaryDomain.
     39        - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
     40        - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
     41        - Using the term "domain" consistently instead of e.g. "host."
     42
     43        * WebCore.xcodeproj/project.pbxproj:
     44        * dom/Document.cpp:
     45        (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
     46        (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
     47        * dom/Document.h:
     48        * html/HTMLAnchorElement.cpp:
     49        (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
     50        * html/HTMLMediaElement.cpp:
     51        (WebCore::HTMLMediaElement::mediaSessionTitle const):
     52        * loader/AdClickAttribution.cpp:
     53        (WebCore::AdClickAttribution::url const):
     54        (WebCore::AdClickAttribution::referrer const):
     55        (WebCore::AdClickAttribution::toString const):
     56        * loader/AdClickAttribution.h:
     57        (WebCore::AdClickAttribution::Source::Source):
     58        (WebCore::AdClickAttribution::Source::matches const):
     59        (WebCore::AdClickAttribution::Source::deleteValue):
     60        (WebCore::AdClickAttribution::Destination::Destination):
     61        (WebCore::AdClickAttribution::Destination::matches const):
     62        (WebCore::AdClickAttribution::Destination::deleteValue):
     63        * loader/ResourceLoadObserver.cpp:
     64        (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
     65        (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
     66        (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
     67        (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
     68        (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
     69        (WebCore::ResourceLoadObserver::logSubresourceLoading):
     70        (WebCore::ResourceLoadObserver::logWebSocketLoading):
     71        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
     72        (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
     73        (WebCore::ResourceLoadObserver::logFontLoad):
     74        (WebCore::ResourceLoadObserver::logCanvasRead):
     75        (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
     76        (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
     77        (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
     78        (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
     79        (WebCore::ResourceLoadObserver::statisticsForOrigin):
     80        (WebCore::primaryDomain): Deleted.
     81        (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
     82        * loader/ResourceLoadObserver.h:
     83        * loader/ResourceLoadStatistics.cpp:
     84        (WebCore::ResourceLoadStatistics::encode const):
     85        (WebCore::ResourceLoadStatistics::decode):
     86        (WebCore::ResourceLoadStatistics::toString const):
     87        (WebCore::ResourceLoadStatistics::merge):
     88        (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
     89        * loader/ResourceLoadStatistics.h:
     90        (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
     91        * page/Page.cpp:
     92        (WebCore::Page::logNavigation):
     93        (WebCore::Page::mainFrameLoadStarted):
     94        * page/Page.h:
     95        * page/PerformanceMonitor.cpp:
     96        (WebCore::reportPageOverPostLoadResourceThreshold):
     97        * platform/RegistrableDomain.h: Added.
     98        (WebCore::RegistrableDomain::RegistrableDomain):
     99        (WebCore::RegistrableDomain::isEmpty const):
     100        (WebCore::RegistrableDomain::string const):
     101        (WebCore::RegistrableDomain::operator!= const):
     102        (WebCore::RegistrableDomain::operator== const):
     103        (WebCore::RegistrableDomain::matches const):
     104        (WebCore::RegistrableDomain::isolatedCopy const):
     105        (WebCore::RegistrableDomain::isHashTableDeletedValue const):
     106        (WebCore::RegistrableDomain::hash const):
     107        (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
     108        (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
     109        (WebCore::RegistrableDomain::encode const):
     110        (WebCore::RegistrableDomain::decode):
     111        * platform/network/NetworkStorageSession.cpp:
     112        (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
     113        (WebCore::NetworkStorageSession::shouldBlockCookies const):
     114        (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
     115        (WebCore::NetworkStorageSession::removePrevalentDomains):
     116        (WebCore::NetworkStorageSession::hasStorageAccess const):
     117        (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
     118        (WebCore::NetworkStorageSession::grantStorageAccess):
     119        (WebCore::getPartitioningDomain): Deleted.
     120        * platform/network/NetworkStorageSession.h:
     121
    11222019-02-25  Chris Fleizach  <cfleizach@apple.com>
    2123
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r242032 r242056  
    20122012                6B0A07F221FA4B5C00D57391 /* AdClickAttribution.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0A07F021FA4B5C00D57391 /* AdClickAttribution.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20132013                6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2014                6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20142015                6B693A2E1C51A82E00B03BEF /* ResourceLoadObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20152016                6C4C96DF1AD4483500363F64 /* JSReadableByteStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500363F64 /* JSReadableByteStreamController.h */; };
     
    91379138                6B0A07F121FA4B5C00D57391 /* AdClickAttribution.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AdClickAttribution.cpp; sourceTree = "<group>"; };
    91389139                6B3480920EEF50D400AC1B41 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
     9140                6B4E8612221B713F0022F389 /* RegistrableDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistrableDomain.h; sourceTree = "<group>"; };
    91399141                6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadObserver.h; sourceTree = "<group>"; };
    91409142                6B693A331C51A95D00B03BEF /* ResourceLoadObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadObserver.cpp; sourceTree = "<group>"; };
     
    2559925601                                CA1635DC2072E76900E7D2CE /* ReferrerPolicy.cpp */,
    2560025602                                9831AE49154225A200FE2644 /* ReferrerPolicy.h */,
     25603                                6B4E8612221B713F0022F389 /* RegistrableDomain.h */,
    2560125604                                CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */,
    2560225605                                CDFC360418CA61C20026E56F /* RemoteCommandListener.h */,
     
    3119131194                                26B9998F1803AE7200D01121 /* RegisterAllocator.h in Headers */,
    3119231195                                85031B4C0A44EFC700F992E0 /* RegisteredEventListener.h in Headers */,
     31196                                6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */,
    3119331197                                51B914101FD2782D00EE2859 /* RegistrationDatabase.h in Headers */,
    3119431198                                51B914111FD2782D00EE2859 /* RegistrationStore.h in Headers */,
  • trunk/Source/WebCore/dom/Document.cpp

    r242032 r242056  
    84658465}
    84668466
    8467 bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const String& primaryDomain)
    8468 {
    8469     return m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction == primaryDomain;
    8470 }
    8471 
    8472 void Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction(const String& primaryDomain)
    8473 {
    8474     m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction = primaryDomain;
     8467bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain& domain)
     8468{
     8469    return m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction == domain;
     8470}
     8471
     8472void Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain& domain)
     8473{
     8474    m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction = domain;
    84758475}
    84768476#endif
  • trunk/Source/WebCore/dom/Document.h

    r241932 r242056  
    4545#include "ReferrerPolicy.h"
    4646#include "Region.h"
     47#include "RegistrableDomain.h"
    4748#include "RenderPtr.h"
    4849#include "ScriptExecutionContext.h"
     
    14951496
    14961497#if ENABLE(RESOURCE_LOAD_STATISTICS)
    1497     bool hasRequestedPageSpecificStorageAccessWithUserInteraction(const String& primaryDomain);
    1498     void setHasRequestedPageSpecificStorageAccessWithUserInteraction(const String& primaryDomain);
     1498    bool hasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain&);
     1499    void setHasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain&);
    14991500#endif
    15001501
     
    20602061   
    20612062#if ENABLE(RESOURCE_LOAD_STATISTICS)
    2062     String m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction { };
     2063    RegistrableDomain m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction { };
    20632064#endif
    20642065   
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r241490 r242056  
    4343#include "PingLoader.h"
    4444#include "PlatformMouseEvent.h"
    45 #include "PublicSuffix.h"
     45#include "RegistrableDomain.h"
    4646#include "RenderImage.h"
    4747#include "ResourceRequest.h"
     
    443443
    444444    auto documentDomain = document().domain();
    445     auto adDestinationHost = adDestinationURL.host().toString();
    446 #if ENABLE(PUBLIC_SUFFIX_LIST)
    447     if (topPrivatelyControlledDomain(documentDomain) == topPrivatelyControlledDomain(adDestinationHost)) {
    448 #else
    449     if (documentDomain == adDestinationHost) {
    450 #endif
     445    if (RegistrableDomain(documentDomain).matches(adDestinationURL)) {
    451446        document().addConsoleMessage(MessageSource::Other, MessageLevel::Warning, "addestination can not be the same site as the current website."_s);
    452447        return WTF::nullopt;
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r241945 r242056  
    7474#include "PlatformMediaSessionManager.h"
    7575#include "ProgressTracker.h"
    76 #include "PublicSuffix.h"
    7776#include "Quirks.h"
     77#include "RegistrableDomain.h"
    7878#include "RenderLayerCompositor.h"
    7979#include "RenderTheme.h"
     
    76637663        title = decodeHostName(title);
    76647664#endif
    7665 #if ENABLE(PUBLIC_SUFFIX_LIST)
    76667665    if (!title.isEmpty()) {
    7667         auto domain = topPrivatelyControlledDomain(title);
     7666        auto domain = RegistrableDomain { title };
    76687667        if (!domain.isEmpty())
    7669             title = domain;
    7670     }
    7671 #endif
     7668            title = domain.string();
     7669    }
    76727670
    76737671    return title;
  • trunk/Source/WebCore/loader/AdClickAttribution.cpp

    r241451 r242056  
    6161    StringBuilder builder;
    6262    builder.appendLiteral("https://");
    63     builder.append(m_source.registrableDomain);
     63    builder.append(m_source.registrableDomain.string());
    6464    builder.appendLiteral("/.well-known/ad-click-attribution/");
    6565    builder.appendNumber(m_conversion.value().data);
     
    8181    StringBuilder builder;
    8282    builder.appendLiteral("https://");
    83     builder.append(m_destination.registrableDomain);
     83    builder.append(m_destination.registrableDomain.string());
    8484    builder.append('/');
    8585
     
    9595    StringBuilder builder;
    9696    builder.appendLiteral("Source: ");
    97     builder.append(m_source.registrableDomain);
     97    builder.append(m_source.registrableDomain.string());
    9898    builder.appendLiteral("\nDestination: ");
    99     builder.append(m_destination.registrableDomain);
     99    builder.append(m_destination.registrableDomain.string());
    100100    builder.appendLiteral("\nCampaign ID: ");
    101101    builder.appendNumber(m_campaign.id);
  • trunk/Source/WebCore/loader/AdClickAttribution.h

    r241451 r242056  
    2626#pragma once
    2727
    28 #include "PublicSuffix.h"
     28#include "RegistrableDomain.h"
    2929#include <wtf/Optional.h>
    3030#include <wtf/URL.h>
     
    6161        Source() = default;
    6262        explicit Source(const String& host)
    63 #if ENABLE(PUBLIC_SUFFIX_LIST)
    64             : registrableDomain { topPrivatelyControlledDomain(host) }
    65 #else
    66             : registrableDomain { emptyString() }
    67 #endif
     63            : registrableDomain { host }
    6864        {
    6965        }
     
    8177        bool matches(const URL& url) const
    8278        {
    83 #if ENABLE(PUBLIC_SUFFIX_LIST)
    84             return registrableDomain == topPrivatelyControlledDomain(url.host().toString());
    85 #else
    86             return registrableDomain == url.host().toString();
    87 #endif
     79            return registrableDomain.matches(url);
    8880        }
    8981
     
    10698        void deleteValue()
    10799        {
    108             registrableDomain = String { WTF::HashTableDeletedValue };
     100            registrableDomain = RegistrableDomain { WTF::HashTableDeletedValue };
    109101        }
    110102
     
    114106        }
    115107
    116         String registrableDomain;
     108        RegistrableDomain registrableDomain;
    117109    };
    118110
     
    134126        Destination() = default;
    135127        explicit Destination(const String& host)
    136 #if ENABLE(PUBLIC_SUFFIX_LIST)
    137             : registrableDomain { topPrivatelyControlledDomain(host) }
    138 #else
    139             : registrableDomain { emptyString() }
    140 #endif
     128            : registrableDomain { RegistrableDomain { host } }
    141129        {
    142130        }
     
    149137        bool matches(const URL& url) const
    150138        {
    151 #if ENABLE(PUBLIC_SUFFIX_LIST)
    152             return registrableDomain == topPrivatelyControlledDomain(url.host().toString());
    153 #else
    154             return registrableDomain == url.host().toString();
    155 #endif
     139            return registrableDomain == RegistrableDomain { url };
    156140        }
    157141       
     
    174158        void deleteValue()
    175159        {
    176             registrableDomain = String { WTF::HashTableDeletedValue };
     160            registrableDomain = RegistrableDomain { WTF::HashTableDeletedValue };
    177161        }
    178162
     
    182166        }
    183167
    184         String registrableDomain;
     168        RegistrableDomain registrableDomain;
    185169    };
    186170
  • trunk/Source/WebCore/loader/ResourceLoadObserver.cpp

    r241743 r242056  
    3434#include "Logging.h"
    3535#include "Page.h"
     36#include "RegistrableDomain.h"
    3637#include "ResourceLoadStatistics.h"
    3738#include "ResourceRequest.h"
     
    4546namespace WebCore {
    4647
    47 template<typename T> static inline String primaryDomain(const T& value)
    48 {
    49     return ResourceLoadStatistics::primaryDomain(value);
    50 }
    51 
    5248static const Seconds minimumNotificationInterval { 5_s };
    5349
     
    6460}
    6561
    66 void ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback(WTF::Function<void(const String& domainInNeedOfStorageAccess, uint64_t openerPageID, const String& openerDomain)>&& callback)
     62void ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback(WTF::Function<void(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain)>&& callback)
    6763{
    6864    ASSERT(!m_requestStorageAccessUnderOpenerCallback);
     
    7066}
    7167
    72 void ResourceLoadObserver::setLogUserInteractionNotificationCallback(Function<void(PAL::SessionID, const String&)>&& callback)
     68void ResourceLoadObserver::setLogUserInteractionNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&)>&& callback)
    7369{
    7470    ASSERT(!m_logUserInteractionNotificationCallback);
     
    7672}
    7773
    78 void ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback(Function<void(PAL::SessionID, const String&, const String&, WallTime)>&& callback)
     74void ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&& callback)
    7975{
    8076    ASSERT(!m_logWebSocketLoadingNotificationCallback);
     
    8278}
    8379
    84 void ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback(Function<void(PAL::SessionID, const String&, const String&, WallTime)>&& callback)
     80void ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&& callback)
    8581{
    8682    ASSERT(!m_logSubresourceLoadingNotificationCallback);
     
    8884}
    8985
    90 void ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback(Function<void(PAL::SessionID, const String&, const String&)>&& callback)
     86void ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&)>&& callback)
    9187{
    9288    ASSERT(!m_logSubresourceRedirectNotificationCallback);
     
    131127        return;
    132128
    133     auto targetPrimaryDomain = primaryDomain(targetURL);
    134     auto mainFramePrimaryDomain = primaryDomain(mainFrameURL);
    135     auto sourcePrimaryDomain = primaryDomain(sourceURL);
    136 
    137     if (targetPrimaryDomain == mainFramePrimaryDomain || (isRedirect && targetPrimaryDomain == sourcePrimaryDomain))
     129    RegistrableDomain targetDomain { targetURL };
     130    RegistrableDomain mainFrameDomain { mainFrameURL };
     131    RegistrableDomain sourceDomain { sourceURL };
     132
     133    if (targetDomain == mainFrameDomain || (isRedirect && targetDomain == sourceDomain))
    138134        return;
    139135
    140136    bool shouldCallNotificationCallback = false;
    141137    {
    142         auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
     138        auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
    143139        auto lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
    144140        targetStatistics.lastSeen = lastSeen;
    145         if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
     141        if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFrameDomain.string()).isNewEntry)
    146142            shouldCallNotificationCallback = true;
    147143
    148         m_logSubresourceLoadingNotificationCallback(page->sessionID(), targetPrimaryDomain, mainFramePrimaryDomain, lastSeen);
     144        m_logSubresourceLoadingNotificationCallback(page->sessionID(), targetDomain, mainFrameDomain, lastSeen);
    149145    }
    150146
    151147    if (isRedirect) {
    152         auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
    153         bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain).isNewEntry;
    154         auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
    155         bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(sourcePrimaryDomain).isNewEntry;
     148        auto& redirectingOriginStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
     149        bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetDomain.string()).isNewEntry;
     150        auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
     151        bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(sourceDomain.string()).isNewEntry;
    156152
    157153        if (isNewRedirectToEntry || isNewRedirectFromEntry)
    158154            shouldCallNotificationCallback = true;
    159155
    160         m_logSubresourceRedirectNotificationCallback(page->sessionID(), sourcePrimaryDomain, targetPrimaryDomain);
     156        m_logSubresourceRedirectNotificationCallback(page->sessionID(), sourceDomain, targetDomain);
    161157    }
    162158
     
    176172        return;
    177173   
    178     auto targetPrimaryDomain = primaryDomain(targetURL);
    179     auto mainFramePrimaryDomain = primaryDomain(mainFrameURL);
    180 
    181     if (targetPrimaryDomain == mainFramePrimaryDomain)
     174    RegistrableDomain targetDomain { targetURL };
     175    RegistrableDomain mainFrameDomain { mainFrameURL };
     176
     177    if (targetDomain == mainFrameDomain)
    182178        return;
    183179
    184180    auto lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
    185181
    186     auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
     182    auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
    187183    targetStatistics.lastSeen = lastSeen;
    188     if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
    189         scheduleNotificationIfNeeded();
    190 
    191     m_logWebSocketLoadingNotificationCallback(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen);
     184    if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFrameDomain.string()).isNewEntry)
     185        scheduleNotificationIfNeeded();
     186
     187    m_logWebSocketLoadingNotificationCallback(sessionID, targetDomain, mainFrameDomain, lastSeen);
    192188}
    193189
     
    198194
    199195    auto& url = document.url();
    200     if (url.protocolIsAbout() || url.isEmpty())
    201         return;
    202 
    203     auto domain = primaryDomain(url);
     196    if (url.protocolIsAbout() || url.isLocalFile() || url.isEmpty())
     197        return;
     198
     199    RegistrableDomain domain { url };
    204200    auto newTime = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
    205201    auto lastReportedUserInteraction = m_lastReportedUserInteractionMap.get(domain);
     
    209205    m_lastReportedUserInteractionMap.set(domain, newTime);
    210206
    211     auto& statistics = ensureResourceStatisticsForPrimaryDomain(domain);
     207    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    212208    statistics.hadUserInteraction = true;
    213209    statistics.lastSeen = newTime;
     
    243239        };
    244240        auto escapedURL = escapeForJSON(url.string());
    245         auto escapedDomain = escapeForJSON(domain);
     241        auto escapedDomain = escapeForJSON(domain.string());
    246242
    247243        LOCAL_LOG(R"({ "url": "%{public}s",)", escapedURL.utf8().data());
     
    255251
    256252#if ENABLE(RESOURCE_LOAD_STATISTICS)
    257 void ResourceLoadObserver::requestStorageAccessUnderOpener(const String& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument)
     253void ResourceLoadObserver::requestStorageAccessUnderOpener(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument)
    258254{
    259255    auto openerUrl = openerDocument.url();
    260     auto openerPrimaryDomain = primaryDomain(openerUrl);
    261     if (domainInNeedOfStorageAccess != openerPrimaryDomain
     256    RegistrableDomain openerDomain { openerUrl };
     257    if (domainInNeedOfStorageAccess != openerDomain
    262258        && !openerDocument.hasRequestedPageSpecificStorageAccessWithUserInteraction(domainInNeedOfStorageAccess)
    263259        && !equalIgnoringASCIICase(openerUrl.string(), WTF::blankURL())) {
    264         m_requestStorageAccessUnderOpenerCallback(domainInNeedOfStorageAccess, openerPageID, openerPrimaryDomain);
     260        m_requestStorageAccessUnderOpenerCallback(domainInNeedOfStorageAccess, openerPageID, openerDomain);
    265261        // Remember user interaction-based requests since they don't need to be repeated.
    266262        openerDocument.setHasRequestedPageSpecificStorageAccessWithUserInteraction(domainInNeedOfStorageAccess);
     
    274270    if (!shouldLog(document.sessionID().isEphemeral()))
    275271        return;
    276     auto registrableDomain = primaryDomain(document.url());
    277     auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain);
     272    RegistrableDomain registrableDomain { document.url() };
     273    auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
    278274    bool shouldCallNotificationCallback = false;
    279275    if (!loadStatus) {
     
    284280            shouldCallNotificationCallback = true;
    285281    }
    286     auto mainFrameRegistrableDomain = primaryDomain(document.topDocument().url());
    287     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
     282    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
     283    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
    288284        shouldCallNotificationCallback = true;
    289285    if (shouldCallNotificationCallback)
     
    301297    if (!shouldLog(document.sessionID().isEphemeral()))
    302298        return;
    303     auto registrableDomain = primaryDomain(document.url());
    304     auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain);
    305     auto mainFrameRegistrableDomain = primaryDomain(document.topDocument().url());
     299    RegistrableDomain registrableDomain { document.url() };
     300    auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
     301    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    306302    statistics.canvasActivityRecord.wasDataRead = true;
    307     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
     303    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
    308304        scheduleNotificationIfNeeded();
    309305#else
     
    317313    if (!shouldLog(document.sessionID().isEphemeral()))
    318314        return;
    319     auto registrableDomain = primaryDomain(document.url());
    320     auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain);
     315    RegistrableDomain registrableDomain { document.url() };
     316    auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
    321317    bool shouldCallNotificationCallback = false;
    322     auto mainFrameRegistrableDomain = primaryDomain(document.topDocument().url());
     318    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    323319    if (statistics.canvasActivityRecord.recordWrittenOrMeasuredText(textWritten))
    324320        shouldCallNotificationCallback = true;
    325     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
     321    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
    326322        shouldCallNotificationCallback = true;
    327323    if (shouldCallNotificationCallback)
     
    338334    if (!shouldLog(document.sessionID().isEphemeral()))
    339335        return;
    340     auto registrableDomain = primaryDomain(document.url());
    341     auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain);
     336    RegistrableDomain registrableDomain { document.url() };
     337    auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
    342338    bool shouldCallNotificationCallback = false;
    343339    if (!statistics.navigatorFunctionsAccessed.contains(functionName)) {
     
    345341        shouldCallNotificationCallback = true;
    346342    }
    347     auto mainFrameRegistrableDomain = primaryDomain(document.topDocument().url());
    348     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
     343    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
     344    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
    349345        shouldCallNotificationCallback = true;
    350346    if (shouldCallNotificationCallback)
     
    361357    if (!shouldLog(document.sessionID().isEphemeral()))
    362358        return;
    363     auto registrableDomain = primaryDomain(document.url());
    364     auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain);
     359    RegistrableDomain registrableDomain { document.url() };
     360    auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
    365361    bool shouldCallNotificationCallback = false;
    366362    if (!statistics.screenFunctionsAccessed.contains(functionName)) {
     
    368364        shouldCallNotificationCallback = true;
    369365    }
    370     auto mainFrameRegistrableDomain = primaryDomain(document.topDocument().url());
    371     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
     366    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
     367    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
    372368        shouldCallNotificationCallback = true;
    373369    if (shouldCallNotificationCallback)
     
    379375}
    380376   
    381 ResourceLoadStatistics& ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain(const String& primaryDomain)
    382 {
    383     auto addResult = m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] {
    384         return ResourceLoadStatistics(primaryDomain);
     377ResourceLoadStatistics& ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain& domain)
     378{
     379    auto addResult = m_resourceStatisticsMap.ensure(domain, [&domain] {
     380        return ResourceLoadStatistics(domain);
    385381    });
    386382    return addResult.iterator->value;
     
    408404String ResourceLoadObserver::statisticsForOrigin(const String& origin)
    409405{
    410     auto iter = m_resourceStatisticsMap.find(origin);
     406    auto iter = m_resourceStatisticsMap.find(RegistrableDomain { origin });
    411407    if (iter == m_resourceStatisticsMap.end())
    412408        return emptyString();
  • trunk/Source/WebCore/loader/ResourceLoadObserver.h

    r240498 r242056  
    4949class Frame;
    5050class Page;
     51class RegistrableDomain;
    5152class ResourceRequest;
    5253class ResourceResponse;
     
    7374
    7475    WEBCORE_EXPORT void setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&&);
    75     WEBCORE_EXPORT void setRequestStorageAccessUnderOpenerCallback(Function<void(const String&, uint64_t, const String&)>&&);
    76     WEBCORE_EXPORT void setLogUserInteractionNotificationCallback(Function<void(PAL::SessionID, const String&)>&&);
    77     WEBCORE_EXPORT void setLogWebSocketLoadingNotificationCallback(Function<void(PAL::SessionID, const String&, const String&, WallTime)>&&);
    78     WEBCORE_EXPORT void setLogSubresourceLoadingNotificationCallback(Function<void(PAL::SessionID, const String&, const String&, WallTime)>&&);
    79     WEBCORE_EXPORT void setLogSubresourceRedirectNotificationCallback(Function<void(PAL::SessionID, const String&, const String&)>&&);
     76    WEBCORE_EXPORT void setRequestStorageAccessUnderOpenerCallback(Function<void(const RegistrableDomain&, uint64_t, const RegistrableDomain&)>&&);
     77    WEBCORE_EXPORT void setLogUserInteractionNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&)>&&);
     78    WEBCORE_EXPORT void setLogWebSocketLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&&);
     79    WEBCORE_EXPORT void setLogSubresourceLoadingNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)>&&);
     80    WEBCORE_EXPORT void setLogSubresourceRedirectNotificationCallback(Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&)>&&);
    8081
    8182    WEBCORE_EXPORT void notifyObserver();
     
    9192
    9293    bool shouldLog(bool usesEphemeralSession) const;
    93     ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
     94    ResourceLoadStatistics& ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain&);
    9495
    9596    void scheduleNotificationIfNeeded();
     
    9798
    9899#if ENABLE(RESOURCE_LOAD_STATISTICS)
    99     void requestStorageAccessUnderOpener(const String& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument);
     100    void requestStorageAccessUnderOpener(const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, Document& openerDocument);
    100101#endif
    101102
    102     HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
    103     HashMap<String, WTF::WallTime> m_lastReportedUserInteractionMap;
     103    HashMap<RegistrableDomain, ResourceLoadStatistics> m_resourceStatisticsMap;
     104    HashMap<RegistrableDomain, WTF::WallTime> m_lastReportedUserInteractionMap;
    104105    Function<void(Vector<ResourceLoadStatistics>&&)> m_notificationCallback;
    105     Function<void(const String&, uint64_t, const String&)> m_requestStorageAccessUnderOpenerCallback;
    106     Function<void(PAL::SessionID, const String&)> m_logUserInteractionNotificationCallback;
    107     Function<void(PAL::SessionID, const String&, const String&, WallTime)> m_logWebSocketLoadingNotificationCallback;
    108     Function<void(PAL::SessionID, const String&, const String&, WallTime)> m_logSubresourceLoadingNotificationCallback;
    109     Function<void(PAL::SessionID, const String&, const String&)> m_logSubresourceRedirectNotificationCallback;
     106    Function<void(const RegistrableDomain&, uint64_t, const RegistrableDomain&)> m_requestStorageAccessUnderOpenerCallback;
     107    Function<void(PAL::SessionID, const RegistrableDomain&)> m_logUserInteractionNotificationCallback;
     108    Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)> m_logWebSocketLoadingNotificationCallback;
     109    Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&, WallTime)> m_logSubresourceLoadingNotificationCallback;
     110    Function<void(PAL::SessionID, const RegistrableDomain&, const RegistrableDomain&)> m_logSubresourceRedirectNotificationCallback;
    110111
    111112    Timer m_notificationTimer;
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp

    r239888 r242056  
    9595void ResourceLoadStatistics::encode(KeyedEncoder& encoder) const
    9696{
    97     encoder.encodeString("PrevalentResourceOrigin", highLevelDomain);
     97    encoder.encodeString("PrevalentResourceOrigin", registrableDomain.string());
    9898   
    9999    encoder.encodeDouble("lastSeen", lastSeen.secondsSinceEpoch().value());
     
    203203bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion)
    204204{
    205     if (!decoder.decodeString("PrevalentResourceOrigin", highLevelDomain))
    206         return false;
    207    
     205    String registrableDomainAsString;
     206    if (!decoder.decodeString("PrevalentResourceOrigin", registrableDomainAsString))
     207        return false;
     208    registrableDomain = RegistrableDomain(registrableDomainAsString);
     209
    208210    // User interaction
    209211    if (!decoder.decodeBool("hadUserInteraction", hadUserInteraction))
     
    397399    StringBuilder builder;
    398400    builder.appendLiteral("High level domain: ");
    399     builder.append(highLevelDomain);
     401    builder.append(registrableDomain.string());
    400402    builder.append('\n');
    401403    builder.appendLiteral("    lastSeen: ");
     
    467469void ResourceLoadStatistics::merge(const ResourceLoadStatistics& other)
    468470{
    469     ASSERT(other.highLevelDomain == highLevelDomain);
     471    ASSERT(other.registrableDomain == registrableDomain);
    470472
    471473    if (lastSeen < other.lastSeen)
     
    516518}
    517519
    518 String ResourceLoadStatistics::primaryDomain(const URL& url)
    519 {
    520     return primaryDomain(url.host());
    521 }
    522 
    523 String ResourceLoadStatistics::primaryDomain(StringView host)
    524 {
    525     if (host.isNull() || host.isEmpty())
    526         return "nullOrigin"_s;
    527 
    528     String hostString = host.toString();
    529 #if ENABLE(PUBLIC_SUFFIX_LIST)
    530     String primaryDomain = topPrivatelyControlledDomain(hostString);
    531     // We will have an empty string here if there is no TLD. Use the host as a fallback.
    532     if (!primaryDomain.isEmpty())
    533         return primaryDomain;
    534 #endif
    535 
    536     return hostString;
    537 }
    538 
    539520WallTime ResourceLoadStatistics::reduceTimeResolution(WallTime time)
    540521{
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.h

    r239888 r242056  
    2727
    2828#include "CanvasActivityRecord.h"
     29#include "RegistrableDomain.h"
    2930#include <wtf/HashCountedSet.h>
    3031#include <wtf/HashSet.h>
     
    4142
    4243struct ResourceLoadStatistics {
    43     explicit ResourceLoadStatistics(const String& primaryDomain)
    44         : highLevelDomain(primaryDomain)
     44    explicit ResourceLoadStatistics(const RegistrableDomain& domain)
     45        : registrableDomain { domain }
    4546    {
    4647    }
     
    5354    ResourceLoadStatistics& operator=(ResourceLoadStatistics&&) = default;
    5455
    55     WEBCORE_EXPORT static String primaryDomain(const URL&);
    56     WEBCORE_EXPORT static String primaryDomain(StringView host);
    57 
    5856    WEBCORE_EXPORT static WallTime reduceTimeResolution(WallTime);
    5957
     
    6563    WEBCORE_EXPORT void merge(const ResourceLoadStatistics&);
    6664
    67     String highLevelDomain;
     65    RegistrableDomain registrableDomain;
    6866
    6967    WallTime lastSeen;
  • trunk/Source/WebCore/page/Page.cpp

    r241978 r242056  
    9090#include "PointerLockController.h"
    9191#include "ProgressTracker.h"
    92 #include "PublicSuffix.h"
    9392#include "RenderLayerCompositor.h"
    9493#include "RenderTheme.h"
     
    23702369
    23712370    if (!navigation.domain.isEmpty())
    2372         diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainVisitedKey(), navigation.domain, ShouldSample::Yes);
     2371        diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainVisitedKey(), navigation.domain.string(), ShouldSample::Yes);
    23732372}
    23742373
    23752374void Page::mainFrameLoadStarted(const URL& destinationURL, FrameLoadType type)
    23762375{
    2377     String domain;
    2378 #if ENABLE(PUBLIC_SUFFIX_LIST)
    2379     domain = topPrivatelyControlledDomain(destinationURL.host().toString());
    2380 #else
    2381     UNUSED_PARAM(destinationURL);
    2382 #endif
    2383 
    2384     Navigation navigation = { domain, type };
     2376    Navigation navigation = { RegistrableDomain { destinationURL }, type };
    23852377
    23862378    // To avoid being too verbose, we only log navigations if the page is or becomes visible. This avoids logging non-user observable loads.
  • trunk/Source/WebCore/page/Page.h

    r242032 r242056  
    3333#include "RTCController.h"
    3434#include "Region.h"
     35#include "RegistrableDomain.h"
    3536#include "ScrollTypes.h"
    3637#include "Supplementable.h"
     
    705706private:
    706707    struct Navigation {
    707         String domain;
     708        RegistrableDomain domain;
    708709        FrameLoadType type;
    709710    };
  • trunk/Source/WebCore/page/PerformanceMonitor.cpp

    r239427 r242056  
    3636#include "Page.h"
    3737#include "PerformanceLogging.h"
    38 #include "PublicSuffix.h"
     38#include "RegistrableDomain.h"
    3939
    4040namespace WebCore {
     
    149149        return;
    150150
    151     String domain = topPrivatelyControlledDomain(document->url().host().toString());
    152     if (domain.isEmpty())
     151    RegistrableDomain registrableDomain { document->url() };
     152    if (registrableDomain.isEmpty())
    153153        return;
    154154
    155155    switch (reason) {
    156156    case ReportingReason::HighCPUUsage:
    157         page.diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainCausingEnergyDrainKey(), domain, ShouldSample::No);
     157        page.diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainCausingEnergyDrainKey(), registrableDomain.string(), ShouldSample::No);
    158158        break;
    159159    case ReportingReason::HighMemoryUsage:
    160         page.diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainCausingJetsamKey(), domain, ShouldSample::No);
     160        page.diagnosticLoggingClient().logDiagnosticMessageWithEnhancedPrivacy(DiagnosticLoggingKeys::domainCausingJetsamKey(), registrableDomain.string(), ShouldSample::No);
    161161        break;
    162162    }
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp

    r240292 r242056  
    5959#if ENABLE(RESOURCE_LOAD_STATISTICS)
    6060
    61 static inline String getPartitioningDomain(const URL& url)
    62 {
    63 #if ENABLE(PUBLIC_SUFFIX_LIST)
    64     auto domain = topPrivatelyControlledDomain(url.host().toString());
    65     if (domain.isEmpty())
    66         domain = url.host().toString();
    67 #else
    68     auto domain = url.host().toString();
    69 #endif
    70     return domain;
    71 }
    72 
    73 bool NetworkStorageSession::shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const
    74 {
    75     if (topPrivatelyControlledDomain.isEmpty())
    76         return false;
    77 
    78     return m_topPrivatelyControlledDomainsToBlock.contains(topPrivatelyControlledDomain);
     61bool NetworkStorageSession::shouldBlockThirdPartyCookies(const RegistrableDomain& registrableDomain) const
     62{
     63    if (registrableDomain.isEmpty())
     64        return false;
     65
     66    return m_registrableDomainsToBlockCookieFor.contains(registrableDomain);
    7967}
    8068
     
    8674bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<uint64_t> frameID, Optional<uint64_t> pageID) const
    8775{
    88     auto firstPartyDomain = getPartitioningDomain(firstPartyForCookies);
     76    RegistrableDomain firstPartyDomain { firstPartyForCookies };
    8977    if (firstPartyDomain.isEmpty())
    9078        return false;
    9179
    92     auto resourceDomain = getPartitioningDomain(resource);
     80    RegistrableDomain resourceDomain { resource };
    9381    if (resourceDomain.isEmpty())
    9482        return false;
     
    115103}
    116104
    117 void NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(const Vector<String>& domains)
    118 {
    119     m_topPrivatelyControlledDomainsToBlock.clear();
    120     m_topPrivatelyControlledDomainsToBlock.add(domains.begin(), domains.end());
    121 }
    122 
    123 void NetworkStorageSession::removePrevalentDomains(const Vector<String>& domains)
     105void NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(const Vector<RegistrableDomain>& domains)
     106{
     107    m_registrableDomainsToBlockCookieFor.clear();
     108    m_registrableDomainsToBlockCookieFor.add(domains.begin(), domains.end());
     109}
     110
     111void NetworkStorageSession::removePrevalentDomains(const Vector<RegistrableDomain>& domains)
    124112{
    125113    for (auto& domain : domains)
    126         m_topPrivatelyControlledDomainsToBlock.remove(domain);
    127 }
    128 
    129 bool NetworkStorageSession::hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) const
     114        m_registrableDomainsToBlockCookieFor.remove(domain);
     115}
     116
     117bool NetworkStorageSession::hasStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) const
    130118{
    131119    if (frameID) {
     
    155143    for (auto& innerMap : m_framesGrantedStorageAccess.values()) {
    156144        for (auto& value : innerMap.values())
    157             entries.append(value);
     145            entries.append(value.string());
    158146    }
    159147    return entries;
    160148}
    161149   
    162 void NetworkStorageSession::grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID)
     150void NetworkStorageSession::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID)
    163151{
    164152    if (!frameID) {
     
    167155        auto pagesGrantedIterator = m_pagesGrantedStorageAccess.find(pageID);
    168156        if (pagesGrantedIterator == m_pagesGrantedStorageAccess.end()) {
    169             HashMap<String, String> entry;
     157            HashMap<RegistrableDomain, RegistrableDomain> entry;
    170158            entry.add(firstPartyDomain, resourceDomain);
    171159            m_pagesGrantedStorageAccess.add(pageID, entry);
     
    182170    auto pagesGrantedIterator = m_framesGrantedStorageAccess.find(pageID);
    183171    if (pagesGrantedIterator == m_framesGrantedStorageAccess.end()) {
    184         HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> entry;
     172        HashMap<uint64_t, RegistrableDomain, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> entry;
    185173        entry.add(frameID.value(), resourceDomain);
    186174        m_framesGrantedStorageAccess.add(pageID, entry);
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r240835 r242056  
    2727
    2828#include "CredentialStorage.h"
     29#include "RegistrableDomain.h"
    2930#include <pal/SessionID.h>
    3031#include <wtf/Function.h>
     
    142143    WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, Optional<uint64_t> frameID, Optional<uint64_t> pageID) const;
    143144    WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<uint64_t> frameID, Optional<uint64_t> pageID) const;
    144     WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<String>&);
     145    WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<RegistrableDomain>&);
    145146    WEBCORE_EXPORT void setAgeCapForClientSideCookies(Optional<Seconds>);
    146     WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains);
    147     WEBCORE_EXPORT bool hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) const;
     147    WEBCORE_EXPORT void removePrevalentDomains(const Vector<RegistrableDomain>& domains);
     148    WEBCORE_EXPORT bool hasStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) const;
    148149    WEBCORE_EXPORT Vector<String> getAllStorageAccessEntries() const;
    149     WEBCORE_EXPORT void grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID);
     150    WEBCORE_EXPORT void grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID);
    150151    WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
    151152    WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);
     
    177178
    178179#if ENABLE(RESOURCE_LOAD_STATISTICS)
    179     bool shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const;
    180     HashSet<String> m_topPrivatelyControlledDomainsToBlock;
    181     HashMap<uint64_t, HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
    182     HashMap<uint64_t, HashMap<String, String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess;
     180    bool shouldBlockThirdPartyCookies(const RegistrableDomain&) const;
     181    HashSet<RegistrableDomain> m_registrableDomainsToBlockCookieFor;
     182    HashMap<uint64_t, HashMap<uint64_t, RegistrableDomain, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
     183    HashMap<uint64_t, HashMap<RegistrableDomain, RegistrableDomain>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess;
    183184    Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { };
    184185    Optional<Seconds> m_ageCapForClientSideCookies { };
  • trunk/Source/WebKit/ChangeLog

    r242055 r242056  
     12019-02-25  John Wilander  <wilander@apple.com>
     2
     3        Introduce and adopt new class RegistrableDomain for eTLD+1
     4        https://bugs.webkit.org/show_bug.cgi?id=194791
     5        <rdar://problem/48179240>
     6
     7        Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
     8
     9        A new API test was added. Plenty of existing layout tests under
     10        http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
     11
     12        This patch introduces and adopts a new class called WebCore::RegistrableDomain
     13        which represents a domain's eTLD+1 (effective top level domain plus one) and is
     14        the basis for the term "site," as in same-site. Other popular names include
     15        high-level domain, primary domain, and top privately controlled/owned domain.
     16        Effective top level domains are enumerated on the Public Suffix List
     17        (https://publicsuffix.org).
     18
     19        This class just uses the full domain for when the Public Suffix List cannot help
     20        finding the registrable domain and for WebKit ports that haven't enabled
     21        PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
     22        for the null or unique origin (this matches how these origins were handled
     23        before).
     24
     25        The implementation is a wrapper around a String and the functions and class
     26        members that now make use of this new class used to handle regular String
     27        objects which didn't help much in terms of type safety or guarantees that the
     28        string had already been converted to an eTLD+1.
     29
     30        We've at least two bad bugs in the Storage Access API because of confusion
     31        between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
     32        will prohibit such bugs in the future.
     33
     34        Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
     35        WebCore::RegistrableDomain for partitioning in a later patch.
     36
     37        This patch also enhances parameter naming by:
     38        - Removing parts that refer to "primary" as in primaryDomain.
     39        - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
     40        - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
     41        - Using the term "domain" consistently instead of e.g. "host."
     42
     43        A follow-up patch will continue backwards in call chains to create
     44        WebCore::RegistrableDomain objects as early as possible instead of using strings.
     45        I did not do that work here in the interest of patch size.
     46
     47        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
     48        (WebKit::domainsToString):
     49        (WebKit::pruneResources):
     50        (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
     51        (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
     52        (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
     53        (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
     54        (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
     55        (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
     56        (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
     57        (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
     58        (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
     59        (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
     60        (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
     61        (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
     62        (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
     63        (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
     64        (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
     65        (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
     66        (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
     67        (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
     68        (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
     69        (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
     70        (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
     71        (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
     72        (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
     73        (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
     74        (WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
     75        (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
     76        (WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
     77        (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
     78        (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
     79        (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
     80        (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
     81        (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
     82        (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
     83        (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForRegistrableDomain):
     84        (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
     85        (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
     86        (WebKit::debugLogDomainsInBatches):
     87        (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
     88        (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
     89        (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
     90        (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
     91        (WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
     92        (WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
     93        (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
     94        (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain): Deleted.
     95        (WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): Deleted.
     96        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
     97        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
     98        (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
     99        (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
     100        (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
     101        (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
     102        (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
     103        (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
     104        (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
     105        (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
     106        (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
     107        (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
     108        (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
     109        (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
     110        (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
     111        (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
     112        (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
     113        (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
     114        (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
     115        (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
     116        (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
     117        (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
     118        (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
     119        (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
     120        (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
     121        (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
     122        (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
     123        (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
     124        (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
     125        (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
     126        (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
     127        (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
     128        (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
     129        (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
     130        (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
     131        (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
     132        (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
     133        (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
     134        (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
     135        (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
     136        (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
     137        (WebKit::WebResourceLoadStatisticsStore::registrableDomainsWithWebsiteData):
     138        (WebKit::isolatedPrimaryDomain): Deleted.
     139        (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
     140        (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
     141        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
     142        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     143        (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
     144        (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
     145        (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
     146        (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
     147        (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
     148        (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
     149        * NetworkProcess/NetworkConnectionToWebProcess.h:
     150        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
     151        * NetworkProcess/NetworkProcess.cpp:
     152        (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
     153        (WebKit::NetworkProcess::isGrandfathered):
     154        (WebKit::NetworkProcess::isPrevalentResource):
     155        (WebKit::NetworkProcess::isVeryPrevalentResource):
     156        (WebKit::NetworkProcess::setGrandfathered):
     157        (WebKit::NetworkProcess::setPrevalentResource):
     158        (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
     159        (WebKit::NetworkProcess::setVeryPrevalentResource):
     160        (WebKit::NetworkProcess::clearPrevalentResource):
     161        (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
     162        (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
     163        (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
     164        (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
     165        (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
     166        (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
     167        (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
     168        (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
     169        (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
     170        (WebKit::NetworkProcess::setLastSeen):
     171        (WebKit::NetworkProcess::hasStorageAccessForFrame):
     172        (WebKit::NetworkProcess::hasStorageAccess):
     173        (WebKit::NetworkProcess::requestStorageAccess):
     174        (WebKit::NetworkProcess::requestStorageAccessGranted):
     175        (WebKit::NetworkProcess::grantStorageAccess):
     176        (WebKit::NetworkProcess::logFrameNavigation):
     177        (WebKit::NetworkProcess::logUserInteraction):
     178        (WebKit::NetworkProcess::hadUserInteraction):
     179        (WebKit::NetworkProcess::clearUserInteraction):
     180        (WebKit::NetworkProcess::removePrevalentDomains):
     181        (WebKit::filterForRegistrableDomains):
     182        (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
     183        (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
     184        (WebKit::filterForTopLevelDomains): Deleted.
     185        (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
     186        (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
     187        * NetworkProcess/NetworkProcess.h:
     188        * NetworkProcess/NetworkProcess.messages.in:
     189        * NetworkProcess/NetworkResourceLoader.cpp:
     190        (WebKit::logCookieInformationInternal):
     191        * NetworkProcess/NetworkSession.cpp:
     192        (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
     193        (WebKit::NetworkSession::registrableDomainsWithWebsiteData):
     194        (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
     195        (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
     196        * NetworkProcess/NetworkSession.h:
     197        * Shared/WebCoreArgumentCoders.cpp:
     198        (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
     199        (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
     200        * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
     201        (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
     202        * UIProcess/Network/NetworkProcessProxy.cpp:
     203        (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
     204        (WebKit::NetworkProcessProxy::isPrevalentResource):
     205        (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
     206        (WebKit::NetworkProcessProxy::setPrevalentResource):
     207        (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
     208        (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
     209        (WebKit::NetworkProcessProxy::setLastSeen):
     210        (WebKit::NetworkProcessProxy::clearPrevalentResource):
     211        (WebKit::NetworkProcessProxy::logUserInteraction):
     212        (WebKit::NetworkProcessProxy::hasHadUserInteraction):
     213        (WebKit::NetworkProcessProxy::clearUserInteraction):
     214        (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
     215        (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
     216        (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
     217        (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
     218        (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
     219        (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
     220        (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
     221        (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
     222        (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
     223        (WebKit::NetworkProcessProxy::isGrandfathered):
     224        (WebKit::NetworkProcessProxy::setGrandfathered):
     225        (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
     226        (WebKit::NetworkProcessProxy::hasStorageAccess):
     227        (WebKit::NetworkProcessProxy::requestStorageAccess):
     228        (WebKit::NetworkProcessProxy::grantStorageAccess):
     229        (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
     230        (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
     231        (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.
     232        (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.
     233        * UIProcess/Network/NetworkProcessProxy.h:
     234        * UIProcess/Network/NetworkProcessProxy.messages.in:
     235        * UIProcess/WebPageProxy.cpp:
     236        (WebKit::WebPageProxy::logFrameNavigation):
     237        (WebKit::WebPageProxy::requestStorageAccessConfirm):
     238        * UIProcess/WebProcessProxy.cpp:
     239        (WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed):
     240        (WebKit::WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
     241        (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
     242        (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.
     243        (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.
     244        * UIProcess/WebProcessProxy.h:
     245        * UIProcess/WebResourceLoadStatisticsStore.messages.in:
     246        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     247        (WebKit::WebsiteDataStore::isPrevalentResource):
     248        (WebKit::WebsiteDataStore::setPrevalentResource):
     249        (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
     250        (WebKit::WebsiteDataStore::isVeryPrevalentResource):
     251        (WebKit::WebsiteDataStore::setVeryPrevalentResource):
     252        (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
     253        (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
     254        (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
     255        (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
     256        (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
     257        (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
     258        (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
     259        (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
     260        (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
     261        (WebKit::WebsiteDataStore::clearPrevalentResource):
     262        (WebKit::WebsiteDataStore::setLastSeen):
     263        (WebKit::WebsiteDataStore::hasStorageAccess):
     264        (WebKit::WebsiteDataStore::requestStorageAccess):
     265        (WebKit::WebsiteDataStore::grantStorageAccess):
     266        (WebKit::WebsiteDataStore::logUserInteraction):
     267        (WebKit::WebsiteDataStore::hasHadUserInteraction):
     268        (WebKit::WebsiteDataStore::clearUserInteraction):
     269        (WebKit::WebsiteDataStore::setGrandfathered):
     270        (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Deleted.
     271        * UIProcess/WebsiteData/WebsiteDataStore.h:
     272        * WebProcess/WebPage/WebPage.cpp:
     273        (WebKit::WebPage::hasStorageAccess):
     274        (WebKit::WebPage::requestStorageAccess):
     275        * WebProcess/WebProcess.cpp:
     276        (WebKit::m_nonVisibleProcessCleanupTimer):
     277        (WebKit::WebProcess::initializeWebProcess):
     278
    12792019-02-25  Adrian Perez de Castro  <aperez@igalia.com>
    2280
  • trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp

    r241924 r242056  
    5454constexpr unsigned operatingDatesWindow { 30 };
    5555constexpr unsigned maxImportance { 3 };
    56 static const char* debugStaticPrevalentResource { "3rdpartytestwebkit.org" };
    5756
    5857#if !RELEASE_LOG_DISABLED
    59 static String domainsToString(const Vector<String>& domains)
     58static String domainsToString(const Vector<RegistrableDomain>& domains)
    6059{
    6160    StringBuilder builder;
     
    6362        if (!builder.isEmpty())
    6463            builder.appendLiteral(", ");
    65         builder.append(domain);
     64        builder.append(domain.string());
    6665    }
    6766    return builder.toString();
     
    141140
    142141struct StatisticsLastSeen {
    143     String topPrivatelyOwnedDomain;
     142    RegistrableDomain domain;
    144143    WallTime lastSeen;
    145144};
    146145
    147 static void pruneResources(HashMap<String, WebCore::ResourceLoadStatistics>& statisticsMap, Vector<StatisticsLastSeen>& statisticsToPrune, size_t& numberOfEntriesToPrune)
     146static void pruneResources(HashMap<RegistrableDomain, ResourceLoadStatistics>& statisticsMap, Vector<StatisticsLastSeen>& statisticsToPrune, size_t& numberOfEntriesToPrune)
    148147{
    149148    if (statisticsToPrune.size() > numberOfEntriesToPrune) {
     
    154153
    155154    for (size_t i = 0, end = std::min(numberOfEntriesToPrune, statisticsToPrune.size()); i != end; ++i, --numberOfEntriesToPrune)
    156         statisticsMap.remove(statisticsToPrune[i].topPrivatelyOwnedDomain);
     155        statisticsMap.remove(statisticsToPrune[i].domain);
    157156}
    158157
     
    235234#endif
    236235
    237     auto prevalentResourceDomains = topPrivatelyControlledDomainsToRemoveWebsiteDataFor();
     236    auto prevalentResourceDomains = registrableDomainsToRemoveWebsiteDataFor();
    238237    if (prevalentResourceDomains.isEmpty()) {
    239238        callback();
     
    253252        }
    254253
    255         weakThis->m_store.deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(WebResourceLoadStatisticsStore::monitoredDataTypes(), WTFMove(prevalentResourceDomains), shouldNotifyPagesWhenDataRecordsWereScanned, [callback = WTFMove(callback), weakThis = WTFMove(weakThis), workQueue = workQueue.copyRef()](const HashSet<String>& domainsWithDeletedWebsiteData) mutable {
    256             workQueue->dispatch([topDomains = crossThreadCopy(domainsWithDeletedWebsiteData), callback = WTFMove(callback), weakThis = WTFMove(weakThis)] () mutable {
     254        weakThis->m_store.deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(WebResourceLoadStatisticsStore::monitoredDataTypes(), WTFMove(prevalentResourceDomains), shouldNotifyPagesWhenDataRecordsWereScanned, [callback = WTFMove(callback), weakThis = WTFMove(weakThis), workQueue = workQueue.copyRef()](const HashSet<String>& domainsWithDeletedWebsiteData) mutable {
     255            workQueue->dispatch([domainsWithDeletedWebsiteData = crossThreadCopy(domainsWithDeletedWebsiteData), callback = WTFMove(callback), weakThis = WTFMove(weakThis)] () mutable {
    257256                if (!weakThis) {
    258257                    callback();
    259258                    return;
    260259                }
    261                 for (auto& prevalentResourceDomain : topDomains) {
    262                     auto& statistic = weakThis->ensureResourceStatisticsForPrimaryDomain(prevalentResourceDomain);
     260                for (auto& domain : domainsWithDeletedWebsiteData) {
     261                    auto& statistic = weakThis->ensureResourceStatisticsForRegistrableDomain(RegistrableDomain { domain });
    263262                    ++statistic.dataRecordsRemoved;
    264263                }
     
    273272}
    274273
    275 unsigned ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const WebCore::ResourceLoadStatistics& resourceStatistic, HashSet<String>& domainsThatHaveRedirectedTo, unsigned numberOfRecursiveCalls) const
     274unsigned ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const ResourceLoadStatistics& resourceStatistic, HashSet<RegistrableDomain>& domainsThatHaveRedirectedTo, unsigned numberOfRecursiveCalls) const
    276275{
    277276    ASSERT(!RunLoop::isMain());
     
    288287
    289288    for (auto& subresourceUniqueRedirectFromDomain : resourceStatistic.subresourceUniqueRedirectsFrom.values()) {
    290         auto mapEntry = m_resourceStatisticsMap.find(subresourceUniqueRedirectFromDomain);
     289        auto mapEntry = m_resourceStatisticsMap.find(RegistrableDomain { subresourceUniqueRedirectFromDomain });
    291290        if (mapEntry == m_resourceStatisticsMap.end() || mapEntry->value.isPrevalentResource)
    292291            continue;
    293         if (domainsThatHaveRedirectedTo.add(mapEntry->value.highLevelDomain).isNewEntry)
     292        if (domainsThatHaveRedirectedTo.add(mapEntry->value.registrableDomain).isNewEntry)
    294293            numberOfRecursiveCalls = recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(mapEntry->value, domainsThatHaveRedirectedTo, numberOfRecursiveCalls);
    295294    }
    296295    for (auto& topFrameUniqueRedirectFromDomain : resourceStatistic.topFrameUniqueRedirectsFrom.values()) {
    297         auto mapEntry = m_resourceStatisticsMap.find(topFrameUniqueRedirectFromDomain);
     296        auto mapEntry = m_resourceStatisticsMap.find(RegistrableDomain { topFrameUniqueRedirectFromDomain });
    298297        if (mapEntry == m_resourceStatisticsMap.end() || mapEntry->value.isPrevalentResource)
    299298            continue;
    300         if (domainsThatHaveRedirectedTo.add(mapEntry->value.highLevelDomain).isNewEntry)
     299        if (domainsThatHaveRedirectedTo.add(mapEntry->value.registrableDomain).isNewEntry)
    301300            numberOfRecursiveCalls = recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(mapEntry->value, domainsThatHaveRedirectedTo, numberOfRecursiveCalls);
    302301    }
     
    305304}
    306305
    307 void ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics& resourceStatistic)
     306void ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent(ResourceLoadStatistics& resourceStatistic)
    308307{
    309308    ASSERT(!RunLoop::isMain());
     
    313312
    314313    for (auto& subresourceDomainRedirectedTo : resourceStatistic.subresourceUniqueRedirectsTo.values()) {
    315         auto mapEntry = m_resourceStatisticsMap.find(subresourceDomainRedirectedTo);
     314        auto mapEntry = m_resourceStatisticsMap.find(RegistrableDomain { subresourceDomainRedirectedTo });
    316315        if (mapEntry != m_resourceStatisticsMap.end() && mapEntry->value.isPrevalentResource) {
    317316            setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
     
    321320
    322321    for (auto& topFrameDomainRedirectedTo : resourceStatistic.topFrameUniqueRedirectsTo.values()) {
    323         auto mapEntry = m_resourceStatisticsMap.find(topFrameDomainRedirectedTo);
     322        auto mapEntry = m_resourceStatisticsMap.find(RegistrableDomain { topFrameDomainRedirectedTo });
    324323        if (mapEntry != m_resourceStatisticsMap.end() && mapEntry->value.isPrevalentResource) {
    325324            setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
     
    334333        return false;
    335334
    336     return resourceStatistic.highLevelDomain == debugStaticPrevalentResource || resourceStatistic.highLevelDomain == m_debugManualPrevalentResource;
     335    return resourceStatistic.registrableDomain == m_debugStaticPrevalentResource || resourceStatistic.registrableDomain == m_debugManualPrevalentResource;
    337336}
    338337
     
    377376}
    378377
    379 void ResourceLoadStatisticsMemoryStore::hasStorageAccess(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    380 {
    381     ASSERT(!RunLoop::isMain());
    382 
    383     auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain);
     378void ResourceLoadStatisticsMemoryStore::hasStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     379{
     380    ASSERT(!RunLoop::isMain());
     381
     382    auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
    384383    if (shouldBlockAndPurgeCookies(subFrameStatistic)) {
    385384        completionHandler(false);
     
    392391    }
    393392
    394     RunLoop::main().dispatch([store = makeRef(m_store), subFramePrimaryDomain = subFramePrimaryDomain.isolatedCopy(), topFramePrimaryDomain = topFramePrimaryDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable {
    395         store->callHasStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID.value(), pageID, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)](bool result) mutable {
     393    RunLoop::main().dispatch([store = makeRef(m_store), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable {
     394        store->callHasStorageAccessForFrameHandler(subFrameDomain, topFrameDomain, frameID.value(), pageID, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)](bool result) mutable {
    396395            store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler), result] () mutable {
    397396                completionHandler(result);
     
    401400}
    402401
    403 void ResourceLoadStatisticsMemoryStore::requestStorageAccess(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
    404 {
    405     ASSERT(!RunLoop::isMain());
    406 
    407     auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain);
     402void ResourceLoadStatisticsMemoryStore::requestStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
     403{
     404    ASSERT(!RunLoop::isMain());
     405
     406    auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
    408407    if (shouldBlockAndPurgeCookies(subFrameStatistic)) {
    409408#if !RELEASE_LOG_DISABLED
    410         RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Cannot grant storage access to %{public}s since its cookies are blocked in third-party contexts and it has not received user interaction as first-party.", subFramePrimaryDomain.utf8().data());
     409        RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Cannot grant storage access to %{public}s since its cookies are blocked in third-party contexts and it has not received user interaction as first-party.", subFrameDomain.string().utf8().data());
    411410#endif
    412411        completionHandler(StorageAccessStatus::CannotRequestAccess);
     
    416415    if (!shouldBlockAndKeepCookies(subFrameStatistic)) {
    417416#if !RELEASE_LOG_DISABLED
    418         RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "No need to grant storage access to %{public}s since its cookies are not blocked in third-party contexts.", subFramePrimaryDomain.utf8().data());
     417        RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "No need to grant storage access to %{public}s since its cookies are not blocked in third-party contexts.", subFrameDomain.string().utf8().data());
    419418#endif
    420419        completionHandler(StorageAccessStatus::HasAccess);
     
    422421    }
    423422
    424     auto userWasPromptedEarlier = promptEnabled && hasUserGrantedStorageAccessThroughPrompt(subFrameStatistic, topFramePrimaryDomain);
     423    auto userWasPromptedEarlier = promptEnabled && hasUserGrantedStorageAccessThroughPrompt(subFrameStatistic, topFrameDomain);
    425424    if (promptEnabled && !userWasPromptedEarlier) {
    426425#if !RELEASE_LOG_DISABLED
    427         RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "About to ask the user whether they want to grant storage access to %{public}s under %{public}s or not.", subFramePrimaryDomain.utf8().data(), topFramePrimaryDomain.utf8().data());
     426        RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "About to ask the user whether they want to grant storage access to %{public}s under %{public}s or not.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data());
    428427#endif
    429428        completionHandler(StorageAccessStatus::RequiresUserPrompt);
     
    431430    } else if (userWasPromptedEarlier) {
    432431#if !RELEASE_LOG_DISABLED
    433         RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFramePrimaryDomain.utf8().data(), topFramePrimaryDomain.utf8().data());
     432        RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data());
    434433#endif
    435434    }
     
    437436    subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++;
    438437
    439     grantStorageAccessInternal(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable {
     438    grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable {
    440439        completionHandler(wasGrantedAccess ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess);
    441440    });
    442441}
    443442
    444 void ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener(String&& primaryDomainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerPrimaryDomain)
    445 {
    446     ASSERT(primaryDomainInNeedOfStorageAccess != openerPrimaryDomain);
    447     ASSERT(!RunLoop::isMain());
    448 
    449     if (primaryDomainInNeedOfStorageAccess == openerPrimaryDomain)
    450         return;
    451 
    452     auto& domainInNeedOfStorageAccessStatistic = ensureResourceStatisticsForPrimaryDomain(primaryDomainInNeedOfStorageAccess);
     443void ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener(RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, RegistrableDomain&& openerDomain)
     444{
     445    ASSERT(domainInNeedOfStorageAccess != openerDomain);
     446    ASSERT(!RunLoop::isMain());
     447
     448    if (domainInNeedOfStorageAccess == openerDomain)
     449        return;
     450
     451    auto& domainInNeedOfStorageAccessStatistic = ensureResourceStatisticsForRegistrableDomain(domainInNeedOfStorageAccess);
    453452    auto cookiesBlockedAndPurged = shouldBlockAndPurgeCookies(domainInNeedOfStorageAccessStatistic);
    454453
     
    458457
    459458#if !RELEASE_LOG_DISABLED
    460     RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "[Temporary combatibility fix] Storage access was granted for %{public}s under opener page from %{public}s, with user interaction in the opened window.", primaryDomainInNeedOfStorageAccess.utf8().data(), openerPrimaryDomain.utf8().data());
    461 #endif
    462     grantStorageAccessInternal(WTFMove(primaryDomainInNeedOfStorageAccess), WTFMove(openerPrimaryDomain), WTF::nullopt, openerPageID, false, [](bool) { });
    463 }
    464 
    465 void ResourceLoadStatisticsMemoryStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)
    466 {
    467     ASSERT(!RunLoop::isMain());
    468 
    469     auto subFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(subFrameHost);
    470     auto topFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(topFrameHost);
     459    RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "[Temporary combatibility fix] Storage access was granted for %{public}s under opener page from %{public}s, with user interaction in the opened window.", domainInNeedOfStorageAccess.string().utf8().data(), openerDomain.string().utf8().data());
     460#endif
     461    grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, false, [](bool) { });
     462}
     463
     464void ResourceLoadStatisticsMemoryStore::grantStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)
     465{
     466    ASSERT(!RunLoop::isMain());
     467
    471468    if (userWasPromptedNow) {
    472         auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain);
     469        auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
    473470        ASSERT(subFrameStatistic.hadUserInteraction);
    474         subFrameStatistic.storageAccessUnderTopFrameOrigins.add(topFramePrimaryDomain);
    475     }
    476     grantStorageAccessInternal(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler));
    477 }
    478 
    479 void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback)
    480 {
    481     ASSERT(!RunLoop::isMain());
    482 
    483     if (subFramePrimaryDomain == topFramePrimaryDomain) {
     471        subFrameStatistic.storageAccessUnderTopFrameOrigins.add(topFrameDomain.string());
     472    }
     473    grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler));
     474}
     475
     476void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback)
     477{
     478    ASSERT(!RunLoop::isMain());
     479
     480    if (subFrameDomain == topFrameDomain) {
    484481        callback(true);
    485482        return;
     
    488485    // FIXME: Remove m_storageAccessPromptsEnabled check if prompting is no longer experimental.
    489486    if (userWasPromptedNowOrEarlier && m_storageAccessPromptsEnabled) {
    490         auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain);
     487        auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
    491488        ASSERT(subFrameStatistic.hadUserInteraction);
    492         ASSERT(subFrameStatistic.storageAccessUnderTopFrameOrigins.contains(topFramePrimaryDomain));
     489        ASSERT(subFrameStatistic.storageAccessUnderTopFrameOrigins.contains(topFrameDomain.string()));
    493490        subFrameStatistic.mostRecentUserInteractionTime = WallTime::now();
    494491    }
    495492
    496     RunLoop::main().dispatch([subFramePrimaryDomain = subFramePrimaryDomain.isolatedCopy(), topFramePrimaryDomain = topFramePrimaryDomain.isolatedCopy(), frameID, pageID, store = makeRef(m_store), callback = WTFMove(callback)]() mutable {
    497         store->callGrantStorageAccessHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, [callback = WTFMove(callback), store = store.copyRef()](bool value) mutable {
     493    RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(m_store), callback = WTFMove(callback)]() mutable {
     494        store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [callback = WTFMove(callback), store = store.copyRef()](bool value) mutable {
    498495            store->statisticsQueue().dispatch([callback = WTFMove(callback), value] () mutable {
    499496                callback(value);
     
    508505
    509506    RunLoop::main().dispatch([weakThis = makeWeakPtr(*this), callback = WTFMove(callback), shouldNotifyPagesWhenDataRecordsWereScanned = m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, workQueue = m_workQueue.copyRef(), store = makeRef(m_store)] () mutable {
    510         store->topPrivatelyControlledDomainsWithWebsiteData(WebResourceLoadStatisticsStore::monitoredDataTypes(), shouldNotifyPagesWhenDataRecordsWereScanned, [weakThis = WTFMove(weakThis), callback = WTFMove(callback), workQueue = workQueue.copyRef()] (HashSet<String>&& topDomainsWithWebsiteData) mutable {
    511             workQueue->dispatch([weakThis = WTFMove(weakThis), topDomains = crossThreadCopy(topDomainsWithWebsiteData), callback = WTFMove(callback)] () mutable {
     507        store->registrableDomainsWithWebsiteData(WebResourceLoadStatisticsStore::monitoredDataTypes(), shouldNotifyPagesWhenDataRecordsWereScanned, [weakThis = WTFMove(weakThis), callback = WTFMove(callback), workQueue = workQueue.copyRef()] (HashSet<RegistrableDomain>&& domainsWithWebsiteData) mutable {
     508            workQueue->dispatch([weakThis = WTFMove(weakThis), domainsWithWebsiteData = crossThreadCopy(domainsWithWebsiteData), callback = WTFMove(callback)] () mutable {
    512509                if (!weakThis) {
    513510                    callback();
     
    515512                }
    516513
    517                 for (auto& topPrivatelyControlledDomain : topDomains) {
    518                     auto& statistic = weakThis->ensureResourceStatisticsForPrimaryDomain(topPrivatelyControlledDomain);
     514                for (auto& domain : domainsWithWebsiteData) {
     515                    auto& statistic = weakThis->ensureResourceStatisticsForRegistrableDomain(domain);
    519516                    statistic.grandfathered = true;
    520517                }
     
    529526}
    530527
    531 Vector<String> ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode()
     528Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode()
    532529{
    533530    if (!m_debugModeEnabled)
    534531        return { };
    535532
    536     Vector<String> primaryDomainsToBlock;
    537     primaryDomainsToBlock.reserveInitialCapacity(2);
    538 
    539     auto& staticSesourceStatistic = ensureResourceStatisticsForPrimaryDomain(debugStaticPrevalentResource);
     533    Vector<RegistrableDomain> domainsToBlock;
     534    domainsToBlock.reserveInitialCapacity(2);
     535
     536    auto& staticSesourceStatistic = ensureResourceStatisticsForRegistrableDomain(m_debugStaticPrevalentResource);
    540537    setPrevalentResource(staticSesourceStatistic, ResourceLoadPrevalence::High);
    541     primaryDomainsToBlock.uncheckedAppend(debugStaticPrevalentResource);
     538    domainsToBlock.uncheckedAppend(m_debugStaticPrevalentResource);
    542539
    543540    if (!m_debugManualPrevalentResource.isEmpty()) {
    544         auto& manualResourceStatistic = ensureResourceStatisticsForPrimaryDomain(m_debugManualPrevalentResource);
     541        auto& manualResourceStatistic = ensureResourceStatisticsForRegistrableDomain(m_debugManualPrevalentResource);
    545542        setPrevalentResource(manualResourceStatistic, ResourceLoadPrevalence::High);
    546         primaryDomainsToBlock.uncheckedAppend(m_debugManualPrevalentResource);
     543        domainsToBlock.uncheckedAppend(m_debugManualPrevalentResource);
    547544#if !RELEASE_LOG_DISABLED
    548         RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "Did set %{public}s as prevalent resource for the purposes of ITP Debug Mode.", m_debugManualPrevalentResource.utf8().data());
     545        RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "Did set %{public}s as prevalent resource for the purposes of ITP Debug Mode.", m_debugManualPrevalentResource.string().utf8().data());
    549546#endif
    550547    }
    551548   
    552     return primaryDomainsToBlock;
     549    return domainsToBlock;
    553550}
    554551
     
    571568}
    572569
    573 void ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode(const String& domain)
     570void ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode(const RegistrableDomain& domain)
    574571{
    575572    m_debugManualPrevalentResource = domain;
     
    602599}
    603600
    604 void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame)
    605 {
    606     ASSERT(!RunLoop::isMain());
    607 
    608     bool areTargetAndMainFrameDomainsAssociated = targetPrimaryDomain == mainFramePrimaryDomain;
    609     bool areTargetAndSourceDomainsAssociated = targetPrimaryDomain == sourcePrimaryDomain;
     601void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
     602{
     603    ASSERT(!RunLoop::isMain());
     604
     605    bool areTargetAndTopFrameDomainsSameSite = targetDomain == topFrameDomain;
     606    bool areTargetAndSourceDomainsSameSite = targetDomain == sourceDomain;
    610607
    611608    bool statisticsWereUpdated = false;
    612     if (!isMainFrame && targetHost != mainFrameHost && !(areTargetAndMainFrameDomainsAssociated || areTargetAndSourceDomainsAssociated)) {
    613         auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
     609    if (!isMainFrame && !(areTargetAndTopFrameDomainsSameSite || areTargetAndSourceDomainsSameSite)) {
     610        auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
    614611        targetStatistics.lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
    615         if (targetStatistics.subframeUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
     612        if (targetStatistics.subframeUnderTopFrameOrigins.add(topFrameDomain.string()).isNewEntry)
    616613            statisticsWereUpdated = true;
    617614    }
    618615
    619     if (isRedirect && !areTargetAndSourceDomainsAssociated) {
     616    if (isRedirect && !areTargetAndSourceDomainsSameSite) {
    620617        if (isMainFrame) {
    621             auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
    622             if (redirectingOriginStatistics.topFrameUniqueRedirectsTo.add(targetPrimaryDomain).isNewEntry)
     618            auto& redirectingOriginStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
     619            if (redirectingOriginStatistics.topFrameUniqueRedirectsTo.add(targetDomain.string()).isNewEntry)
    623620                statisticsWereUpdated = true;
    624             auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
    625             if (targetStatistics.topFrameUniqueRedirectsFrom.add(sourcePrimaryDomain).isNewEntry)
     621            auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
     622            if (targetStatistics.topFrameUniqueRedirectsFrom.add(sourceDomain.string()).isNewEntry)
    626623                statisticsWereUpdated = true;
    627624        } else {
    628             auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
    629             if (redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain).isNewEntry)
     625            auto& redirectingOriginStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
     626            if (redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetDomain.string()).isNewEntry)
    630627                statisticsWereUpdated = true;
    631             auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
    632             if (targetStatistics.subresourceUniqueRedirectsFrom.add(sourcePrimaryDomain).isNewEntry)
     628            auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
     629            if (targetStatistics.subresourceUniqueRedirectsFrom.add(sourceDomain.string()).isNewEntry)
    633630                statisticsWereUpdated = true;
    634631        }
     
    639636}
    640637
    641 void ResourceLoadStatisticsMemoryStore::logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
    642 {
    643     ASSERT(!RunLoop::isMain());
    644 
    645     auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
     638void ResourceLoadStatisticsMemoryStore::logSubresourceLoading(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen)
     639{
     640    ASSERT(!RunLoop::isMain());
     641
     642    auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
    646643    targetStatistics.lastSeen = lastSeen;
    647     if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
     644    if (targetStatistics.subresourceUnderTopFrameOrigins.add(topFrameDomain.string()).isNewEntry)
    648645        scheduleStatisticsProcessingRequestIfNecessary();
    649646}
    650647
    651 void ResourceLoadStatisticsMemoryStore::logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain)
    652 {
    653     ASSERT(!RunLoop::isMain());
    654 
    655     auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
    656     bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain).isNewEntry;
    657     auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
    658     bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(sourcePrimaryDomain).isNewEntry;
    659    
     648void ResourceLoadStatisticsMemoryStore::logSubresourceRedirect(const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain)
     649{
     650    ASSERT(!RunLoop::isMain());
     651
     652    auto& redirectingOriginStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
     653    bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetDomain.string()).isNewEntry;
     654    auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
     655    bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(sourceDomain.string()).isNewEntry;
     656
    660657    if (isNewRedirectToEntry || isNewRedirectFromEntry)
    661658        scheduleStatisticsProcessingRequestIfNecessary();
    662659}
    663660
    664 void ResourceLoadStatisticsMemoryStore::logUserInteraction(const String& primaryDomain)
    665 {
    666     ASSERT(!RunLoop::isMain());
    667 
    668     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     661void ResourceLoadStatisticsMemoryStore::logUserInteraction(const RegistrableDomain& domain)
     662{
     663    ASSERT(!RunLoop::isMain());
     664
     665    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    669666    statistics.hadUserInteraction = true;
    670667    statistics.mostRecentUserInteractionTime = WallTime::now();
    671668}
    672669
    673 void ResourceLoadStatisticsMemoryStore::clearUserInteraction(const String& primaryDomain)
    674 {
    675     ASSERT(!RunLoop::isMain());
    676 
    677     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     670void ResourceLoadStatisticsMemoryStore::clearUserInteraction(const RegistrableDomain& domain)
     671{
     672    ASSERT(!RunLoop::isMain());
     673
     674    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    678675    statistics.hadUserInteraction = false;
    679676    statistics.mostRecentUserInteractionTime = { };
    680677}
    681678
    682 bool ResourceLoadStatisticsMemoryStore::hasHadUserInteraction(const String& primaryDomain)
    683 {
    684     ASSERT(!RunLoop::isMain());
    685 
    686     auto mapEntry = m_resourceStatisticsMap.find(primaryDomain);
     679bool ResourceLoadStatisticsMemoryStore::hasHadUserInteraction(const RegistrableDomain& domain)
     680{
     681    ASSERT(!RunLoop::isMain());
     682
     683    auto mapEntry = m_resourceStatisticsMap.find(domain);
    687684    return mapEntry == m_resourceStatisticsMap.end() ? false: hasHadUnexpiredRecentUserInteraction(mapEntry->value);
    688685}
    689686
    690 void ResourceLoadStatisticsMemoryStore::setPrevalentResource(WebCore::ResourceLoadStatistics& resourceStatistic, ResourceLoadPrevalence newPrevalence)
     687void ResourceLoadStatisticsMemoryStore::setPrevalentResource(ResourceLoadStatistics& resourceStatistic, ResourceLoadPrevalence newPrevalence)
    691688{
    692689    ASSERT(!RunLoop::isMain());
     
    694691    resourceStatistic.isPrevalentResource = true;
    695692    resourceStatistic.isVeryPrevalentResource = newPrevalence == ResourceLoadPrevalence::VeryHigh;
    696     HashSet<String> domainsThatHaveRedirectedTo;
     693    HashSet<RegistrableDomain> domainsThatHaveRedirectedTo;
    697694    recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(resourceStatistic, domainsThatHaveRedirectedTo, 0);
    698695    for (auto& domain : domainsThatHaveRedirectedTo) {
     
    716713}
    717714
    718 bool ResourceLoadStatisticsMemoryStore::isPrevalentResource(const String& primaryDomain) const
    719 {
    720     ASSERT(!RunLoop::isMain());
    721 
    722     auto mapEntry = m_resourceStatisticsMap.find(primaryDomain);
     715bool ResourceLoadStatisticsMemoryStore::isPrevalentResource(const RegistrableDomain& domain) const
     716{
     717    ASSERT(!RunLoop::isMain());
     718
     719    auto mapEntry = m_resourceStatisticsMap.find(domain);
    723720    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.isPrevalentResource;
    724721}
    725722
    726 bool ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource(const String& primaryDomain) const
    727 {
    728     ASSERT(!RunLoop::isMain());
    729 
    730     auto mapEntry = m_resourceStatisticsMap.find(primaryDomain);
     723bool ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource(const RegistrableDomain& domain) const
     724{
     725    ASSERT(!RunLoop::isMain());
     726
     727    auto mapEntry = m_resourceStatisticsMap.find(domain);
    731728    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.isPrevalentResource && mapEntry->value.isVeryPrevalentResource;
    732729}
    733730
    734 bool ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder(const String& subresourcePrimaryDomain, const String& topFramePrimaryDomain) const
    735 {
    736     ASSERT(!RunLoop::isMain());
    737 
    738     auto mapEntry = m_resourceStatisticsMap.find(subresourcePrimaryDomain);
    739     return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUnderTopFrameOrigins.contains(topFramePrimaryDomain);
    740 }
    741 
    742 bool ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain) const
    743 {
    744     ASSERT(!RunLoop::isMain());
    745 
    746     auto mapEntry = m_resourceStatisticsMap.find(subFramePrimaryDomain);
    747     return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subframeUnderTopFrameOrigins.contains(topFramePrimaryDomain);
    748 }
    749 
    750 bool ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo(const String& hostRedirectedFromPrimaryDomain, const String& hostRedirectedToPrimaryDomain) const
    751 {
    752     ASSERT(!RunLoop::isMain());
    753 
    754     auto mapEntry = m_resourceStatisticsMap.find(hostRedirectedFromPrimaryDomain);
    755     return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUniqueRedirectsTo.contains(hostRedirectedToPrimaryDomain);
    756 }
    757 
    758 void ResourceLoadStatisticsMemoryStore::clearPrevalentResource(const String& primaryDomain)
    759 {
    760     ASSERT(!RunLoop::isMain());
    761 
    762     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     731bool ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder(const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain) const
     732{
     733    ASSERT(!RunLoop::isMain());
     734
     735    auto mapEntry = m_resourceStatisticsMap.find(subresourceDomain);
     736    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUnderTopFrameOrigins.contains(topFrameDomain.string());
     737}
     738
     739bool ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain) const
     740{
     741    ASSERT(!RunLoop::isMain());
     742
     743    auto mapEntry = m_resourceStatisticsMap.find(subFrameDomain);
     744    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subframeUnderTopFrameOrigins.contains(topFrameDomain.string());
     745}
     746
     747bool ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo(const RegistrableDomain& redirectedFromDomain, const RegistrableDomain& redirectedToDomain) const
     748{
     749    ASSERT(!RunLoop::isMain());
     750
     751    auto mapEntry = m_resourceStatisticsMap.find(redirectedFromDomain);
     752    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUniqueRedirectsTo.contains(redirectedToDomain.string());
     753}
     754
     755void ResourceLoadStatisticsMemoryStore::clearPrevalentResource(const RegistrableDomain& domain)
     756{
     757    ASSERT(!RunLoop::isMain());
     758
     759    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    763760    statistics.isPrevalentResource = false;
    764761    statistics.isVeryPrevalentResource = false;
    765762}
    766763
    767 void ResourceLoadStatisticsMemoryStore::setGrandfathered(const String& primaryDomain, bool value)
    768 {
    769     ASSERT(!RunLoop::isMain());
    770 
    771     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     764void ResourceLoadStatisticsMemoryStore::setGrandfathered(const RegistrableDomain& domain, bool value)
     765{
     766    ASSERT(!RunLoop::isMain());
     767
     768    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    772769    statistics.grandfathered = value;
    773770}
    774771
    775 bool ResourceLoadStatisticsMemoryStore::isGrandfathered(const String& primaryDomain) const
    776 {
    777     ASSERT(!RunLoop::isMain());
    778 
    779     auto mapEntry = m_resourceStatisticsMap.find(primaryDomain);
     772bool ResourceLoadStatisticsMemoryStore::isGrandfathered(const RegistrableDomain& domain) const
     773{
     774    ASSERT(!RunLoop::isMain());
     775
     776    auto mapEntry = m_resourceStatisticsMap.find(domain);
    780777    return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.grandfathered;
    781778}
    782779
    783 void ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin(const String& primarySubFrameDomain, const String& primaryTopFrameDomain)
    784 {
    785     ASSERT(!RunLoop::isMain());
    786 
    787     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubFrameDomain);
    788     statistics.subframeUnderTopFrameOrigins.add(primaryTopFrameDomain);
     780void ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain)
     781{
     782    ASSERT(!RunLoop::isMain());
     783
     784    auto& statistics = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
     785    statistics.subframeUnderTopFrameOrigins.add(topFrameDomain.string());
    789786    // For consistency, make sure we also have a statistics entry for the top frame domain.
    790     ensureResourceStatisticsForPrimaryDomain(primaryTopFrameDomain);
    791 }
    792 
    793 void ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin(const String& primarySubresourceDomain, const String& primaryTopFrameDomain)
    794 {
    795     ASSERT(!RunLoop::isMain());
    796 
    797     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain);
    798     statistics.subresourceUnderTopFrameOrigins.add(primaryTopFrameDomain);
     787    ensureResourceStatisticsForRegistrableDomain(topFrameDomain);
     788}
     789
     790void ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin(const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain)
     791{
     792    ASSERT(!RunLoop::isMain());
     793
     794    auto& statistics = ensureResourceStatisticsForRegistrableDomain(subresourceDomain);
     795    statistics.subresourceUnderTopFrameOrigins.add(topFrameDomain.string());
    799796    // For consistency, make sure we also have a statistics entry for the top frame domain.
    800     ensureResourceStatisticsForPrimaryDomain(primaryTopFrameDomain);
    801 }
    802 
    803 void ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo(const String& primarySubresourceDomain, const String& primaryRedirectDomain)
    804 {
    805     ASSERT(!RunLoop::isMain());
    806 
    807     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain);
    808     statistics.subresourceUniqueRedirectsTo.add(primaryRedirectDomain);
     797    ensureResourceStatisticsForRegistrableDomain(topFrameDomain);
     798}
     799
     800void ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo(const RegistrableDomain& subresourceDomain, const RegistrableDomain& redirectDomain)
     801{
     802    ASSERT(!RunLoop::isMain());
     803
     804    auto& statistics = ensureResourceStatisticsForRegistrableDomain(subresourceDomain);
     805    statistics.subresourceUniqueRedirectsTo.add(redirectDomain.string());
    809806    // For consistency, make sure we also have a statistics entry for the redirect domain.
    810     ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain);
    811 }
    812 
    813 void ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom(const String& primarySubresourceDomain, const String& primaryRedirectDomain)
    814 {
    815     ASSERT(!RunLoop::isMain());
    816 
    817     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain);
    818     statistics.subresourceUniqueRedirectsFrom.add(primaryRedirectDomain);
     807    ensureResourceStatisticsForRegistrableDomain(redirectDomain);
     808}
     809
     810void ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom(const RegistrableDomain& subresourceDomain, const RegistrableDomain& redirectDomain)
     811{
     812    ASSERT(!RunLoop::isMain());
     813
     814    auto& statistics = ensureResourceStatisticsForRegistrableDomain(subresourceDomain);
     815    statistics.subresourceUniqueRedirectsFrom.add(redirectDomain.string());
    819816    // For consistency, make sure we also have a statistics entry for the redirect domain.
    820     ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain);
    821 }
    822 
    823 void ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo(const String& topFramePrimaryDomain, const String& primaryRedirectDomain)
    824 {
    825     ASSERT(!RunLoop::isMain());
    826 
    827     auto& statistics = ensureResourceStatisticsForPrimaryDomain(topFramePrimaryDomain);
    828     statistics.topFrameUniqueRedirectsTo.add(primaryRedirectDomain);
     817    ensureResourceStatisticsForRegistrableDomain(redirectDomain);
     818}
     819
     820void ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo(const RegistrableDomain& topFrameDomain, const RegistrableDomain& redirectDomain)
     821{
     822    ASSERT(!RunLoop::isMain());
     823
     824    auto& statistics = ensureResourceStatisticsForRegistrableDomain(topFrameDomain);
     825    statistics.topFrameUniqueRedirectsTo.add(redirectDomain.string());
    829826    // For consistency, make sure we also have a statistics entry for the redirect domain.
    830     ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain);
    831 }
    832 
    833 void ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom(const String& topFramePrimaryDomain, const String& primaryRedirectDomain)
    834 {
    835     ASSERT(!RunLoop::isMain());
    836 
    837     auto& statistics = ensureResourceStatisticsForPrimaryDomain(topFramePrimaryDomain);
    838     statistics.topFrameUniqueRedirectsFrom.add(primaryRedirectDomain);
     827    ensureResourceStatisticsForRegistrableDomain(redirectDomain);
     828}
     829
     830void ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom(const RegistrableDomain& topFrameDomain, const RegistrableDomain& redirectDomain)
     831{
     832    ASSERT(!RunLoop::isMain());
     833
     834    auto& statistics = ensureResourceStatisticsForRegistrableDomain(topFrameDomain);
     835    statistics.topFrameUniqueRedirectsFrom.add(redirectDomain.string());
    839836    // For consistency, make sure we also have a statistics entry for the redirect domain.
    840     ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain);
     837    ensureResourceStatisticsForRegistrableDomain(redirectDomain);
    841838}
    842839
     
    930927}
    931928
    932 ResourceLoadStatistics& ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain(const String& primaryDomain)
    933 {
    934     ASSERT(!RunLoop::isMain());
    935 
    936     return m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] {
    937         return ResourceLoadStatistics(primaryDomain);
     929ResourceLoadStatistics& ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain& domain)
     930{
     931    ASSERT(!RunLoop::isMain());
     932
     933    return m_resourceStatisticsMap.ensure(domain, [&domain] {
     934        return ResourceLoadStatistics(domain);
    938935    }).iterator->value;
    939936}
     
    10341031
    10351032    for (auto& statistic : statistics) {
    1036         auto result = m_resourceStatisticsMap.ensure(statistic.highLevelDomain, [&statistic] {
     1033        auto result = m_resourceStatisticsMap.ensure(statistic.registrableDomain, [&statistic] {
    10371034            return WTFMove(statistic);
    10381035        });
     
    10551052}
    10561053
    1057 bool ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const String& firstPartyPrimaryDomain)
    1058 {
    1059     return statistic.storageAccessUnderTopFrameOrigins.contains(firstPartyPrimaryDomain);
    1060 }
    1061 
    1062 static void debugLogDomainsInBatches(const char* action, const Vector<String>& domains)
     1054bool ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const RegistrableDomain& firstPartyDomain)
     1055{
     1056    return statistic.storageAccessUnderTopFrameOrigins.contains(firstPartyDomain.string());
     1057}
     1058
     1059static void debugLogDomainsInBatches(const char* action, const Vector<RegistrableDomain>& domains)
    10631060{
    10641061#if !RELEASE_LOG_DISABLED
     
    10721069    }
    10731070   
    1074     Vector<String> batch;
     1071    Vector<RegistrableDomain> batch;
    10751072    batch.reserveInitialCapacity(maxNumberOfDomainsInOneLogStatement);
    10761073    auto batchNumber = 1;
     
    10971094    ASSERT(!RunLoop::isMain());
    10981095
    1099     Vector<String> domainsToBlock;
     1096    Vector<RegistrableDomain> domainsToBlock;
    11001097    for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
    11011098        if (resourceStatistic.isPrevalentResource)
    1102             domainsToBlock.append(resourceStatistic.highLevelDomain);
     1099            domainsToBlock.append(resourceStatistic.registrableDomain);
    11031100    }
    11041101
     
    11251122}
    11261123
    1127 void ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains(const Vector<String>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
     1124void ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains(const Vector<RegistrableDomain>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
    11281125{
    11291126    ASSERT(!RunLoop::isMain());
     
    11381135}
    11391136
    1140 void ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler)
     1137void ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains(const Vector<RegistrableDomain>& domains, CompletionHandler<void()>&& completionHandler)
    11411138{
    11421139    ASSERT(!RunLoop::isMain());
     
    11781175}
    11791176
    1180 Vector<String> ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor()
     1177Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor()
    11811178{
    11821179    ASSERT(!RunLoop::isMain());
     
    11881185        m_endOfGrandfatheringTimestamp = { };
    11891186
    1190     Vector<String> prevalentResources;
     1187    Vector<RegistrableDomain> prevalentResources;
    11911188    for (auto& statistic : m_resourceStatisticsMap.values()) {
    11921189        if (statistic.isPrevalentResource && !hasHadUnexpiredRecentUserInteraction(statistic) && (!shouldCheckForGrandfathering || !statistic.grandfathered))
    1193             prevalentResources.append(statistic.highLevelDomain);
     1190            prevalentResources.append(statistic.registrableDomain);
    11941191
    11951192        if (shouldClearGrandfathering && statistic.grandfathered)
     
    12601257    Vector<StatisticsLastSeen> resourcesToPrunePerImportance[maxImportance + 1];
    12611258    for (auto& resourceStatistic : m_resourceStatisticsMap.values())
    1262         resourcesToPrunePerImportance[computeImportance(resourceStatistic)].append({ resourceStatistic.highLevelDomain, resourceStatistic.lastSeen });
     1259        resourcesToPrunePerImportance[computeImportance(resourceStatistic)].append({ resourceStatistic.registrableDomain, resourceStatistic.lastSeen });
    12631260
    12641261    for (unsigned importance = 0; numberOfEntriesLeftToPrune && importance <= maxImportance; ++importance)
     
    12841281}
    12851282
    1286 void ResourceLoadStatisticsMemoryStore::setLastSeen(const String& primaryDomain, Seconds seconds)
    1287 {
    1288     ASSERT(!RunLoop::isMain());
    1289 
    1290     auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     1283void ResourceLoadStatisticsMemoryStore::setLastSeen(const RegistrableDomain& domain, Seconds seconds)
     1284{
     1285    ASSERT(!RunLoop::isMain());
     1286
     1287    auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain);
    12911288    statistics.lastSeen = WallTime::fromRawSeconds(seconds.seconds());
    12921289}
    12931290
    1294 void ResourceLoadStatisticsMemoryStore::setPrevalentResource(const String& primaryDomain)
    1295 {
    1296     ASSERT(!RunLoop::isMain());
    1297 
    1298     auto& resourceStatistic = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     1291void ResourceLoadStatisticsMemoryStore::setPrevalentResource(const RegistrableDomain& domain)
     1292{
     1293    ASSERT(!RunLoop::isMain());
     1294
     1295    auto& resourceStatistic = ensureResourceStatisticsForRegistrableDomain(domain);
    12991296    setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
    13001297}
    13011298
    1302 void ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource(const String& primaryDomain)
    1303 {
    1304     ASSERT(!RunLoop::isMain());
    1305 
    1306     auto& resourceStatistic = ensureResourceStatisticsForPrimaryDomain(primaryDomain);
     1299void ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource(const RegistrableDomain& domain)
     1300{
     1301    ASSERT(!RunLoop::isMain());
     1302
     1303    auto& resourceStatistic = ensureResourceStatisticsForRegistrableDomain(domain);
    13071304    setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::VeryHigh);
    13081305}
  • trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h

    r240498 r242056  
    5353class ResourceLoadStatisticsMemoryStore : public CanMakeWeakPtr<ResourceLoadStatisticsMemoryStore> {
    5454public:
     55    using ResourceLoadStatistics = WebCore::ResourceLoadStatistics;
     56    using RegistrableDomain = WebCore::RegistrableDomain;
     57    using TopFrameDomain = WebCore::RegistrableDomain;
     58    using SubFrameDomain = WebCore::RegistrableDomain;
     59    using SubResourceDomain = WebCore::RegistrableDomain;
     60    using RedirectDomain = WebCore::RegistrableDomain;
     61    using RedirectedFromDomain = WebCore::RegistrableDomain;
     62    using RedirectedToDomain = WebCore::RegistrableDomain;
     63    using NavigatedFromDomain = WebCore::RegistrableDomain;
     64    using NavigatedToDomain = WebCore::RegistrableDomain;
     65    using DomainInNeedOfStorageAccess = WebCore::RegistrableDomain;
     66    using OpenerDomain = WebCore::RegistrableDomain;
     67    using OpenerPageID = uint64_t;
     68    using PageID = uint64_t;
     69    using FrameID = uint64_t;
     70
    5571    ResourceLoadStatisticsMemoryStore(WebResourceLoadStatisticsStore&, WorkQueue&);
    5672    ~ResourceLoadStatisticsMemoryStore();
     
    6480    void mergeWithDataFromDecoder(WebCore::KeyedDecoder&);
    6581
    66     void mergeStatistics(Vector<WebCore::ResourceLoadStatistics>&&);
    67     void processStatistics(const Function<void(const WebCore::ResourceLoadStatistics&)>&) const;
     82    void mergeStatistics(Vector<ResourceLoadStatistics>&&);
     83    void processStatistics(const Function<void(const ResourceLoadStatistics&)>&) const;
    6884
    6985    void updateCookieBlocking(CompletionHandler<void()>&&);
    70     void updateCookieBlockingForDomains(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
    71     void clearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&);
     86    void updateCookieBlockingForDomains(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&);
     87    void clearBlockingStateForDomains(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&);
    7288
    7389    void includeTodayAsOperatingDateIfNecessary();
    7490    void processStatisticsAndDataRecords();
    7591
    76     void requestStorageAccessUnderOpener(String&& primaryDomainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerPrimaryDomain);
     92    void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, OpenerPageID, OpenerDomain&&);
    7793    void removeAllStorageAccess(CompletionHandler<void()>&&);
    7894
     
    8096    void cancelPendingStatisticsProcessingRequest();
    8197
    82     bool isRegisteredAsSubresourceUnder(const String& subresourcePrimaryDomain, const String& topFramePrimaryDomain) const;
    83     bool isRegisteredAsSubFrameUnder(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain) const;
    84     bool isRegisteredAsRedirectingTo(const String& hostRedirectedFromPrimaryDomain, const String& hostRedirectedToPrimaryDomain) const;
    85 
    86     void clearPrevalentResource(const String& primaryDomain);
     98    bool isRegisteredAsSubresourceUnder(const SubResourceDomain&, const TopFrameDomain&) const;
     99    bool isRegisteredAsSubFrameUnder(const SubFrameDomain&, const TopFrameDomain&) const;
     100    bool isRegisteredAsRedirectingTo(const RedirectedFromDomain&, const RedirectedToDomain&) const;
     101
     102    void clearPrevalentResource(const RegistrableDomain&);
    87103    String dumpResourceLoadStatistics() const;
    88     bool isPrevalentResource(const String& primaryDomain) const;
    89     bool isVeryPrevalentResource(const String& primaryDomain) const;
    90     void setPrevalentResource(const String& primaryDomain);
    91     void setVeryPrevalentResource(const String& primaryDomain);
    92 
    93     void setGrandfathered(const String& primaryDomain, bool value);
    94     bool isGrandfathered(const String& primaryDomain) const;
    95 
    96     void setSubframeUnderTopFrameOrigin(const String& primarySubFrameDomain, const String& primaryTopFrameDomain);
    97     void setSubresourceUnderTopFrameOrigin(const String& primarySubresourceDomain, const String& primaryTopFrameDomain);
    98     void setSubresourceUniqueRedirectTo(const String& primarySubresourceDomain, const String& primaryRedirectDomain);
    99     void setSubresourceUniqueRedirectFrom(const String& primarySubresourceDomain, const String& primaryRedirectDomain);
    100     void setTopFrameUniqueRedirectTo(const String& topFramePrimaryDomain, const String& primaryRedirectDomain);
    101     void setTopFrameUniqueRedirectFrom(const String& topFramePrimaryDomain, const String& primaryRedirectDomain);
     104    bool isPrevalentResource(const RegistrableDomain&) const;
     105    bool isVeryPrevalentResource(const RegistrableDomain&) const;
     106    void setPrevalentResource(const RegistrableDomain&);
     107    void setVeryPrevalentResource(const RegistrableDomain&);
     108
     109    void setGrandfathered(const RegistrableDomain&, bool value);
     110    bool isGrandfathered(const RegistrableDomain&) const;
     111
     112    void setSubframeUnderTopFrameOrigin(const SubFrameDomain&, const TopFrameDomain&);
     113    void setSubresourceUnderTopFrameOrigin(const SubResourceDomain&, const TopFrameDomain&);
     114    void setSubresourceUniqueRedirectTo(const SubResourceDomain&, const RedirectDomain&);
     115    void setSubresourceUniqueRedirectFrom(const SubResourceDomain&, const RedirectDomain&);
     116    void setTopFrameUniqueRedirectTo(const TopFrameDomain&, const RedirectDomain&);
     117    void setTopFrameUniqueRedirectFrom(const TopFrameDomain&, const RedirectDomain&);
    102118
    103119    void logTestingEvent(const String&);
     
    117133    void setResourceLoadStatisticsDebugMode(bool);
    118134    bool isDebugModeEnabled() const { return m_debugModeEnabled; };
    119     void setPrevalentResourceForDebugMode(const String& domain);
    120 
    121     void hasStorageAccess(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
    122     void requestStorageAccess(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
    123     void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
    124 
    125     void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame);
    126     void logUserInteraction(const String& primaryDomain);
    127     void logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
    128     void logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain);
    129 
    130     void clearUserInteraction(const String& primaryDomain);
    131     bool hasHadUserInteraction(const String& primaryDomain);
    132 
    133     void setLastSeen(const String& primaryDomain, Seconds);
     135    void setPrevalentResourceForDebugMode(const RegistrableDomain&);
     136
     137    void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&);
     138    void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
     139    void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
     140
     141    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame);
     142    void logUserInteraction(const TopFrameDomain&);
     143    void logSubresourceLoading(const SubResourceDomain&, const TopFrameDomain&, WallTime lastSeen);
     144    void logSubresourceRedirect(const RedirectedFromDomain&, const RedirectedToDomain&);
     145
     146    void clearUserInteraction(const RegistrableDomain&);
     147    bool hasHadUserInteraction(const RegistrableDomain&);
     148
     149    void setLastSeen(const RegistrableDomain&, Seconds);
    134150
    135151    void didCreateNetworkProcess();
     
    138154
    139155private:
    140     static bool shouldBlockAndKeepCookies(const WebCore::ResourceLoadStatistics&);
    141     static bool shouldBlockAndPurgeCookies(const WebCore::ResourceLoadStatistics&);
    142     static bool hasUserGrantedStorageAccessThroughPrompt(const WebCore::ResourceLoadStatistics&, const String& firstPartyPrimaryDomain);
    143     bool hasHadUnexpiredRecentUserInteraction(WebCore::ResourceLoadStatistics&) const;
    144     bool hasStatisticsExpired(const WebCore::ResourceLoadStatistics&) const;
    145     bool wasAccessedAsFirstPartyDueToUserInteraction(const WebCore::ResourceLoadStatistics& current, const WebCore::ResourceLoadStatistics& updated) const;
    146     void setPrevalentResource(WebCore::ResourceLoadStatistics&, ResourceLoadPrevalence);
    147     unsigned recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const WebCore::ResourceLoadStatistics&, HashSet<String>& domainsThatHaveRedirectedTo, unsigned numberOfRecursiveCalls) const;
     156    static bool shouldBlockAndKeepCookies(const ResourceLoadStatistics&);
     157    static bool shouldBlockAndPurgeCookies(const ResourceLoadStatistics&);
     158    static bool hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&);
     159    bool hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics&) const;
     160    bool hasStatisticsExpired(const ResourceLoadStatistics&) const;
     161    bool wasAccessedAsFirstPartyDueToUserInteraction(const ResourceLoadStatistics& current, const ResourceLoadStatistics& updated) const;
     162    void setPrevalentResource(ResourceLoadStatistics&, ResourceLoadPrevalence);
     163    unsigned recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const ResourceLoadStatistics&, HashSet<RedirectedToDomain>&, unsigned numberOfRecursiveCalls) const;
    148164    void setStorageAccessPromptsEnabled(bool enabled) { m_storageAccessPromptsEnabled  = enabled; }
    149165    bool shouldRemoveDataRecords() const;
     
    151167    void setDataRecordsBeingRemoved(bool);
    152168    void scheduleStatisticsProcessingRequestIfNecessary();
    153     void grantStorageAccessInternal(String&& subFrameHost, String&& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&);
    154     void markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics&);
    155     bool isPrevalentDueToDebugMode(WebCore::ResourceLoadStatistics&);
    156     Vector<String> ensurePrevalentResourcesForDebugMode();
     169    void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&);
     170    void markAsPrevalentIfHasRedirectedToPrevalent(ResourceLoadStatistics&);
     171    bool isPrevalentDueToDebugMode(ResourceLoadStatistics&);
     172    Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode();
    157173    void removeDataRecords(CompletionHandler<void()>&&);
    158174    void pruneStatisticsIfNeeded();
    159     WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
    160     Vector<String> topPrivatelyControlledDomainsToRemoveWebsiteDataFor();
     175    ResourceLoadStatistics& ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain&);
     176    Vector<RegistrableDomain> registrableDomainsToRemoveWebsiteDataFor();
    161177    void setCacheMaxAgeCap(Seconds);
    162178    void updateCacheMaxAgeCap();
     
    184200    Ref<WorkQueue> m_workQueue;
    185201    WeakPtr<ResourceLoadStatisticsPersistentStorage> m_persistentStorage;
    186     HashMap<String, WebCore::ResourceLoadStatistics> m_resourceStatisticsMap;
     202    HashMap<RegistrableDomain, ResourceLoadStatistics> m_resourceStatisticsMap;
    187203#if HAVE(CORE_PREDICTION)
    188204    ResourceLoadStatisticsClassifierCocoa m_resourceLoadStatisticsClassifier;
     
    198214    bool m_debugLoggingEnabled { false };
    199215    bool m_debugModeEnabled { false };
    200     String m_debugManualPrevalentResource;
     216    const RegistrableDomain m_debugStaticPrevalentResource { "3rdpartytestwebkit.org"_s };
     217    RegistrableDomain m_debugManualPrevalentResource;
    201218    bool m_storageAccessPromptsEnabled { false };
    202219    bool m_dataRecordsBeingRemoved { false };
  • trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp

    r241924 r242056  
    5757using namespace WebCore;
    5858
    59 template<typename T> static inline String isolatedPrimaryDomain(const T& value)
    60 {
    61     return ResourceLoadStatistics::primaryDomain(value).isolatedCopy();
    62 }
    63 
    6459const OptionSet<WebsiteDataType>& WebResourceLoadStatisticsStore::monitoredDataTypes()
    6560{
     
    209204}
    210205
    211 void WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode(const String& primaryDomain, CompletionHandler<void()>&& completionHandler)
    212 {
    213     ASSERT(RunLoop::isMain());
    214    
    215     postTask([this, primaryDomain = isolatedPrimaryDomain(primaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    216         if (m_memoryStore)
    217             m_memoryStore->setPrevalentResourceForDebugMode(primaryDomain);
     206void WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     207{
     208    ASSERT(RunLoop::isMain());
     209   
     210    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     211        if (m_memoryStore)
     212            m_memoryStore->setPrevalentResourceForDebugMode(domain);
    218213        postTaskReply(WTFMove(completionHandler));
    219214    });
     
    258253}
    259254
    260 void WebResourceLoadStatisticsStore::hasStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    261 {
    262     ASSERT(subFrameHost != topFrameHost);
    263     ASSERT(RunLoop::isMain());
    264 
    265     postTask([this, subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable {
     255void WebResourceLoadStatisticsStore::hasStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     256{
     257    ASSERT(subFrameDomain != topFrameDomain);
     258    ASSERT(RunLoop::isMain());
     259
     260    postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable {
    266261        if (!m_memoryStore) {
    267262            postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable {
     
    270265            return;
    271266        }
    272         m_memoryStore->hasStorageAccess(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler)](bool hasStorageAccess) mutable {
     267        m_memoryStore->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler)](bool hasStorageAccess) mutable {
    273268            postTaskReply([completionHandler = WTFMove(completionHandler), hasStorageAccess]() mutable {
    274269                completionHandler(hasStorageAccess);
     
    278273}
    279274
    280 bool WebResourceLoadStatisticsStore::hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID)
     275bool WebResourceLoadStatisticsStore::hasStorageAccessForFrame(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, uint64_t frameID, uint64_t pageID)
    281276{
    282277    return m_networkSession ? m_networkSession->networkStorageSession().hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID) : false;
    283278}
    284279
    285 void WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&& callback)
     280void WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&& callback)
    286281{
    287282    ASSERT(RunLoop::isMain());
     
    295290}
    296291
    297 void WebResourceLoadStatisticsStore::requestStorageAccessGranted(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
    298 {
    299     auto statusHandler = [this, protectedThis = makeRef(*this), subFrameHost = isolatedPrimaryDomain(subFrameHost), topFrameHost = isolatedPrimaryDomain(topFrameHost), promptEnabled, frameID, pageID, completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {
     292void WebResourceLoadStatisticsStore::requestStorageAccessGranted(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
     293{
     294    auto statusHandler = [this, protectedThis = makeRef(*this), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), promptEnabled, frameID, pageID, completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {
    300295        switch (status) {
    301296        case StorageAccessStatus::CannotRequestAccess:
     
    305300            {
    306301            ASSERT_UNUSED(promptEnabled, promptEnabled);
    307             auto subFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(subFrameHost);
    308             auto topFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(topFrameHost);
    309             CompletionHandler<void(bool)> requestConfirmationCompletionHandler = [this, protectedThis = protectedThis.copyRef(), subFrameHost = WTFMove(subFrameHost), topFrameHost = WTFMove(topFrameHost), frameID, pageID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable {
     302            CompletionHandler<void(bool)> requestConfirmationCompletionHandler = [this, protectedThis = protectedThis.copyRef(), subFrameDomain, topFrameDomain, frameID, pageID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable {
    310303                if (userDidGrantAccess)
    311                     grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userDidGrantAccess, WTFMove(completionHandler));
     304                    grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, userDidGrantAccess, WTFMove(completionHandler));
    312305                else
    313306                    completionHandler(false);
    314307            };
    315             m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::RequestStorageAccessConfirm(pageID, frameID, subFramePrimaryDomain, topFramePrimaryDomain), WTFMove(requestConfirmationCompletionHandler));
     308            m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::RequestStorageAccessConfirm(pageID, frameID, subFrameDomain.string(), topFrameDomain.string()), WTFMove(requestConfirmationCompletionHandler));
    316309            }
    317310            return;
     
    322315    };
    323316
    324     requestStorageAccess(subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(statusHandler));
    325 }
    326 
    327 void WebResourceLoadStatisticsStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
    328 {
    329     auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost);
    330     auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost);
    331     if (subFramePrimaryDomain == topFramePrimaryDomain) {
     317    requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, promptEnabled, WTFMove(statusHandler));
     318}
     319
     320void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
     321{
     322    if (subFrameDomain == topFrameDomain) {
    332323        completionHandler(StorageAccessStatus::HasAccess);
    333324        return;
    334325    }
    335326
    336     postTask([this, subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, promptEnabled, completionHandler = WTFMove(completionHandler)]() mutable {
     327    postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, promptEnabled, completionHandler = WTFMove(completionHandler)]() mutable {
    337328        if (!m_memoryStore) {
    338329            postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable {
     
    342333        }
    343334
    344         m_memoryStore->requestStorageAccess(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID.value(), pageID, promptEnabled, [completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {
     335        m_memoryStore->requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID.value(), pageID, promptEnabled, [completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {
    345336            postTaskReply([completionHandler = WTFMove(completionHandler), status]() mutable {
    346337                completionHandler(status);
     
    350341}
    351342
    352 void WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener(String&& primaryDomainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerPrimaryDomain)
     343void WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener(RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, RegistrableDomain&& openerDomain)
    353344{
    354345    ASSERT(RunLoop::isMain());
     
    357348    // coming from IPC. Strings which are safe to move to other threads as long as nobody on this thread holds a reference
    358349    // to those strings.
    359     postTask([this, primaryDomainInNeedOfStorageAccess = WTFMove(primaryDomainInNeedOfStorageAccess), openerPageID, openerPrimaryDomain = WTFMove(openerPrimaryDomain)]() mutable {
    360         if (m_memoryStore)
    361             m_memoryStore->requestStorageAccessUnderOpener(WTFMove(primaryDomainInNeedOfStorageAccess), openerPageID, WTFMove(openerPrimaryDomain));
    362     });
    363 }
    364 
    365 void WebResourceLoadStatisticsStore::grantStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)
    366 {
    367     ASSERT(RunLoop::isMain());
    368     postTask([this, subFrameHost = crossThreadCopy(subFrameHost), topFrameHost = crossThreadCopy(topFrameHost), frameID, pageID, userWasPromptedNow, completionHandler = WTFMove(completionHandler)]() mutable {
     350    postTask([this, domainInNeedOfStorageAccess = WTFMove(domainInNeedOfStorageAccess), openerPageID, openerDomain = WTFMove(openerDomain)]() mutable {
     351        if (m_memoryStore)
     352            m_memoryStore->requestStorageAccessUnderOpener(WTFMove(domainInNeedOfStorageAccess), openerPageID, WTFMove(openerDomain));
     353    });
     354}
     355
     356void WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)
     357{
     358    ASSERT(RunLoop::isMain());
     359    postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, userWasPromptedNow, completionHandler = WTFMove(completionHandler)]() mutable {
    369360        if (!m_memoryStore) {
    370361            postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable {
     
    374365        }
    375366
    376         m_memoryStore->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPromptedNow, [completionHandler = WTFMove(completionHandler)](bool wasGrantedAccess) mutable {
     367        m_memoryStore->grantStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, [completionHandler = WTFMove(completionHandler)](bool wasGrantedAccess) mutable {
    377368            postTaskReply([completionHandler = WTFMove(completionHandler), wasGrantedAccess]() mutable {
    378369                completionHandler(wasGrantedAccess);
     
    382373}
    383374
    384 bool WebResourceLoadStatisticsStore::grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID)
     375bool WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID)
    385376{
    386377    bool isStorageGranted = false;
     
    395386}
    396387
    397 void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback)
    398 {
    399     ASSERT(RunLoop::isMain());
    400 
    401     callback(grantStorageAccess(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID));
     388void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback)
     389{
     390    ASSERT(RunLoop::isMain());
     391
     392    callback(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID));
    402393}
    403394
     
    476467        return;
    477468
    478     auto targetPrimaryDomain = ResourceLoadStatistics::primaryDomain(targetURL);
    479     auto mainFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(pageURL);
    480     auto sourcePrimaryDomain = ResourceLoadStatistics::primaryDomain(sourceURL);
    481 
    482     logFrameNavigation(targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost.toString(), mainFrameHost.toString(), isRedirect, frame.isMainFrame());
    483 }
    484 
    485 void WebResourceLoadStatisticsStore::logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame)
    486 {
    487     postTask([this, targetPrimaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), mainFramePrimaryDomain = isolatedPrimaryDomain(mainFramePrimaryDomain), sourcePrimaryDomain = isolatedPrimaryDomain(sourcePrimaryDomain), targetHost = isolatedPrimaryDomain(targetHost), mainFrameHost = isolatedPrimaryDomain(mainFrameHost), isRedirect, isMainFrame] {
    488        
    489         if (m_memoryStore)
    490             m_memoryStore->logFrameNavigation(targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost, mainFrameHost, isRedirect, isMainFrame);
    491     });
    492 }
    493 
    494 void WebResourceLoadStatisticsStore::logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler)
    495 {
    496     postTask([this, targetPrimaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), mainFramePrimaryDomain = isolatedPrimaryDomain(mainFramePrimaryDomain), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable {
    497         if (m_memoryStore)
    498             m_memoryStore->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen);
    499 
    500         postTaskReply(WTFMove(completionHandler));
    501     });
    502 }
    503 
    504 void WebResourceLoadStatisticsStore::logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler)
    505 {
    506     postTask([this, targetPrimaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), mainFramePrimaryDomain = isolatedPrimaryDomain(mainFramePrimaryDomain), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable {
    507         if (m_memoryStore)
    508             m_memoryStore->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen);
    509        
    510         postTaskReply(WTFMove(completionHandler));
    511     });
    512 }
    513 
    514 void WebResourceLoadStatisticsStore::logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler)
    515 {
    516     postTask([this, sourcePrimaryDomain = isolatedPrimaryDomain(sourcePrimaryDomain), targetPrimaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    517         if (m_memoryStore)
    518             m_memoryStore->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain);
    519        
    520         postTaskReply(WTFMove(completionHandler));
    521     });
    522 }
    523 
    524 void WebResourceLoadStatisticsStore::logUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler)
    525 {
    526     ASSERT(RunLoop::isMain());
    527 
    528     postTask([this, primaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    529         if (m_memoryStore)
    530             m_memoryStore->logUserInteraction(primaryDomain);
    531         postTaskReply(WTFMove(completionHandler));
    532     });
    533 }
    534 
    535 void WebResourceLoadStatisticsStore::clearUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler)
    536 {
    537     ASSERT(RunLoop::isMain());
    538    
    539     postTask([this, primaryDomain = isolatedPrimaryDomain(targetPrimaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    540         if (m_memoryStore)
    541             m_memoryStore->clearUserInteraction(primaryDomain);
    542         postTaskReply(WTFMove(completionHandler));
    543     });
    544 }
    545 
    546 void WebResourceLoadStatisticsStore::hasHadUserInteraction(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler)
    547 {
    548     postTask([this, primaryDomain = isolatedPrimaryDomain(primaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    549         bool hadUserInteraction = m_memoryStore ? m_memoryStore->hasHadUserInteraction(primaryDomain) : false;
     469    RegistrableDomain targetDomain { targetURL };
     470    RegistrableDomain topFrameDomain { pageURL };
     471    RegistrableDomain sourceDomain { sourceURL };
     472
     473    logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, frame.isMainFrame());
     474}
     475
     476void WebResourceLoadStatisticsStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
     477{
     478    postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), sourceDomain = sourceDomain.isolatedCopy(), isRedirect, isMainFrame] {
     479
     480        if (m_memoryStore)
     481            m_memoryStore->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame);
     482    });
     483}
     484
     485void WebResourceLoadStatisticsStore::logWebSocketLoading(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler)
     486{
     487    postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable {
     488        if (m_memoryStore)
     489            m_memoryStore->logSubresourceLoading(targetDomain, topFrameDomain, lastSeen);
     490
     491        postTaskReply(WTFMove(completionHandler));
     492    });
     493}
     494
     495void WebResourceLoadStatisticsStore::logSubresourceLoading(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler)
     496{
     497    postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable {
     498        if (m_memoryStore)
     499            m_memoryStore->logSubresourceLoading(targetDomain, topFrameDomain, lastSeen);
     500
     501        postTaskReply(WTFMove(completionHandler));
     502    });
     503}
     504
     505void WebResourceLoadStatisticsStore::logSubresourceRedirect(const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain, CompletionHandler<void()>&& completionHandler)
     506{
     507    postTask([this, sourceDomain = sourceDomain.isolatedCopy(), targetDomain = targetDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     508        if (m_memoryStore)
     509            m_memoryStore->logSubresourceRedirect(sourceDomain, targetDomain);
     510
     511        postTaskReply(WTFMove(completionHandler));
     512    });
     513}
     514
     515void WebResourceLoadStatisticsStore::logUserInteraction(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     516{
     517    ASSERT(RunLoop::isMain());
     518
     519    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     520        if (m_memoryStore)
     521            m_memoryStore->logUserInteraction(domain);
     522        postTaskReply(WTFMove(completionHandler));
     523    });
     524}
     525
     526void WebResourceLoadStatisticsStore::clearUserInteraction(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     527{
     528    ASSERT(RunLoop::isMain());
     529   
     530    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     531        if (m_memoryStore)
     532            m_memoryStore->clearUserInteraction(domain);
     533        postTaskReply(WTFMove(completionHandler));
     534    });
     535}
     536
     537void WebResourceLoadStatisticsStore::hasHadUserInteraction(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     538{
     539    postTask([this, domain, completionHandler = WTFMove(completionHandler)]() mutable {
     540        bool hadUserInteraction = m_memoryStore ? m_memoryStore->hasHadUserInteraction(domain) : false;
    550541        postTaskReply([hadUserInteraction, completionHandler = WTFMove(completionHandler)]() mutable {
    551542            completionHandler(hadUserInteraction);
     
    554545}
    555546
    556 void WebResourceLoadStatisticsStore::setLastSeen(const String& resourceDomain, Seconds seconds, CompletionHandler<void()>&& completionHandler)
    557 {
    558     ASSERT(RunLoop::isMain());
    559    
    560     postTask([this, resourceDomain = isolatedPrimaryDomain(resourceDomain), seconds, completionHandler = WTFMove(completionHandler)]() mutable {
    561         if (m_memoryStore)
    562             m_memoryStore->setLastSeen(resourceDomain, seconds);
    563         postTaskReply(WTFMove(completionHandler));
    564     });
    565 }
    566    
    567 void WebResourceLoadStatisticsStore::setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    568 {
    569     ASSERT(RunLoop::isMain());
    570 
    571     postTask([this, resourceDomain = isolatedPrimaryDomain(resourceDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    572         if (m_memoryStore)
    573             m_memoryStore->setPrevalentResource(resourceDomain);
    574         postTaskReply(WTFMove(completionHandler));
    575     });
    576 }
    577 
    578 void WebResourceLoadStatisticsStore::setVeryPrevalentResource(const String& primaryDomain, CompletionHandler<void()>&& completionHandler)
    579 {
    580     ASSERT(RunLoop::isMain());
    581 
    582     postTask([this, primaryDomain = isolatedPrimaryDomain(primaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    583         if (m_memoryStore)
    584             m_memoryStore->setVeryPrevalentResource(primaryDomain);
     547void WebResourceLoadStatisticsStore::setLastSeen(const RegistrableDomain& domain, Seconds seconds, CompletionHandler<void()>&& completionHandler)
     548{
     549    ASSERT(RunLoop::isMain());
     550   
     551    postTask([this, domain = domain.isolatedCopy(), seconds, completionHandler = WTFMove(completionHandler)]() mutable {
     552        if (m_memoryStore)
     553            m_memoryStore->setLastSeen(domain, seconds);
     554        postTaskReply(WTFMove(completionHandler));
     555    });
     556}
     557   
     558void WebResourceLoadStatisticsStore::setPrevalentResource(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     559{
     560    ASSERT(RunLoop::isMain());
     561
     562    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     563        if (m_memoryStore)
     564            m_memoryStore->setPrevalentResource(domain);
     565        postTaskReply(WTFMove(completionHandler));
     566    });
     567}
     568
     569void WebResourceLoadStatisticsStore::setVeryPrevalentResource(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     570{
     571    ASSERT(RunLoop::isMain());
     572
     573    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     574        if (m_memoryStore)
     575            m_memoryStore->setVeryPrevalentResource(domain);
    585576        postTaskReply(WTFMove(completionHandler));
    586577    });
     
    599590}
    600591
    601 void WebResourceLoadStatisticsStore::isPrevalentResource(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler)
    602 {
    603     ASSERT(RunLoop::isMain());
    604    
    605     postTask([this, primaryDomain = isolatedPrimaryDomain(primaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    606         bool isPrevalentResource = m_memoryStore ? m_memoryStore->isPrevalentResource(primaryDomain) : false;
     592void WebResourceLoadStatisticsStore::isPrevalentResource(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     593{
     594    ASSERT(RunLoop::isMain());
     595   
     596    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     597        bool isPrevalentResource = m_memoryStore ? m_memoryStore->isPrevalentResource(domain) : false;
    607598        postTaskReply([isPrevalentResource, completionHandler = WTFMove(completionHandler)]() mutable {
    608599            completionHandler(isPrevalentResource);
     
    611602}
    612603   
    613 void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler)
    614 {
    615     ASSERT(RunLoop::isMain());
    616    
    617     postTask([this, primaryDomain = isolatedPrimaryDomain(primaryDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    618         bool isVeryPrevalentResource = m_memoryStore ? m_memoryStore->isVeryPrevalentResource(primaryDomain) : false;
     604void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     605{
     606    ASSERT(RunLoop::isMain());
     607   
     608    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     609        bool isVeryPrevalentResource = m_memoryStore ? m_memoryStore->isVeryPrevalentResource(domain) : false;
    619610        postTaskReply([isVeryPrevalentResource, completionHandler = WTFMove(completionHandler)]() mutable {
    620611            completionHandler(isVeryPrevalentResource);
     
    623614}
    624615
    625 void WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder(const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler)
    626 {
    627     ASSERT(RunLoop::isMain());
    628 
    629     postTask([this, subresourcePrimaryDomain = isolatedPrimaryDomain(subresource), topFramePrimaryDomain = isolatedPrimaryDomain(topFrame), completionHandler = WTFMove(completionHandler)]() mutable {
    630         bool isRegisteredAsSubresourceUnder = m_memoryStore ? m_memoryStore->isRegisteredAsSubresourceUnder(subresourcePrimaryDomain, topFramePrimaryDomain) : false;
     616void WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder(const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler)
     617{
     618    ASSERT(RunLoop::isMain());
     619
     620    postTask([this, subresourceDomain = subresourceDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     621        bool isRegisteredAsSubresourceUnder = m_memoryStore ? m_memoryStore->isRegisteredAsSubresourceUnder(subresourceDomain, topFrameDomain) : false;
    631622        postTaskReply([isRegisteredAsSubresourceUnder, completionHandler = WTFMove(completionHandler)]() mutable {
    632623            completionHandler(isRegisteredAsSubresourceUnder);
     
    635626}
    636627
    637 void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const String& subFrame, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler)
    638 {
    639     ASSERT(RunLoop::isMain());
    640 
    641     postTask([this, subFramePrimaryDomain = isolatedPrimaryDomain(subFrame), topFramePrimaryDomain = isolatedPrimaryDomain(topFrame), completionHandler = WTFMove(completionHandler)]() mutable {
    642         bool isRegisteredAsSubFrameUnder = m_memoryStore ? m_memoryStore->isRegisteredAsSubFrameUnder(subFramePrimaryDomain, topFramePrimaryDomain) : false;
     628void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler)
     629{
     630    ASSERT(RunLoop::isMain());
     631
     632    postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     633        bool isRegisteredAsSubFrameUnder = m_memoryStore ? m_memoryStore->isRegisteredAsSubFrameUnder(subFrameDomain, topFrameDomain) : false;
    643634        postTaskReply([isRegisteredAsSubFrameUnder, completionHandler = WTFMove(completionHandler)]() mutable {
    644635            completionHandler(isRegisteredAsSubFrameUnder);
     
    647638}
    648639
    649 void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const String& hostRedirectedFrom, const String& hostRedirectedTo, CompletionHandler<void(bool)>&& completionHandler)
    650 {
    651     ASSERT(RunLoop::isMain());
    652 
    653     postTask([this, hostRedirectedFromPrimaryDomain = isolatedPrimaryDomain(hostRedirectedFrom), hostRedirectedToPrimaryDomain = isolatedPrimaryDomain(hostRedirectedTo), completionHandler = WTFMove(completionHandler)]() mutable {
    654         bool isRegisteredAsRedirectingTo = m_memoryStore ? m_memoryStore->isRegisteredAsRedirectingTo(hostRedirectedFromPrimaryDomain, hostRedirectedToPrimaryDomain) : false;
     640void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const RegistrableDomain& domainRedirectedFrom, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void(bool)>&& completionHandler)
     641{
     642    ASSERT(RunLoop::isMain());
     643
     644    postTask([this, domainRedirectedFrom = domainRedirectedFrom.isolatedCopy(), domainRedirectedTo = domainRedirectedTo.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     645        bool isRegisteredAsRedirectingTo = m_memoryStore ? m_memoryStore->isRegisteredAsRedirectingTo(domainRedirectedFrom, domainRedirectedTo) : false;
    655646        postTaskReply([isRegisteredAsRedirectingTo, completionHandler = WTFMove(completionHandler)]() mutable {
    656647            completionHandler(isRegisteredAsRedirectingTo);
     
    659650}
    660651
    661 void WebResourceLoadStatisticsStore::clearPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    662 {
    663     ASSERT(RunLoop::isMain());
    664    
    665     postTask([this, resourceDomain = isolatedPrimaryDomain(resourceDomain), completionHandler = WTFMove(completionHandler)]() mutable {
    666         if (m_memoryStore)
    667             m_memoryStore->clearPrevalentResource(resourceDomain);
    668         postTaskReply(WTFMove(completionHandler));
    669     });
    670 }
    671 
    672 void WebResourceLoadStatisticsStore::setGrandfathered(const String& domain, bool value, CompletionHandler<void()>&& completionHandler)
    673 {
    674     ASSERT(RunLoop::isMain());
    675 
    676     postTask([this, primaryDomain = isolatedPrimaryDomain(domain), value, completionHandler = WTFMove(completionHandler)]() mutable {
    677         if (m_memoryStore)
    678             m_memoryStore->setGrandfathered(primaryDomain, value);
    679         postTaskReply(WTFMove(completionHandler));
    680     });
    681 }
    682    
    683 void WebResourceLoadStatisticsStore::isGrandfathered(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler)
    684 {
    685     ASSERT(RunLoop::isMain());
    686 
    687     postTask([this, completionHandler = WTFMove(completionHandler), primaryDomain = isolatedPrimaryDomain(primaryDomain)]() mutable {
    688         bool isGrandFathered = m_memoryStore ? m_memoryStore->isGrandfathered(primaryDomain) : false;
     652void WebResourceLoadStatisticsStore::clearPrevalentResource(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     653{
     654    ASSERT(RunLoop::isMain());
     655   
     656    postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
     657        if (m_memoryStore)
     658            m_memoryStore->clearPrevalentResource(domain);
     659        postTaskReply(WTFMove(completionHandler));
     660    });
     661}
     662
     663void WebResourceLoadStatisticsStore::setGrandfathered(const RegistrableDomain& domain, bool value, CompletionHandler<void()>&& completionHandler)
     664{
     665    ASSERT(RunLoop::isMain());
     666
     667    postTask([this, domain = domain.isolatedCopy(), value, completionHandler = WTFMove(completionHandler)]() mutable {
     668        if (m_memoryStore)
     669            m_memoryStore->setGrandfathered(domain, value);
     670        postTaskReply(WTFMove(completionHandler));
     671    });
     672}
     673   
     674void WebResourceLoadStatisticsStore::isGrandfathered(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     675{
     676    ASSERT(RunLoop::isMain());
     677
     678    postTask([this, completionHandler = WTFMove(completionHandler), domain = domain.isolatedCopy()]() mutable {
     679        bool isGrandFathered = m_memoryStore ? m_memoryStore->isGrandfathered(domain) : false;
    689680        postTaskReply([isGrandFathered, completionHandler = WTFMove(completionHandler)]() mutable {
    690681            completionHandler(isGrandFathered);
     
    693684}
    694685
    695 void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const String& subframe, const String& topFrame, CompletionHandler<void()>&& completionHandler)
    696 {
    697     ASSERT(RunLoop::isMain());
    698    
    699     postTask([this, completionHandler = WTFMove(completionHandler), primaryTopFrameDomain = isolatedPrimaryDomain(topFrame), primarySubFrameDomain = isolatedPrimaryDomain(subframe)]() mutable {
    700         if (m_memoryStore)
    701             m_memoryStore->setSubframeUnderTopFrameOrigin(primarySubFrameDomain, primaryTopFrameDomain);
    702         postTaskReply(WTFMove(completionHandler));
    703     });
    704 }
    705 
    706 void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const String& subresource, const String& topFrame, CompletionHandler<void()>&& completionHandler)
    707 {
    708     ASSERT(RunLoop::isMain());
    709    
    710     postTask([this, completionHandler = WTFMove(completionHandler), primaryTopFrameDomain = isolatedPrimaryDomain(topFrame), primarySubresourceDomain = isolatedPrimaryDomain(subresource)]() mutable {
    711         if (m_memoryStore)
    712             m_memoryStore->setSubresourceUnderTopFrameOrigin(primarySubresourceDomain, primaryTopFrameDomain);
    713         postTaskReply(WTFMove(completionHandler));
    714     });
    715 }
    716 
    717 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const String& subresource, const String& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    718 {
    719     ASSERT(RunLoop::isMain());
    720    
    721     postTask([this, completionHandler = WTFMove(completionHandler), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedTo), primarySubresourceDomain = isolatedPrimaryDomain(subresource)]() mutable {
    722         if (m_memoryStore)
    723             m_memoryStore->setSubresourceUniqueRedirectTo(primarySubresourceDomain, primaryRedirectDomain);
    724         postTaskReply(WTFMove(completionHandler));
    725     });
    726 }
    727 
    728 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const String& subresource, const String& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    729 {
    730     ASSERT(RunLoop::isMain());
    731    
    732     postTask([this, completionHandler = WTFMove(completionHandler), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedFrom), primarySubresourceDomain = isolatedPrimaryDomain(subresource)]() mutable {
    733         if (m_memoryStore)
    734             m_memoryStore->setSubresourceUniqueRedirectFrom(primarySubresourceDomain, primaryRedirectDomain);
    735         postTaskReply(WTFMove(completionHandler));
    736     });
    737 }
    738 
    739 void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const String& topFrameHostName, const String& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    740 {
    741     ASSERT(RunLoop::isMain());
    742    
    743     postTask([this, completionHandler = WTFMove(completionHandler), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHostName), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedTo)]() mutable {
    744         if (m_memoryStore)
    745             m_memoryStore->setTopFrameUniqueRedirectTo(topFramePrimaryDomain, primaryRedirectDomain);
    746         postTaskReply(WTFMove(completionHandler));
    747     });
    748 }
    749 
    750 void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const String& topFrameHostName, const String& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    751 {
    752     ASSERT(RunLoop::isMain());
    753    
    754     postTask([this, completionHandler = WTFMove(completionHandler), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHostName), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedFrom)]() mutable {
    755         if (m_memoryStore)
    756             m_memoryStore->setTopFrameUniqueRedirectFrom(topFramePrimaryDomain, primaryRedirectDomain);
     686void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void()>&& completionHandler)
     687{
     688    ASSERT(RunLoop::isMain());
     689   
     690    postTask([this, completionHandler = WTFMove(completionHandler), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy()]() mutable {
     691        if (m_memoryStore)
     692            m_memoryStore->setSubframeUnderTopFrameOrigin(subFrameDomain, topFrameDomain);
     693        postTaskReply(WTFMove(completionHandler));
     694    });
     695}
     696
     697void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void()>&& completionHandler)
     698{
     699    ASSERT(RunLoop::isMain());
     700   
     701    postTask([this, completionHandler = WTFMove(completionHandler), subresourceDomain = subresourceDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy()]() mutable {
     702        if (m_memoryStore)
     703            m_memoryStore->setSubresourceUnderTopFrameOrigin(subresourceDomain, topFrameDomain);
     704        postTaskReply(WTFMove(completionHandler));
     705    });
     706}
     707
     708void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const RegistrableDomain& subresourceDomain, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void()>&& completionHandler)
     709{
     710    ASSERT(RunLoop::isMain());
     711   
     712    postTask([this, completionHandler = WTFMove(completionHandler), subresourceDomain = subresourceDomain.isolatedCopy(), domainRedirectedTo = domainRedirectedTo.isolatedCopy()]() mutable {
     713        if (m_memoryStore)
     714            m_memoryStore->setSubresourceUniqueRedirectTo(subresourceDomain, domainRedirectedTo);
     715        postTaskReply(WTFMove(completionHandler));
     716    });
     717}
     718
     719void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const RegistrableDomain& subresourceDomain, const RegistrableDomain& domainRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     720{
     721    ASSERT(RunLoop::isMain());
     722   
     723    postTask([this, completionHandler = WTFMove(completionHandler), subresourceDomain = subresourceDomain.isolatedCopy(), domainRedirectedFrom = domainRedirectedFrom.isolatedCopy()]() mutable {
     724        if (m_memoryStore)
     725            m_memoryStore->setSubresourceUniqueRedirectFrom(subresourceDomain, domainRedirectedFrom);
     726        postTaskReply(WTFMove(completionHandler));
     727    });
     728}
     729
     730void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const RegistrableDomain& topFrameDomain, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void()>&& completionHandler)
     731{
     732    ASSERT(RunLoop::isMain());
     733   
     734    postTask([this, completionHandler = WTFMove(completionHandler), topFrameDomain = topFrameDomain.isolatedCopy(), domainRedirectedTo = domainRedirectedTo.isolatedCopy()]() mutable {
     735        if (m_memoryStore)
     736            m_memoryStore->setTopFrameUniqueRedirectTo(topFrameDomain, domainRedirectedTo);
     737        postTaskReply(WTFMove(completionHandler));
     738    });
     739}
     740
     741void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const RegistrableDomain& topFrameDomain, const RegistrableDomain& domainRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     742{
     743    ASSERT(RunLoop::isMain());
     744   
     745    postTask([this, completionHandler = WTFMove(completionHandler), topFrameDomain = topFrameDomain.isolatedCopy(), domainRedirectedFrom = domainRedirectedFrom.isolatedCopy()]() mutable {
     746        if (m_memoryStore)
     747            m_memoryStore->setTopFrameUniqueRedirectFrom(topFrameDomain, domainRedirectedFrom);
    757748        postTaskReply(WTFMove(completionHandler));
    758749    });
     
    775766}
    776767
    777 void WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains(const Vector<String>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
     768void WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains(const Vector<RegistrableDomain>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
    778769{
    779770    // Helper function used by testing system. Should only be called from the main thread.
     
    791782}
    792783
    793 void WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler)
     784void WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains(const Vector<RegistrableDomain>& domains, CompletionHandler<void()>&& completionHandler)
    794785{
    795786    // Helper function used by testing system. Should only be called from the main thread.
     
    886877}
    887878
    888 void WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<String>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
     879void WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<RegistrableDomain>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
    889880{
    890881    ASSERT(RunLoop::isMain());
     
    896887}
    897888
    898 void WebResourceLoadStatisticsStore::removePrevalentDomains(const Vector<String>& domains)
     889void WebResourceLoadStatisticsStore::removePrevalentDomains(const Vector<RegistrableDomain>& domains)
    899890{
    900891    if (m_networkSession)
     
    902893}
    903894
    904 void WebResourceLoadStatisticsStore::callRemoveDomainsHandler(const Vector<String>& domains)
     895void WebResourceLoadStatisticsStore::callRemoveDomainsHandler(const Vector<RegistrableDomain>& domains)
    905896{
    906897    ASSERT(RunLoop::isMain());
     
    960951}
    961952
    962 void WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
     953void WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
    963954{
    964955    ASSERT(RunLoop::isMain());
    965956   
    966957    if (m_networkSession) {
    967         m_networkSession->deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypes, WTFMove(topPrivatelyControlledDomains), shouldNotifyPage, WTFMove(completionHandler));
     958        m_networkSession->deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(dataTypes, WTFMove(domains), shouldNotifyPage, WTFMove(completionHandler));
    968959        return;
    969960    }
     
    972963}
    973964
    974 void WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
     965void WebResourceLoadStatisticsStore::registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&& completionHandler)
    975966{
    976967    ASSERT(RunLoop::isMain());
    977968   
    978969    if (m_networkSession) {
    979         m_networkSession->topPrivatelyControlledDomainsWithWebsiteData(dataTypes, shouldNotifyPage, WTFMove(completionHandler));
     970        m_networkSession->registrableDomainsWithWebsiteData(dataTypes, shouldNotifyPage, WTFMove(completionHandler));
    980971        return;
    981972    }
  • trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h

    r240676 r242056  
    3131#include "StorageAccessStatus.h"
    3232#include "WebsiteDataType.h"
     33#include <WebCore/RegistrableDomain.h>
    3334#include <wtf/CompletionHandler.h>
    3435#include <wtf/RunLoop.h>
     
    6061class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver {
    6162public:
     63    using ResourceLoadStatistics = WebCore::ResourceLoadStatistics;
     64    using RegistrableDomain = WebCore::RegistrableDomain;
     65    using TopFrameDomain = WebCore::RegistrableDomain;
     66    using SubFrameDomain = WebCore::RegistrableDomain;
     67    using SubResourceDomain = WebCore::RegistrableDomain;
     68    using RedirectDomain = WebCore::RegistrableDomain;
     69    using RedirectedFromDomain = WebCore::RegistrableDomain;
     70    using RedirectedToDomain = WebCore::RegistrableDomain;
     71    using NavigatedFromDomain = WebCore::RegistrableDomain;
     72    using NavigatedToDomain = WebCore::RegistrableDomain;
     73    using DomainInNeedOfStorageAccess = WebCore::RegistrableDomain;
     74    using OpenerDomain = WebCore::RegistrableDomain;
     75    using OpenerPageID = uint64_t;
     76    using PageID = uint64_t;
     77    using FrameID = uint64_t;
     78
    6279    static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory)
    6380    {
     
    7693    void setShouldSubmitTelemetry(bool);
    7794
    78     void grantStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
     95    void grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
    7996
    8097    void applicationWillTerminate();
    8198
    8299    void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL);
    83     void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame);
    84     void logUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&);
    85     void logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&);
    86     void logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&);
    87     void logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain, CompletionHandler<void()>&&);
    88     void clearUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&);
    89     void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
    90     void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&&);
    91     bool grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID);
    92     void hasHadUserInteraction(const String& resourceDomain, CompletionHandler<void(bool)>&&);
    93     void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
    94     bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
    95     void requestStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
    96     void requestStorageAccessGranted(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
     100    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame);
     101    void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&);
     102    void logWebSocketLoading(const SubResourceDomain&, const TopFrameDomain&, WallTime lastSeen, CompletionHandler<void()>&&);
     103    void logSubresourceLoading(const SubResourceDomain&, const TopFrameDomain&, WallTime lastSeen, CompletionHandler<void()>&&);
     104    void logSubresourceRedirect(const RedirectedFromDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     105    void clearUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&);
     106    void deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<RegistrableDomain>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
     107    void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&);
     108    bool grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID);
     109    void hasHadUserInteraction(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     110    void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&& callback);
     111    bool hasStorageAccessForFrame(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID);
     112    void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
     113    void requestStorageAccessGranted(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
    97114    void requestUpdate();
    98     void setLastSeen(const String& resourceDomain, Seconds, CompletionHandler<void()>&&);
    99     void setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&);
    100     void setVeryPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&);
     115    void setLastSeen(const RegistrableDomain&, Seconds, CompletionHandler<void()>&&);
     116    void setPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&);
     117    void setVeryPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&);
    101118    void dumpResourceLoadStatistics(CompletionHandler<void(String)>&&);
    102     void isPrevalentResource(const String&, CompletionHandler<void(bool)>&&);
    103     void isVeryPrevalentResource(const String&, CompletionHandler<void(bool)>&&);
    104     void isRegisteredAsSubresourceUnder(const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&&);
    105     void isRegisteredAsSubFrameUnder(const String& subFrame, const String& topFrame, CompletionHandler<void(bool)>&&);
    106     void isRegisteredAsRedirectingTo(const String& hostRedirectedFrom, const String& hostRedirectedTo, CompletionHandler<void(bool)>&&);
    107     void clearPrevalentResource(const String&, CompletionHandler<void()>&&);
    108     void setGrandfathered(const String&, bool, CompletionHandler<void()>&&);
    109     void isGrandfathered(const String&, CompletionHandler<void(bool)>&&);
    110     void removePrevalentDomains(const Vector<String>& domainsToBlock);
     119    void isPrevalentResource(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     120    void isVeryPrevalentResource(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     121    void isRegisteredAsSubresourceUnder(const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&);
     122    void isRegisteredAsSubFrameUnder(const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&);
     123    void isRegisteredAsRedirectingTo(const RedirectedFromDomain&, const RedirectedToDomain&, CompletionHandler<void(bool)>&&);
     124    void clearPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&);
     125    void setGrandfathered(const RegistrableDomain&, bool, CompletionHandler<void()>&&);
     126    void isGrandfathered(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     127    void removePrevalentDomains(const Vector<RegistrableDomain>&);
    111128    void setNotifyPagesWhenDataRecordsWereScanned(bool, CompletionHandler<void()>&&);
    112     void setSubframeUnderTopFrameOrigin(const String& subframe, const String& topFrame, CompletionHandler<void()>&&);
    113     void setSubresourceUnderTopFrameOrigin(const String& subresource, const String& topFrame, CompletionHandler<void()>&&);
    114     void setSubresourceUniqueRedirectTo(const String& subresource, const String& hostNameRedirectedTo, CompletionHandler<void()>&&);
    115     void setSubresourceUniqueRedirectFrom(const String& subresource, const String& hostNameRedirectedFrom, CompletionHandler<void()>&&);
    116     void setTopFrameUniqueRedirectTo(const String& topFrameHostName, const String& hostNameRedirectedTo, CompletionHandler<void()>&&);
    117     void setTopFrameUniqueRedirectFrom(const String& topFrameHostName, const String& hostNameRedirectedFrom, CompletionHandler<void()>&&);
     129    void setSubframeUnderTopFrameOrigin(const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
     130    void setSubresourceUnderTopFrameOrigin(const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
     131    void setSubresourceUniqueRedirectTo(const SubResourceDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     132    void setSubresourceUniqueRedirectFrom(const SubResourceDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
     133    void setTopFrameUniqueRedirectTo(const TopFrameDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     134    void setTopFrameUniqueRedirectFrom(const TopFrameDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
    118135    void scheduleCookieBlockingUpdate(CompletionHandler<void()>&&);
    119     void scheduleCookieBlockingUpdateForDomains(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
    120     void scheduleClearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&);
     136    void scheduleCookieBlockingUpdateForDomains(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&);
     137    void scheduleClearBlockingStateForDomains(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&);
    121138    void scheduleStatisticsAndDataRecordsProcessing(CompletionHandler<void()>&&);
    122139    void submitTelemetry(CompletionHandler<void()>&&);
     
    134151
    135152    void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&);
    136     void setPrevalentResourceForDebugMode(const String& resourceDomain, CompletionHandler<void()>&&);
     153    void setPrevalentResourceForDebugMode(const RegistrableDomain&, CompletionHandler<void()>&&);
    137154
    138155    void logTestingEvent(const String&);
    139     void callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     156    void callGrantStorageAccessHandler(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&);
    140157    void removeAllStorageAccess(CompletionHandler<void()>&&);
    141     void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
    142     void callRemoveDomainsHandler(const Vector<String>& domains);
    143     void callHasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     158    void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&);
     159    void callRemoveDomainsHandler(const Vector<RegistrableDomain>&);
     160    void callHasStorageAccessForFrameHandler(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);
    144161
    145162    void didCreateNetworkProcess();
     
    162179
    163180    // IPC message handlers.
    164     void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins);
    165     void requestStorageAccessUnderOpener(String&& primaryDomainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerPrimaryDomain);
     181    void resourceLoadStatisticsUpdated(Vector<ResourceLoadStatistics>&& origins);
     182    void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, uint64_t openerPageID, OpenerDomain&&);
    166183
    167184    void performDailyTasks();
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r241743 r242056  
    6464namespace WebKit {
    6565using namespace WebCore;
     66using RegistrableDomain = WebCore::RegistrableDomain;
    6667
    6768Ref<NetworkConnectionToWebProcess> NetworkConnectionToWebProcess::create(NetworkProcess& networkProcess, IPC::Connection::Identifier connectionIdentifier)
     
    586587}
    587588
    588 void NetworkConnectionToWebProcess::logUserInteraction(PAL::SessionID sessionID, const String& topLevelOrigin)
     589void NetworkConnectionToWebProcess::logUserInteraction(PAL::SessionID sessionID, const RegistrableDomain& domain)
    589590{
    590591    ASSERT(sessionID.isValid());
     
    594595    if (auto networkSession = networkProcess().networkSession(sessionID)) {
    595596        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    596             resourceLoadStatistics->logUserInteraction(topLevelOrigin, [] { });
    597     }
    598 }
    599 
    600 void NetworkConnectionToWebProcess::logWebSocketLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
     597            resourceLoadStatistics->logUserInteraction(domain, [] { });
     598    }
     599}
     600
     601void NetworkConnectionToWebProcess::logWebSocketLoading(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen)
    601602{
    602603    if (auto networkSession = networkProcess().networkSession(sessionID)) {
    603604        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    604             resourceLoadStatistics->logWebSocketLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
    605     }
    606 }
    607 
    608 void NetworkConnectionToWebProcess::logSubresourceLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
     605            resourceLoadStatistics->logWebSocketLoading(targetDomain, topFrameDomain, lastSeen, [] { });
     606    }
     607}
     608
     609void NetworkConnectionToWebProcess::logSubresourceLoading(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen)
    609610{
    610611    if (auto networkSession = networkProcess().networkSession(sessionID)) {
    611612        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    612             resourceLoadStatistics->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
    613     }
    614 }
    615 
    616 void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain)
     613            resourceLoadStatistics->logSubresourceLoading(targetDomain, topFrameDomain, lastSeen, [] { });
     614    }
     615}
     616
     617void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessionID, const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain)
    617618{
    618619    if (auto networkSession = networkProcess().networkSession(sessionID)) {
    619620        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    620             resourceLoadStatistics->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain, [] { });
     621            resourceLoadStatistics->logSubresourceRedirect(sourceDomain, targetDomain, [] { });
    621622    }
    622623}
     
    633634}
    634635
    635 void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    636 {
    637     networkProcess().hasStorageAccess(sessionID, subFrameHost, topFrameHost, frameID, pageID, WTFMove(completionHandler));
    638 }
    639 
    640 void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
    641 {
    642     networkProcess().requestStorageAccessGranted(sessionID, subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
     636void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     637{
     638    networkProcess().hasStorageAccess(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
     639}
     640
     641void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
     642{
     643    networkProcess().requestStorageAccessGranted(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, promptEnabled, WTFMove(completionHandler));
    643644}
    644645#endif
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r241317 r242056  
    3434#include "NetworkRTCProvider.h"
    3535#include <WebCore/NetworkLoadInformation.h>
     36#include <WebCore/RegistrableDomain.h>
    3637#include <wtf/RefCounted.h>
    3738
     
    6566class NetworkConnectionToWebProcess : public RefCounted<NetworkConnectionToWebProcess>, IPC::Connection::Client {
    6667public:
     68    using RegistrableDomain = WebCore::RegistrableDomain;
     69
    6770    static Ref<NetworkConnectionToWebProcess> create(NetworkProcess&, IPC::Connection::Identifier);
    6871    virtual ~NetworkConnectionToWebProcess();
     
    200203    void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
    201204
    202     void logUserInteraction(PAL::SessionID, const String& topLevelOrigin);
    203     void logWebSocketLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
    204     void logSubresourceLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
    205     void logSubresourceRedirect(PAL::SessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain);
     205    void logUserInteraction(PAL::SessionID, const RegistrableDomain&);
     206    void logWebSocketLoading(PAL::SessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen);
     207    void logSubresourceLoading(PAL::SessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen);
     208    void logSubresourceRedirect(PAL::SessionID, const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain);
    206209    void requestResourceLoadStatisticsUpdate();
    207     void hasStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
    208     void requestStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool prompt, CompletionHandler<void(bool)>&&);
     210    void hasStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     211    void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool prompt, CompletionHandler<void(bool)>&&);
    209212#endif
    210213
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in

    r241317 r242056  
    5959    RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
    6060    RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
    61     LogUserInteraction(PAL::SessionID sessionID, String topLevelOrigin)
    62     LogWebSocketLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
    63     LogSubresourceLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
    64     LogSubresourceRedirect(PAL::SessionID sessionID, String sourcePrimaryDomain, String targetPrimaryDomain)
     61    LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain domain)
     62    LogWebSocketLoading(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WallTime lastSeen)
     63    LogSubresourceLoading(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WallTime lastSeen)
     64    LogSubresourceRedirect(PAL::SessionID sessionID, WebCore::RegistrableDomain sourceDomain, WebCore::RegistrableDomain targetDomain)
    6565    RequestResourceLoadStatisticsUpdate();
    66     HasStorageAccess(PAL::SessionID sessionID, String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
    67     RequestStorageAccess(PAL::SessionID sessionID, String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, bool prompt) -> (bool accessGranted) Async
     66    HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
     67    RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID, bool prompt) -> (bool accessGranted) Async
    6868#endif
    6969
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r241603 r242056  
    578578}
    579579
    580 void NetworkProcess::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<String>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
     580void NetworkProcess::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<RegistrableDomain>& domainsToBlock, CompletionHandler<void()>&& completionHandler)
    581581{
    582582    if (auto* networkStorageSession = storageSession(sessionID))
     
    585585}
    586586
    587 void NetworkProcess::isGrandfathered(PAL::SessionID sessionID, const String& targetPrimaryDomain, CompletionHandler<void(bool)>&& completionHandler)
    588 {
    589     if (auto* networkSession = this->networkSession(sessionID)) {
    590         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    591             resourceLoadStatistics->isGrandfathered(targetPrimaryDomain, WTFMove(completionHandler));
     587void NetworkProcess::isGrandfathered(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     588{
     589    if (auto* networkSession = this->networkSession(sessionID)) {
     590        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     591            resourceLoadStatistics->isGrandfathered(domain, WTFMove(completionHandler));
    592592        else
    593593            completionHandler(false);
     
    598598}
    599599
    600 void NetworkProcess::isPrevalentResource(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void(bool)>&& completionHandler)
    601 {
    602     if (auto* networkSession = this->networkSession(sessionID)) {
    603         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    604             resourceLoadStatistics->isPrevalentResource(resourceDomain, WTFMove(completionHandler));
     600void NetworkProcess::isPrevalentResource(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     601{
     602    if (auto* networkSession = this->networkSession(sessionID)) {
     603        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     604            resourceLoadStatistics->isPrevalentResource(domain, WTFMove(completionHandler));
    605605        else
    606606            completionHandler(false);
     
    611611}
    612612
    613 void NetworkProcess::isVeryPrevalentResource(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void(bool)>&& completionHandler)
    614 {
    615     if (auto* networkSession = this->networkSession(sessionID)) {
    616         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    617             resourceLoadStatistics->isVeryPrevalentResource(resourceDomain, WTFMove(completionHandler));
     613void NetworkProcess::isVeryPrevalentResource(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     614{
     615    if (auto* networkSession = this->networkSession(sessionID)) {
     616        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     617            resourceLoadStatistics->isVeryPrevalentResource(domain, WTFMove(completionHandler));
    618618        else
    619619            completionHandler(false);
     
    631631}
    632632
    633 void NetworkProcess::setGrandfathered(PAL::SessionID sessionID, const String& resourceDomain, bool isGrandfathered, CompletionHandler<void()>&& completionHandler)
    634 {
    635     if (auto* networkSession = this->networkSession(sessionID)) {
    636         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    637             resourceLoadStatistics->setGrandfathered(resourceDomain, isGrandfathered, WTFMove(completionHandler));
    638         else
    639             completionHandler();
    640     } else {
    641         ASSERT_NOT_REACHED();
    642         completionHandler();
    643     }
    644 }
    645 
    646 void NetworkProcess::setPrevalentResource(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    647 {
    648     if (auto* networkSession = this->networkSession(sessionID)) {
    649         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    650             resourceLoadStatistics->setPrevalentResource(resourceDomain, WTFMove(completionHandler));
    651         else
    652             completionHandler();
    653     } else {
    654         ASSERT_NOT_REACHED();
    655         completionHandler();
    656     }
    657 }
    658 
    659 void NetworkProcess::setPrevalentResourceForDebugMode(PAL::SessionID sessionID, String resourceDomain, CompletionHandler<void()>&& completionHandler)
    660 {
    661     if (auto* networkSession = this->networkSession(sessionID)) {
    662         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    663             resourceLoadStatistics->setPrevalentResourceForDebugMode(resourceDomain, WTFMove(completionHandler));
    664         else
    665             completionHandler();
    666     } else {
    667         ASSERT_NOT_REACHED();
    668         completionHandler();
    669     }
    670 }
    671 
    672 void NetworkProcess::setVeryPrevalentResource(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    673 {
    674     if (auto* networkSession = this->networkSession(sessionID)) {
    675         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    676             resourceLoadStatistics->setVeryPrevalentResource(resourceDomain, WTFMove(completionHandler));
    677         else
    678             completionHandler();
    679     } else {
    680         ASSERT_NOT_REACHED();
    681         completionHandler();
    682     }
    683 }
    684 
    685 void NetworkProcess::clearPrevalentResource(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    686 {
    687     if (auto* networkSession = this->networkSession(sessionID)) {
    688         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    689             resourceLoadStatistics->clearPrevalentResource(resourceDomain, WTFMove(completionHandler));
     633void NetworkProcess::setGrandfathered(PAL::SessionID sessionID, const RegistrableDomain& domain, bool isGrandfathered, CompletionHandler<void()>&& completionHandler)
     634{
     635    if (auto* networkSession = this->networkSession(sessionID)) {
     636        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     637            resourceLoadStatistics->setGrandfathered(domain, isGrandfathered, WTFMove(completionHandler));
     638        else
     639            completionHandler();
     640    } else {
     641        ASSERT_NOT_REACHED();
     642        completionHandler();
     643    }
     644}
     645
     646void NetworkProcess::setPrevalentResource(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     647{
     648    if (auto* networkSession = this->networkSession(sessionID)) {
     649        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     650            resourceLoadStatistics->setPrevalentResource(domain, WTFMove(completionHandler));
     651        else
     652            completionHandler();
     653    } else {
     654        ASSERT_NOT_REACHED();
     655        completionHandler();
     656    }
     657}
     658
     659void NetworkProcess::setPrevalentResourceForDebugMode(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     660{
     661    if (auto* networkSession = this->networkSession(sessionID)) {
     662        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     663            resourceLoadStatistics->setPrevalentResourceForDebugMode(domain, WTFMove(completionHandler));
     664        else
     665            completionHandler();
     666    } else {
     667        ASSERT_NOT_REACHED();
     668        completionHandler();
     669    }
     670}
     671
     672void NetworkProcess::setVeryPrevalentResource(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     673{
     674    if (auto* networkSession = this->networkSession(sessionID)) {
     675        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     676            resourceLoadStatistics->setVeryPrevalentResource(domain, WTFMove(completionHandler));
     677        else
     678            completionHandler();
     679    } else {
     680        ASSERT_NOT_REACHED();
     681        completionHandler();
     682    }
     683}
     684
     685void NetworkProcess::clearPrevalentResource(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     686{
     687    if (auto* networkSession = this->networkSession(sessionID)) {
     688        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     689            resourceLoadStatistics->clearPrevalentResource(domain, WTFMove(completionHandler));
    690690        else
    691691            completionHandler();
     
    790790}
    791791
    792 void NetworkProcess::setSubframeUnderTopFrameOrigin(PAL::SessionID sessionID, String subframe, String topFrame, CompletionHandler<void()>&& completionHandler)
    793 {
    794     if (auto* networkSession = this->networkSession(sessionID)) {
    795         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    796             resourceLoadStatistics->setSubframeUnderTopFrameOrigin(subframe, topFrame, WTFMove(completionHandler));
    797         else
    798             completionHandler();
    799     } else {
    800         ASSERT_NOT_REACHED();
    801         completionHandler();
    802     }
    803 }
    804 
    805 void NetworkProcess::isRegisteredAsRedirectingTo(PAL::SessionID sessionID, const String& redirectedFrom, const String& redirectedTo, CompletionHandler<void(bool)>&& completionHandler)
    806 {
    807     if (auto* networkSession = this->networkSession(sessionID)) {
    808         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    809             resourceLoadStatistics->isRegisteredAsRedirectingTo(redirectedFrom, redirectedTo, WTFMove(completionHandler));
     792void NetworkProcess::setSubframeUnderTopFrameOrigin(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void()>&& completionHandler)
     793{
     794    if (auto* networkSession = this->networkSession(sessionID)) {
     795        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     796            resourceLoadStatistics->setSubframeUnderTopFrameOrigin(subFrameDomain, topFrameDomain, WTFMove(completionHandler));
     797        else
     798            completionHandler();
     799    } else {
     800        ASSERT_NOT_REACHED();
     801        completionHandler();
     802    }
     803}
     804
     805void NetworkProcess::isRegisteredAsRedirectingTo(PAL::SessionID sessionID, const RegistrableDomain& domainRedirectedFrom, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void(bool)>&& completionHandler)
     806{
     807    if (auto* networkSession = this->networkSession(sessionID)) {
     808        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     809            resourceLoadStatistics->isRegisteredAsRedirectingTo(domainRedirectedFrom, domainRedirectedTo, WTFMove(completionHandler));
    810810        else
    811811            completionHandler(false);
     
    816816}
    817817
    818 void NetworkProcess::isRegisteredAsSubFrameUnder(PAL::SessionID sessionID, const String& subframe, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler)
    819 {
    820     if (auto* networkSession = this->networkSession(sessionID)) {
    821         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    822             resourceLoadStatistics->isRegisteredAsSubFrameUnder(subframe, topFrame, WTFMove(completionHandler));
     818void NetworkProcess::isRegisteredAsSubFrameUnder(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler)
     819{
     820    if (auto* networkSession = this->networkSession(sessionID)) {
     821        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     822            resourceLoadStatistics->isRegisteredAsSubFrameUnder(subFrameDomain, topFrameDomain, WTFMove(completionHandler));
    823823        else
    824824            completionHandler(false);
     
    829829}
    830830
    831 void NetworkProcess::setSubresourceUnderTopFrameOrigin(PAL::SessionID sessionID, String subresource, String topFrame, CompletionHandler<void()>&& completionHandler)
    832 {
    833     if (auto* networkSession = this->networkSession(sessionID)) {
    834         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    835             resourceLoadStatistics->setSubresourceUnderTopFrameOrigin(subresource, topFrame, WTFMove(completionHandler));
    836         else
    837             completionHandler();
    838     } else {
    839         ASSERT_NOT_REACHED();
    840         completionHandler();
    841     }
    842 }
    843 
    844 void NetworkProcess::setSubresourceUniqueRedirectTo(PAL::SessionID sessionID, String subresource, String hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    845 {
    846     if (auto* networkSession = this->networkSession(sessionID)) {
    847         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    848             resourceLoadStatistics->setSubresourceUniqueRedirectTo(subresource, hostNameRedirectedTo, WTFMove(completionHandler));
    849         else
    850             completionHandler();
    851     } else {
    852         ASSERT_NOT_REACHED();
    853         completionHandler();
    854     }
    855 }
    856 
    857 void NetworkProcess::setSubresourceUniqueRedirectFrom(PAL::SessionID sessionID, String subresource, String hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    858 {
    859     if (auto* networkSession = this->networkSession(sessionID)) {
    860         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    861             resourceLoadStatistics->setSubresourceUniqueRedirectFrom(subresource, hostNameRedirectedFrom, WTFMove(completionHandler));
    862         else
    863             completionHandler();
    864     } else {
    865         ASSERT_NOT_REACHED();
    866         completionHandler();
    867     }
    868 }
    869 
    870 void NetworkProcess::isRegisteredAsSubresourceUnder(PAL::SessionID sessionID, const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler)
    871 {
    872     if (auto* networkSession = this->networkSession(sessionID)) {
    873         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    874             resourceLoadStatistics->isRegisteredAsSubresourceUnder(subresource, topFrame, WTFMove(completionHandler));
     831void NetworkProcess::setSubresourceUnderTopFrameOrigin(PAL::SessionID sessionID, const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void()>&& completionHandler)
     832{
     833    if (auto* networkSession = this->networkSession(sessionID)) {
     834        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     835            resourceLoadStatistics->setSubresourceUnderTopFrameOrigin(subresourceDomain, topFrameDomain, WTFMove(completionHandler));
     836        else
     837            completionHandler();
     838    } else {
     839        ASSERT_NOT_REACHED();
     840        completionHandler();
     841    }
     842}
     843
     844void NetworkProcess::setSubresourceUniqueRedirectTo(PAL::SessionID sessionID, const RegistrableDomain& subresourceDomain, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void()>&& completionHandler)
     845{
     846    if (auto* networkSession = this->networkSession(sessionID)) {
     847        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     848            resourceLoadStatistics->setSubresourceUniqueRedirectTo(subresourceDomain, domainRedirectedTo, WTFMove(completionHandler));
     849        else
     850            completionHandler();
     851    } else {
     852        ASSERT_NOT_REACHED();
     853        completionHandler();
     854    }
     855}
     856
     857void NetworkProcess::setSubresourceUniqueRedirectFrom(PAL::SessionID sessionID, const RegistrableDomain& subresourceDomain, const RegistrableDomain& domainRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     858{
     859    if (auto* networkSession = this->networkSession(sessionID)) {
     860        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     861            resourceLoadStatistics->setSubresourceUniqueRedirectFrom(subresourceDomain, domainRedirectedFrom, WTFMove(completionHandler));
     862        else
     863            completionHandler();
     864    } else {
     865        ASSERT_NOT_REACHED();
     866        completionHandler();
     867    }
     868}
     869
     870void NetworkProcess::isRegisteredAsSubresourceUnder(PAL::SessionID sessionID, const RegistrableDomain& subresourceDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler)
     871{
     872    if (auto* networkSession = this->networkSession(sessionID)) {
     873        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     874            resourceLoadStatistics->isRegisteredAsSubresourceUnder(subresourceDomain, topFrameDomain, WTFMove(completionHandler));
    875875        else
    876876            completionHandler(false);
     
    881881}
    882882
    883 void NetworkProcess::setTopFrameUniqueRedirectTo(PAL::SessionID sessionID, String topFrameHostName, String hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    884 {
    885     if (auto* networkSession = this->networkSession(sessionID)) {
    886         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    887             resourceLoadStatistics->setTopFrameUniqueRedirectTo(topFrameHostName, hostNameRedirectedTo, WTFMove(completionHandler));
    888         else
    889             completionHandler();
    890     } else {
    891         ASSERT_NOT_REACHED();
    892         completionHandler();
    893     }
    894 }
    895 
    896 void NetworkProcess::setTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, String topFrameHostName, String hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    897 {
    898     if (auto* networkSession = this->networkSession(sessionID)) {
    899         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    900             resourceLoadStatistics->setTopFrameUniqueRedirectFrom(topFrameHostName, hostNameRedirectedFrom, WTFMove(completionHandler));
    901         else
    902             completionHandler();
    903     } else {
    904         ASSERT_NOT_REACHED();
    905         completionHandler();
    906     }
    907 }
    908    
    909    
    910 void NetworkProcess::setLastSeen(PAL::SessionID sessionID, const String& resourceDomain, Seconds seconds, CompletionHandler<void()>&& completionHandler)
    911 {
    912     if (auto* networkSession = this->networkSession(sessionID)) {
    913         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    914             resourceLoadStatistics->setLastSeen(resourceDomain, seconds, WTFMove(completionHandler));
    915         else
    916             completionHandler();
    917     } else {
    918         ASSERT_NOT_REACHED();
    919         completionHandler();
    920     }
    921 }
    922 
    923 void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     883void NetworkProcess::setTopFrameUniqueRedirectTo(PAL::SessionID sessionID, const RegistrableDomain& topFrameDomain, const RegistrableDomain& domainRedirectedTo, CompletionHandler<void()>&& completionHandler)
     884{
     885    if (auto* networkSession = this->networkSession(sessionID)) {
     886        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     887            resourceLoadStatistics->setTopFrameUniqueRedirectTo(topFrameDomain, domainRedirectedTo, WTFMove(completionHandler));
     888        else
     889            completionHandler();
     890    } else {
     891        ASSERT_NOT_REACHED();
     892        completionHandler();
     893    }
     894}
     895
     896void NetworkProcess::setTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, const RegistrableDomain& topFrameDomain, const RegistrableDomain& domainRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     897{
     898    if (auto* networkSession = this->networkSession(sessionID)) {
     899        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     900            resourceLoadStatistics->setTopFrameUniqueRedirectFrom(topFrameDomain, domainRedirectedFrom, WTFMove(completionHandler));
     901        else
     902            completionHandler();
     903    } else {
     904        ASSERT_NOT_REACHED();
     905        completionHandler();
     906    }
     907}
     908   
     909   
     910void NetworkProcess::setLastSeen(PAL::SessionID sessionID, const RegistrableDomain& domain, Seconds seconds, CompletionHandler<void()>&& completionHandler)
     911{
     912    if (auto* networkSession = this->networkSession(sessionID)) {
     913        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     914            resourceLoadStatistics->setLastSeen(domain, seconds, WTFMove(completionHandler));
     915        else
     916            completionHandler();
     917    } else {
     918        ASSERT_NOT_REACHED();
     919        completionHandler();
     920    }
     921}
     922
     923void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    924924{
    925925    bool hasStorageAccess = false;
    926926    if (auto* networkStorageSession = storageSession(sessionID))
    927         hasStorageAccess = networkStorageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID);
     927        hasStorageAccess = networkStorageSession->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID);
    928928    else
    929929        ASSERT_NOT_REACHED();
     
    942942}
    943943
    944 void NetworkProcess::hasStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    945 {
    946     if (auto* networkSession = this->networkSession(sessionID)) {
    947         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    948             resourceLoadStatistics->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(completionHandler));
     944void NetworkProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     945{
     946    if (auto* networkSession = this->networkSession(sessionID)) {
     947        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     948            resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
    949949        else
    950950            completionHandler(false);
     
    955955}
    956956
    957 void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
    958 {
    959     if (auto* networkSession = this->networkSession(sessionID)) {
    960         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    961             resourceLoadStatistics->requestStorageAccess(resourceDomain, firstPartyDomain, frameID.value(), pageID, promptEnabled, WTFMove(completionHandler));
     957void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
     958{
     959    if (auto* networkSession = this->networkSession(sessionID)) {
     960        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     961            resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, promptEnabled, WTFMove(completionHandler));
    962962        else
    963963            completionHandler(StorageAccessStatus::CannotRequestAccess);
     
    968968}
    969969
    970 void NetworkProcess::requestStorageAccessGranted(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
    971 {
    972     if (auto* networkSession = this->networkSession(sessionID)) {
    973         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    974             resourceLoadStatistics->requestStorageAccessGranted(subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
     970void NetworkProcess::requestStorageAccessGranted(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
     971{
     972    if (auto* networkSession = this->networkSession(sessionID)) {
     973        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     974            resourceLoadStatistics->requestStorageAccessGranted(subFrameDomain, topFrameDomain, frameID, pageID, promptEnabled, WTFMove(completionHandler));
    975975        else
    976976            completionHandler(false);
     
    981981}
    982982
    983 void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
    984 {
    985     if (auto* networkSession = this->networkSession(sessionID)) {
    986         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    987             resourceLoadStatistics->grantStorageAccess(resourceDomain, firstPartyDomain, frameID.value(), pageID, userWasPrompted, WTFMove(completionHandler));
     983void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
     984{
     985    // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally.
     986    if (!frameID) {
     987        completionHandler(false);
     988        return;
     989    }
     990
     991    if (auto* networkSession = this->networkSession(sessionID)) {
     992        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     993            resourceLoadStatistics->grantStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, userWasPrompted, WTFMove(completionHandler));
    988994        else
    989995            completionHandler(false);
     
    9941000}
    9951001
    996 void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame)
    997 {
    998     if (auto* networkSession = this->networkSession(sessionID)) {
    999         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    1000             resourceLoadStatistics->logFrameNavigation(targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost, mainFrameHost, isRedirect, isMainFrame);
     1002void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
     1003{
     1004    if (auto* networkSession = this->networkSession(sessionID)) {
     1005        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     1006            resourceLoadStatistics->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame);
    10011007    } else
    10021008        ASSERT_NOT_REACHED();
    10031009}
    10041010
    1005 void NetworkProcess::logUserInteraction(PAL::SessionID sessionID, const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler)
    1006 {
    1007     if (auto* networkSession = this->networkSession(sessionID)) {
    1008         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    1009             resourceLoadStatistics->logUserInteraction(targetPrimaryDomain, WTFMove(completionHandler));
    1010         else
    1011             completionHandler();
    1012     } else {
    1013         ASSERT_NOT_REACHED();
    1014         completionHandler();
    1015     }
    1016 }
    1017 
    1018 void NetworkProcess::hadUserInteraction(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void(bool)>&& completionHandler)
    1019 {
    1020     if (auto* networkSession = this->networkSession(sessionID)) {
    1021         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    1022             resourceLoadStatistics->hasHadUserInteraction(resourceDomain, WTFMove(completionHandler));
     1011void NetworkProcess::logUserInteraction(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     1012{
     1013    if (auto* networkSession = this->networkSession(sessionID)) {
     1014        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     1015            resourceLoadStatistics->logUserInteraction(domain, WTFMove(completionHandler));
     1016        else
     1017            completionHandler();
     1018    } else {
     1019        ASSERT_NOT_REACHED();
     1020        completionHandler();
     1021    }
     1022}
     1023
     1024void NetworkProcess::hadUserInteraction(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
     1025{
     1026    if (auto* networkSession = this->networkSession(sessionID)) {
     1027        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     1028            resourceLoadStatistics->hasHadUserInteraction(domain, WTFMove(completionHandler));
    10231029        else
    10241030            completionHandler(false);
     
    10291035}
    10301036
    1031 void NetworkProcess::clearUserInteraction(PAL::SessionID sessionID, const String& resourceDomain, CompletionHandler<void()>&& completionHandler)
    1032 {
    1033     if (auto* networkSession = this->networkSession(sessionID)) {
    1034         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
    1035             resourceLoadStatistics->clearUserInteraction(resourceDomain, WTFMove(completionHandler));
     1037void NetworkProcess::clearUserInteraction(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler)
     1038{
     1039    if (auto* networkSession = this->networkSession(sessionID)) {
     1040        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
     1041            resourceLoadStatistics->clearUserInteraction(domain, WTFMove(completionHandler));
    10361042        else
    10371043            completionHandler();
     
    10511057}
    10521058
    1053 void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains)
     1059void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<RegistrableDomain>& domains)
    10541060{
    10551061    if (auto* networkStorageSession = storageSession(sessionID))
     
    14161422
    14171423#if ENABLE(RESOURCE_LOAD_STATISTICS)
    1418 static Vector<String> filterForTopLevelDomains(const Vector<String>& topLevelDomains, const HashSet<String>& foundValues)
     1424static Vector<String> filterForRegistrableDomains(const Vector<RegistrableDomain>& registrableDomains, const HashSet<String>& foundValues)
    14191425{
    14201426    Vector<String> result;
    1421     for (const auto& hostname : topLevelDomains) {
    1422         if (foundValues.contains(hostname))
    1423             result.append(hostname);
     1427    for (const auto& domain : registrableDomains) {
     1428        if (foundValues.contains(domain.string()))
     1429            result.append(domain.string());
    14241430    }
    14251431   
     
    14271433}
    14281434
    1429 static Vector<WebsiteData::Entry> filterForTopLevelDomains(const Vector<String>& topLevelDomains, const Vector<WebsiteData::Entry>& foundValues)
     1435static Vector<WebsiteData::Entry> filterForRegistrableDomains(const Vector<RegistrableDomain>& registrableDomains, const Vector<WebsiteData::Entry>& foundValues)
    14301436{
    14311437    Vector<WebsiteData::Entry> result;
    14321438    for (const auto& value : foundValues) {
    1433         if (topLevelDomains.contains(value.origin.host))
     1439        if (registrableDomains.contains(RegistrableDomain { value.origin.host }))
    14341440            result.append(value);
    14351441    }
     
    14381444}
    14391445
    1440 void NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
     1446void NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
    14411447{
    14421448    OptionSet<WebsiteDataFetchOption> fetchOptions = WebsiteDataFetchOption::DoNotCreateProcesses;
     
    14691475    };
    14701476   
    1471     auto callbackAggregator = adoptRef(*new CallbackAggregator([this, completionHandler = WTFMove(completionHandler), shouldNotifyPage] (const HashSet<String>& originsWithData) mutable {
     1477    auto callbackAggregator = adoptRef(*new CallbackAggregator([this, completionHandler = WTFMove(completionHandler), shouldNotifyPage] (const HashSet<String>& domainsWithData) mutable {
    14721478        if (shouldNotifyPage)
    1473             parentProcessConnection()->send(Messages::NetworkProcessProxy::NotifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished(), 0);
     1479            parentProcessConnection()->send(Messages::NetworkProcessProxy::NotifyWebsiteDataDeletionForRegistrableDomainsFinished(), 0);
    14741480       
    1475         RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), originsWithData = crossThreadCopy(originsWithData)] () mutable {
    1476             completionHandler(originsWithData);
     1481        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), domainsWithData = crossThreadCopy(domainsWithData)] () mutable {
     1482            completionHandler(domainsWithData);
    14771483        });
    14781484    }));
     
    14841490        if (auto* networkStorageSession = storageSession(sessionID)) {
    14851491            networkStorageSession->getHostnamesWithCookies(websiteDataStore.hostNamesWithCookies);
    1486             hostnamesWithCookiesToDelete = filterForTopLevelDomains(topPrivatelyControlledDomains, websiteDataStore.hostNamesWithCookies);
     1492            hostnamesWithCookiesToDelete = filterForRegistrableDomains(domains, websiteDataStore.hostNamesWithCookies);
    14871493            networkStorageSession->deleteCookiesForHostnames(hostnamesWithCookiesToDelete);
    14881494        }
     
    14941500        if (auto* networkStorageSession = storageSession(sessionID)) {
    14951501            getHostNamesWithHSTSCache(*networkStorageSession, websiteDataStore.hostNamesWithHSTSCache);
    1496             hostnamesWithHSTSToDelete = filterForTopLevelDomains(topPrivatelyControlledDomains, websiteDataStore.hostNamesWithHSTSCache);
     1502            hostnamesWithHSTSToDelete = filterForRegistrableDomains(domains, websiteDataStore.hostNamesWithHSTSCache);
    14971503            deleteHSTSCacheForHostNames(*networkStorageSession, hostnamesWithHSTSToDelete);
    14981504        }
     
    15091515   
    15101516    if (websiteDataTypes.contains(WebsiteDataType::DOMCache)) {
    1511         CacheStorage::Engine::fetchEntries(*this, sessionID, fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes), [this, topPrivatelyControlledDomains, sessionID, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {
     1517        CacheStorage::Engine::fetchEntries(*this, sessionID, fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes), [this, domains, sessionID, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {
    15121518           
    1513             auto entriesToDelete = filterForTopLevelDomains(topPrivatelyControlledDomains, entries);
     1519            auto entriesToDelete = filterForRegistrableDomains(domains, entries);
    15141520
    15151521            callbackAggregator->m_websiteData.entries.appendVector(entriesToDelete);
     
    15241530    if (!path.isEmpty() && websiteDataTypes.contains(WebsiteDataType::IndexedDBDatabases)) {
    15251531        // FIXME: Pick the right database store based on the session ID.
    1526         postStorageTask(CrossThreadTask([this, sessionID, callbackAggregator = callbackAggregator.copyRef(), path = WTFMove(path), topPrivatelyControlledDomains]() mutable {
    1527             RunLoop::main().dispatch([this, sessionID, topPrivatelyControlledDomains = crossThreadCopy(topPrivatelyControlledDomains), callbackAggregator = callbackAggregator.copyRef(), securityOrigins = indexedDatabaseOrigins(path)] {
     1532        postStorageTask(CrossThreadTask([this, sessionID, callbackAggregator = callbackAggregator.copyRef(), path = WTFMove(path), domains]() mutable {
     1533            RunLoop::main().dispatch([this, sessionID, domains = crossThreadCopy(domains), callbackAggregator = callbackAggregator.copyRef(), securityOrigins = indexedDatabaseOrigins(path)] {
    15281534                Vector<SecurityOriginData> entriesToDelete;
    15291535                for (const auto& securityOrigin : securityOrigins) {
    1530                     if (!topPrivatelyControlledDomains.contains(securityOrigin.host))
     1536                    if (!domains.contains(RegistrableDomain { securityOrigin.host }))
    15311537                        continue;
    15321538
     
    15441550    path = m_swDatabasePaths.get(sessionID);
    15451551    if (!path.isEmpty() && websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) {
    1546         swServerForSession(sessionID).getOriginsWithRegistrations([this, sessionID, topPrivatelyControlledDomains, callbackAggregator = callbackAggregator.copyRef()](const HashSet<SecurityOriginData>& securityOrigins) mutable {
     1552        swServerForSession(sessionID).getOriginsWithRegistrations([this, sessionID, domains, callbackAggregator = callbackAggregator.copyRef()](const HashSet<SecurityOriginData>& securityOrigins) mutable {
    15471553            for (auto& securityOrigin : securityOrigins) {
    1548                 if (!topPrivatelyControlledDomains.contains(securityOrigin.host))
     1554                if (!domains.contains(RegistrableDomain { securityOrigin.host }))
    15491555                    continue;
    15501556                callbackAggregator->m_websiteData.entries.append({ securityOrigin, WebsiteDataType::ServiceWorkerRegistrations, 0 });
     
    15561562   
    15571563    if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) {
    1558         fetchDiskCacheEntries(cache(), sessionID, fetchOptions, [this, topPrivatelyControlledDomains, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {
     1564        fetchDiskCacheEntries(cache(), sessionID, fetchOptions, [this, domains, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {
    15591565
    15601566            Vector<SecurityOriginData> entriesToDelete;
    15611567            for (auto& entry : entries) {
    1562                 if (!topPrivatelyControlledDomains.contains(entry.origin.host))
     1568                if (!domains.contains(RegistrableDomain { entry.origin.host }))
    15631569                    continue;
    15641570                entriesToDelete.append(entry.origin);
     
    15701576}
    15711577
    1572 void NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
     1578void NetworkProcess::registrableDomainsWithWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&& completionHandler)
    15731579{
    15741580    OptionSet<WebsiteDataFetchOption> fetchOptions = WebsiteDataFetchOption::DoNotCreateProcesses;
    15751581   
    15761582    struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {
    1577         explicit CallbackAggregator(CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
     1583        explicit CallbackAggregator(CompletionHandler<void(HashSet<RegistrableDomain>&&)>&& completionHandler)
    15781584            : m_completionHandler(WTFMove(completionHandler))
    15791585        {
     
    15831589        {
    15841590            RunLoop::main().dispatch([completionHandler = WTFMove(m_completionHandler), websiteData = WTFMove(m_websiteData)] () mutable {
    1585                 HashSet<String> origins;
     1591                HashSet<RegistrableDomain> domains;
    15861592                for (const auto& hostnameWithCookies : websiteData.hostNamesWithCookies)
    1587                     origins.add(hostnameWithCookies);
    1588                
     1593                    domains.add(RegistrableDomain { hostnameWithCookies });
     1594
    15891595                for (const auto& hostnameWithHSTS : websiteData.hostNamesWithHSTSCache)
    1590                     origins.add(hostnameWithHSTS);
    1591                
     1596                    domains.add(RegistrableDomain { hostnameWithHSTS });
     1597
    15921598                for (const auto& entry : websiteData.entries)
    1593                     origins.add(entry.origin.host);
    1594                
    1595                 completionHandler(WTFMove(origins));
     1599                    domains.add(RegistrableDomain { entry.origin.host });
     1600
     1601                completionHandler(WTFMove(domains));
    15961602            });
    15971603        }
    15981604       
    1599         CompletionHandler<void(HashSet<String>&&)> m_completionHandler;
     1605        CompletionHandler<void(HashSet<RegistrableDomain>&&)> m_completionHandler;
    16001606        WebsiteData m_websiteData;
    16011607    };
    16021608   
    1603     auto callbackAggregator = adoptRef(*new CallbackAggregator([this, completionHandler = WTFMove(completionHandler), shouldNotifyPage] (HashSet<String>&& originsWithData) mutable {
     1609    auto callbackAggregator = adoptRef(*new CallbackAggregator([this, completionHandler = WTFMove(completionHandler), shouldNotifyPage] (HashSet<RegistrableDomain>&& domainsWithData) mutable {
    16041610        if (shouldNotifyPage)
    1605             parentProcessConnection()->send(Messages::NetworkProcessProxy::NotifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished(), 0);
    1606 
    1607         RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), originsWithData = crossThreadCopy(originsWithData)] () mutable {
    1608             completionHandler(WTFMove(originsWithData));
     1611            parentProcessConnection()->send(Messages::NetworkProcessProxy::NotifyWebsiteDataScanForRegistrableDomainsFinished(), 0);
     1612
     1613        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), domainsWithData = crossThreadCopy(domainsWithData)] () mutable {
     1614            completionHandler(WTFMove(domainsWithData));
    16091615        });
    16101616    }));
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r241603 r242056  
    3838#include <WebCore/IDBKeyData.h>
    3939#include <WebCore/IDBServer.h>
     40#include <WebCore/RegistrableDomain.h>
    4041#include <WebCore/ServiceWorkerIdentifier.h>
    4142#include <WebCore/ServiceWorkerTypes.h>
     
    111112    WTF_MAKE_NONCOPYABLE(NetworkProcess);
    112113public:
     114    using RegistrableDomain = WebCore::RegistrableDomain;
     115    using TopFrameDomain = WebCore::RegistrableDomain;
     116    using SubFrameDomain = WebCore::RegistrableDomain;
     117    using SubResourceDomain = WebCore::RegistrableDomain;
     118    using RedirectDomain = WebCore::RegistrableDomain;
     119    using RedirectedFromDomain = WebCore::RegistrableDomain;
     120    using RedirectedToDomain = WebCore::RegistrableDomain;
     121    using NavigatedFromDomain = WebCore::RegistrableDomain;
     122    using NavigatedToDomain = WebCore::RegistrableDomain;
     123    using DomainInNeedOfStorageAccess = WebCore::RegistrableDomain;
     124    using OpenerDomain = WebCore::RegistrableDomain;
     125    using OpenerPageID = uint64_t;
     126    using PageID = uint64_t;
     127    using FrameID = uint64_t;
     128
    113129    NetworkProcess(AuxiliaryProcessInitializationParameters&&);
    114130    ~NetworkProcess();
     
    181197
    182198#if ENABLE(RESOURCE_LOAD_STATISTICS)
    183     void clearPrevalentResource(PAL::SessionID, const String& resourceDomain, CompletionHandler<void()>&&);
    184     void clearUserInteraction(PAL::SessionID, const String& resourceDomain, CompletionHandler<void()>&&);
    185     void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(PAL::SessionID, OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
     199    void clearPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
     200    void clearUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
     201    void deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(PAL::SessionID, OptionSet<WebsiteDataType>, Vector<RegistrableDomain>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
    186202    void dumpResourceLoadStatistics(PAL::SessionID, CompletionHandler<void(String)>&&);
    187     void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
    188     void isGrandfathered(PAL::SessionID, const String& targetPrimaryDomain, CompletionHandler<void(bool)>&&);
    189     void isPrevalentResource(PAL::SessionID, const String& resourceDomain, CompletionHandler<void(bool)>&&);
    190     void isVeryPrevalentResource(PAL::SessionID, const String& resourceDomain, CompletionHandler<void(bool)>&&);
     203    void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<RegistrableDomain>& domainsToBlock, CompletionHandler<void()>&&);
     204    void isGrandfathered(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     205    void isPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     206    void isVeryPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
    191207    void setAgeCapForClientSideCookies(PAL::SessionID, Optional<Seconds>, CompletionHandler<void()>&&);
    192     void isRegisteredAsRedirectingTo(PAL::SessionID, const String& redirectedFrom, const String& redirectedTo, CompletionHandler<void(bool)>&&);
    193     void isRegisteredAsSubFrameUnder(PAL::SessionID, const String& subframe, const String& topFrame, CompletionHandler<void(bool)>&&);
    194     void isRegisteredAsSubresourceUnder(PAL::SessionID, const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&&);
    195     void setGrandfathered(PAL::SessionID, const String& resourceDomain, bool isGrandfathered, CompletionHandler<void()>&&);
     208    void isRegisteredAsRedirectingTo(PAL::SessionID, const RedirectedFromDomain&, const RedirectedToDomain&, CompletionHandler<void(bool)>&&);
     209    void isRegisteredAsSubFrameUnder(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&);
     210    void isRegisteredAsSubresourceUnder(PAL::SessionID, const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&);
     211    void setGrandfathered(PAL::SessionID, const RegistrableDomain&, bool isGrandfathered, CompletionHandler<void()>&&);
    196212    void setMaxStatisticsEntries(PAL::SessionID, uint64_t maximumEntryCount, CompletionHandler<void()>&&);
    197     void setPrevalentResource(PAL::SessionID, const String& resourceDomain, CompletionHandler<void()>&&);
    198     void setPrevalentResourceForDebugMode(PAL::SessionID, String resourceDomain, CompletionHandler<void()>&&);
    199     void setVeryPrevalentResource(PAL::SessionID, const String& resourceDomain, CompletionHandler<void()>&&);
     213    void setPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
     214    void setPrevalentResourceForDebugMode(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
     215    void setVeryPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
    200216    void setPruneEntriesDownTo(PAL::SessionID, uint64_t pruneTargetCount, CompletionHandler<void()>&&);
    201     void hadUserInteraction(PAL::SessionID, const String& resourceDomain, CompletionHandler<void(bool)>&&);
    202     void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     217    void hadUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     218    void hasStorageAccessForFrame(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);
    203219    void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&);
    204     void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
    205     void hasStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
    206     void logFrameNavigation(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame);
    207     void logUserInteraction(PAL::SessionID, const String& targetPrimaryDomain, CompletionHandler<void()>&&);
     220    void grantStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
     221    void hasStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&);
     222    void logFrameNavigation(PAL::SessionID, const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame);
     223    void logUserInteraction(PAL::SessionID, const TopFrameDomain&, CompletionHandler<void()>&&);
    208224    void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
    209     void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
    210     void requestStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
    211     void requestStorageAccessGranted(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
     225    void removePrevalentDomains(PAL::SessionID, const Vector<RegistrableDomain>&);
     226    void requestStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
     227    void requestStorageAccessGranted(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
    212228    void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
    213229    void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&);
     
    218234    void setCacheMaxAgeCapForPrevalentResources(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
    219235    void setGrandfatheringTime(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
    220     void setLastSeen(PAL::SessionID, const String& resourceDomain, Seconds, CompletionHandler<void()>&&);
     236    void setLastSeen(PAL::SessionID, const RegistrableDomain&, Seconds, CompletionHandler<void()>&&);
    221237    void setMinimumTimeBetweenDataRecordsRemoval(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
    222238    void setNotifyPagesWhenDataRecordsWereScanned(PAL::SessionID, bool value, CompletionHandler<void()>&&);
     
    225241    void setResourceLoadStatisticsDebugMode(PAL::SessionID, bool debugMode, CompletionHandler<void()>&&d);
    226242    void setShouldClassifyResourcesBeforeDataRecordsRemoval(PAL::SessionID, bool value, CompletionHandler<void()>&&);
    227     void setSubframeUnderTopFrameOrigin(PAL::SessionID, String subframe, String topFrame, CompletionHandler<void()>&&);
    228     void setSubresourceUnderTopFrameOrigin(PAL::SessionID, String subresource, String topFrame, CompletionHandler<void()>&&);
    229     void setSubresourceUniqueRedirectTo(PAL::SessionID, String subresource, String hostNameRedirectedTo, CompletionHandler<void()>&&);
    230     void setSubresourceUniqueRedirectFrom(PAL::SessionID, String subresource, String hostNameRedirectedFrom, CompletionHandler<void()>&&);
     243    void setSubframeUnderTopFrameOrigin(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
     244    void setSubresourceUnderTopFrameOrigin(PAL::SessionID, const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
     245    void setSubresourceUniqueRedirectTo(PAL::SessionID, const SubResourceDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     246    void setSubresourceUniqueRedirectFrom(PAL::SessionID, const SubResourceDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
    231247    void setTimeToLiveUserInteraction(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
    232     void setTopFrameUniqueRedirectTo(PAL::SessionID, String topFrameHostName, String hostNameRedirectedTo, CompletionHandler<void()>&&);
    233     void setTopFrameUniqueRedirectFrom(PAL::SessionID, String topFrameHostName, String hostNameRedirectedFrom, CompletionHandler<void()>&&);
    234     void topPrivatelyControlledDomainsWithWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&&);
     248    void setTopFrameUniqueRedirectTo(PAL::SessionID, const TopFrameDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     249    void setTopFrameUniqueRedirectFrom(PAL::SessionID, const TopFrameDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
     250    void registrableDomainsWithWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&);
    235251#endif
    236252
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r241603 r242056  
    8484
    8585#if ENABLE(RESOURCE_LOAD_STATISTICS)
    86     ClearPrevalentResource(PAL::SessionID sessionID, String resourceDomain) -> () Async
    87     ClearUserInteraction(PAL::SessionID sessionID, String resourceDomain) -> () Async
     86    ClearPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     87    ClearUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
    8888    DumpResourceLoadStatistics(PAL::SessionID sessionID) -> (String dumpedStatistics) Async
    8989    SetResourceLoadStatisticsEnabled(bool enabled)
    90     UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<String> domainsToBlock) -> () Async
    91     IsGrandfathered(PAL::SessionID sessionID, String targetPrimaryDomain) -> (bool isGrandfathered) Async
    92     IsPrevalentResource(PAL::SessionID sessionID, String targetPrimaryDomain) -> (bool isPrevalent) Async
    93     IsVeryPrevalentResource(PAL::SessionID sessionID, String targetPrimaryDomain) -> (bool isVeryPrevalent) Async
     90    UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsToBlock) -> () Async
     91    IsGrandfathered(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain) -> (bool isGrandfathered) Async
     92    IsPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain) -> (bool isPrevalent) Async
     93    IsVeryPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain) -> (bool isVeryPrevalent) Async
    9494    SetAgeCapForClientSideCookies(PAL::SessionID sessionID, Optional<Seconds> seconds) -> () Async
    95     SetLastSeen(PAL::SessionID sessionID, String resourceDomain, Seconds seconds) -> () Async
    96     SetPrevalentResource(PAL::SessionID sessionID, String resourceDomain) -> () Async
    97     SetPrevalentResourceForDebugMode(PAL::SessionID sessionID, String resourceDomain) -> () Async
    98     HadUserInteraction(PAL::SessionID sessionID, String resourceDomain) -> (bool hadUserInteraction) Async
    99     HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
    100     HasStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
     95    SetLastSeen(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, Seconds seconds) -> () Async
     96    SetPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     97    SetPrevalentResourceForDebugMode(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     98    HadUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> (bool hadUserInteraction) Async
     99    HasStorageAccessForFrame(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
     100    HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
    101101    GetAllStorageAccessEntries(PAL::SessionID sessionID) -> (Vector<String> domains) Async
    102     GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted) -> (bool accessGranted) Async
    103     IsRegisteredAsRedirectingTo(PAL::SessionID sessionID, String redirectedFrom, String redirectedTo) -> (bool isRedirectingTo) Async
    104     IsRegisteredAsSubFrameUnder(PAL::SessionID sessionID, String subframe, String topFrame) -> (bool isSubframeUnder) Async
    105     IsRegisteredAsSubresourceUnder(PAL::SessionID sessionID, String subresource, String topFrame) -> (bool isSubresourceUnder) Async
    106     LogFrameNavigation(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, String sourcePrimaryDomain, String targetHost, String mainFrameHost, bool isRedirect, bool isMainFrame)
    107     LogUserInteraction(PAL::SessionID sessionID, String targetPrimaryDomain) -> () Async
     102    GrantStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted) -> (bool accessGranted) Async
     103    IsRegisteredAsRedirectingTo(PAL::SessionID sessionID, WebCore::RegistrableDomain redirectedFromDomain, WebCore::RegistrableDomain redirectedToDomain) -> (bool isRedirectingTo) Async
     104    IsRegisteredAsSubFrameUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubframeUnder) Async
     105    IsRegisteredAsSubresourceUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubresourceUnder) Async
     106    LogFrameNavigation(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain sourceDomain, bool isRedirect, bool isMainFrame)
     107    LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain) -> () Async
    108108    RemoveAllStorageAccess(PAL::SessionID sessionID) -> () Async
    109     RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction)
    110     RequestStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled) -> (enum:uint8_t WebKit::StorageAccessStatus storageAccessStatus) Async
     109    RemovePrevalentDomains(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsWithInteraction)
     110    RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled) -> (enum:uint8_t WebKit::StorageAccessStatus storageAccessStatus) Async
    111111    ResetParametersToDefaultValues(PAL::SessionID sessionID) -> () Async
    112112    ScheduleClearInMemoryAndPersistent(PAL::SessionID sessionID, Optional<WallTime> modifiedSince, enum:bool WebKit::ShouldGrandfatherStatistics shouldGrandfather) -> () Async
     
    115115    SubmitTelemetry(PAL::SessionID sessionID) -> () Async
    116116    SetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, Seconds seconds) -> () Async
    117     SetGrandfathered(PAL::SessionID sessionID, String resourceDomain, bool isGrandfathered) -> () Async
     117    SetGrandfathered(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, bool isGrandfathered) -> () Async
    118118    SetGrandfatheringTime(PAL::SessionID sessionID, Seconds seconds) -> () Async
    119119    SetMaxStatisticsEntries(PAL::SessionID sessionID, uint64_t maximumEntryCount) -> () Async
     
    124124    SetNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID sessionID, bool value) -> () Async
    125125    SetResourceLoadStatisticsDebugMode(PAL::SessionID sessionID, bool debugMode) -> () Async
    126     SetVeryPrevalentResource(PAL::SessionID sessionID, String resourceDomain) -> () Async
    127     SetSubframeUnderTopFrameOrigin(PAL::SessionID sessionID, String subframe, String topFrame) -> () Async
    128     SetSubresourceUnderTopFrameOrigin(PAL::SessionID sessionID, String subresource, String topFrame) -> () Async
    129     SetSubresourceUniqueRedirectTo(PAL::SessionID sessionID, String subresource, String hostNameRedirectedTo) -> () Async
    130     SetSubresourceUniqueRedirectFrom(PAL::SessionID sessionID, String subresource, String hostNameRedirectedFrom) -> () Async
     126    SetVeryPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
     127    SetSubframeUnderTopFrameOrigin(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> () Async
     128    SetSubresourceUnderTopFrameOrigin(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain topFrameDomain) -> () Async
     129    SetSubresourceUniqueRedirectTo(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain redirectedToDomain) -> () Async
     130    SetSubresourceUniqueRedirectFrom(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain redirectedFromDomain) -> () Async
    131131    SetTimeToLiveUserInteraction(PAL::SessionID sessionID, Seconds seconds) -> () Async
    132     SetTopFrameUniqueRedirectTo(PAL::SessionID sessionID, String topFrameHostName, String hostNameRedirectedTo) -> () Async
    133     SetTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, String topFrameHostName, String hostNameRedirectedFrom) -> () Async
     132    SetTopFrameUniqueRedirectTo(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain redirectedToDomain) -> () Async
     133    SetTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain redirectedFromDomain) -> () Async
    134134    ResetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID) -> () Async
    135135#endif
  • trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

    r241317 r242056  
    4949#include <WebCore/NetworkLoadMetrics.h>
    5050#include <WebCore/NetworkStorageSession.h>
     51#include <WebCore/RegistrableDomain.h>
    5152#include <WebCore/SameSiteInfo.h>
    5253#include <WebCore/SecurityOrigin.h>
     
    980981    auto escapedPageID = escapeIDForJSON(pageID);
    981982    auto escapedIdentifier = escapeIDForJSON(identifier);
    982     bool hasStorageAccess = (frameID && pageID) ? networkStorageSession.hasStorageAccess(url.string(), firstParty.string(), frameID.value(), pageID.value()) : false;
     983    bool hasStorageAccess = (frameID && pageID) ? networkStorageSession.hasStorageAccess(WebCore::RegistrableDomain { url }, WebCore::RegistrableDomain { firstParty }, frameID.value(), pageID.value()) : false;
    983984
    984985#define LOCAL_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(networkStorageSession.sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - %s::" fmt, loggedObject, label.utf8().data(), ##__VA_ARGS__)
  • trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp

    r241451 r242056  
    118118}
    119119
    120 void NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
     120void NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&& completionHandler)
    121121{
    122     m_networkProcess->deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(m_sessionID, dataTypes, WTFMove(topPrivatelyControlledDomains), shouldNotifyPage, WTFMove(completionHandler));
     122    m_networkProcess->deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(m_sessionID, dataTypes, WTFMove(domains), shouldNotifyPage, WTFMove(completionHandler));
    123123}
    124124
    125 void NetworkSession::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
     125void NetworkSession::registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&& completionHandler)
    126126{
    127     m_networkProcess->topPrivatelyControlledDomainsWithWebsiteData(m_sessionID, dataTypes, shouldNotifyPage, WTFMove(completionHandler));
     127    m_networkProcess->registrableDomainsWithWebsiteData(m_sessionID, dataTypes, shouldNotifyPage, WTFMove(completionHandler));
    128128}
    129129#endif
  • trunk/Source/WebKit/NetworkProcess/NetworkSession.h

    r241451 r242056  
    2626#pragma once
    2727
     28#include <WebCore/RegistrableDomain.h>
    2829#include <pal/SessionID.h>
    2930#include <wtf/HashSet.h>
     
    7273    void setResourceLoadStatisticsEnabled(bool);
    7374    void notifyResourceLoadStatisticsProcessed();
    74     void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
    75     void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&&);
     75    void deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<WebCore::RegistrableDomain>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&);
     76    void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<WebCore::RegistrableDomain>&&)>&&);
    7677    void logDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned significantFigures, WebCore::ShouldSample);
    7778    void notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins);
  • trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp

    r240579 r242056  
    6363#include <WebCore/RectEdges.h>
    6464#include <WebCore/Region.h>
     65#include <WebCore/RegistrableDomain.h>
    6566#include <WebCore/ResourceError.h>
    6667#include <WebCore/ResourceLoadStatistics.h>
     
    26722673void ArgumentCoder<ResourceLoadStatistics>::encode(Encoder& encoder, const WebCore::ResourceLoadStatistics& statistics)
    26732674{
    2674     encoder << statistics.highLevelDomain;
     2675    encoder << statistics.registrableDomain;
    26752676   
    26762677    encoder << statistics.lastSeen.secondsSinceEpoch().value();
     
    27162717{
    27172718    ResourceLoadStatistics statistics;
    2718     if (!decoder.decode(statistics.highLevelDomain))
    2719         return WTF::nullopt;
    2720    
     2719    Optional<RegistrableDomain> registrableDomain;
     2720    decoder >> registrableDomain;
     2721    if (!registrableDomain)
     2722        return WTF::nullopt;
     2723    statistics.registrableDomain = *registrableDomain;
     2724
    27212725    double lastSeenTimeAsDouble;
    27222726    if (!decoder.decode(lastSeenTimeAsDouble))
  • trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm

    r240243 r242056  
    2929#if ENABLE(RESOURCE_LOAD_STATISTICS)
    3030
     31#import <WebCore/RegistrableDomain.h>
    3132#import <wtf/text/WTFString.h>
    3233
     
    5354        auto* debugManualPrevalentResource = [[NSUserDefaults standardUserDefaults] stringForKey:@"ResourceLoadStatisticsManualPrevalentResource"];
    5455        if (debugManualPrevalentResource)
    55             setPrevalentResourceForDebugMode(debugManualPrevalentResource);
     56            setPrevalentResourceForDebugMode(RegistrableDomain { debugManualPrevalentResource });
    5657
    5758        Seconds cacheMaxAgeCapForPrevalentResources([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsCacheMaxAgeCap"]);
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r241451 r242056  
    5050#include "WebsiteDataStoreClient.h"
    5151#include <WebCore/ClientOrigin.h>
     52#include <WebCore/RegistrableDomain.h>
    5253#include <wtf/CompletionHandler.h>
    5354
     
    415416    }
    416417
    417     sendWithAsyncReply(Messages::NetworkProcess::UpdatePrevalentDomainsToBlockCookiesFor(sessionID, domainsToBlock), WTFMove(completionHandler));
     418    Vector<RegistrableDomain> registrableDomainsToBlock;
     419    registrableDomainsToBlock.reserveInitialCapacity(domainsToBlock.size());
     420    for (auto& domainString : domainsToBlock)
     421        registrableDomainsToBlock.uncheckedAppend(RegistrableDomain { domainString });
     422
     423    sendWithAsyncReply(Messages::NetworkProcess::UpdatePrevalentDomainsToBlockCookiesFor(sessionID, registrableDomainsToBlock), WTFMove(completionHandler));
    418424}
    419425
     
    425431    }
    426432
    427     sendWithAsyncReply(Messages::NetworkProcess::IsPrevalentResource(sessionID, resourceDomain), WTFMove(completionHandler));
     433    sendWithAsyncReply(Messages::NetworkProcess::IsPrevalentResource(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    428434}
    429435
     
    435441    }
    436442
    437     sendWithAsyncReply(Messages::NetworkProcess::IsVeryPrevalentResource(sessionID, resourceDomain), WTFMove(completionHandler));
     443    sendWithAsyncReply(Messages::NetworkProcess::IsVeryPrevalentResource(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    438444}
    439445
     
    445451    }
    446452
    447     sendWithAsyncReply(Messages::NetworkProcess::SetPrevalentResource(sessionID, resourceDomain), WTFMove(completionHandler));
     453    sendWithAsyncReply(Messages::NetworkProcess::SetPrevalentResource(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    448454}
    449455
     
    455461    }
    456462
    457     sendWithAsyncReply(Messages::NetworkProcess::SetPrevalentResourceForDebugMode(sessionID, resourceDomain), WTFMove(completionHandler));
     463    sendWithAsyncReply(Messages::NetworkProcess::SetPrevalentResourceForDebugMode(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    458464}
    459465
     
    465471    }
    466472
    467     sendWithAsyncReply(Messages::NetworkProcess::SetVeryPrevalentResource(sessionID, resourceDomain), WTFMove(completionHandler));
     473    sendWithAsyncReply(Messages::NetworkProcess::SetVeryPrevalentResource(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    468474}
    469475
     
    475481    }
    476482   
    477     sendWithAsyncReply(Messages::NetworkProcess::SetLastSeen(sessionID, resourceDomain, lastSeen), WTFMove(completionHandler));
     483    sendWithAsyncReply(Messages::NetworkProcess::SetLastSeen(sessionID, RegistrableDomain { resourceDomain }, lastSeen), WTFMove(completionHandler));
    478484}
    479485
     
    485491    }
    486492   
    487     sendWithAsyncReply(Messages::NetworkProcess::ClearPrevalentResource(sessionID, resourceDomain), WTFMove(completionHandler));
     493    sendWithAsyncReply(Messages::NetworkProcess::ClearPrevalentResource(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    488494}
    489495   
     
    525531    }
    526532
    527     sendWithAsyncReply(Messages::NetworkProcess::LogUserInteraction(sessionID, resourceDomain), WTFMove(completionHandler));
     533    sendWithAsyncReply(Messages::NetworkProcess::LogUserInteraction(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    528534}
    529535
     
    535541    }
    536542   
    537     sendWithAsyncReply(Messages::NetworkProcess::HadUserInteraction(sessionID, resourceDomain), WTFMove(completionHandler));
     543    sendWithAsyncReply(Messages::NetworkProcess::HadUserInteraction(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    538544}
    539545
     
    545551    }
    546552   
    547     sendWithAsyncReply(Messages::NetworkProcess::ClearUserInteraction(sessionID, resourceDomain), WTFMove(completionHandler));
     553    sendWithAsyncReply(Messages::NetworkProcess::ClearUserInteraction(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    548554}
    549555
     
    595601    }
    596602   
    597     sendWithAsyncReply(Messages::NetworkProcess::SetSubframeUnderTopFrameOrigin(sessionID, subframe, topFrame), WTFMove(completionHandler));
     603    sendWithAsyncReply(Messages::NetworkProcess::SetSubframeUnderTopFrameOrigin(sessionID, RegistrableDomain { subframe }, RegistrableDomain { topFrame }), WTFMove(completionHandler));
    598604}
    599605
     
    605611    }
    606612   
    607     sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsRedirectingTo(sessionID, redirectedFrom, redirectedTo), WTFMove(completionHandler));
     613    sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsRedirectingTo(sessionID, RegistrableDomain { redirectedFrom }, RegistrableDomain { redirectedTo }), WTFMove(completionHandler));
    608614}
    609615
     
    615621    }
    616622   
    617     sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsSubFrameUnder(sessionID, subFrame, topFrame), WTFMove(completionHandler));
     623    sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsSubFrameUnder(sessionID, RegistrableDomain { subFrame }, RegistrableDomain { topFrame }), WTFMove(completionHandler));
    618624}
    619625
     
    625631    }
    626632   
    627     sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUnderTopFrameOrigin(sessionID, subresource, topFrame), WTFMove(completionHandler));
     633    sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUnderTopFrameOrigin(sessionID, RegistrableDomain { subresource }, RegistrableDomain { topFrame }), WTFMove(completionHandler));
    628634}
    629635
     
    635641    }
    636642   
    637     sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsSubresourceUnder(sessionID, subresource, topFrame), WTFMove(completionHandler));
     643    sendWithAsyncReply(Messages::NetworkProcess::IsRegisteredAsSubresourceUnder(sessionID, RegistrableDomain { subresource }, RegistrableDomain { topFrame }), WTFMove(completionHandler));
    638644}
    639645
     
    645651    }
    646652   
    647     sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUniqueRedirectTo(sessionID, subresource, hostNameRedirectedTo), WTFMove(completionHandler));
     653    sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUniqueRedirectTo(sessionID, RegistrableDomain { subresource }, RegistrableDomain { hostNameRedirectedTo }), WTFMove(completionHandler));
    648654}
    649655
     
    655661    }
    656662   
    657     sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUniqueRedirectFrom(sessionID, subresource, hostNameRedirectedFrom), WTFMove(completionHandler));
     663    sendWithAsyncReply(Messages::NetworkProcess::SetSubresourceUniqueRedirectFrom(sessionID, RegistrableDomain { subresource }, RegistrableDomain { hostNameRedirectedFrom }), WTFMove(completionHandler));
    658664}
    659665
     
    665671    }
    666672   
    667     sendWithAsyncReply(Messages::NetworkProcess::SetTopFrameUniqueRedirectTo(sessionID, topFrameHostName, hostNameRedirectedTo), WTFMove(completionHandler));
     673    sendWithAsyncReply(Messages::NetworkProcess::SetTopFrameUniqueRedirectTo(sessionID, RegistrableDomain { topFrameHostName }, RegistrableDomain { hostNameRedirectedTo }), WTFMove(completionHandler));
    668674}
    669675
     
    675681    }
    676682   
    677     sendWithAsyncReply(Messages::NetworkProcess::SetTopFrameUniqueRedirectFrom(sessionID, topFrameHostName, hostNameRedirectedFrom), WTFMove(completionHandler));
     683    sendWithAsyncReply(Messages::NetworkProcess::SetTopFrameUniqueRedirectFrom(sessionID, RegistrableDomain { topFrameHostName }, RegistrableDomain { hostNameRedirectedFrom }), WTFMove(completionHandler));
    678684}
    679685
     
    685691    }
    686692   
    687     sendWithAsyncReply(Messages::NetworkProcess::IsGrandfathered(sessionID, resourceDomain), WTFMove(completionHandler));
     693    sendWithAsyncReply(Messages::NetworkProcess::IsGrandfathered(sessionID, RegistrableDomain { resourceDomain }), WTFMove(completionHandler));
    688694}
    689695
     
    695701    }
    696702   
    697     sendWithAsyncReply(Messages::NetworkProcess::SetGrandfathered(sessionID, resourceDomain, isGrandfathered), WTFMove(completionHandler));
     703    sendWithAsyncReply(Messages::NetworkProcess::SetGrandfathered(sessionID, RegistrableDomain { resourceDomain }, isGrandfathered), WTFMove(completionHandler));
    698704}
    699705
     
    705711    }
    706712
    707     sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID), WTFMove(completionHandler));
     713    sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, RegistrableDomain { resourceDomain }, RegistrableDomain { firstPartyDomain }, frameID, pageID), WTFMove(completionHandler));
    708714}
    709715
     
    715721    }
    716722   
    717     sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID), WTFMove(completionHandler));
     723    sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccess(sessionID, RegistrableDomain { resourceDomain }, RegistrableDomain { firstPartyDomain }, frameID, pageID), WTFMove(completionHandler));
    718724}
    719725
     
    725731    }
    726732
    727     sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, promptEnabled), WTFMove(completionHandler));
     733    sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, RegistrableDomain { resourceDomain }, RegistrableDomain { firstPartyDomain }, frameID, pageID, promptEnabled), WTFMove(completionHandler));
    728734}
    729735
     
    746752    }
    747753
    748     sendWithAsyncReply(Messages::NetworkProcess::GrantStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID.value(), pageID, userWasPrompted), WTFMove(completionHandler));
     754    // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally.
     755    if (!frameID) {
     756        completionHandler(false);
     757        return;
     758    }
     759
     760    sendWithAsyncReply(Messages::NetworkProcess::GrantStorageAccess(sessionID, RegistrableDomain { resourceDomain }, RegistrableDomain { firstPartyDomain }, frameID.value(), pageID, userWasPrompted), WTFMove(completionHandler));
    749761}
    750762
     
    900912}
    901913
    902 void NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished()
    903 {
    904     WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished();
    905 }
    906 
    907 void NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished()
    908 {
    909     WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished();
     914void NetworkProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished()
     915{
     916    WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished();
     917}
     918
     919void NetworkProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished()
     920{
     921    WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished();
    910922}
    911923
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r241451 r242056  
    190190    void logTestingEvent(PAL::SessionID, const String& event);
    191191    void notifyResourceLoadStatisticsProcessed();
    192     void notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished();
    193     void notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished();
     192    void notifyWebsiteDataDeletionForRegistrableDomainsFinished();
     193    void notifyWebsiteDataScanForRegistrableDomainsFinished();
    194194    void notifyResourceLoadStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins);
    195195#endif
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in

    r240676 r242056  
    4444    LogTestingEvent(PAL::SessionID sessionID, String event)
    4545    NotifyResourceLoadStatisticsProcessed()
    46     NotifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished()
    47     NotifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished()
     46    NotifyWebsiteDataDeletionForRegistrableDomainsFinished()
     47    NotifyWebsiteDataScanForRegistrableDomainsFinished()
    4848    NotifyResourceLoadStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins)
    4949    RequestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, String subFrameHost, String topFrameHost) -> (bool userDidGrantAccess) Async
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r242010 r242056  
    46204620    if (targetHost.isEmpty() || mainFrameHost.isEmpty() || targetHost == sourceURL.host())
    46214621        return;
    4622    
    4623     auto targetPrimaryDomain = ResourceLoadStatistics::primaryDomain(targetURL);
    4624     auto mainFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(pageURL);
    4625     auto sourcePrimaryDomain = ResourceLoadStatistics::primaryDomain(sourceURL);
    4626 
    4627     m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::LogFrameNavigation(m_websiteDataStore->sessionID(), targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost.toString(), mainFrameHost.toString(), isRedirect, frame.isMainFrame()));
     4622
     4623    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::LogFrameNavigation(m_websiteDataStore->sessionID(), RegistrableDomain { targetURL }, RegistrableDomain { pageURL }, RegistrableDomain { sourceURL }, isRedirect, frame.isMainFrame()));
    46284624}
    46294625#endif
     
    83598355void WebPageProxy::requestStorageAccessConfirm(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)
    83608356{
    8361     m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), ResourceLoadStatistics::primaryDomain(subFrameHost), ResourceLoadStatistics::primaryDomain(topFrameHost), WTFMove(completionHandler));
     8357    RegistrableDomain subFrameRegistrableDomain { subFrameHost };
     8358    RegistrableDomain topFrameRegistrableDomain { topFrameHost };
     8359    m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), subFrameRegistrableDomain.string(), topFrameRegistrableDomain.string(), WTFMove(completionHandler));
    83628360}
    83638361#endif
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r241868 r242056  
    320320{
    321321    for (auto& page : globalPageMap())
    322         page.value->postMessageToInjectedBundle("WebsiteDataScanForTopPrivatelyControlledDomainsFinished", nullptr);
    323 }
    324 
    325 void WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished()
     322        page.value->postMessageToInjectedBundle("WebsiteDataScanForRegistrableDomainsFinished", nullptr);
     323}
     324
     325void WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished()
    326326{
    327327    for (auto& page : globalPageMap())
    328         page.value->postMessageToInjectedBundle("WebsiteDataScanForTopPrivatelyControlledDomainsFinished", nullptr);
    329 }
    330 
    331 void WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished()
     328        page.value->postMessageToInjectedBundle("WebsiteDataScanForRegistrableDomainsFinished", nullptr);
     329}
     330
     331void WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished()
    332332{
    333333    for (auto& page : globalPageMap())
    334         page.value->postMessageToInjectedBundle("WebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished", nullptr);
     334        page.value->postMessageToInjectedBundle("WebsiteDataDeletionForRegistrableDomainsFinished", nullptr);
    335335}
    336336
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r241855 r242056  
    178178    static void notifyPageStatisticsTelemetryFinished(API::Object* messageBody);
    179179
    180     static void notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished();
    181     static void notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished();
     180    static void notifyWebsiteDataDeletionForRegistrableDomainsFinished();
     181    static void notifyWebsiteDataScanForRegistrableDomainsFinished();
    182182#endif
    183183
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.messages.in

    r240243 r242056  
    2424
    2525messages -> WebResourceLoadStatisticsStore {
    26     RequestStorageAccessUnderOpener(String domainReceivingUserInteraction, uint64_t openerPageID, String openerDomain)
     26    RequestStorageAccessUnderOpener(WebCore::RegistrableDomain domainReceivingUserInteraction, uint64_t openerPageID, WebCore::RegistrableDomain openerDomain)
    2727    ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> origins)
    2828}
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r241928 r242056  
    4949#include <WebCore/HTMLMediaElement.h>
    5050#include <WebCore/OriginLock.h>
     51#include <WebCore/RegistrableDomain.h>
    5152#include <WebCore/SecurityOrigin.h>
    5253#include <WebCore/SecurityOriginData.h>
     
    620621}
    621622
    622 #if ENABLE(RESOURCE_LOAD_STATISTICS)
    623 void WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, HashSet<String>&&)>&& completionHandler)
    624 {
    625     fetchDataAndApply(dataTypes, fetchOptions, m_queue.copyRef(), [topPrivatelyControlledDomains = crossThreadCopy(topPrivatelyControlledDomains), completionHandler = WTFMove(completionHandler)] (auto&& existingDataRecords) mutable {
    626         ASSERT(!RunLoop::isMain());
    627 
    628         Vector<WebsiteDataRecord> matchingDataRecords;
    629         HashSet<String> domainsWithMatchingDataRecords;
    630         for (auto&& dataRecord : existingDataRecords) {
    631             for (auto& topPrivatelyControlledDomain : topPrivatelyControlledDomains) {
    632                 if (dataRecord.matchesTopPrivatelyControlledDomain(topPrivatelyControlledDomain)) {
    633                     matchingDataRecords.append(WTFMove(dataRecord));
    634                     domainsWithMatchingDataRecords.add(topPrivatelyControlledDomain.isolatedCopy());
    635                     break;
    636                 }
    637             }
    638         }
    639         RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), matchingDataRecords = WTFMove(matchingDataRecords), domainsWithMatchingDataRecords = WTFMove(domainsWithMatchingDataRecords)] () mutable {
    640             completionHandler(WTFMove(matchingDataRecords), WTFMove(domainsWithMatchingDataRecords));
    641         });
    642     });
    643 }
    644 #endif
    645 
    646623static ProcessAccessType computeNetworkProcessAccessTypeForDataRemoval(OptionSet<WebsiteDataType> dataTypes, bool isNonPersistentStore)
    647624{
     
    13001277    for (auto& processPool : processPools()) {
    13011278        if (auto* process = processPool->networkProcess()) {
    1302             process->isPrevalentResource(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));
     1279            process->isPrevalentResource(m_sessionID, url.host().toString(), WTFMove(completionHandler));
    13031280            RELEASE_ASSERT(processPools().size() == 1);
    13041281            break;
     
    13191296
    13201297    for (auto& processPool : processPools()) {
    1321         processPool->ensureNetworkProcess().setPrevalentResource(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1298        processPool->ensureNetworkProcess().setPrevalentResource(m_sessionID, url.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    13221299    }
    13231300}
     
    13361313    for (auto& processPool : processPools()) {
    13371314        if (auto* process = processPool->networkProcess())
    1338             process->setPrevalentResourceForDebugMode(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1315            process->setPrevalentResourceForDebugMode(m_sessionID, url.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    13391316    }
    13401317}
     
    13511328    for (auto& processPool : processPools()) {
    13521329        if (auto* process = processPool->networkProcess()) {
    1353             process->isVeryPrevalentResource(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));
     1330            process->isVeryPrevalentResource(m_sessionID, url.host().toString(), WTFMove(completionHandler));
    13541331            ASSERT(processPools().size() == 1);
    13551332            break;
     
    13711348    for (auto& processPool : processPools()) {
    13721349        if (auto* process = processPool->networkProcess())
    1373             process->setVeryPrevalentResource(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1350            process->setVeryPrevalentResource(m_sessionID, url.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    13741351    }
    13751352}
     
    13851362}
    13861363
    1387 void WebsiteDataStore::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame, CompletionHandler<void()>&& completionHandler)
    1388 {
    1389     ASSERT(RunLoop::isMain());
    1390    
    1391     if (subframe.protocolIsAbout() || subframe.isEmpty() || topFrame.protocolIsAbout() || topFrame.isEmpty()) {
     1364void WebsiteDataStore::setSubframeUnderTopFrameOrigin(const URL& subFrameURL, const URL& topFrameURL, CompletionHandler<void()>&& completionHandler)
     1365{
     1366    ASSERT(RunLoop::isMain());
     1367   
     1368    if (subFrameURL.protocolIsAbout() || subFrameURL.isEmpty() || topFrameURL.protocolIsAbout() || topFrameURL.isEmpty()) {
    13921369        completionHandler();
    13931370        return;
     
    13981375    for (auto& processPool : processPools()) {
    13991376        if (auto* process = processPool->networkProcess())
    1400             process->setSubframeUnderTopFrameOrigin(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subframe), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1401     }
    1402 }
    1403 
    1404 void WebsiteDataStore::isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, CompletionHandler<void(bool)>&& completionHandler)
     1377            process->setSubframeUnderTopFrameOrigin(m_sessionID, subFrameURL.host().toString(), topFrameURL.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1378    }
     1379}
     1380
     1381void WebsiteDataStore::isRegisteredAsSubFrameUnder(const URL& subFrameURL, const URL& topFrameURL, CompletionHandler<void(bool)>&& completionHandler)
    14051382{
    14061383    ASSERT(RunLoop::isMain());
     
    14081385    for (auto& processPool : processPools()) {
    14091386        if (auto* process = processPool->networkProcess()) {
    1410             process->isRegisteredAsSubFrameUnder(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subFrame), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));
     1387            process->isRegisteredAsSubFrameUnder(m_sessionID, subFrameURL.host().toString(), topFrameURL.host().toString(), WTFMove(completionHandler));
    14111388            ASSERT(processPools().size() == 1);
    14121389            break;
     
    14151392}
    14161393
    1417 void WebsiteDataStore::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame, CompletionHandler<void()>&& completionHandler)
    1418 {
    1419     ASSERT(RunLoop::isMain());
    1420    
    1421     if (subresource.protocolIsAbout() || subresource.isEmpty() || topFrame.protocolIsAbout() || topFrame.isEmpty()) {
     1394void WebsiteDataStore::setSubresourceUnderTopFrameOrigin(const URL& subresourceURL, const URL& topFrameURL, CompletionHandler<void()>&& completionHandler)
     1395{
     1396    ASSERT(RunLoop::isMain());
     1397   
     1398    if (subresourceURL.protocolIsAbout() || subresourceURL.isEmpty() || topFrameURL.protocolIsAbout() || topFrameURL.isEmpty()) {
    14221399        completionHandler();
    14231400        return;
     
    14281405    for (auto& processPool : processPools()) {
    14291406        if (auto* process = processPool->networkProcess())
    1430             process->setSubresourceUnderTopFrameOrigin(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1431     }
    1432 }
    1433 
    1434 void WebsiteDataStore::isRegisteredAsSubresourceUnder(const URL& subresource, const URL& topFrame, CompletionHandler<void(bool)>&& completionHandler)
     1407            process->setSubresourceUnderTopFrameOrigin(m_sessionID, subresourceURL.host().toString(), topFrameURL.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1408    }
     1409}
     1410
     1411void WebsiteDataStore::isRegisteredAsSubresourceUnder(const URL& subresourceURL, const URL& topFrameURL, CompletionHandler<void(bool)>&& completionHandler)
    14351412{
    14361413    ASSERT(RunLoop::isMain());
     
    14381415    for (auto& processPool : processPools()) {
    14391416        if (auto* process = processPool->networkProcess()) {
    1440             process->isRegisteredAsSubresourceUnder(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));
     1417            process->isRegisteredAsSubresourceUnder(m_sessionID, subresourceURL.host().toString(), topFrameURL.host().toString(), WTFMove(completionHandler));
    14411418            ASSERT(processPools().size() == 1);
    14421419            break;
     
    14451422}
    14461423
    1447 void WebsiteDataStore::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    1448 {
    1449     ASSERT(RunLoop::isMain());
    1450    
    1451     if (subresource.protocolIsAbout() || subresource.isEmpty() || hostNameRedirectedTo.protocolIsAbout() || hostNameRedirectedTo.isEmpty()) {
     1424void WebsiteDataStore::setSubresourceUniqueRedirectTo(const URL& subresourceURL, const URL& urlRedirectedTo, CompletionHandler<void()>&& completionHandler)
     1425{
     1426    ASSERT(RunLoop::isMain());
     1427   
     1428    if (subresourceURL.protocolIsAbout() || subresourceURL.isEmpty() || urlRedirectedTo.protocolIsAbout() || urlRedirectedTo.isEmpty()) {
    14521429        completionHandler();
    14531430        return;
     
    14581435    for (auto& processPool : processPools()) {
    14591436        if (auto* process = processPool->networkProcess())
    1460             process->setSubresourceUniqueRedirectTo(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedTo), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1461     }
    1462 }
    1463 
    1464 void WebsiteDataStore::setSubresourceUniqueRedirectFrom(const URL& subresource, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    1465 {
    1466     ASSERT(RunLoop::isMain());
    1467    
    1468     if (subresource.protocolIsAbout() || subresource.isEmpty() || hostNameRedirectedFrom.protocolIsAbout() || hostNameRedirectedFrom.isEmpty()) {
     1437            process->setSubresourceUniqueRedirectTo(m_sessionID, subresourceURL.host().toString(), urlRedirectedTo.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1438    }
     1439}
     1440
     1441void WebsiteDataStore::setSubresourceUniqueRedirectFrom(const URL& subresourceURL, const URL& urlRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     1442{
     1443    ASSERT(RunLoop::isMain());
     1444   
     1445    if (subresourceURL.protocolIsAbout() || subresourceURL.isEmpty() || urlRedirectedFrom.protocolIsAbout() || urlRedirectedFrom.isEmpty()) {
    14691446        completionHandler();
    14701447        return;
     
    14751452    for (auto& processPool : processPools()) {
    14761453        if (auto* process = processPool->networkProcess())
    1477             process->setSubresourceUniqueRedirectFrom(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedFrom), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1478     }
    1479 }
    1480 
    1481 void WebsiteDataStore::setTopFrameUniqueRedirectTo(const URL& topFrameHostName, const URL& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)
    1482 {
    1483     ASSERT(RunLoop::isMain());
    1484    
    1485     if (topFrameHostName.protocolIsAbout() || topFrameHostName.isEmpty() || hostNameRedirectedTo.protocolIsAbout() || hostNameRedirectedTo.isEmpty()) {
     1454            process->setSubresourceUniqueRedirectFrom(m_sessionID, subresourceURL.host().toString(), urlRedirectedFrom.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1455    }
     1456}
     1457
     1458void WebsiteDataStore::setTopFrameUniqueRedirectTo(const URL& topFrameURL, const URL& urlRedirectedTo, CompletionHandler<void()>&& completionHandler)
     1459{
     1460    ASSERT(RunLoop::isMain());
     1461   
     1462    if (topFrameURL.protocolIsAbout() || topFrameURL.isEmpty() || urlRedirectedTo.protocolIsAbout() || urlRedirectedTo.isEmpty()) {
    14861463        completionHandler();
    14871464        return;
     
    14921469    for (auto& processPool : processPools()) {
    14931470        if (auto* process = processPool->networkProcess())
    1494             process->setTopFrameUniqueRedirectTo(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(topFrameHostName), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedTo), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1495     }
    1496 }
    1497 
    1498 void WebsiteDataStore::setTopFrameUniqueRedirectFrom(const URL& topFrameHostName, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)
    1499 {
    1500     ASSERT(RunLoop::isMain());
    1501    
    1502     if (topFrameHostName.protocolIsAbout() || topFrameHostName.isEmpty() || hostNameRedirectedFrom.protocolIsAbout() || hostNameRedirectedFrom.isEmpty()) {
     1471            process->setTopFrameUniqueRedirectTo(m_sessionID, topFrameURL.host().toString(), urlRedirectedTo.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1472    }
     1473}
     1474
     1475void WebsiteDataStore::setTopFrameUniqueRedirectFrom(const URL& topFrameURL, const URL& urlRedirectedFrom, CompletionHandler<void()>&& completionHandler)
     1476{
     1477    ASSERT(RunLoop::isMain());
     1478   
     1479    if (topFrameURL.protocolIsAbout() || topFrameURL.isEmpty() || urlRedirectedFrom.protocolIsAbout() || urlRedirectedFrom.isEmpty()) {
    15031480        completionHandler();
    15041481        return;
     
    15091486    for (auto& processPool : processPools()) {
    15101487        if (auto* process = processPool->networkProcess())
    1511             process->setTopFrameUniqueRedirectFrom(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(topFrameHostName), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedFrom), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    1512     }
    1513 }
    1514 
    1515 void WebsiteDataStore::isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, CompletionHandler<void(bool)>&& completionHandler)
     1488            process->setTopFrameUniqueRedirectFrom(m_sessionID, topFrameURL.host().toString(), urlRedirectedFrom.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1489    }
     1490}
     1491
     1492void WebsiteDataStore::isRegisteredAsRedirectingTo(const URL& urlRedirectedFrom, const URL& urlRedirectedTo, CompletionHandler<void(bool)>&& completionHandler)
    15161493{
    15171494    ASSERT(RunLoop::isMain());
     
    15191496    for (auto& processPool : processPools()) {
    15201497        if (auto* process = processPool->networkProcess()) {
    1521             process->isRegisteredAsRedirectingTo(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(hostRedirectedFrom), WebCore::ResourceLoadStatistics::primaryDomain(hostRedirectedTo), WTFMove(completionHandler));
     1498            process->isRegisteredAsRedirectingTo(m_sessionID, urlRedirectedFrom.host().toString(), urlRedirectedTo.host().toString(), WTFMove(completionHandler));
    15221499            ASSERT(processPools().size() == 1);
    15231500            break;
     
    15371514    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
    15381515
    1539     const auto& primaryDomain = WebCore::ResourceLoadStatistics::primaryDomain(url);
    15401516    for (auto& processPool : processPools()) {
    15411517        if (auto* process = processPool->networkProcess())
    1542             process->clearPrevalentResource(m_sessionID, primaryDomain, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1518            process->clearPrevalentResource(m_sessionID, url.host().toString(), [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    15431519    }
    15441520}
     
    16211597    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
    16221598
    1623     const auto& primaryDomain = WebCore::ResourceLoadStatistics::primaryDomain(url);
    16241599    for (auto& processPool : processPools()) {
    16251600        if (auto* process = processPool->networkProcess())
    1626             process->setLastSeen(m_sessionID, primaryDomain, seconds, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
     1601            process->setLastSeen(m_sessionID, url.host().toString(), seconds, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
    16271602    }
    16281603}
     
    16561631}
    16571632
    1658 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
     1633void WebsiteDataStore::hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    16591634{
    16601635    if (!resourceLoadStatisticsEnabled()) {
     
    16701645
    16711646    if (auto networkProcess = webPage->process().processPool().networkProcess())
    1672         networkProcess->hasStorageAccess(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subFrameHost), WebCore::ResourceLoadStatistics::primaryDomain(topFrameHost), frameID, pageID, WTFMove(completionHandler));
    1673 }
    1674 
    1675 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
     1647        networkProcess->hasStorageAccess(m_sessionID, subFrameHost, topFrameHost, frameID, pageID, WTFMove(completionHandler));
     1648}
     1649
     1650void WebsiteDataStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
    16761651{
    16771652    if (!resourceLoadStatisticsEnabled()) {
     
    16871662
    16881663    if (auto networkProcess = webPage->process().processPool().networkProcess())
    1689         networkProcess->requestStorageAccess(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subFrameHost), WebCore::ResourceLoadStatistics::primaryDomain(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler));
     1664        networkProcess->requestStorageAccess(m_sessionID, subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
    16901665}
    16911666
     
    17041679
    17051680    if (auto networkProcess = webPage->process().processPool().networkProcess())
    1706         networkProcess->grantStorageAccess(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(subFrameHost), WebCore::ResourceLoadStatistics::primaryDomain(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler));
     1681        networkProcess->grantStorageAccess(m_sessionID, subFrameHost, topFrameHost, frameID, pageID, userWasPrompted, WTFMove(completionHandler));
    17071682}
    17081683
     
    17281703    for (auto& processPool : processPools()) {
    17291704        if (auto* process = processPool->networkProcess())
    1730             process->logUserInteraction(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), [callbackAggregator = callbackAggregator.copyRef()] { });
     1705            process->logUserInteraction(m_sessionID, url.host().toString(), [callbackAggregator = callbackAggregator.copyRef()] { });
    17311706    }
    17321707}
     
    17431718    for (auto& processPool : processPools()) {
    17441719        if (auto* process = processPool->networkProcess()) {
    1745             process->hasHadUserInteraction(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));
     1720            process->hasHadUserInteraction(m_sessionID, url.host().toString(), WTFMove(completionHandler));
    17461721            ASSERT(processPools().size() == 1);
    17471722            break;
     
    17631738    for (auto& processPool : processPools()) {
    17641739        if (auto* process = processPool->networkProcess())
    1765             process->clearUserInteraction(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), [callbackAggregator = callbackAggregator.copyRef()] { });
     1740            process->clearUserInteraction(m_sessionID, url.host().toString(), [callbackAggregator = callbackAggregator.copyRef()] { });
    17661741    }
    17671742}
     
    17801755    for (auto& processPool : processPools()) {
    17811756        if (auto* process = processPool->networkProcess())
    1782             process->setGrandfathered(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), isGrandfathered, [callbackAggregator = callbackAggregator.copyRef()] { });
     1757            process->setGrandfathered(m_sessionID, url.host().toString(), isGrandfathered, [callbackAggregator = callbackAggregator.copyRef()] { });
    17831758    }
    17841759}
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r241826 r242056  
    126126
    127127#if ENABLE(RESOURCE_LOAD_STATISTICS)
    128     void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, HashSet<String>&&)>&& completionHandler);
    129 
    130128    void clearPrevalentResource(const URL&, CompletionHandler<void()>&&);
    131129    void clearUserInteraction(const URL&, CompletionHandler<void()>&&);
     
    166164    void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); }
    167165    void setVeryPrevalentResource(const URL&, CompletionHandler<void()>&&);
    168     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
    169     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
     166    void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
     167    void requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
    170168    void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
    171169    void setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r241988 r242056  
    195195#include <WebCore/PromisedAttachmentInfo.h>
    196196#include <WebCore/Range.h>
     197#include <WebCore/RegistrableDomain.h>
    197198#include <WebCore/RemoteDOMWindow.h>
    198199#include <WebCore/RemoteFrame.h>
     
    64036404void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)
    64046405{
    6405     WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), WebCore::ResourceLoadStatistics::primaryDomain(subFrameHost), WebCore::ResourceLoadStatistics::primaryDomain(topFrameHost), frameID, m_pageID), WTFMove(completionHandler));
     6406    WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), RegistrableDomain { subFrameHost }, RegistrableDomain { topFrameHost }, frameID, m_pageID), WTFMove(completionHandler));
    64066407}
    64076408   
     
    64096410{
    64106411    bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled();
    6411     WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WebCore::ResourceLoadStatistics::primaryDomain(subFrameHost), WebCore::ResourceLoadStatistics::primaryDomain(topFrameHost), frameID, m_pageID, promptEnabled), WTFMove(completionHandler));
     6412    WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), RegistrableDomain { subFrameHost }, RegistrableDomain { topFrameHost }, frameID, m_pageID, promptEnabled), WTFMove(completionHandler));
    64126413}
    64136414#endif
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r241556 r242056  
    107107#include <WebCore/PlatformMediaSessionManager.h>
    108108#include <WebCore/ProcessWarming.h>
     109#include <WebCore/RegistrableDomain.h>
    109110#include <WebCore/ResourceLoadObserver.h>
    110111#include <WebCore/ResourceLoadStatistics.h>
     
    212213    });
    213214
    214     ResourceLoadObserver::shared().setRequestStorageAccessUnderOpenerCallback([this] (const String& domainInNeedOfStorageAccess, uint64_t openerPageID, const String& openerDomain) {
     215    ResourceLoadObserver::shared().setRequestStorageAccessUnderOpenerCallback([this] (const RegistrableDomain& domainInNeedOfStorageAccess, uint64_t openerPageID, const RegistrableDomain& openerDomain) {
    215216        parentProcessConnection()->send(Messages::WebResourceLoadStatisticsStore::RequestStorageAccessUnderOpener(domainInNeedOfStorageAccess, openerPageID, openerDomain), 0);
    216217    });
     
    402403
    403404#if ENABLE(RESOURCE_LOAD_STATISTICS)
    404     ResourceLoadObserver::shared().setLogUserInteractionNotificationCallback([this] (PAL::SessionID sessionID, const String& topLevelOrigin) {
    405         m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogUserInteraction(sessionID, topLevelOrigin), 0);
     405    ResourceLoadObserver::shared().setLogUserInteractionNotificationCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& domain) {
     406        m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogUserInteraction(sessionID, domain), 0);
    406407    });
    407408
    408     ResourceLoadObserver::shared().setLogWebSocketLoadingNotificationCallback([this] (PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) {
    409         m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogWebSocketLoading(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen), 0);
     409    ResourceLoadObserver::shared().setLogWebSocketLoadingNotificationCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen) {
     410        m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogWebSocketLoading(sessionID, targetDomain, topFrameDomain, lastSeen), 0);
    410411    });
    411412   
    412     ResourceLoadObserver::shared().setLogSubresourceLoadingNotificationCallback([this] (PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) {
    413         m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceLoading(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen), 0);
     413    ResourceLoadObserver::shared().setLogSubresourceLoadingNotificationCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen) {
     414        m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceLoading(sessionID, targetDomain, topFrameDomain, lastSeen), 0);
    414415    });
    415416
    416     ResourceLoadObserver::shared().setLogSubresourceRedirectNotificationCallback([this] (PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain) {
    417         m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceRedirect(sessionID, sourcePrimaryDomain, targetPrimaryDomain), 0);
     417    ResourceLoadObserver::shared().setLogSubresourceRedirectNotificationCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain) {
     418        m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceRedirect(sessionID, sourceDomain, targetDomain), 0);
    418419    });
    419420#endif
  • trunk/Tools/ChangeLog

    r242055 r242056  
     12019-02-25  John Wilander  <wilander@apple.com>
     2
     3        Introduce and adopt new class RegistrableDomain for eTLD+1
     4        https://bugs.webkit.org/show_bug.cgi?id=194791
     5        <rdar://problem/48179240>
     6
     7        Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
     8
     9        This patch adds an API test and replaces two instances of
     10        "TopPrivatelyOwnedDomains" with "RegistrableDomains" in message names.
     11
     12        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     13        * TestWebKitAPI/Tests/WebCore/AdClickAttribution.cpp:
     14        (TestWebKitAPI::TEST):
     15            Changed two strings to make sure the registrable domains are still considered
     16            invalid and pass the test.
     17        * TestWebKitAPI/Tests/WebCore/RegistrableDomain.cpp: Added.
     18        (TestWebKitAPI::TEST):
     19        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     20        (WTR::InjectedBundle::didReceiveMessageToPage):
     21
    1222019-02-25  Adrian Perez de Castro  <aperez@igalia.com>
    223
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r241899 r242056  
    349349                6B0A07F721FA9C2B00D57391 /* AdClickAttribution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B0A07F621FA9C2B00D57391 /* AdClickAttribution.cpp */; };
    350350                6B306106218A372900F5A802 /* ClosingWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6B306105218A372900F5A802 /* ClosingWebView.mm */; };
     351                6B4E861C2220A5520022F389 /* RegistrableDomain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E861B2220A5520022F389 /* RegistrableDomain.cpp */; };
    351352                6B9ABE122086952F00D75DE6 /* HTTPParsers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B9ABE112086952F00D75DE6 /* HTTPParsers.cpp */; };
    352353                6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */; };
     
    17411742                6B0A07F621FA9C2B00D57391 /* AdClickAttribution.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AdClickAttribution.cpp; sourceTree = "<group>"; };
    17421743                6B306105218A372900F5A802 /* ClosingWebView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ClosingWebView.mm; sourceTree = "<group>"; };
     1744                6B4E861B2220A5520022F389 /* RegistrableDomain.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RegistrableDomain.cpp; sourceTree = "<group>"; };
    17431745                6B9ABE112086952F00D75DE6 /* HTTPParsers.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPParsers.cpp; sourceTree = "<group>"; };
    17441746                725C3EF2220584BA007C36FC /* AdditionalSupportedImageTypes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = AdditionalSupportedImageTypes.html; sourceTree = "<group>"; };
     
    27402742                                AA96CAB421C7DB4200FD2F97 /* ParsedContentType.cpp */,
    27412743                                041A1E33216FFDBC00789E0A /* PublicSuffix.cpp */,
     2744                                6B4E861B2220A5520022F389 /* RegistrableDomain.cpp */,
    27422745                                F418BE141F71B7DC001970E6 /* RoundedRectTests.cpp */,
    27432746                                CDCFA7A91E45122F00C2433D /* SampleMap.cpp */,
     
    42214224                                041A1E34216FFDBC00789E0A /* PublicSuffix.cpp in Sources */,
    42224225                                7C83E0C21D0A653500FEBCF3 /* QuickLook.mm in Sources */,
     4226                                6B4E861C2220A5520022F389 /* RegistrableDomain.cpp in Sources */,
    42234227                                7CCE7F0D1A411AE600447C4C /* ReloadPageAfterCrash.cpp in Sources */,
    42244228                                7C83E0C31D0A653A00FEBCF3 /* RemoteObjectRegistry.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/AdClickAttribution.cpp

    r240911 r242056  
    101101TEST(AdClickAttribution, InvalidSourceHost)
    102102{
    103     AdClickAttribution attribution(AdClickAttribution::Campaign(max6BitValue), AdClickAttribution::Source("webkitorg"), AdClickAttribution::Destination("example.com"));
     103    AdClickAttribution attribution(AdClickAttribution::Campaign(max6BitValue), AdClickAttribution::Source(""), AdClickAttribution::Destination("example.com"));
    104104    attribution.setConversion(AdClickAttribution::Conversion(max6BitValue, AdClickAttribution::Priority(max6BitValue)));
    105105
     
    113113TEST(AdClickAttribution, InvalidDestinationHost)
    114114{
    115     AdClickAttribution attribution(AdClickAttribution::Campaign(max6BitValue + 1), AdClickAttribution::Source("webkit.org"), AdClickAttribution::Destination("examplecom"));
     115    AdClickAttribution attribution(AdClickAttribution::Campaign(max6BitValue + 1), AdClickAttribution::Source("webkit.org"), AdClickAttribution::Destination(""));
    116116    attribution.setConversion(AdClickAttribution::Conversion(max6BitValue, AdClickAttribution::Priority(max6BitValue)));
    117117
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r239871 r242056  
    417417    }
    418418
    419     if (WKStringIsEqualToUTF8CString(messageName, "WebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished")) {
     419    if (WKStringIsEqualToUTF8CString(messageName, "WebsiteDataDeletionForRegistrableDomainsFinished")) {
    420420        m_testRunner->statisticsDidModifyDataRecordsCallback();
    421421        return;
    422422    }
    423423
    424     if (WKStringIsEqualToUTF8CString(messageName, "WebsiteDataScanForTopPrivatelyControlledDomainsFinished")) {
     424    if (WKStringIsEqualToUTF8CString(messageName, "WebsiteDataScanForRegistrableDomainsFinished")) {
    425425        m_testRunner->statisticsDidScanDataRecordsCallback();
    426426        return;
Note: See TracChangeset for help on using the changeset viewer.