Skip to content
  • jpfau@apple.com's avatar
    Optionally partition cache to prevent using cache for tracking · 97c6a7f9
    jpfau@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=110269
    
    Reviewed by Maciej Stachowiak.
    
    Source/JavaScriptCore:
    
    * Configurations/FeatureDefines.xcconfig: Add defines for cache partitioning and public suffix list usage
    
    Source/WebCore:
    
    Implement memory cache partitioning by passing the cache name through
    resource requests into a new version of resourceForURL.
    
    Test: http/tests/cache/partitioned-cache.html
    
    * Configurations/FeatureDefines.xcconfig: Add defines for cache partitioning and public suffix list usage
    * WebCore.exp.in: Export new functions for WKSI and test suite
    * WebCore.xcodeproj/project.pbxproj:
    * html/DOMURL.cpp:
    (WebCore::DOMURL::revokeObjectURL): Retrofit for new resourceForRequest function
    * inspector/InspectorPageAgent.cpp:
    (WebCore::InspectorPageAgent::cachedResource): Retrofit for new resourceForRequest function
    * inspector/InspectorResourceAgent.cpp:
    (WebCore::InspectorResourceAgent::replayXHR): Retrofit for new resourceForRequest function
    * loader/DocumentLoader.h:
    (DocumentLoader):
    (WebCore::DocumentLoader::recordMemoryCacheLoadForFutureClientNotification): Retrofit for new resourceForRequest function
    (WebCore::DocumentLoader::takeMemoryCacheLoadsForClientNotification): Retrofit for new resourceForRequest function
    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::loadedResourceFromMemoryCache): Retrofit for new resourceForRequest function
    (WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads): Retrofit for new resourceForRequest function
    * loader/archive/cf/LegacyWebArchive.cpp:
    (WebCore::LegacyWebArchive::create): Retrofit for new resourceForRequest function
    * loader/cache/CachedResource.cpp:
    (WebCore::CachedResource::~CachedResource):
    * loader/cache/CachedResource.h: Retrofit for new resourceForRequest function
    (CachedResource):
    (WebCore::CachedResource::cachePartition):
    * loader/cache/CachedResourceLoader.cpp:
    (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): Retrofit for new resourceForRequest function
    (WebCore::CachedResourceLoader::requestResource): Retrofit for new resourceForRequest function
    (WebCore::CachedResourceLoader::loadResource): Retrofit for new resourceForRequest function
    * loader/cache/MemoryCache.cpp:
    (WebCore):
    (WebCore::partitionName): Add function for determining absolute partition name
    (WebCore::MemoryCache::add): Retrofit for partition mapping
    (WebCore::MemoryCache::revalidationSucceeded): Retrofit for partition mapping
    (WebCore::MemoryCache::resourceForURL): Call into new resourceForRequest
    (WebCore::MemoryCache::resourceForRequest): Retrofit for partition mapping
    (WebCore::MemoryCache::evict): Retrofit for partition mapping
    (WebCore::MemoryCache::removeResourcesWithOrigin): Retrofit for partition mapping
    (WebCore::MemoryCache::getOriginsWithCache): Retrofit for partition mapping
    (WebCore::MemoryCache::removeUrlFromCache): Retrofit for partition mapping
    (WebCore::MemoryCache::removeRequestFromCache): Retrofit for partition mapping
    (WebCore::MemoryCache::removeRequestFromCacheImpl): Retrofit for partition mapping
    (WebCore::MemoryCache::crossThreadRemoveRequestFromCache): Add function for calling removeRequestFromCacheImpl that takes a CrossThreadResourceRequestData
    (WebCore::MemoryCache::getStatistics): Retrofit for partition mapping
    (WebCore::MemoryCache::setDisabled): Retrofit for partition mapping
    * loader/cache/MemoryCache.h:
    (MemoryCache):
    * page/SecurityOrigin.cpp:
    (WebCore):
    (WebCore::SecurityOrigin::cachePartition): Add function for determining the cache partition name
    * page/SecurityOrigin.h:
    (SecurityOrigin):
    * platform/PublicSuffix.h: Added.
    (WebCore):
    * platform/mac/PublicSuffixMac.mm: Added.
    (WebCore):
    (WebCore::isPublicSuffix):
    (WebCore::topPrivatelyControlledDomain):
    * platform/mac/WebCoreSystemInterface.h:
    * platform/mac/WebCoreSystemInterface.mm:
    * platform/network/cf/ResourceRequest.h:
    (ResourceRequest):
    (WebCore::ResourceRequest::cachePartition):
    (WebCore::ResourceRequest::setCachePartition):
    (CrossThreadResourceRequestData):
    * platform/network/cf/ResourceRequestCFNet.cpp:
    (WebCore::ResourceRequest::doPlatformCopyData): Pass through cache partition name
    (WebCore):
    (WebCore::ResourceRequest::doPlatformAdopt): Pass through cache partition name
    * platform/network/mac/ResourceRequestMac.mm:
    (WebCore::ResourceRequest::doUpdateResourceRequest): Pass through cache partition name
    (WebCore::ResourceRequest::doUpdatePlatformRequest): Pass through cache partition name
    
    Source/WebKit/mac:
    
    Update WKSI bindings and add feature defines.
    
    * Configurations/FeatureDefines.xcconfig: Add defines for cache partitioning and public suffix list usage
    * WebCoreSupport/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    Source/WebKit2:
    
    Update WKSI bindings and add feature defines.
    
    * Configurations/FeatureDefines.xcconfig: Add defines for cache partitioning and public suffix list usage
    * WebCoreSupport/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    Tools:
    
    Add test suite for public suffix functions on Mac.
    
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/mac/PublicSuffix.mm: Added.
    (TestWebKitAPI):
    (TestWebKitAPI::TEST_F):
    
    WebKitLibraries:
    
    Update WKSI bindings.
    
    * WebKitSystemInterface.h:
    * libWebKitSystemInterfaceLion.a:
    * libWebKitSystemInterfaceMountainLion.a:
    
    LayoutTests:
    
    Added tests for ensuring the cache partitioning functions
    
    * http/tests/cache/partitioned-cache-expected.txt: Added.
    * http/tests/cache/partitioned-cache.html: Added.
    * http/tests/cache/resources/echo-cookie.cgi: Added.
    * http/tests/cache/resources/partitioned-cache-loader.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    97c6a7f9