Optionally partition cache to prevent using cache for tracking
authorjpfau@apple.com <jpfau@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2013 00:49:17 +0000 (00:49 +0000)
committerjpfau@apple.com <jpfau@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2013 00:49:17 +0000 (00:49 +0000)
commitb54e94479518111c0bd91c61d00acce51049bffc
treecda41a99f2bb672cce94cf4ad6071368aaf845f2
parentd548d85d0879d6625c21d4a39f1090c240e4e5dc
Optionally partition cache to prevent using cache for tracking
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: https://svn.webkit.org/repository/webkit/trunk@143986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/cache/partitioned-cache-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cache/partitioned-cache.html [new file with mode: 0644]
LayoutTests/http/tests/cache/resources/echo-cookie.cgi [new file with mode: 0755]
LayoutTests/http/tests/cache/resources/partitioned-cache-loader.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/DOMURL.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/loader/cache/MemoryCache.h
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/SecurityOrigin.h
Source/WebCore/platform/PublicSuffix.h [new file with mode: 0644]
Source/WebCore/platform/mac/PublicSuffixMac.mm [new file with mode: 0644]
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/mac/PublicSuffix.mm [new file with mode: 0644]
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLion.a
WebKitLibraries/libWebKitSystemInterfaceMountainLion.a