[Cocoa] Add SPI to opt out a URL scheme from the memory cache
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 02:12:37 +0000 (02:12 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 02:12:37 +0000 (02:12 +0000)
commit3e3a4035fb8416a2dba629536f754f996988b1e6
treed39741c7f6b7e5abaa302b34d66f0ff3121a5bcb
parentdce5828de8a1da595a7b4a80fc93c023622de132
[Cocoa] Add SPI to opt out a URL scheme from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=152950
rdar://problem/24066652

Reviewed by Tim Horton.

Source/WebCore:

Added a list of schemes to SchemeRegistry whose resources should always be revalidated. Taught CachedResource to
return a freshness lifetime of 0 for these resources, unless the scheme is one that should be cached indefinitely.

New API test: WebKit2.AlwaysRevalidatedURLSchemes

* loader/cache/CachedResource.cpp:
(WebCore::shouldCacheSchemeIndefinitely): Moved from SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely().
(WebCore::CachedResource::freshnessLifetime): For a scheme that should not be cached indefinitely, return 0 if
that scheme should always be revalidated according to SchemeRegistry.
* platform/SchemeRegistry.cpp:
(WebCore::alwaysRevalidatedSchemes):
(WebCore::SchemeRegistry::registerURLSchemeAsAlwaysRevalidated):
(WebCore::SchemeRegistry::shouldAlwaysRevalidateURLScheme):
(WebCore::SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely): Moved to WebCore::shouldCacheSchemeIndefinitely().
There was no reason for this to be in SchemeRegistry.
* platform/SchemeRegistry.h:

Source/WebKit2:

Added a alwaysRevalidatedURLSchemes property to _WKProcessPoolConfiguration. Taught WebProcess to add these
schemes to SchemeRegistry when initializing a new web process.

* Shared/API/Cocoa/WKFoundation.h: Added a newline to force re-postprocessing.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration alwaysRevalidatedURLSchemes]):
(-[_WKProcessPoolConfiguration setAlwaysRevalidatedURLSchemes:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::registerURLSchemeAsAlwaysRevalidated):
* WebProcess/WebProcess.h:

Tools:

Added an API test.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/AlwaysRevalidatedURLSchemes.mm: Added.
(+[AlwaysRevalidatedURLSchemeProtocol canInitWithRequest:]):
(+[AlwaysRevalidatedURLSchemeProtocol canonicalRequestForRequest:]):
(+[AlwaysRevalidatedURLSchemeProtocol requestIsCacheEquivalent:toRequest:]):
(-[AlwaysRevalidatedURLSchemeProtocol startLoading]):
(-[AlwaysRevalidatedURLSchemeProtocol stopLoading]):
(-[AlwaysRevalidatedURLSchemesDelegate webView:didFinishNavigation:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/platform/SchemeRegistry.cpp
Source/WebCore/platform/SchemeRegistry.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WKFoundation.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AlwaysRevalidatedURLSchemes.mm [new file with mode: 0644]