[webkit-changes] [WebKit/WebKit] ac05e4: Introduce PublicSuffixStore with cache

Sihui noreply at github.com
Thu Mar 21 16:13:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ac05e4cafed5aa893fdfb19a86d27ad1583ef366
      https://github.com/WebKit/WebKit/commit/ac05e4cafed5aa893fdfb19a86d27ad1583ef366
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2024-03-21 (Thu, 21 Mar 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/loader/ResourceLoadStatistics.cpp
    M Source/WebCore/loader/cache/MemoryCache.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/SecurityOrigin.cpp
    M Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp
    M Source/WebCore/platform/Curl.cmake
    R Source/WebCore/platform/PublicSuffix.h
    A Source/WebCore/platform/PublicSuffixStore.cpp
    A Source/WebCore/platform/PublicSuffixStore.h
    M Source/WebCore/platform/RegistrableDomain.h
    M Source/WebCore/platform/SourcesSoup.txt
    R Source/WebCore/platform/cocoa/PublicSuffixCocoa.mm
    A Source/WebCore/platform/cocoa/PublicSuffixStoreCocoa.mm
    M Source/WebCore/platform/glib/UserAgentQuirks.cpp
    M Source/WebCore/platform/graphics/skia/PathSkia.cpp
    M Source/WebCore/platform/network/NetworkStorageSession.cpp
    M Source/WebCore/platform/network/ResourceRequestBase.cpp
    M Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
    M Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
    M Source/WebCore/platform/network/curl/CookieJarDB.cpp
    R Source/WebCore/platform/network/curl/PublicSuffixCurl.cpp
    A Source/WebCore/platform/network/curl/PublicSuffixStoreCurl.cpp
    R Source/WebCore/platform/soup/PublicSuffixSoup.cpp
    A Source/WebCore/platform/soup/PublicSuffixStoreSoup.cpp
    M Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
    M Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp
    M Source/WebKit/Shared/GoToBackForwardItemParameters.h
    M Source/WebKit/Shared/GoToBackForwardItemParameters.serialization.in
    M Source/WebKit/Shared/LoadParameters.h
    M Source/WebKit/Shared/LoadParameters.serialization.in
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMatchPatternCocoa.mm
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.cpp
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp

  Log Message:
  -----------
  Introduce PublicSuffixStore with cache
https://bugs.webkit.org/show_bug.cgi?id=271188
rdar://124971859

Reviewed by Per Arne Vollan and Chris Dumez.

Intoduce a new class PublicSuffixStore and move existing public suffix related functions into it. PublicSuffixStore can
have a cache for public suffix. When the cache is in use, PublicSuffixStore searches public suffix in it before invoking
platform specific code (this may help us to tighten sandbox in some process later). Currently the cache is only enabled
in web process on Cocoa platforms.

Before this patch, web process has a cache for finding top privately controlled domain of a given host. UI process sends
(host, domain) pair to web process on load time, and web process will add the entry in cache (256605 at main). This patch
makes UI process send the public suffix the to web process, and makes web process store it in the new public suffix
cache, since the domain cache has a size limit, and it only benefits search for the given host. Also, this patch fixes
the regression from 270762 at main, that web process does not update the cache on receiving LoadParameters (since
setTopPrivatelyControlledDomain is dropped from LoadParameters::decode), by adding addPublicSuffix to
WebPage::platformDidReceiveLoadParameters.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::urlForBindings const):
* Source/WebCore/loader/ResourceLoadStatistics.cpp:
* Source/WebCore/loader/cache/MemoryCache.cpp:
* Source/WebCore/page/Quirks.cpp:
(WebCore::isYahooMail):
(WebCore::Quirks::shouldHideSearchFieldResultsButton const):
(WebCore::Quirks::isAmazon const):
(WebCore::Quirks::isGoogleMaps const):
* Source/WebCore/page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::isSameSiteAs const):
(WebCore::SecurityOrigin::isMatchingRegistrableDomainSuffix const):
* Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::isValidSourceForExtensionMode):
* Source/WebCore/platform/Curl.cmake:
* Source/WebCore/platform/PublicSuffixStore.cpp: Added.
(WebCore::PublicSuffixStore::singleton):
(WebCore::PublicSuffixStore::clearHostTopPrivatelyControlledDomainCache):
(WebCore::PublicSuffixStore::isPublicSuffix const):
(WebCore::PublicSuffixStore::publicSuffix const):
(WebCore::PublicSuffixStore::topPrivatelyControlledDomain const):
* Source/WebCore/platform/PublicSuffixStore.h: Renamed from Source/WebCore/platform/PublicSuffix.h.
* Source/WebCore/platform/RegistrableDomain.h:
(WebCore::RegistrableDomain::uncheckedCreateFromHost):
(WebCore::RegistrableDomain::registrableDomainFromHost):
* Source/WebCore/platform/SourcesSoup.txt:
* Source/WebCore/platform/cocoa/PublicSuffixCocoa.mm: Removed.
* Source/WebCore/platform/cocoa/PublicSuffixStoreCocoa.mm: Added.
(WebCore::isPublicSuffixCF):
(WebCore::PublicSuffixStore::platformIsPublicSuffix const):
(WebCore::PublicSuffixStore::platformTopPrivatelyControlledDomain const):
(WebCore::PublicSuffixStore::enablePublicSuffixCache):
(WebCore::PublicSuffixStore::addPublicSuffix):
* Source/WebCore/platform/glib/UserAgentQuirks.cpp:
(WebCore::UserAgentQuirks::quirksForURL):
* Source/WebCore/platform/graphics/skia/PathSkia.cpp:
* Source/WebCore/platform/network/NetworkStorageSession.cpp:
* Source/WebCore/platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::partitionName):
* Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp:
* Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:
* Source/WebCore/platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::hasCookies):
(WebCore::CookieJarDB::canAcceptCookie):
* Source/WebCore/platform/network/curl/PublicSuffixStoreCurl.cpp: Renamed from Source/WebCore/platform/network/curl/PublicSuffixCurl.cpp.
(WebCore::PublicSuffixStore::platformIsPublicSuffix const):
(WebCore::topPrivatelyControlledDomainInternal):
(WebCore::PublicSuffixStore::platformTopPrivatelyControlledDomain const):
* Source/WebCore/platform/soup/PublicSuffixStoreSoup.cpp: Renamed from Source/WebCore/platform/soup/PublicSuffixSoup.cpp.
(WebCore::PublicSuffixStore::platformIsPublicSuffix const):
(WebCore::permissiveTopPrivateDomain):
(WebCore::PublicSuffixStore::platformTopPrivatelyControlledDomain const):
* Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm:
* Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const):
* Source/WebKit/Shared/GoToBackForwardItemParameters.h:
* Source/WebKit/Shared/GoToBackForwardItemParameters.serialization.in:
* Source/WebKit/Shared/LoadParameters.h:
* Source/WebKit/Shared/LoadParameters.serialization.in:
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMatchPatternCocoa.mm:
(WebKit::WebExtensionMatchPattern::hostIsPublicSuffix const):
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcessForReload):
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::resetStateAfterProcessTermination):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::didExceedMemoryFootprintThreshold):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.cpp:
(WebKit::WebsiteDataRecord::displayNameForHostName):
(WebKit::WebsiteDataRecord::displayNameForOrigin):
(WebKit::WebsiteDataRecord::topPrivatelyControlledDomain):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::goToBackForwardItem):
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::prewarmLogs):
(WebKit::WebProcess::platformInitializeProcess):
* Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
(TestWebKitAPI::TEST_F):

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



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


More information about the webkit-changes mailing list