WebKit Bugzilla
Attachment 359563 Details for
Bug 193580
: Move NetworkStorageSession ownership to NetworkProcess
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193580-20190118172855.patch (text/plain), 119.82 KB, created by
Alex Christensen
on 2019-01-18 17:28:56 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-18 17:28:56 PST
Size:
119.82 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 240190) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,53 @@ >+2019-01-18 Alex Christensen <achristensen@webkit.org> >+ >+ Move NetworkStorageSession ownership to NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=193580 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ > 2019-01-18 Eric Carlson <eric.carlson@apple.com> > > Revert r238815, it broke WK1 video fullscreen on Mac >Index: Source/WebCore/platform/network/CredentialStorage.h >=================================================================== >--- Source/WebCore/platform/network/CredentialStorage.h (revision 240190) >+++ Source/WebCore/platform/network/CredentialStorage.h (working copy) >@@ -44,7 +44,7 @@ public: > WEBCORE_EXPORT void remove(const String&, const ProtectionSpace&); > > // OS persistent storage. >- WEBCORE_EXPORT Credential getFromPersistentStorage(const ProtectionSpace&); >+ WEBCORE_EXPORT static Credential getFromPersistentStorage(const ProtectionSpace&); > > WEBCORE_EXPORT void clearCredentials(); > >Index: Source/WebCore/platform/network/NetworkStorageSession.cpp >=================================================================== >--- Source/WebCore/platform/network/NetworkStorageSession.cpp (revision 240190) >+++ Source/WebCore/platform/network/NetworkStorageSession.cpp (working copy) >@@ -42,36 +42,10 @@ namespace WebCore { > > bool NetworkStorageSession::m_processMayUseCookieAPI = false; > >-HashMap<PAL::SessionID, std::unique_ptr<NetworkStorageSession>>& NetworkStorageSession::globalSessionMap() >-{ >- static NeverDestroyed<HashMap<PAL::SessionID, std::unique_ptr<NetworkStorageSession>>> map; >- return map; >-} >- >-NetworkStorageSession* NetworkStorageSession::storageSession(PAL::SessionID sessionID) >-{ >- if (sessionID == PAL::SessionID::defaultSessionID()) >- return &defaultStorageSession(); >- return globalSessionMap().get(sessionID); >-} >- >-void NetworkStorageSession::destroySession(PAL::SessionID sessionID) >-{ >- ASSERT(sessionID != PAL::SessionID::defaultSessionID()); >- globalSessionMap().remove(sessionID); >-} >- >-void NetworkStorageSession::forEach(const WTF::Function<void(const WebCore::NetworkStorageSession&)>& functor) >-{ >- functor(defaultStorageSession()); >- for (auto& storageSession : globalSessionMap().values()) >- functor(*storageSession); >-} >- > bool NetworkStorageSession::processMayUseCookieAPI() > { > return m_processMayUseCookieAPI; >-}; >+} > > void NetworkStorageSession::permitProcessToUseCookieAPI(bool value) > { >Index: Source/WebCore/platform/network/NetworkStorageSession.h >=================================================================== >--- Source/WebCore/platform/network/NetworkStorageSession.h (revision 240190) >+++ Source/WebCore/platform/network/NetworkStorageSession.h (working copy) >@@ -74,16 +74,9 @@ enum class IncludeSecureCookies : bool; > class NetworkStorageSession { > WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED; > public: >- WEBCORE_EXPORT static NetworkStorageSession& defaultStorageSession(); >- WEBCORE_EXPORT static NetworkStorageSession* storageSession(PAL::SessionID); >- WEBCORE_EXPORT static void ensureSession(PAL::SessionID, const String& identifierBase = String()); >- WEBCORE_EXPORT static void destroySession(PAL::SessionID); >- WEBCORE_EXPORT static void forEach(const WTF::Function<void(const WebCore::NetworkStorageSession&)>&); > WEBCORE_EXPORT static void permitProcessToUseCookieAPI(bool); > WEBCORE_EXPORT static bool processMayUseCookieAPI(); > >- WEBCORE_EXPORT static void switchToNewTestingSession(); >- > PAL::SessionID sessionID() const { return m_sessionID; } > CredentialStorage& credentialStorage() { return m_credentialStorage; } > >@@ -92,16 +85,16 @@ public: > #endif > > #if PLATFORM(COCOA) || USE(CFURLCONNECTION) >- WEBCORE_EXPORT static void ensureSession(PAL::SessionID, const String& identifierBase, RetainPtr<CFHTTPCookieStorageRef>&&); >- NetworkStorageSession(PAL::SessionID, RetainPtr<CFURLStorageSessionRef>&&, RetainPtr<CFHTTPCookieStorageRef>&&); >- explicit NetworkStorageSession(PAL::SessionID); >+ WEBCORE_EXPORT static RetainPtr<CFURLStorageSessionRef> createCFStorageSessionForIdentifier(CFStringRef identifier); >+ WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID, RetainPtr<CFURLStorageSessionRef>&&, RetainPtr<CFHTTPCookieStorageRef>&&); >+ WEBCORE_EXPORT explicit NetworkStorageSession(PAL::SessionID); > > // May be null, in which case a Foundation default should be used. > CFURLStorageSessionRef platformSession() { return m_platformSession.get(); } > WEBCORE_EXPORT RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const; > WEBCORE_EXPORT static void setStorageAccessAPIEnabled(bool); > #elif USE(SOUP) >- NetworkStorageSession(PAL::SessionID, std::unique_ptr<SoupNetworkSession>&&); >+ WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID, std::unique_ptr<SoupNetworkSession>&&); > ~NetworkStorageSession(); > > SoupNetworkSession* soupNetworkSession() const { return m_session.get(); }; >@@ -113,7 +106,7 @@ public: > void getCredentialFromPersistentStorage(const ProtectionSpace&, GCancellable*, Function<void (Credential&&)>&& completionHandler); > void saveCredentialToPersistentStorage(const ProtectionSpace&, const Credential&); > #elif USE(CURL) >- NetworkStorageSession(PAL::SessionID, NetworkingContext*); >+ WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID, NetworkingContext*); > ~NetworkStorageSession(); > > const CookieJarCurl& cookieStorage() const { return m_cookieStorage; }; >@@ -124,7 +117,7 @@ public: > > NetworkingContext* context() const; > #else >- NetworkStorageSession(PAL::SessionID, NetworkingContext*); >+ WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID, NetworkingContext*); > ~NetworkStorageSession(); > > NetworkingContext* context() const; >@@ -166,7 +159,6 @@ public: > #endif > > private: >- static HashMap<PAL::SessionID, std::unique_ptr<NetworkStorageSession>>& globalSessionMap(); > PAL::SessionID m_sessionID; > > #if PLATFORM(COCOA) || USE(CFURLCONNECTION) >Index: Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >=================================================================== >--- Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (revision 240190) >+++ Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (working copy) >@@ -40,7 +40,7 @@ namespace WebCore { > > static bool storageAccessAPIEnabled; > >-static RetainPtr<CFURLStorageSessionRef> createCFStorageSessionForIdentifier(CFStringRef identifier) >+RetainPtr<CFURLStorageSessionRef> NetworkStorageSession::createCFStorageSessionForIdentifier(CFStringRef identifier) > { > auto storageSession = adoptCF(_CFURLStorageSessionCreate(kCFAllocatorDefault, identifier, nullptr)); > >@@ -85,66 +85,6 @@ NetworkStorageSession::NetworkStorageSes > { > } > >- >-static std::unique_ptr<NetworkStorageSession>& defaultNetworkStorageSession() >-{ >- ASSERT(isMainThread()); >- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session; >- return session; >-} >- >-void NetworkStorageSession::switchToNewTestingSession() >-{ >- // Session name should be short enough for shared memory region name to be under the limit, otehrwise sandbox rules won't work (see <rdar://problem/13642852>). >- String sessionName = String::format("WebKit Test-%u", static_cast<uint32_t>(getCurrentProcessID())); >- >- auto session = adoptCF(createPrivateStorageSession(sessionName.createCFString().get())); >- >- RetainPtr<CFHTTPCookieStorageRef> cookieStorage; >- if (NetworkStorageSession::processMayUseCookieAPI()) { >- ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >- if (session) >- cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, session.get())); >- } >- >- defaultNetworkStorageSession() = std::make_unique<NetworkStorageSession>(PAL::SessionID::defaultSessionID(), WTFMove(session), WTFMove(cookieStorage)); >-} >- >-NetworkStorageSession& NetworkStorageSession::defaultStorageSession() >-{ >- if (!defaultNetworkStorageSession()) >- defaultNetworkStorageSession() = std::make_unique<NetworkStorageSession>(PAL::SessionID::defaultSessionID()); >- return *defaultNetworkStorageSession(); >-} >- >-void NetworkStorageSession::ensureSession(PAL::SessionID sessionID, const String& identifierBase, RetainPtr<CFHTTPCookieStorageRef>&& cookieStorage) >-{ >- auto addResult = globalSessionMap().add(sessionID, nullptr); >- if (!addResult.isNewEntry) >- return; >- >- RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString(); >- >- RetainPtr<CFURLStorageSessionRef> storageSession; >- if (sessionID.isEphemeral()) >- storageSession = adoptCF(createPrivateStorageSession(cfIdentifier.get())); >- else >- storageSession = createCFStorageSessionForIdentifier(cfIdentifier.get()); >- >- if (NetworkStorageSession::processMayUseCookieAPI()) { >- ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >- if (!cookieStorage && storageSession) >- cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get())); >- } >- >- addResult.iterator->value = std::make_unique<NetworkStorageSession>(sessionID, WTFMove(storageSession), WTFMove(cookieStorage)); >-} >- >-void NetworkStorageSession::ensureSession(PAL::SessionID sessionID, const String& identifierBase) >-{ >- ensureSession(sessionID, identifierBase, nullptr); >-} >- > RetainPtr<CFHTTPCookieStorageRef> NetworkStorageSession::cookieStorage() const > { > if (!processMayUseCookieAPI()) >Index: Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >=================================================================== >--- Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (revision 240190) >+++ Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (working copy) >@@ -370,7 +370,7 @@ bool SocketStreamHandleImpl::getStoredCO > // Try system credential storage first, matching HTTP behavior (CFNetwork only asks the client for password if it couldn't find it in Keychain). > Credential storedCredential; > if (auto* storageSession = m_storageSessionProvider ? m_storageSessionProvider->storageSession() : nullptr) { >- storedCredential = storageSession->credentialStorage().getFromPersistentStorage(protectionSpace); >+ storedCredential = CredentialStorage::getFromPersistentStorage(protectionSpace); > if (storedCredential.isEmpty()) > storedCredential = storageSession->credentialStorage().get(m_credentialPartition, protectionSpace); > } >Index: Source/WebCore/platform/network/cocoa/CookieStorageObserver.h >=================================================================== >--- Source/WebCore/platform/network/cocoa/CookieStorageObserver.h (revision 240190) >+++ Source/WebCore/platform/network/cocoa/CookieStorageObserver.h (working copy) >@@ -35,18 +35,19 @@ OBJC_CLASS WebCookieObserverAdapter; > > namespace WebCore { > >-class CookieStorageObserver : public ThreadSafeRefCounted<CookieStorageObserver> { >+class WEBCORE_EXPORT CookieStorageObserver : public ThreadSafeRefCounted<CookieStorageObserver> { > public: > static Ref<CookieStorageObserver> create(NSHTTPCookieStorage *); >- CookieStorageObserver(NSHTTPCookieStorage *); > ~CookieStorageObserver(); > >- void startObserving(WTF::Function<void()>&& callback); >+ void startObserving(Function<void()>&& callback); > void stopObserving(); > > void cookiesDidChange(); > > private: >+ CookieStorageObserver(NSHTTPCookieStorage *); >+ > RetainPtr<NSHTTPCookieStorage> m_cookieStorage; > bool m_hasRegisteredInternalsForNotifications { false }; > RetainPtr<WebCookieObserverAdapter> m_observerAdapter; >Index: Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >=================================================================== >--- Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp (revision 240190) >+++ Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp (working copy) >@@ -87,30 +87,6 @@ CookieJarDB& NetworkStorageSession::cook > return m_cookieDatabase; > } > >-static std::unique_ptr<NetworkStorageSession>& defaultSession() >-{ >- ASSERT(isMainThread()); >- static std::unique_ptr<NetworkStorageSession> session; >- return session; >-} >- >-NetworkStorageSession& NetworkStorageSession::defaultStorageSession() >-{ >- if (!defaultSession()) >- defaultSession() = std::make_unique<NetworkStorageSession>(PAL::SessionID::defaultSessionID(), nullptr); >- return *defaultSession(); >-} >- >-void NetworkStorageSession::ensureSession(PAL::SessionID, const String&) >-{ >- // FIXME: Implement for WebKit to use. >-} >- >-void NetworkStorageSession::switchToNewTestingSession() >-{ >- // FIXME: Implement for WebKit to use. >-} >- > void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& value) const > { > cookieStorage().setCookiesFromDOM(*this, firstParty, sameSiteInfo, url, frameID, pageID, value); >Index: Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp >=================================================================== >--- Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (revision 240190) >+++ Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (working copy) >@@ -65,31 +65,6 @@ NetworkStorageSession::~NetworkStorageSe > g_signal_handlers_disconnect_matched(m_cookieStorage.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this); > } > >-static std::unique_ptr<NetworkStorageSession>& defaultSession() >-{ >- ASSERT(isMainThread()); >- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session; >- return session; >-} >- >-NetworkStorageSession& NetworkStorageSession::defaultStorageSession() >-{ >- if (!defaultSession()) >- defaultSession() = std::make_unique<NetworkStorageSession>(PAL::SessionID::defaultSessionID(), nullptr); >- return *defaultSession(); >-} >- >-void NetworkStorageSession::ensureSession(PAL::SessionID sessionID, const String&) >-{ >- ASSERT(!globalSessionMap().contains(sessionID)); >- globalSessionMap().add(sessionID, std::make_unique<NetworkStorageSession>(sessionID, std::make_unique<SoupNetworkSession>(sessionID))); >-} >- >-void NetworkStorageSession::switchToNewTestingSession() >-{ >- defaultSession() = std::make_unique<NetworkStorageSession>(PAL::SessionID::defaultSessionID(), std::make_unique<SoupNetworkSession>()); >-} >- > SoupNetworkSession& NetworkStorageSession::getOrCreateSoupNetworkSession() const > { > if (!m_session) >@@ -99,7 +74,6 @@ SoupNetworkSession& NetworkStorageSessio > > void NetworkStorageSession::clearSoupNetworkSessionAndCookieStorage() > { >- ASSERT(defaultSession().get() == this); > m_session = nullptr; > m_cookieObserverHandler = nullptr; > m_cookieStorage = nullptr; >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 240190) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,115 @@ >+2019-01-18 Alex Christensen <achristensen@webkit.org> >+ >+ Move NetworkStorageSession ownership to NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=193580 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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: >+ > 2019-01-18 Daniel Bates <dabates@apple.com> > > Fix some build issues. >Index: Source/WebKit/SourcesCocoa.txt >=================================================================== >--- Source/WebKit/SourcesCocoa.txt (revision 240190) >+++ Source/WebKit/SourcesCocoa.txt (working copy) >@@ -254,6 +254,7 @@ UIProcess/API/Cocoa/_WKWebsiteDataStoreC > UIProcess/API/Cocoa/_WKWebsitePolicies.mm > UIProcess/API/Cocoa/APIAttachmentCocoa.mm > UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm >+UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm > UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm > UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm > UIProcess/API/Cocoa/LegacyBundleForClass.mm >Index: Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (working copy) >@@ -407,18 +407,18 @@ void NetworkConnectionToWebProcess::didF > m_connection->send(Messages::NetworkProcessConnection::DidFinishPreconnection(preconnectionIdentifier, error), 0); > } > >-static NetworkStorageSession& storageSession(PAL::SessionID sessionID) >+static NetworkStorageSession& storageSession(const NetworkProcess& networkProcess, PAL::SessionID sessionID) > { > ASSERT(sessionID.isValid()); > if (sessionID != PAL::SessionID::defaultSessionID()) { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = networkProcess.storageSession(sessionID)) > return *storageSession; > > // Some requests with private browsing mode requested may still be coming shortly after NetworkProcess was told to destroy its session. > // FIXME: Find a way to track private browsing sessions more rigorously. > LOG_ERROR("Non-default storage session was requested, but there was no session for it. Please file a bug unless you just disabled private browsing, in which case it's an expected race."); > } >- return NetworkStorageSession::defaultStorageSession(); >+ return networkProcess.defaultStorageSession(); > } > > void NetworkConnectionToWebProcess::startDownload(PAL::SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName) >@@ -447,7 +447,7 @@ void NetworkConnectionToWebProcess::conv > > void NetworkConnectionToWebProcess::cookiesForDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) > { >- auto& networkStorageSession = storageSession(sessionID); >+ auto& networkStorageSession = storageSession(networkProcess(), sessionID); > std::tie(cookieString, secureCookiesAccessed) = networkStorageSession.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > if (auto session = networkProcess().networkSession(sessionID)) { >@@ -459,7 +459,7 @@ void NetworkConnectionToWebProcess::cook > > void NetworkConnectionToWebProcess::setCookiesFromDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) > { >- auto& networkStorageSession = storageSession(sessionID); >+ auto& networkStorageSession = storageSession(networkProcess(), sessionID); > networkStorageSession.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > if (auto session = networkProcess().networkSession(sessionID)) { >@@ -471,22 +471,22 @@ void NetworkConnectionToWebProcess::setC > > void NetworkConnectionToWebProcess::cookiesEnabled(PAL::SessionID sessionID, bool& result) > { >- result = storageSession(sessionID).cookiesEnabled(); >+ result = storageSession(networkProcess(), sessionID).cookiesEnabled(); > } > > void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) > { >- std::tie(cookieString, secureCookiesAccessed) = storageSession(sessionID).cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); >+ std::tie(cookieString, secureCookiesAccessed) = storageSession(networkProcess(), sessionID).cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > > void NetworkConnectionToWebProcess::getRawCookies(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& result) > { >- storageSession(sessionID).getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, result); >+ storageSession(networkProcess(), sessionID).getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, result); > } > > void NetworkConnectionToWebProcess::deleteCookie(PAL::SessionID sessionID, const URL& url, const String& cookieName) > { >- storageSession(sessionID).deleteCookie(url, cookieName); >+ storageSession(networkProcess(), sessionID).deleteCookie(url, cookieName); > } > > void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, SandboxExtension::Handle&& extensionHandle, const String& contentType) >@@ -561,7 +561,7 @@ void NetworkConnectionToWebProcess::ensu > void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID) > { > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = networkProcess().storageSession(sessionID)) > storageSession->removeStorageAccessForFrame(frameID, pageID); > #else > UNUSED_PARAM(sessionID); >@@ -573,7 +573,7 @@ void NetworkConnectionToWebProcess::remo > void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID) > { > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = networkProcess().storageSession(sessionID)) > storageSession->removeStorageAccessForAllFramesOnPage(pageID); > #else > UNUSED_PARAM(sessionID); >Index: Source/WebKit/NetworkProcess/NetworkProcess.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcess.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkProcess.cpp (working copy) >@@ -91,6 +91,10 @@ > #include "NetworkSessionCocoa.h" > #endif > >+#if USE(SOUP) >+#include <WebCore/SoupNetworkSession.h> >+#endif >+ > #if ENABLE(SERVICE_WORKER) > #include "WebSWServerToContextConnectionMessages.h" > #endif >@@ -302,7 +306,7 @@ void NetworkProcess::initializeNetworkPr > setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation); > > if (parameters.shouldUseTestingNetworkSession) >- NetworkStorageSession::switchToNewTestingSession(); >+ switchToNewTestingSession(); > > SandboxExtension::consumePermanently(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle); > >@@ -436,7 +440,7 @@ void NetworkProcess::createNetworkConnec > > void NetworkProcess::clearCachedCredentials() > { >- NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials(); >+ defaultStorageSession().credentialStorage().clearCredentials(); > if (auto* networkSession = this->networkSession(PAL::SessionID::defaultSessionID())) > networkSession->clearCredentials(); > else >@@ -457,6 +461,78 @@ void NetworkProcess::addWebsiteDataStore > RemoteNetworkingContext::ensureWebsiteDataStoreSession(*this, WTFMove(parameters)); > } > >+void NetworkProcess::switchToNewTestingSession() >+{ >+ // Session name should be short enough for shared memory region name to be under the limit, otehrwise sandbox rules won't work (see <rdar://problem/13642852>). >+ String sessionName = String::format("WebKit Test-%u", static_cast<uint32_t>(getCurrentProcessID())); >+ >+ auto session = adoptCF(WebCore::createPrivateStorageSession(sessionName.createCFString().get())); >+ >+#if PLATFORM(COCOA) >+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage; >+ if (WebCore::NetworkStorageSession::processMayUseCookieAPI()) { >+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >+ if (session) >+ cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, session.get())); >+ } >+ >+ m_defaultNetworkStorageSession = std::make_unique<WebCore::NetworkStorageSession>(PAL::SessionID::defaultSessionID(), WTFMove(session), WTFMove(cookieStorage)); >+#elif USE(SOUP) >+ m_defaultNetworkStorageSession = std::make_unique<WebCore::NetworkStorageSession>(PAL::SessionID::defaultSessionID(), std::make_unique<WebCore::SoupNetworkSession>()); >+#endif >+} >+ >+#if PLATFORM(COCOA) >+void NetworkProcess::ensureSession(const PAL::SessionID& sessionID, const String& identifierBase, RetainPtr<CFHTTPCookieStorageRef>&& cookieStorage) >+#else >+void NetworkProcess::ensureSession(const PAL::SessionID& sessionID, const String& identifierBase) >+#endif >+{ >+ auto addResult = m_networkStorageSessions.add(sessionID, nullptr); >+ if (!addResult.isNewEntry) >+ return; >+ >+#if PLATFORM(COCOA) >+ RetainPtr<CFURLStorageSessionRef> storageSession; >+ RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString(); >+ if (sessionID.isEphemeral()) >+ storageSession = adoptCF(createPrivateStorageSession(cfIdentifier.get())); >+ else >+ storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(cfIdentifier.get()); >+ >+ if (NetworkStorageSession::processMayUseCookieAPI()) { >+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >+ if (!cookieStorage && storageSession) >+ cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get())); >+ } >+ >+ addResult.iterator->value = std::make_unique<NetworkStorageSession>(sessionID, WTFMove(storageSession), WTFMove(cookieStorage)); >+#elif USE(SOUP) >+ addResult.iterator->value = std::make_unique<NetworkStorageSession>(sessionID, std::make_unique<SoupNetworkSession>(sessionID)); >+#endif >+} >+ >+WebCore::NetworkStorageSession* NetworkProcess::storageSession(const PAL::SessionID& sessionID) const >+{ >+ if (sessionID == PAL::SessionID::defaultSessionID()) >+ return &defaultStorageSession(); >+ return m_networkStorageSessions.get(sessionID); >+} >+ >+WebCore::NetworkStorageSession& NetworkProcess::defaultStorageSession() const >+{ >+ if (!m_defaultNetworkStorageSession) >+ m_defaultNetworkStorageSession = std::make_unique<WebCore::NetworkStorageSession>(PAL::SessionID::defaultSessionID()); >+ return *m_defaultNetworkStorageSession; >+} >+ >+void NetworkProcess::forEachNetworkStorageSession(const Function<void(WebCore::NetworkStorageSession&)>& functor) >+{ >+ functor(defaultStorageSession()); >+ for (auto& storageSession : m_networkStorageSessions.values()) >+ functor(*storageSession); >+} >+ > NetworkSession* NetworkProcess::networkSession(const PAL::SessionID& sessionID) const > { > return m_networkSessions.get(sessionID); >@@ -471,7 +547,7 @@ void NetworkProcess::destroySession(cons > { > if (auto session = m_networkSessions.take(sessionID)) > session->get().invalidateAndCancel(); >- NetworkStorageSession::destroySession(sessionID); >+ m_networkStorageSessions.remove(sessionID); > m_sessionsControlledByAutomation.remove(sessionID); > CacheStorage::Engine::destroyEngine(*this, sessionID); > >@@ -499,21 +575,21 @@ void NetworkProcess::writeBlobToFilePath > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void NetworkProcess::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<String>& domainsToBlock, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->setPrevalentDomainsToBlockCookiesFor(domainsToBlock); > parentProcessConnection()->send(Messages::NetworkProcessProxy::DidUpdateBlockCookies(contextId), 0); > } > > void NetworkProcess::setAgeCapForClientSideCookies(PAL::SessionID sessionID, Optional<Seconds> seconds, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->setAgeCapForClientSideCookies(seconds); > parentProcessConnection()->send(Messages::NetworkProcessProxy::DidSetAgeCapForClientSideCookies(contextId), 0); > } > > void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(networkStorageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID), contextId), 0); > else > ASSERT_NOT_REACHED(); >@@ -521,7 +597,7 @@ void NetworkProcess::hasStorageAccessFor > > void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > parentProcessConnection()->send(Messages::NetworkProcessProxy::AllStorageAccessEntriesResult(networkStorageSession->getAllStorageAccessEntries(), contextId), 0); > else > ASSERT_NOT_REACHED(); >@@ -530,7 +606,7 @@ void NetworkProcess::getAllStorageAccess > void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) > { > bool isStorageGranted = false; >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) { >+ if (auto* networkStorageSession = storageSession(sessionID)) { > networkStorageSession->grantStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID); > ASSERT(networkStorageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID)); > isStorageGranted = true; >@@ -563,7 +639,7 @@ void NetworkProcess::logUserInteraction( > > void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->removeAllStorageAccess(); > else > ASSERT_NOT_REACHED(); >@@ -572,13 +648,13 @@ void NetworkProcess::removeAllStorageAcc > > void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->removePrevalentDomains(domains); > } > > void NetworkProcess::setCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, Seconds seconds, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->setCacheMaxAgeCapForPrevalentResources(Seconds { seconds }); > else > ASSERT_NOT_REACHED(); >@@ -587,7 +663,7 @@ void NetworkProcess::setCacheMaxAgeCapFo > > void NetworkProcess::resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, uint64_t contextId) > { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->resetCacheMaxAgeCapForPrevalentResources(); > else > ASSERT_NOT_REACHED(); >@@ -666,13 +742,13 @@ void NetworkProcess::fetchWebsiteData(PA > })); > > if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->getHostnamesWithCookies(callbackAggregator->m_websiteData.hostNamesWithCookies); > } > > if (websiteDataTypes.contains(WebsiteDataType::Credentials)) { >- if (NetworkStorageSession::storageSession(sessionID)) >- callbackAggregator->m_websiteData.originsWithCredentials = NetworkStorageSession::storageSession(sessionID)->credentialStorage().originsWithCredentials(); >+ if (storageSession(sessionID)) >+ callbackAggregator->m_websiteData.originsWithCredentials = storageSession(sessionID)->credentialStorage().originsWithCredentials(); > } > > if (websiteDataTypes.contains(WebsiteDataType::DOMCache)) { >@@ -683,7 +759,7 @@ void NetworkProcess::fetchWebsiteData(PA > > #if PLATFORM(COCOA) > if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > getHostNamesWithHSTSCache(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithHSTSCache); > } > #endif >@@ -722,19 +798,19 @@ void NetworkProcess::deleteWebsiteData(P > { > #if PLATFORM(COCOA) > if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > clearHSTSCache(*networkStorageSession, modifiedSince); > } > #endif > > if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->deleteAllCookiesModifiedSince(modifiedSince); > } > > if (websiteDataTypes.contains(WebsiteDataType::Credentials)) { >- if (NetworkStorageSession::storageSession(sessionID)) >- NetworkStorageSession::storageSession(sessionID)->credentialStorage().clearCredentials(); >+ if (auto* session = storageSession(sessionID)) >+ session->credentialStorage().clearCredentials(); > } > > auto clearTasksHandler = WTF::CallbackAggregator::create([this, callbackID] { >@@ -785,13 +861,13 @@ static void clearDiskCacheEntries(Networ > void NetworkProcess::deleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<SecurityOriginData>& originDatas, const Vector<String>& cookieHostNames, const Vector<String>& HSTSCacheHostNames, uint64_t callbackID) > { > if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > networkStorageSession->deleteCookiesForHostnames(cookieHostNames); > } > > #if PLATFORM(COCOA) > if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { >- if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* networkStorageSession = storageSession(sessionID)) > deleteHSTSCacheForHostNames(*networkStorageSession, HSTSCacheHostNames); > } > #endif >Index: Source/WebKit/NetworkProcess/NetworkProcess.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcess.h (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkProcess.h (working copy) >@@ -46,6 +46,10 @@ > #include <wtf/RetainPtr.h> > #include <wtf/WeakPtr.h> > >+#if PLATFORM(COCOA) >+typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; >+#endif >+ > namespace IPC { > class FormDataReference; > } >@@ -132,6 +136,16 @@ public: > NetworkSession* networkSession(const PAL::SessionID&) const override; > void destroySession(const PAL::SessionID&); > >+ void forEachNetworkStorageSession(const Function<void(WebCore::NetworkStorageSession&)>&); >+ WebCore::NetworkStorageSession* storageSession(const PAL::SessionID&) const; >+ WebCore::NetworkStorageSession& defaultStorageSession() const; >+ void switchToNewTestingSession(); >+#if PLATFORM(COCOA) >+ void ensureSession(const PAL::SessionID&, const String& identifier, RetainPtr<CFHTTPCookieStorageRef>&&); >+#else >+ void ensureSession(const PAL::SessionID&, const String& identifier); >+#endif >+ > bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; } > > void processWillSuspendImminently(bool& handled); >@@ -386,6 +400,8 @@ private: > HashSet<PAL::SessionID> m_sessionsControlledByAutomation; > HashMap<PAL::SessionID, Vector<CacheStorageParametersCallback>> m_cacheStorageParametersCallbacks; > HashMap<PAL::SessionID, Ref<NetworkSession>> m_networkSessions; >+ HashMap<PAL::SessionID, std::unique_ptr<WebCore::NetworkStorageSession>> m_networkStorageSessions; >+ mutable std::unique_ptr<WebCore::NetworkStorageSession> m_defaultNetworkStorageSession; > > #if PLATFORM(COCOA) > void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&); >Index: Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (working copy) >@@ -609,7 +609,7 @@ Optional<Seconds> NetworkResourceLoader: > } > > if (!existingCacheEntryMatchesNewResponse) { >- if (auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(sessionID())) >+ if (auto* networkStorageSession = m_connection->networkProcess().storageSession(sessionID())) > return networkStorageSession->maxAgeCacheCap(request); > } > #endif >@@ -970,7 +970,7 @@ void NetworkResourceLoader::logCookieInf > { > ASSERT(shouldLogCookieInformation(m_connection, sessionID())); > >- auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(sessionID()); >+ auto* networkStorageSession = m_connection->networkProcess().storageSession(sessionID()); > ASSERT(networkStorageSession); > > logCookieInformation(m_connection, "NetworkResourceLoader", reinterpret_cast<const void*>(this), *networkStorageSession, originalRequest().firstPartyForCookies(), SameSiteInfo::create(originalRequest()), originalRequest().url(), originalRequest().httpReferrer(), frameID(), pageID(), identifier()); >Index: Source/WebKit/NetworkProcess/NetworkSession.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkSession.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkSession.cpp (working copy) >@@ -57,7 +57,7 @@ Ref<NetworkSession> NetworkSession::crea > > NetworkStorageSession& NetworkSession::networkStorageSession() const > { >- auto* storageSession = NetworkStorageSession::storageSession(m_sessionID); >+ auto* storageSession = m_networkProcess->storageSession(m_sessionID); > RELEASE_ASSERT(storageSession); > return *storageSession; > } >Index: Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h (revision 240190) >+++ Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h (working copy) >@@ -45,7 +45,7 @@ private: > WebCore::NetworkStorageSession* storageSession() const final > { > if (m_networkProcess) >- return WebCore::NetworkStorageSession::storageSession(m_sessionID); >+ return m_networkProcess->storageSession(m_sessionID); > return nullptr; > } > >Index: Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp (working copy) >@@ -46,7 +46,7 @@ const char* WebCookieManager::supplement > return "WebCookieManager"; > } > >-WebCookieManager::WebCookieManager(ChildProcess& process) >+WebCookieManager::WebCookieManager(NetworkProcess& process) > : m_process(process) > { > m_process.addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this); >@@ -57,7 +57,7 @@ WebCookieManager::~WebCookieManager() = > void WebCookieManager::getHostnamesWithCookies(PAL::SessionID sessionID, CallbackID callbackID) > { > HashSet<String> hostnames; >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->getHostnamesWithCookies(hostnames); > > m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(copyToVector(hostnames), callbackID), 0); >@@ -65,20 +65,20 @@ void WebCookieManager::getHostnamesWithC > > void WebCookieManager::deleteCookiesForHostname(PAL::SessionID sessionID, const String& hostname) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->deleteCookiesForHostnames({ hostname }); > } > > > void WebCookieManager::deleteAllCookies(PAL::SessionID sessionID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->deleteAllCookies(); > } > > void WebCookieManager::deleteCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->deleteCookie(cookie); > > m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0); >@@ -86,7 +86,7 @@ void WebCookieManager::deleteCookie(PAL: > > void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, CallbackID callbackID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->deleteAllCookiesModifiedSince(time); > > m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0); >@@ -95,7 +95,7 @@ void WebCookieManager::deleteAllCookiesM > void WebCookieManager::getAllCookies(PAL::SessionID sessionID, CallbackID callbackID) > { > Vector<Cookie> cookies; >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > cookies = storageSession->getAllCookies(); > > m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0); >@@ -104,7 +104,7 @@ void WebCookieManager::getAllCookies(PAL > void WebCookieManager::getCookies(PAL::SessionID sessionID, const URL& url, CallbackID callbackID) > { > Vector<Cookie> cookies; >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > cookies = storageSession->getCookies(url); > > m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0); >@@ -112,7 +112,7 @@ void WebCookieManager::getCookies(PAL::S > > void WebCookieManager::setCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->setCookie(cookie); > > m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0); >@@ -120,7 +120,7 @@ void WebCookieManager::setCookie(PAL::Se > > void WebCookieManager::setCookies(PAL::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, CallbackID callbackID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > storageSession->setCookies(cookies, url, mainDocumentURL); > > m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0); >@@ -134,7 +134,7 @@ void WebCookieManager::notifyCookiesDidC > > void WebCookieManager::startObservingCookieChanges(PAL::SessionID sessionID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) { >+ if (auto* storageSession = m_process.storageSession(sessionID)) { > WebCore::startObservingCookieChanges(*storageSession, [this, sessionID] { > notifyCookiesDidChange(sessionID); > }); >@@ -143,7 +143,7 @@ void WebCookieManager::startObservingCoo > > void WebCookieManager::stopObservingCookieChanges(PAL::SessionID sessionID) > { >- if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) >+ if (auto* storageSession = m_process.storageSession(sessionID)) > WebCore::stopObservingCookieChanges(*storageSession); > } > >Index: Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h >=================================================================== >--- Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h (revision 240190) >+++ Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h (working copy) >@@ -45,12 +45,12 @@ struct Cookie; > > namespace WebKit { > >-class ChildProcess; >+class NetworkProcess; > > class WebCookieManager : public NetworkProcessSupplement, public IPC::MessageReceiver { > WTF_MAKE_NONCOPYABLE(WebCookieManager); > public: >- WebCookieManager(ChildProcess&); >+ WebCookieManager(NetworkProcess&); > ~WebCookieManager(); > > static const char* supplementName(); >@@ -86,7 +86,7 @@ private: > void startObservingCookieChanges(PAL::SessionID); > void stopObservingCookieChanges(PAL::SessionID); > >- ChildProcess& m_process; >+ NetworkProcess& m_process; > }; > > } // namespace WebKit >Index: Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm >=================================================================== >--- Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm (revision 240190) >+++ Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm (working copy) >@@ -26,6 +26,7 @@ > #import "config.h" > #import "WebCookieManager.h" > >+#import "NetworkProcess.h" > #import "NetworkSession.h" > #import <WebCore/NetworkStorageSession.h> > #import <pal/spi/cf/CFNetworkSPI.h> >@@ -40,7 +41,7 @@ void WebCookieManager::platformSetHTTPCo > > [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)]; > >- NetworkStorageSession::forEach([&] (const NetworkStorageSession& networkStorageSession) { >+ m_process.forEachNetworkStorageSession([&] (const auto& networkStorageSession) { > if (auto cookieStorage = networkStorageSession.cookieStorage()) > CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy); > }); >Index: Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (working copy) >@@ -30,6 +30,7 @@ > #include "NetworkCacheSpeculativeLoadManager.h" > #include "NetworkCacheStatistics.h" > #include "NetworkCacheStorage.h" >+#include "NetworkProcess.h" > #include <WebCore/CacheValidation.h> > #include <WebCore/FileSystem.h> > #include <WebCore/HTTPHeaderNames.h> >@@ -184,14 +185,14 @@ static bool responseNeedsRevalidation(co > return responseHasExpired(response, timestamp, requestDirectives.maxStale); > } > >-static UseDecision makeUseDecision(const Entry& entry, const WebCore::ResourceRequest& request) >+static UseDecision makeUseDecision(NetworkProcess& networkProcess, const Entry& entry, const WebCore::ResourceRequest& request) > { > // The request is conditional so we force revalidation from the network. We merely check the disk cache > // so we can update the cache entry. > if (request.isConditional() && !entry.redirectRequest()) > return UseDecision::Validate; > >- if (!WebCore::verifyVaryingRequestHeaders(WebCore::NetworkStorageSession::defaultStorageSession(), entry.varyingRequestHeaders(), request)) >+ if (!WebCore::verifyVaryingRequestHeaders(networkProcess.defaultStorageSession(), entry.varyingRequestHeaders(), request)) > return UseDecision::NoDueToVaryingHeaderMismatch; > > // We never revalidate in the case of a history navigation. >@@ -305,9 +306,9 @@ void Cache::retrieve(const WebCore::Reso > > #if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION) > if (canUseSpeculativeRevalidation && m_speculativeLoadManager->canRetrieve(storageKey, request, frameID)) { >- m_speculativeLoadManager->retrieve(storageKey, [request, completionHandler = WTFMove(completionHandler), info = WTFMove(info)](std::unique_ptr<Entry> entry) mutable { >+ m_speculativeLoadManager->retrieve(storageKey, [networkProcess = makeRef(networkProcess()), request, completionHandler = WTFMove(completionHandler), info = WTFMove(info)](std::unique_ptr<Entry> entry) mutable { > info.wasSpeculativeLoad = true; >- if (entry && WebCore::verifyVaryingRequestHeaders(WebCore::NetworkStorageSession::defaultStorageSession(), entry->varyingRequestHeaders(), request)) >+ if (entry && WebCore::verifyVaryingRequestHeaders(networkProcess->defaultStorageSession(), entry->varyingRequestHeaders(), request)) > completeRetrieve(WTFMove(completionHandler), WTFMove(entry), info); > else > completeRetrieve(WTFMove(completionHandler), nullptr, info); >@@ -333,7 +334,7 @@ void Cache::retrieve(const WebCore::Reso > > auto entry = Entry::decodeStorageRecord(*record); > >- auto useDecision = entry ? makeUseDecision(*entry, request) : UseDecision::NoDueToDecodeFailure; >+ auto useDecision = entry ? makeUseDecision(networkProcess(), *entry, request) : UseDecision::NoDueToDecodeFailure; > switch (useDecision) { > case UseDecision::Use: > break; >@@ -364,12 +365,12 @@ void Cache::completeRetrieve(RetrieveCom > > std::unique_ptr<Entry> Cache::makeEntry(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, RefPtr<WebCore::SharedBuffer>&& responseData) > { >- return std::make_unique<Entry>(makeCacheKey(request), response, WTFMove(responseData), WebCore::collectVaryingRequestHeaders(WebCore::NetworkStorageSession::defaultStorageSession(), request, response)); >+ return std::make_unique<Entry>(makeCacheKey(request), response, WTFMove(responseData), WebCore::collectVaryingRequestHeaders(networkProcess().defaultStorageSession(), request, response)); > } > > std::unique_ptr<Entry> Cache::makeRedirectEntry(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& redirectRequest) > { >- return std::make_unique<Entry>(makeCacheKey(request), response, redirectRequest, WebCore::collectVaryingRequestHeaders(WebCore::NetworkStorageSession::defaultStorageSession(), request, response)); >+ return std::make_unique<Entry>(makeCacheKey(request), response, redirectRequest, WebCore::collectVaryingRequestHeaders(networkProcess().defaultStorageSession(), request, response)); > } > > std::unique_ptr<Entry> Cache::store(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, RefPtr<WebCore::SharedBuffer>&& responseData, Function<void(MappedBody&)>&& completionHandler) >@@ -453,7 +454,7 @@ std::unique_ptr<Entry> Cache::update(con > WebCore::ResourceResponse response = existingEntry.response(); > WebCore::updateResponseHeadersAfterRevalidation(response, validatingResponse); > >- auto updateEntry = std::make_unique<Entry>(existingEntry.key(), response, existingEntry.buffer(), WebCore::collectVaryingRequestHeaders(WebCore::NetworkStorageSession::defaultStorageSession(), originalRequest, response)); >+ auto updateEntry = std::make_unique<Entry>(existingEntry.key(), response, existingEntry.buffer(), WebCore::collectVaryingRequestHeaders(networkProcess().defaultStorageSession(), originalRequest, response)); > auto updateRecord = updateEntry->encodeAsStorageRecord(); > > m_storage->store(updateRecord, { }); >Index: Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp (working copy) >@@ -74,7 +74,7 @@ void SpeculativeLoad::willSendRedirected > > Optional<Seconds> maxAgeCap; > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- if (auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(PAL::SessionID::defaultSessionID())) >+ if (auto* networkStorageSession = m_cache->networkProcess().storageSession(PAL::SessionID::defaultSessionID())) > maxAgeCap = networkStorageSession->maxAgeCacheCap(request); > #endif > m_cacheEntry = m_cache->storeRedirect(request, redirectResponse, redirectRequest, maxAgeCap); >Index: Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (revision 240190) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (working copy) >@@ -231,7 +231,7 @@ void NetworkProcess::platformSyncAllCook > > #if HAVE(FOUNDATION_WITH_SAVE_COOKIES_WITH_COMPLETION_HANDLER) > RefPtr<CallbackAggregator> callbackAggregator = CallbackAggregator::create(WTFMove(completionHander)); >- WebCore::NetworkStorageSession::forEach([&] (auto& networkStorageSession) { >+ forEachNetworkStorageSession([&] (auto& networkStorageSession) { > saveCookies(networkStorageSession.nsCookieStorage(), [callbackAggregator] { }); > }); > #else >Index: Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (revision 240190) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (working copy) >@@ -445,7 +445,7 @@ - (void)URLSession:(NSURLSession *)sessi > > bool shouldIgnoreHSTS = false; > #if HAVE(CFNETWORK_WITH_IGNORE_HSTS) >- shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); >+ shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && _session->networkProcess().storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); > if (shouldIgnoreHSTS) { > request = downgradeRequest(request); > ASSERT([request.URL.scheme isEqualToString:@"http"]); >@@ -478,7 +478,7 @@ - (void)URLSession:(NSURLSession *)sessi > if (auto* networkDataTask = [self existingTask:task]) { > bool shouldIgnoreHSTS = false; > #if HAVE(CFNETWORK_WITH_IGNORE_HSTS) >- shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); >+ shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && _session->networkProcess().storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); > if (shouldIgnoreHSTS) { > request = downgradeRequest(request); > ASSERT([request.URL.scheme isEqualToString:@"http"]); >@@ -549,7 +549,7 @@ - (void)URLSession:(NSURLSession *)sessi > WebCore::AuthenticationChallenge authenticationChallenge(challenge); > auto completionHandlerCopy = Block_copy(completionHandler); > auto sessionID = _session->sessionID(); >- auto challengeCompletionHandler = [completionHandlerCopy, sessionID, authenticationChallenge, taskIdentifier, partition = networkDataTask->partition()](WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential) >+ auto challengeCompletionHandler = [networkProcess = makeRef(_session->networkProcess()), completionHandlerCopy, sessionID, authenticationChallenge, taskIdentifier, partition = networkDataTask->partition()](WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential) > { > #if !LOG_DISABLED > LOG(NetworkSession, "%llu didReceiveChallenge completionHandler %d", taskIdentifier, disposition); >@@ -566,7 +566,7 @@ - (void)URLSession:(NSURLSession *)sessi > URL urlToStore; > if (authenticationChallenge.failureResponse().httpStatusCode() == 401) > urlToStore = authenticationChallenge.failureResponse().url(); >- if (auto storageSession = WebCore::NetworkStorageSession::storageSession(sessionID)) >+ if (auto storageSession = networkProcess->storageSession(sessionID)) > storageSession->credentialStorage().set(partition, nonPersistentCredential, authenticationChallenge.protectionSpace(), urlToStore); > else > ASSERT_NOT_REACHED(); >@@ -914,7 +914,7 @@ NetworkSessionCocoa::NetworkSessionCocoa > configuration._companionProxyPreference = NSURLSessionCompanionProxyPreferencePreferDirectToCloud; > #endif > >- auto* storageSession = WebCore::NetworkStorageSession::storageSession(parameters.sessionID); >+ auto* storageSession = networkProcess.storageSession(parameters.sessionID); > RELEASE_ASSERT(storageSession); > > NSHTTPCookieStorage* cookieStorage; >Index: Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp (working copy) >@@ -38,10 +38,10 @@ using namespace WebCore; > void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, WebsiteDataStoreParameters&& parameters) > { > auto sessionID = parameters.networkSessionParameters.sessionID; >- if (NetworkStorageSession::storageSession(sessionID)) >+ if (networkProcess.storageSession(sessionID)) > return; > >- NetworkStorageSession::ensureSession(sessionID, String::number(sessionID.sessionID())); >+ networkProcess.ensureSession(sessionID, String::number(sessionID.sessionID())); > networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters))); > } > >Index: Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm >=================================================================== >--- Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm (revision 240190) >+++ Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm (working copy) >@@ -44,7 +44,7 @@ using namespace WebCore; > void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, WebsiteDataStoreParameters&& parameters) > { > auto sessionID = parameters.networkSessionParameters.sessionID; >- if (NetworkStorageSession::storageSession(sessionID)) >+ if (networkProcess.storageSession(sessionID)) > return; > > String base = networkProcess.uiProcessBundleIdentifier(); >@@ -58,9 +58,9 @@ void RemoteNetworkingContext::ensureWebs > if (!sessionID.isEphemeral() && !parameters.uiProcessCookieStorageIdentifier.isEmpty()) > uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier); > >- NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()), WTFMove(uiProcessCookieStorage)); >+ networkProcess.ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()), WTFMove(uiProcessCookieStorage)); > >- auto* session = NetworkStorageSession::storageSession(sessionID); >+ auto* session = networkProcess.storageSession(sessionID); > for (const auto& cookie : parameters.pendingCookies) > session->setCookie(cookie); > >Index: Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp (revision 240190) >+++ Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp (working copy) >@@ -38,10 +38,10 @@ using namespace WebCore; > void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, WebsiteDataStoreParameters&& parameters) > { > auto sessionID = parameters.networkSessionParameters.sessionID; >- if (NetworkStorageSession::storageSession(sessionID)) >+ if (networkProcess.storageSession(sessionID)) > return; > >- NetworkStorageSession::ensureSession(sessionID, String::number(sessionID.sessionID())); >+ networkProcess.ensureSession(sessionID, String::number(sessionID.sessionID())); > networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters))); > } > >Index: Source/WebKit/UIProcess/WebProcessPool.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebProcessPool.cpp (revision 240190) >+++ Source/WebKit/UIProcess/WebProcessPool.cpp (working copy) >@@ -1629,7 +1629,6 @@ void WebProcessPool::setAllowsAnySSLCert > > void WebProcessPool::clearCachedCredentials() > { >- sendToAllProcesses(Messages::WebProcess::ClearCachedCredentials()); > if (m_networkProcess) > m_networkProcess->send(Messages::NetworkProcess::ClearCachedCredentials(), 0); > } >Index: Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (revision 240190) >+++ Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (working copy) >@@ -49,71 +49,70 @@ HTTPCookieStore::~HTTPCookieStore() > ASSERT(m_observers.isEmpty()); > ASSERT(!m_observedCookieManagerProxy); > ASSERT(!m_cookieManagerProxyObserver); >- ASSERT(!m_observingUIProcessCookies); > > unregisterForNewProcessPoolNotifications(); > } > >-void HTTPCookieStore::cookies(Function<void(const Vector<WebCore::Cookie>&)>&& completionHandler) >+void HTTPCookieStore::cookies(CompletionHandler<void(const Vector<WebCore::Cookie>&)>&& completionHandler) > { > auto* pool = m_owningDataStore->processPoolForCookieStorageOperations(); > if (!pool) { > Vector<WebCore::Cookie> allCookies; > if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID()) >- allCookies = WebCore::NetworkStorageSession::defaultStorageSession().getAllCookies(); >+ allCookies = getAllDefaultUIProcessCookieStoreCookies(); > allCookies.appendVector(m_owningDataStore->pendingCookies()); > >- callOnMainThread([completionHandler = WTFMove(completionHandler), allCookies]() { >+ callOnMainThread([completionHandler = WTFMove(completionHandler), allCookies] () mutable { > completionHandler(allCookies); > }); > return; > } > > auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>(); >- cookieManager->getAllCookies(m_owningDataStore->sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](const Vector<WebCore::Cookie>& cookies, CallbackBase::Error error) { >+ cookieManager->getAllCookies(m_owningDataStore->sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (const Vector<WebCore::Cookie>& cookies, CallbackBase::Error error) mutable { > completionHandler(cookies); > }); > } > >-void HTTPCookieStore::setCookie(const WebCore::Cookie& cookie, Function<void ()>&& completionHandler) >+void HTTPCookieStore::setCookie(const WebCore::Cookie& cookie, CompletionHandler<void()>&& completionHandler) > { > auto* pool = m_owningDataStore->processPoolForCookieStorageOperations(); > if (!pool) { > // FIXME: pendingCookies used for defaultSession because session cookies cannot be propagated to Network Process with uiProcessCookieStorageIdentifier. > if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session) >- WebCore::NetworkStorageSession::defaultStorageSession().setCookie(cookie); >+ setCookieInDefaultUIProcessCookieStore(cookie); > else > m_owningDataStore->addPendingCookie(cookie); > >- callOnMainThread([completionHandler = WTFMove(completionHandler)]() { >+ callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable { > completionHandler(); > }); > return; > } > > auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>(); >- cookieManager->setCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) { >+ cookieManager->setCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (CallbackBase::Error error) mutable { > completionHandler(); > }); > } > >-void HTTPCookieStore::deleteCookie(const WebCore::Cookie& cookie, Function<void ()>&& completionHandler) >+void HTTPCookieStore::deleteCookie(const WebCore::Cookie& cookie, CompletionHandler<void()>&& completionHandler) > { > auto* pool = m_owningDataStore->processPoolForCookieStorageOperations(); > if (!pool) { > if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session) >- WebCore::NetworkStorageSession::defaultStorageSession().deleteCookie(cookie); >+ deleteCookieFromDefaultUIProcessCookieStore(cookie); > else > m_owningDataStore->removePendingCookie(cookie); > >- callOnMainThread([completionHandler = WTFMove(completionHandler)]() { >+ callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable { > completionHandler(); > }); > return; > } > > auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>(); >- cookieManager->deleteCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) { >+ cookieManager->deleteCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) mutable { > completionHandler(); > }); > } >@@ -156,12 +155,11 @@ void HTTPCookieStore::registerObserver(O > ASSERT(!m_observingUIProcessCookies); > > // Listen for cookie notifications in the UIProcess in the meantime. >- WebCore::startObservingCookieChanges(WebCore::NetworkStorageSession::defaultStorageSession(), [this] () { >+ startObservingChangesToDefaultUIProcessCookieStore([this] () { > cookiesDidChange(); > }); > > m_observingUIProcessCookies = true; >- > return; > } > >@@ -180,7 +178,7 @@ void HTTPCookieStore::unregisterObserver > m_observedCookieManagerProxy->unregisterObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver); > > if (m_observingUIProcessCookies) >- WebCore::stopObservingCookieChanges(WebCore::NetworkStorageSession::defaultStorageSession()); >+ stopObservingChangesToDefaultUIProcessCookieStore(); > > if (m_processPoolCreationListenerIdentifier) > WebProcessPool::unregisterProcessPoolCreationListener(m_processPoolCreationListenerIdentifier); >@@ -221,7 +219,7 @@ void HTTPCookieStore::registerForNewProc > > // Now that an associated process pool exists, we need to flush the UI process cookie store > // to make sure any changes are reflected within the new process pool. >- WebCore::NetworkStorageSession::defaultStorageSession().flushCookieStore(); >+ flushDefaultUIProcessCookieStore(); > newProcessPool.ensureNetworkProcess(); > > if (m_cookieManagerProxyObserver) { >@@ -240,4 +238,13 @@ void HTTPCookieStore::unregisterForNewPr > m_processPoolCreationListenerIdentifier = 0; > } > >+#if !PLATFORM(COCOA) >+void HTTPCookieStore::flushDefaultUIProcessCookieStore() { } >+Vector<WebCore::Cookie> HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies() { return { }; } >+void HTTPCookieStore::setCookieInDefaultUIProcessCookieStore(const WebCore::Cookie&) { } >+void HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore(const WebCore::Cookie&) { } >+void HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore(Function<void()>&&) { } >+void HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore() { } >+#endif >+ > } // namespace API >Index: Source/WebKit/UIProcess/API/APIHTTPCookieStore.h >=================================================================== >--- Source/WebKit/UIProcess/API/APIHTTPCookieStore.h (revision 240190) >+++ Source/WebKit/UIProcess/API/APIHTTPCookieStore.h (working copy) >@@ -28,12 +28,13 @@ > #include "APIObject.h" > #include "HTTPCookieAcceptPolicy.h" > #include <WebCore/Cookie.h> >+#include <wtf/CompletionHandler.h> > #include <wtf/Forward.h> >-#include <wtf/Function.h> > #include <wtf/HashSet.h> > > namespace WebCore { > struct Cookie; >+class CookieStorageObserver; > } > > namespace WebKit { >@@ -55,9 +56,9 @@ public: > > virtual ~HTTPCookieStore(); > >- void cookies(Function<void (const Vector<WebCore::Cookie>&)>&& completionHandler); >- void setCookie(const WebCore::Cookie&, Function<void ()>&& completionHandler); >- void deleteCookie(const WebCore::Cookie&, Function<void ()>&& completionHandler); >+ void cookies(CompletionHandler<void(const Vector<WebCore::Cookie>&)>&&); >+ void setCookie(const WebCore::Cookie&, CompletionHandler<void()>&&); >+ void deleteCookie(const WebCore::Cookie&, CompletionHandler<void()>&&); > > class Observer { > public: >@@ -77,6 +78,13 @@ private: > void registerForNewProcessPoolNotifications(); > void unregisterForNewProcessPoolNotifications(); > >+ static void flushDefaultUIProcessCookieStore(); >+ static Vector<WebCore::Cookie> getAllDefaultUIProcessCookieStoreCookies(); >+ static void setCookieInDefaultUIProcessCookieStore(const WebCore::Cookie&); >+ static void deleteCookieFromDefaultUIProcessCookieStore(const WebCore::Cookie&); >+ void startObservingChangesToDefaultUIProcessCookieStore(Function<void()>&&); >+ void stopObservingChangesToDefaultUIProcessCookieStore(); >+ > Ref<WebKit::WebsiteDataStore> m_owningDataStore; > HashSet<Observer*> m_observers; > >@@ -85,6 +93,7 @@ private: > bool m_observingUIProcessCookies { false }; > > uint64_t m_processPoolCreationListenerIdentifier { 0 }; >+ RefPtr<WebCore::CookieStorageObserver> m_defaultUIProcessObserver; > }; > > } >Index: Source/WebKit/UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm (nonexistent) >+++ Source/WebKit/UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm (working copy) >@@ -0,0 +1,73 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "APIHTTPCookieStore.h" >+ >+#include <WebCore/Cookie.h> >+#include <WebCore/CookieStorageObserver.h> >+#include <pal/spi/cf/CFNetworkSPI.h> >+ >+namespace API { >+ >+void HTTPCookieStore::flushDefaultUIProcessCookieStore() >+{ >+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] _saveCookies]; >+} >+ >+Vector<WebCore::Cookie> HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies() >+{ >+ NSArray<NSHTTPCookie *> *cookiesArray = [NSHTTPCookieStorage sharedHTTPCookieStorage].cookies; >+ Vector<WebCore::Cookie> cookiesVector; >+ cookiesVector.reserveInitialCapacity(cookiesArray.count); >+ for (NSHTTPCookie *cookie in cookiesArray) >+ cookiesVector.uncheckedAppend({ cookie }); >+ return cookiesVector; >+} >+ >+void HTTPCookieStore::setCookieInDefaultUIProcessCookieStore(const WebCore::Cookie& cookie) >+{ >+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie]; >+} >+ >+void HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore(const WebCore::Cookie& cookie) >+{ >+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; >+} >+ >+void HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore(Function<void()>&& function) >+{ >+ stopObservingChangesToDefaultUIProcessCookieStore(); >+ m_defaultUIProcessObserver = WebCore::CookieStorageObserver::create([NSHTTPCookieStorage sharedHTTPCookieStorage]); >+ m_defaultUIProcessObserver->startObserving(WTFMove(function)); >+} >+ >+void HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore() >+{ >+ if (auto observer = std::exchange(m_defaultUIProcessObserver, nullptr)) >+ observer->stopObserving(); >+} >+ >+} // namespace API >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 240190) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -3452,6 +3452,7 @@ > 5C9EF2E721F058F9003BDC56 /* NetworkStorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkStorageSessionProvider.h; sourceTree = "<group>"; }; > 5CA26D7F217ABBB600F97A35 /* WKSafeBrowsingWarning.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKSafeBrowsingWarning.mm; sourceTree = "<group>"; }; > 5CA26D80217ABBB600F97A35 /* WKSafeBrowsingWarning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSafeBrowsingWarning.h; sourceTree = "<group>"; }; >+ 5CA46E7A21F1A23900CE86B4 /* APIHTTPCookieStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = APIHTTPCookieStoreCocoa.mm; path = UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm; sourceTree = SOURCE_ROOT; }; > 5CA98549210BEB5A0057EB6B /* SafeBrowsingWarning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingWarning.h; sourceTree = "<group>"; }; > 5CA9854B210BEB730057EB6B /* SafeBrowsingWarningCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SafeBrowsingWarningCocoa.mm; sourceTree = "<group>"; }; > 5CADDE0D2151AA010067D309 /* AuthenticationChallengeDisposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AuthenticationChallengeDisposition.h; path = Authentication/AuthenticationChallengeDisposition.h; sourceTree = "<group>"; }; >@@ -4849,9 +4850,9 @@ > 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */, > 1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */, > 1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */, >+ 4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreClient.h */, > 5C46C0AC21B7198B00BC5991 /* WebsiteDataStoreConfiguration.cpp */, > 5C46C0AD21B7198C00BC5991 /* WebsiteDataStoreConfiguration.h */, >- 4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreClient.h */, > ); > path = WebsiteData; > sourceTree = "<group>"; >@@ -6068,6 +6069,7 @@ > 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */, > F41056612130699A0092281D /* APIAttachmentCocoa.mm */, > 7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */, >+ 5CA46E7A21F1A23900CE86B4 /* APIHTTPCookieStoreCocoa.mm */, > FED3C1DA1B447AE800E0EB7F /* APISerializedScriptValueCocoa.mm */, > 1A3635AB1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm */, > 1AFDE64319510B5500C48FFA /* LegacyBundleForClass.mm */, >@@ -8863,10 +8865,10 @@ > 1A81B38118BD66AD0007FDAC /* _WKVisitedLinkStore.h in Headers */, > 1A81B38518BD673A0007FDAC /* _WKVisitedLinkStoreInternal.h in Headers */, > 1AE286781C7E76510069AC4F /* _WKWebsiteDataSize.h in Headers */, >- E4D54D0421F1D72D007E3C36 /* ScrollingTreeFrameScrollingNodeRemoteIOS.h in Headers */, > 1AE286801C7F92C00069AC4F /* _WKWebsiteDataSizeInternal.h in Headers */, > 1AFB4C721ADF155D00B33339 /* _WKWebsiteDataStore.h in Headers */, > 5120C8351E5B74B90025B250 /* _WKWebsiteDataStoreConfiguration.h in Headers */, >+ 41C5379021F15B55008B1FAD /* _WKWebsiteDataStoreDelegate.h in Headers */, > 1A4A93B71AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h in Headers */, > 5CB2378C1DF0DE6E00117AA3 /* _WKWebsitePolicies.h in Headers */, > 5CB2378E1DF0E0D300117AA3 /* _WKWebsitePoliciesInternal.h in Headers */, >@@ -8935,7 +8937,6 @@ > 7CB365B11D31DD1E007158CA /* APIUserInitiatedAction.h in Headers */, > 7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */, > 2D8786241BDB58FF00D02ABB /* APIUserStyleSheet.h in Headers */, >- 41C5379021F15B55008B1FAD /* _WKWebsiteDataStoreDelegate.h in Headers */, > C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */, > C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */, > 1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */, >@@ -9269,6 +9270,7 @@ > BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */, > 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */, > E1E552C516AE065F004ED653 /* SandboxInitializationParameters.h in Headers */, >+ E4D54D0421F1D72D007E3C36 /* ScrollingTreeFrameScrollingNodeRemoteIOS.h in Headers */, > 0F931C1C18C5711900DBA7C3 /* ScrollingTreeOverflowScrollingNodeIOS.h in Headers */, > 0F931C1C18C5711900DBB8D4 /* ScrollingTreeScrollingNodeDelegateIOS.h in Headers */, > 51D130541382EAC000351EDD /* SecItemRequestData.h in Headers */, >Index: Source/WebKit/WebProcess/WebProcess.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebProcess.cpp (revision 240190) >+++ Source/WebKit/WebProcess/WebProcess.cpp (working copy) >@@ -570,11 +570,6 @@ void WebProcess::setCacheModel(CacheMode > platformSetCacheModel(cacheModel); > } > >-void WebProcess::clearCachedCredentials() >-{ >- NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials(); >-} >- > WebPage* WebProcess::focusedWebPage() const > { > for (auto& page : m_pageMap.values()) { >@@ -1291,11 +1286,6 @@ void WebProcess::deleteWebsiteData(PAL:: > > CrossOriginPreflightResultCache::singleton().clear(); > } >- >- if (websiteDataTypes.contains(WebsiteDataType::Credentials)) { >- if (WebCore::NetworkStorageSession::storageSession(sessionID)) >- NetworkStorageSession::storageSession(sessionID)->credentialStorage().clearCredentials(); >- } > } > > void WebProcess::deleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<WebCore::SecurityOriginData>& originDatas) >Index: Source/WebKit/WebProcess/WebProcess.h >=================================================================== >--- Source/WebKit/WebProcess/WebProcess.h (revision 240190) >+++ Source/WebKit/WebProcess/WebProcess.h (working copy) >@@ -266,8 +266,6 @@ private: > > void processSuspensionCleanupTimerFired(); > >- void clearCachedCredentials(); >- > void platformTerminate(); > > void markIsNoLongerPrewarmed(); >Index: Source/WebKit/WebProcess/WebProcess.messages.in >=================================================================== >--- Source/WebKit/WebProcess/WebProcess.messages.in (revision 240190) >+++ Source/WebKit/WebProcess/WebProcess.messages.in (working copy) >@@ -51,8 +51,6 @@ messages -> WebProcess LegacyReceiver { > UserPreferredLanguagesChanged(Vector<String> languages) > FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled) > >- ClearCachedCredentials() >- > # Plug-ins. > DidAddPlugInAutoStartOriginHash(uint32_t hash, WallTime expirationTime, PAL::SessionID sessionID) > ResetPlugInAutoStartOriginDefaultHashes(HashMap<uint32_t,WallTime> hashes) >Index: Source/WebKit/WebProcess/Plugins/PluginView.cpp >=================================================================== >--- Source/WebKit/WebProcess/Plugins/PluginView.cpp (revision 240190) >+++ Source/WebKit/WebProcess/Plugins/PluginView.cpp (working copy) >@@ -1602,11 +1602,7 @@ bool PluginView::getAuthenticationInfo(c > if (!contentDocument) > return false; > >- String partitionName = contentDocument->topDocument().domainForCachePartition(); >- Credential credential = NetworkStorageSession::defaultStorageSession().credentialStorage().get(partitionName, protectionSpace); >- if (credential.isEmpty()) >- credential = NetworkStorageSession::defaultStorageSession().credentialStorage().getFromPersistentStorage(protectionSpace); >- >+ auto credential = CredentialStorage::getFromPersistentStorage(protectionSpace); > if (!credential.hasPassword()) > return false; > >Index: Source/WebKitLegacy/ChangeLog >=================================================================== >--- Source/WebKitLegacy/ChangeLog (revision 240190) >+++ Source/WebKitLegacy/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2019-01-18 Alex Christensen <achristensen@webkit.org> >+ >+ Move NetworkStorageSession ownership to NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=193580 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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: >+ > 2019-01-18 Eric Carlson <eric.carlson@apple.com> > > Revert r238815, it broke WK1 video fullscreen on Mac >Index: Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp >=================================================================== >--- Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp (nonexistent) >+++ Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp (working copy) >@@ -0,0 +1,102 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "NetworkStorageSessionMap.h" >+ >+#include <WebCore/NetworkStorageSession.h> >+#include <pal/SessionID.h> >+#include <wtf/ProcessID.h> >+#include <wtf/ProcessPrivilege.h> >+ >+static std::unique_ptr<WebCore::NetworkStorageSession>& defaultNetworkStorageSession() >+{ >+ ASSERT(isMainThread()); >+ static NeverDestroyed<std::unique_ptr<WebCore::NetworkStorageSession>> session; >+ return session; >+} >+ >+static HashMap<PAL::SessionID, std::unique_ptr<WebCore::NetworkStorageSession>>& globalSessionMap() >+{ >+ static NeverDestroyed<HashMap<PAL::SessionID, std::unique_ptr<WebCore::NetworkStorageSession>>> map; >+ return map; >+} >+ >+WebCore::NetworkStorageSession* NetworkStorageSessionMap::storageSession(const PAL::SessionID& sessionID) >+{ >+ return globalSessionMap().get(sessionID); >+} >+ >+WebCore::NetworkStorageSession& NetworkStorageSessionMap::defaultStorageSession() >+{ >+ if (!defaultNetworkStorageSession()) >+ defaultNetworkStorageSession() = std::make_unique<WebCore::NetworkStorageSession>(PAL::SessionID::defaultSessionID()); >+ return *defaultNetworkStorageSession(); >+} >+ >+void NetworkStorageSessionMap::switchToNewTestingSession() >+{ >+ // Session name should be short enough for shared memory region name to be under the limit, otehrwise sandbox rules won't work (see <rdar://problem/13642852>). >+ String sessionName = String::format("WebKit Test-%u", static_cast<uint32_t>(getCurrentProcessID())); >+ >+ auto session = adoptCF(WebCore::createPrivateStorageSession(sessionName.createCFString().get())); >+ >+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage; >+ if (WebCore::NetworkStorageSession::processMayUseCookieAPI()) { >+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >+ if (session) >+ cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, session.get())); >+ } >+ >+ defaultNetworkStorageSession() = std::make_unique<WebCore::NetworkStorageSession>(PAL::SessionID::defaultSessionID(), WTFMove(session), WTFMove(cookieStorage)); >+} >+ >+void NetworkStorageSessionMap::ensureSession(const PAL::SessionID& sessionID, const String& identifierBase) >+{ >+ auto addResult = globalSessionMap().add(sessionID, nullptr); >+ if (!addResult.isNewEntry) >+ return; >+ >+ RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString(); >+ >+ RetainPtr<CFURLStorageSessionRef> storageSession; >+ if (sessionID.isEphemeral()) >+ storageSession = adoptCF(WebCore::createPrivateStorageSession(cfIdentifier.get())); >+ else >+ storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(cfIdentifier.get()); >+ >+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage; >+ if (WebCore::NetworkStorageSession::processMayUseCookieAPI()) { >+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >+ if (storageSession) >+ cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get())); >+ } >+ >+ addResult.iterator->value = std::make_unique<WebCore::NetworkStorageSession>(sessionID, WTFMove(storageSession), WTFMove(cookieStorage)); >+} >+ >+void NetworkStorageSessionMap::destroySession(const PAL::SessionID& sessionID) >+{ >+ globalSessionMap().remove(sessionID); >+} >Index: Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.h >=================================================================== >--- Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.h (nonexistent) >+++ Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.h (working copy) >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/text/WTFString.h> >+ >+namespace PAL { >+class SessionID; >+} >+ >+namespace WebCore { >+class NetworkStorageSession; >+} >+ >+class NetworkStorageSessionMap { >+public: >+ static WebCore::NetworkStorageSession* storageSession(const PAL::SessionID&); >+ static WebCore::NetworkStorageSession& defaultStorageSession(); >+ static void switchToNewTestingSession(); >+ static void ensureSession(const PAL::SessionID&, const String& identifierBase = String()); >+ static void destroySession(const PAL::SessionID&); >+}; >Index: Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h >=================================================================== >--- Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h (revision 240190) >+++ Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h (working copy) >@@ -25,6 +25,7 @@ > > #pragma once > >+#include "NetworkStorageSessionMap.h" > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/Page.h> > #include <WebCore/StorageSessionProvider.h> >@@ -37,7 +38,7 @@ public: > WebCore::NetworkStorageSession* storageSession() const > { > if (m_page) >- return WebCore::NetworkStorageSession::storageSession(m_page->sessionID()); >+ return NetworkStorageSessionMap::storageSession(m_page->sessionID()); > return nullptr; > } > >Index: Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (revision 240190) >+++ Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (working copy) >@@ -148,6 +148,8 @@ > 598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */; }; > 598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5C9EF2F521F061BE003BDC56 /* PageStorageSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9EF2F421F061BE003BDC56 /* PageStorageSessionProvider.h */; }; >+ 5CA46E7821F1451D00CE86B4 /* NetworkStorageSessionMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CA46E7621F1451D00CE86B4 /* NetworkStorageSessionMap.h */; }; >+ 5CA46E7921F1451D00CE86B4 /* NetworkStorageSessionMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CA46E7721F1451D00CE86B4 /* NetworkStorageSessionMap.cpp */; }; > 5CE44F4A206D70EA003EFD01 /* PingHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE44F49206D70E9003EFD01 /* PingHandle.h */; }; > 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; }; >@@ -990,6 +992,8 @@ > 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMockInternal.h; sourceTree = "<group>"; }; > 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProvider.h; sourceTree = "<group>"; }; > 5C9EF2F421F061BE003BDC56 /* PageStorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PageStorageSessionProvider.h; path = WebCoreSupport/PageStorageSessionProvider.h; sourceTree = SOURCE_ROOT; }; >+ 5CA46E7621F1451D00CE86B4 /* NetworkStorageSessionMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkStorageSessionMap.h; path = WebCoreSupport/NetworkStorageSessionMap.h; sourceTree = SOURCE_ROOT; }; >+ 5CA46E7721F1451D00CE86B4 /* NetworkStorageSessionMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkStorageSessionMap.cpp; path = WebCoreSupport/NetworkStorageSessionMap.cpp; sourceTree = SOURCE_ROOT; }; > 5CE44F49206D70E9003EFD01 /* PingHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingHandle.h; path = WebCoreSupport/PingHandle.h; sourceTree = SOURCE_ROOT; }; > 5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; > 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; }; >@@ -2566,6 +2570,8 @@ > A10C1D4418202FFB0036883A /* ios */, > B82958D1132707D0000D0E79 /* CorrectionPanel.h */, > B82958D2132707D0000D0E79 /* CorrectionPanel.mm */, >+ 5CA46E7721F1451D00CE86B4 /* NetworkStorageSessionMap.cpp */, >+ 5CA46E7621F1451D00CE86B4 /* NetworkStorageSessionMap.h */, > 5C9EF2F421F061BE003BDC56 /* PageStorageSessionProvider.h */, > 5CE44F49206D70E9003EFD01 /* PingHandle.h */, > 7C01CB81173435C900C5D807 /* PopupMenuMac.h */, >@@ -2944,6 +2950,7 @@ > 1AAF5CEA0EDDE1FE008D883D /* NetscapePluginHostManager.h in Headers */, > 1AAF5CEC0EDDE1FE008D883D /* NetscapePluginHostProxy.h in Headers */, > 1AAF5CEE0EDDE1FE008D883D /* NetscapePluginInstanceProxy.h in Headers */, >+ 5CA46E7821F1451D00CE86B4 /* NetworkStorageSessionMap.h in Headers */, > E1531BD82187B954002E3F81 /* NSURLDownloadSPI.h in Headers */, > 93D4379B1D57ABEF00AB85EA /* ObjCEventListener.h in Headers */, > 93D4379D1D57ABEF00AB85EA /* ObjCNodeFilterCondition.h in Headers */, >@@ -3530,6 +3537,7 @@ > 1AAF5CEB0EDDE1FE008D883D /* NetscapePluginHostManager.mm in Sources */, > 1AAF5CED0EDDE1FE008D883D /* NetscapePluginHostProxy.mm in Sources */, > 1AAF5CEF0EDDE1FE008D883D /* NetscapePluginInstanceProxy.mm in Sources */, >+ 5CA46E7921F1451D00CE86B4 /* NetworkStorageSessionMap.cpp in Sources */, > 939810DD0824BF01008DF038 /* npapi.mm in Sources */, > 93D4379C1D57ABEF00AB85EA /* ObjCEventListener.mm in Sources */, > 93D4379E1D57ABEF00AB85EA /* ObjCNodeFilterCondition.mm in Sources */, >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 240190) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,25 @@ >+2019-01-18 Alex Christensen <achristensen@webkit.org> >+ >+ Move NetworkStorageSession ownership to NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=193580 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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:]): >+ > 2019-01-18 Eric Carlson <eric.carlson@apple.com> > > Revert r238815, it broke WK1 video fullscreen on Mac >Index: Source/WebKitLegacy/mac/Misc/WebCache.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebCache.mm (revision 240190) >+++ Source/WebKitLegacy/mac/Misc/WebCache.mm (working copy) >@@ -25,6 +25,7 @@ > > #import "WebCache.h" > >+#import "NetworkStorageSessionMap.h" > #import "WebApplicationCacheInternal.h" > #import "WebNSObjectExtras.h" > #import "WebPreferences.h" >@@ -54,7 +55,7 @@ > class DefaultStorageSessionProvider : public WebCore::StorageSessionProvider { > WebCore::NetworkStorageSession* storageSession() const final > { >- return &WebCore::NetworkStorageSession::defaultStorageSession(); >+ return &NetworkStorageSessionMap::defaultStorageSession(); > } > }; > >@@ -223,7 +224,7 @@ + (BOOL)isDisabled > + (void)clearCachedCredentials > { > [WebView _makeAllWebViewsPerformSelector:@selector(_clearCredentials)]; >- WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials(); >+ NetworkStorageSessionMap::defaultStorageSession().credentialStorage().clearCredentials(); > } > > @end >Index: Source/WebKitLegacy/mac/Misc/WebDownload.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebDownload.mm (revision 240190) >+++ Source/WebKitLegacy/mac/Misc/WebDownload.mm (working copy) >@@ -28,6 +28,8 @@ > > #import <WebKitLegacy/WebDownload.h> > >+#import "NetworkStorageSessionMap.h" >+#import "WebTypesInternal.h" > #import <Foundation/NSURLAuthenticationChallenge.h> > #import <WebCore/AuthenticationMac.h> > #import <WebCore/Credential.h> >@@ -38,8 +40,6 @@ > #import <pal/spi/cocoa/NSURLDownloadSPI.h> > #import <wtf/Assertions.h> > >-#import "WebTypesInternal.h" >- > using namespace WebCore; > > @interface WebDownloadInternal : NSObject <NSURLDownloadDelegate> { >@@ -95,7 +95,7 @@ - (void)download:(NSURLDownload *)downlo > #if !PLATFORM(IOS_FAMILY) > // Try previously stored credential first. > if (![challenge previousFailureCount]) { >- NSURLCredential *credential = NetworkStorageSession::defaultStorageSession().credentialStorage().get(emptyString(), ProtectionSpace([challenge protectionSpace])).nsCredential(); >+ NSURLCredential *credential = NetworkStorageSessionMap::defaultStorageSession().credentialStorage().get(emptyString(), ProtectionSpace([challenge protectionSpace])).nsCredential(); > if (credential) { > [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; > return; >Index: Source/WebKitLegacy/mac/Plugins/WebBaseNetscapePluginView.mm >=================================================================== >--- Source/WebKitLegacy/mac/Plugins/WebBaseNetscapePluginView.mm (revision 240190) >+++ Source/WebKitLegacy/mac/Plugins/WebBaseNetscapePluginView.mm (working copy) >@@ -30,6 +30,7 @@ > > #import "WebBaseNetscapePluginView.h" > >+#import "NetworkStorageSessionMap.h" > #import "WebFrameInternal.h" > #import "WebKitLogging.h" > #import "WebKitNSStringExtras.h" >@@ -872,7 +873,7 @@ if (!protocol) > > RetainPtr<NSURLProtectionSpace> protectionSpace = adoptNS([[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]); > >- NSURLCredential *credential = WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().get(emptyString(), ProtectionSpace(protectionSpace.get())).nsCredential(); >+ NSURLCredential *credential = NetworkStorageSessionMap::defaultStorageSession().credentialStorage().get(emptyString(), ProtectionSpace(protectionSpace.get())).nsCredential(); > if (!credential) > credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()]; > if (!credential) >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm (revision 240190) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm (working copy) >@@ -25,6 +25,7 @@ > > #import "WebFrameNetworkingContext.h" > >+#import "NetworkStorageSessionMap.h" > #import "WebFrameInternal.h" > #import "WebViewPrivate.h" > #import <WebCore/FrameLoader.h> >@@ -46,14 +47,14 @@ using namespace WebCore; > NetworkStorageSession& WebFrameNetworkingContext::ensurePrivateBrowsingSession() > { > ASSERT(isMainThread()); >- NetworkStorageSession::ensureSession(PAL::SessionID::legacyPrivateSessionID(), [[NSBundle mainBundle] bundleIdentifier]); >- return *NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID()); >+ NetworkStorageSessionMap::ensureSession(PAL::SessionID::legacyPrivateSessionID(), [[NSBundle mainBundle] bundleIdentifier]); >+ return *NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID()); > } > > void WebFrameNetworkingContext::destroyPrivateBrowsingSession() > { > ASSERT(isMainThread()); >- NetworkStorageSession::destroySession(PAL::SessionID::legacyPrivateSessionID()); >+ NetworkStorageSessionMap::destroySession(PAL::SessionID::legacyPrivateSessionID()); > } > > bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const >@@ -94,10 +95,10 @@ NetworkStorageSession* WebFrameNetworkin > { > ASSERT(isMainThread()); > if (frame() && frame()->page() && frame()->page()->sessionID().isEphemeral()) { >- if (auto* session = NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID())) >+ if (auto* session = NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID())) > return session; > // Some requests may still be coming shortly before WebCore updates the session ID and after WebKit destroys the private browsing session. > LOG_ERROR("Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race."); > } >- return &NetworkStorageSession::defaultStorageSession(); >+ return &NetworkStorageSessionMap::defaultStorageSession(); > } >Index: Source/WebKitLegacy/mac/WebView/WebPreferences.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebPreferences.mm (revision 240190) >+++ Source/WebKitLegacy/mac/WebView/WebPreferences.mm (working copy) >@@ -30,6 +30,7 @@ > #import "WebPreferencesPrivate.h" > #import "WebPreferenceKeysPrivate.h" > >+#import "NetworkStorageSessionMap.h" > #import "WebApplicationCache.h" > #import "WebFrameNetworkingContext.h" > #import "WebKitLogging.h" >@@ -1876,18 +1877,18 @@ + (void)_switchNetworkLoaderToNewTesting > #if PLATFORM(IOS_FAMILY) > WebThreadLock(); > #endif >- NetworkStorageSession::switchToNewTestingSession(); >+ NetworkStorageSessionMap::switchToNewTestingSession(); > } > > + (void)_clearNetworkLoaderSession > { >- NetworkStorageSession::defaultStorageSession().deleteAllCookies(); >+ NetworkStorageSessionMap::defaultStorageSession().deleteAllCookies(); > } > > + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy > { >- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage(); >- ASSERT(cookieStorage); // Will fail when NetworkStorageSession::switchToNewTestingSession() was not called beforehand. >+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSessionMap::defaultStorageSession().cookieStorage(); >+ ASSERT(cookieStorage); // Will fail when NetworkStorageSessionMap::switchToNewTestingSession() was not called beforehand. > CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy); > } > >Index: Source/WebKitLegacy/win/ChangeLog >=================================================================== >--- Source/WebKitLegacy/win/ChangeLog (revision 240190) >+++ Source/WebKitLegacy/win/ChangeLog (working copy) >@@ -1,3 +1,21 @@ >+2019-01-18 Alex Christensen <achristensen@webkit.org> >+ >+ Move NetworkStorageSession ownership to NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=193580 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebFrameNetworkingContext.cpp: >+ (WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): >+ (WebFrameNetworkingContext::ensurePrivateBrowsingSession): >+ (WebFrameNetworkingContext::destroyPrivateBrowsingSession): >+ (WebFrameNetworkingContext::storageSession const): >+ * WebDownloadCFNet.cpp: >+ (WebDownload::didReceiveAuthenticationChallenge): >+ * WebPreferences.cpp: >+ (WebPreferences::clearNetworkLoaderSession): >+ (WebPreferences::switchNetworkLoaderToNewTestingSession): >+ > 2019-01-17 Per Arne Vollan <pvollan@apple.com> > > [Win][HighDPI] Repaint glitches when scrolling. >Index: Source/WebKitLegacy/win/WebDownloadCFNet.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebDownloadCFNet.cpp (revision 240190) >+++ Source/WebKitLegacy/win/WebDownloadCFNet.cpp (working copy) >@@ -28,6 +28,7 @@ > > #include "DefaultDownloadDelegate.h" > #include "MarshallingHelpers.h" >+#include "NetworkStorageSessionMap.h" > #include "WebError.h" > #include "WebKit.h" > #include "WebKitLogging.h" >@@ -376,7 +377,7 @@ void WebDownload::didReceiveAuthenticati > { > // Try previously stored credential first. > if (!CFURLAuthChallengeGetPreviousFailureCount(challenge)) { >- Credential credential = WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().get(emptyString(), core(CFURLAuthChallengeGetProtectionSpace(challenge))); >+ Credential credential = NetworkStorageSessionMap::defaultStorageSession().credentialStorage().get(emptyString(), core(CFURLAuthChallengeGetProtectionSpace(challenge))); > if (!credential.isEmpty()) { > RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential)); > CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge); >Index: Source/WebKitLegacy/win/WebPreferences.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebPreferences.cpp (revision 240190) >+++ Source/WebKitLegacy/win/WebPreferences.cpp (working copy) >@@ -27,6 +27,7 @@ > #include "WebKitDLL.h" > #include "WebPreferences.h" > >+#include "NetworkStorageSessionMap.h" > #include "WebNotificationCenter.h" > #include "WebPreferenceKeysPrivate.h" > >@@ -2118,13 +2119,13 @@ HRESULT WebPreferences::mediaPreloadingE > > HRESULT WebPreferences::clearNetworkLoaderSession() > { >- NetworkStorageSession::defaultStorageSession().deleteAllCookies(); >+ NetworkStorageSessionMap::defaultStorageSession().deleteAllCookies(); > return S_OK; > } > > HRESULT WebPreferences::switchNetworkLoaderToNewTestingSession() > { >- NetworkStorageSession::switchToNewTestingSession(); >+ NetworkStorageSessionMap::switchToNewTestingSession(); > return S_OK; > } > >Index: Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp (revision 240190) >+++ Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp (working copy) >@@ -25,6 +25,7 @@ > > #include "WebFrameNetworkingContext.h" > >+#include "NetworkStorageSessionMap.h" > #include "WebView.h" > #include <WebCore/FrameLoader.h> > #include <WebCore/FrameLoaderClient.h> >@@ -50,10 +51,10 @@ static String& identifierBase() > #if USE(CFURLCONNECTION) > void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(WebKitCookieStorageAcceptPolicy policy) > { >- if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage()) >+ if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSessionMap::defaultStorageSession().cookieStorage()) > CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy); > >- if (auto privateSession = NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID())) >+ if (auto privateSession = NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID())) > CFHTTPCookieStorageSetCookieAcceptPolicy(privateSession->cookieStorage().get(), policy); > } > #endif >@@ -70,7 +71,7 @@ NetworkStorageSession& WebFrameNetworkin > #if USE(CFURLCONNECTION) > ASSERT(isMainThread()); > >- if (auto privateSession = NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID())) >+ if (auto privateSession = NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID())) > return *privateSession; > > String base; >@@ -81,17 +82,17 @@ NetworkStorageSession& WebFrameNetworkin > } else > base = identifierBase(); > >- NetworkStorageSession::ensureSession(PAL::SessionID::legacyPrivateSessionID(), base); >+ NetworkStorageSessionMap::ensureSession(PAL::SessionID::legacyPrivateSessionID(), base); > > #endif >- return *NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID()); >+ return *NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID()); > } > > void WebFrameNetworkingContext::destroyPrivateBrowsingSession() > { > ASSERT(isMainThread()); > >- NetworkStorageSession::destroySession(PAL::SessionID::legacyPrivateSessionID()); >+ NetworkStorageSessionMap::destroySession(PAL::SessionID::legacyPrivateSessionID()); > } > > ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const >@@ -104,7 +105,7 @@ NetworkStorageSession* WebFrameNetworkin > ASSERT(isMainThread()); > > if (frame() && frame()->page()->usesEphemeralSession()) >- return NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID()); >+ return NetworkStorageSessionMap::storageSession(PAL::SessionID::legacyPrivateSessionID()); > >- return &NetworkStorageSession::defaultStorageSession(); >+ return &NetworkStorageSessionMap::defaultStorageSession(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193580
:
359502
|
359524
|
359531
|
359542
|
359554
|
359563
|
359566
|
359570
|
359748
|
359755
|
359756
|
359757
|
359762
|
359763
|
359764