Move NetworkStorageSession ownership to NetworkProcess
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2019 21:28:28 +0000 (21:28 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2019 21:28:28 +0000 (21:28 +0000)
commit489fc3a30c7e1f73dfaf37fb06f27e4e06bccfb3
tree7a2a13294517a35825e747a41e4fc7ffbf5ddfef
parent08f56c9f066e7a577f0a9c3a4c8c9da64ea0d990
Move NetworkStorageSession ownership to NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=193580

Reviewed by Geoff Garen.

Source/WebCore:

NetworkStorageSessions used to be owned by a process-global map living in WebCore.
This patch moves the ownership to the WebKit/WebKitLegacy layer.
In WebKitLegacy they are still owned by a process-global map for compatibility.
In WebKit they are owned by a map owned by the NetworkProcess object.
There were three non-NetworkProcess uses of NetworkStorageSessions which have been dealt with thusly:
1. The WebProcess used to clear credentials from a NetworkStorageSession.  Since this was the only use
of a NetworkStorageSession in the WebProcess we can conclude there were no credentials to clear,
so this code was removed with no change in behavior.
2. The WebProcess used NetworkStorageSessions to get persistent credentials.  This was turned
into a static method that does the same thing.  We should audit these calls and decide if we really want them.
3. The UIProcess used NetworkStorageSessions in APIHTTPCookieStore to interact with the default cookie
storage on Cocoa platforms.  This has been replaced by functions that do the same thing directly.

* platform/network/CredentialStorage.h:
* platform/network/NetworkStorageSession.cpp:
(WebCore::NetworkStorageSession::processMayUseCookieAPI):
(WebCore::NetworkStorageSession::globalSessionMap): Deleted.
(WebCore::NetworkStorageSession::storageSession): Deleted.
(WebCore::NetworkStorageSession::destroySession): Deleted.
(WebCore::NetworkStorageSession::forEach): Deleted.
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
(WebCore::createCFStorageSessionForIdentifier): Deleted.
(WebCore::defaultNetworkStorageSession): Deleted.
(WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted.
(WebCore::NetworkStorageSession::defaultStorageSession): Deleted.
(WebCore::NetworkStorageSession::ensureSession): Deleted.
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
* platform/network/cocoa/CookieStorageObserver.h:
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::defaultSession): Deleted.
(WebCore::NetworkStorageSession::defaultStorageSession): Deleted.
(WebCore::NetworkStorageSession::ensureSession): Deleted.
(WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::clearSoupNetworkSessionAndCookieStorage):
(WebCore::defaultSession): Deleted.
(WebCore::NetworkStorageSession::defaultStorageSession): Deleted.
(WebCore::NetworkStorageSession::ensureSession): Deleted.
(WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted.

Source/WebKit:

* NetworkProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::WebCookieManager):
(WebKit::WebCookieManager::getHostnamesWithCookies):
(WebKit::WebCookieManager::deleteCookiesForHostname):
(WebKit::WebCookieManager::deleteAllCookies):
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::startObservingCookieChanges):
(WebKit::WebCookieManager::stopObservingCookieChanges):
* NetworkProcess/Cookies/WebCookieManager.h:
* NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
(WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::storageSession):
(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
(WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
(WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
(WebKit::NetworkConnectionToWebProcess::getRawCookies):
(WebKit::NetworkConnectionToWebProcess::deleteCookie):
(WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
(WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::clearCachedCredentials):
(WebKit::NetworkProcess::switchToNewTestingSession):
(WebKit::NetworkProcess::ensureSession):
(WebKit::NetworkProcess::storageSession const):
(WebKit::NetworkProcess::defaultStorageSession const):
(WebKit::NetworkProcess::forEachNetworkStorageSession):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
(WebKit::NetworkProcess::setAgeCapForClientSideCookies):
(WebKit::NetworkProcess::hasStorageAccessForFrame):
(WebKit::NetworkProcess::getAllStorageAccessEntries):
(WebKit::NetworkProcess::grantStorageAccess):
(WebKit::NetworkProcess::removeAllStorageAccess):
(WebKit::NetworkProcess::removePrevalentDomains):
(WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
(WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
(WebKit::NetworkResourceLoader::logCookieInformation const):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::networkStorageSession const):
* NetworkProcess/NetworkStorageSessionProvider.h:
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::makeUseDecision):
(WebKit::NetworkCache::Cache::retrieve):
(WebKit::NetworkCache::Cache::makeEntry):
(WebKit::NetworkCache::Cache::makeRedirectEntry):
(WebKit::NetworkCache::Cache::update):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformSyncAllCookies):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
* SourcesCocoa.txt:
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::~HTTPCookieStore):
(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::setCookie):
(API::HTTPCookieStore::deleteCookie):
(API::HTTPCookieStore::registerObserver):
(API::HTTPCookieStore::unregisterObserver):
(API::HTTPCookieStore::registerForNewProcessPoolNotifications):
(API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
(API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
(API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
(API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
(API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
(API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Added.
(API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
(API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
(API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
(API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
(API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
(API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::clearCachedCredentials):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::getAuthenticationInfo):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::deleteWebsiteData):
(WebKit::WebProcess::clearCachedCredentials): Deleted.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Source/WebKitLegacy:

* WebCoreSupport/NetworkStorageSessionMap.cpp: Added.
(defaultNetworkStorageSession):
(globalSessionMap):
(NetworkStorageSessionMap::storageSession):
(NetworkStorageSessionMap::defaultStorageSession):
(NetworkStorageSessionMap::switchToNewTestingSession):
(NetworkStorageSessionMap::ensureSession):
(NetworkStorageSessionMap::destroySession):
* WebCoreSupport/NetworkStorageSessionMap.h: Added.
* WebCoreSupport/PageStorageSessionProvider.h:
* WebKitLegacy.xcodeproj/project.pbxproj:

Source/WebKitLegacy/mac:

* Misc/WebCache.mm:
(+[WebCache clearCachedCredentials]):
* Misc/WebDownload.mm:
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
* Plugins/WebBaseNetscapePluginView.mm:
(WebKit::getAuthenticationInfo):
* WebCoreSupport/WebFrameNetworkingContext.mm:
(WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebFrameNetworkingContext::destroyPrivateBrowsingSession):
(WebFrameNetworkingContext::storageSession const):
* WebView/WebPreferences.mm:
(+[WebPreferences _switchNetworkLoaderToNewTestingSession]):
(+[WebPreferences _clearNetworkLoaderSession]):
(+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):

Source/WebKitLegacy/win:

* WebCoreSupport/WebFrameNetworkingContext.cpp:
(WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
(WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebFrameNetworkingContext::destroyPrivateBrowsingSession):
(WebFrameNetworkingContext::storageSession const):
* WebDownloadCFNet.cpp:
(WebDownload::didReceiveAuthenticationChallenge):
* WebPreferences.cpp:
(WebPreferences::clearNetworkLoaderSession):
(WebPreferences::switchNetworkLoaderToNewTestingSession):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240292 268f45cc-cd09-0410-ab3c-d52691b4dbfc
65 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/CredentialStorage.h
Source/WebCore/platform/network/NetworkStorageSession.cpp
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
Source/WebCore/platform/network/cocoa/CookieStorageObserver.h
Source/WebCore/platform/network/curl/CurlResourceHandleDelegate.cpp
Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
Source/WebCore/platform/network/soup/DNSResolveQueueSoup.cpp
Source/WebCore/platform/network/soup/DNSResolveQueueSoup.h
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h
Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm
Source/WebKit/NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h
Source/WebKit/NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/NetworkSession.cpp
Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h
Source/WebKit/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp
Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp
Source/WebKit/UIProcess/API/APIHTTPCookieStore.h
Source/WebKit/UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp
Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/soup/WebProcessSoup.cpp
Source/WebKitLegacy/CMakeLists.txt
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp [new file with mode: 0644]
Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.h [new file with mode: 0644]
Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h
Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Misc/WebCache.mm
Source/WebKitLegacy/mac/Misc/WebDownload.mm
Source/WebKitLegacy/mac/Plugins/WebBaseNetscapePluginView.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp
Source/WebKitLegacy/win/WebDownloadCFNet.cpp
Source/WebKitLegacy/win/WebPreferences.cpp