WebKit Bugzilla
Attachment 359221 Details for
Bug 193368
: Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193368-20190115162708.patch (text/plain), 20.99 KB, created by
Alex Christensen
on 2019-01-15 16:27:10 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-15 16:27:10 PST
Size:
20.99 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 240014) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,27 @@ >+2019-01-15 Alex Christensen <achristensen@webkit.org> >+ >+ Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193368 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The NetworkStorageSession ownership needs to move to the WebKit/WebKitLegacy layer instead of being a process-global static map. >+ >+ * loader/EmptyClients.cpp: >+ * platform/network/CredentialStorage.cpp: >+ (WebCore::CredentialStorage::defaultCredentialStorage): Deleted. >+ * platform/network/CredentialStorage.h: >+ * platform/network/NetworkStorageSession.h: >+ * platform/network/cf/NetworkStorageSessionCFNet.cpp: >+ (WebCore::NetworkStorageSession::switchToNewTestingSession): >+ (WebCore::NetworkStorageSession::ensureSession): >+ * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: >+ (WebCore::createPrivateStorageSession): >+ * platform/network/curl/ResourceHandleCurl.cpp: >+ (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): >+ (WebCore::ResourceHandle::receivedCredential): >+ (WebCore::ResourceHandle::getCredential): >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Stop using CookiesStrategy >Index: Source/WebCore/loader/EmptyClients.cpp >=================================================================== >--- Source/WebCore/loader/EmptyClients.cpp (revision 240014) >+++ Source/WebCore/loader/EmptyClients.cpp (working copy) >@@ -288,7 +288,7 @@ private: > EmptyFrameNetworkingContext(); > > bool shouldClearReferrerOnHTTPSToHTTPRedirect() const { return true; } >- NetworkStorageSession* storageSession() const final { return &NetworkStorageSession::defaultStorageSession(); } >+ NetworkStorageSession* storageSession() const final { return nullptr; } > > #if PLATFORM(COCOA) > bool localFileContentSniffingEnabled() const { return false; } >Index: Source/WebCore/platform/network/CredentialStorage.cpp >=================================================================== >--- Source/WebCore/platform/network/CredentialStorage.cpp (revision 240013) >+++ Source/WebCore/platform/network/CredentialStorage.cpp (working copy) >@@ -35,11 +35,6 @@ > > namespace WebCore { > >-CredentialStorage& CredentialStorage::defaultCredentialStorage() >-{ >- return NetworkStorageSession::defaultStorageSession().credentialStorage(); >-} >- > static String originStringFromURL(const URL& url) > { > return makeString(url.protocol(), "://", url.hostAndPort(), '/'); >Index: Source/WebCore/platform/network/CredentialStorage.h >=================================================================== >--- Source/WebCore/platform/network/CredentialStorage.h (revision 240013) >+++ Source/WebCore/platform/network/CredentialStorage.h (working copy) >@@ -38,8 +38,6 @@ class ProtectionSpace; > > class CredentialStorage { > public: >- WEBCORE_EXPORT static CredentialStorage& defaultCredentialStorage(); >- > // WebCore session credential storage. > WEBCORE_EXPORT void set(const String&, const Credential&, const ProtectionSpace&, const URL&); > WEBCORE_EXPORT Credential get(const String&, const ProtectionSpace&); >Index: Source/WebCore/platform/network/NetworkStorageSession.h >=================================================================== >--- Source/WebCore/platform/network/NetworkStorageSession.h (revision 240013) >+++ Source/WebCore/platform/network/NetworkStorageSession.h (working copy) >@@ -208,10 +208,8 @@ private: > static bool m_processMayUseCookieAPI; > }; > >-#if PLATFORM(COCOA) >+#if PLATFORM(COCOA) || USE(CFURLCONNECTION) > WEBCORE_EXPORT CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier); >-#elif USE(CFURLCONNECTION) >-CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier, CFURLStorageSessionRef defaultStorageSession); > #endif > > } >Index: Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >=================================================================== >--- Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (revision 240013) >+++ Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (working copy) >@@ -98,12 +98,7 @@ void NetworkStorageSession::switchToNewT > // 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())); > >- RetainPtr<CFURLStorageSessionRef> session; >-#if PLATFORM(COCOA) >- session = adoptCF(createPrivateStorageSession(sessionName.createCFString().get())); >-#else >- session = adoptCF(createPrivateStorageSession(sessionName.createCFString().get(), defaultStorageSession().platformSession())); >-#endif >+ auto session = adoptCF(createPrivateStorageSession(sessionName.createCFString().get())); > > RetainPtr<CFHTTPCookieStorageRef> cookieStorage; > if (NetworkStorageSession::processMayUseCookieAPI()) { >@@ -131,13 +126,9 @@ void NetworkStorageSession::ensureSessio > RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString(); > > RetainPtr<CFURLStorageSessionRef> storageSession; >- if (sessionID.isEphemeral()) { >-#if PLATFORM(COCOA) >+ if (sessionID.isEphemeral()) > storageSession = adoptCF(createPrivateStorageSession(cfIdentifier.get())); >-#else >- storageSession = adoptCF(createPrivateStorageSession(cfIdentifier.get(), defaultNetworkStorageSession()->platformSession())); >-#endif >- } else >+ else > storageSession = createCFStorageSessionForIdentifier(cfIdentifier.get()); > > if (NetworkStorageSession::processMayUseCookieAPI()) { >Index: Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp >=================================================================== >--- Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp (revision 240014) >+++ Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp (working copy) >@@ -61,7 +61,7 @@ DECLARE_CF_TYPE_TRAIT(CFHTTPCookie); > > namespace WebCore { > >-CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier, CFURLStorageSessionRef defaultStorageSession) >+CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier) > { > const void* sessionPropertyKeys[] = { _kCFURLStorageSessionIsPrivate }; > const void* sessionPropertyValues[] = { kCFBooleanTrue }; >@@ -72,24 +72,14 @@ CFURLStorageSessionRef createPrivateStor > // with the exception that it should be in-memory only storage. > CFURLCacheRef cache = _CFURLStorageSessionCopyCache(kCFAllocatorDefault, storageSession); > CFURLCacheSetDiskCapacity(cache, 0); >- CFURLCacheRef defaultCache; >- if (defaultStorageSession) >- defaultCache = _CFURLStorageSessionCopyCache(kCFAllocatorDefault, defaultStorageSession); >- else >- defaultCache = CFURLCacheCopySharedURLCache(); >+ CFURLCacheRef defaultCache = CFURLCacheCopySharedURLCache(); > CFURLCacheSetMemoryCapacity(cache, CFURLCacheMemoryCapacity(defaultCache)); > CFRelease(defaultCache); > CFRelease(cache); > > CFHTTPCookieStorageRef cookieStorage = _CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession); >- CFHTTPCookieStorageRef defaultCookieStorage; >- if (defaultStorageSession) >- defaultCookieStorage = _CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, defaultStorageSession); >- else >- defaultCookieStorage = _CFHTTPCookieStorageGetDefault(kCFAllocatorDefault); >+ CFHTTPCookieStorageRef defaultCookieStorage = _CFHTTPCookieStorageGetDefault(kCFAllocatorDefault); > CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage, CFHTTPCookieStorageGetCookieAcceptPolicy(defaultCookieStorage)); >- if (defaultStorageSession) >- CFRelease(defaultCookieStorage); > CFRelease(cookieStorage); > > return storageSession; >Index: Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >=================================================================== >--- Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (revision 240014) >+++ Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (working copy) >@@ -145,7 +145,7 @@ Ref<CurlRequest> ResourceHandle::createC > if (status == RequestStatus::NewRequest) { > addCacheValidationHeaders(request); > >- auto& storageSession = NetworkStorageSession::defaultStorageSession(); >+ auto& storageSession = *context()->storageSession(PAL::SessionID::defaultSessionID()); > auto& cookieJar = storageSession.cookieStorage(); > auto includeSecureCookies = request.url().protocolIs("https") ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; > String cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; >@@ -231,7 +231,7 @@ void ResourceHandle::didReceiveAuthentic > URL urlToStore; > if (challenge.failureResponse().httpStatusCode() == 401) > urlToStore = challenge.failureResponse().url(); >- CredentialStorage::defaultCredentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore); >+ context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore); > > restartRequestWithCredential(challenge.protectionSpace(), credential); > >@@ -246,16 +246,16 @@ void ResourceHandle::didReceiveAuthentic > // The stored credential wasn't accepted, stop using it. > // There is a race condition here, since a different credential might have already been stored by another ResourceHandle, > // but the observable effect should be very minor, if any. >- CredentialStorage::defaultCredentialStorage().remove(partition, challenge.protectionSpace()); >+ context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().remove(partition, challenge.protectionSpace()); > } > > if (!challenge.previousFailureCount()) { >- Credential credential = CredentialStorage::defaultCredentialStorage().get(partition, challenge.protectionSpace()); >+ Credential credential = context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().get(partition, challenge.protectionSpace()); > if (!credential.isEmpty() && credential != d->m_initialCredential) { > ASSERT(credential.persistence() == CredentialPersistenceNone); > if (challenge.failureResponse().httpStatusCode() == 401) { > // Store the credential back, possibly adding it as a default for this directory. >- CredentialStorage::defaultCredentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url()); >+ context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url()); > } > > restartRequestWithCredential(challenge.protectionSpace(), credential); >@@ -289,7 +289,7 @@ void ResourceHandle::receivedCredential( > if (shouldUseCredentialStorage()) { > if (challenge.failureResponse().httpStatusCode() == 401) { > URL urlToStore = challenge.failureResponse().url(); >- CredentialStorage::defaultCredentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore); >+ context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore); > } > } > >@@ -346,13 +346,13 @@ Optional<Credential> ResourceHandle::get > if (credential.isEmpty()) { > // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, > // try and reuse the credential preemptively, as allowed by RFC 2617. >- d->m_initialCredential = CredentialStorage::defaultCredentialStorage().get(partition, request.url()); >+ d->m_initialCredential = context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().get(partition, request.url()); > } else if (!redirect) { > // If there is already a protection space known for the URL, update stored credentials > // before sending a request. This makes it possible to implement logout by sending an > // XMLHttpRequest with known incorrect credentials, and aborting it immediately (so that > // an authentication dialog doesn't pop up). >- CredentialStorage::defaultCredentialStorage().set(partition, credential, request.url()); >+ context()->storageSession(PAL::SessionID::defaultSessionID())->credentialStorage().set(partition, credential, request.url()); > } > } > >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 240016) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-01-15 Alex Christensen <achristensen@webkit.org> >+ >+ Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193368 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/Plugins/PluginView.cpp: >+ (WebKit::PluginView::getAuthenticationInfo): >+ > 2019-01-15 Tim Horton <timothy_horton@apple.com> > > Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() >Index: Source/WebKit/WebProcess/Plugins/PluginView.cpp >=================================================================== >--- Source/WebKit/WebProcess/Plugins/PluginView.cpp (revision 240014) >+++ Source/WebKit/WebProcess/Plugins/PluginView.cpp (working copy) >@@ -57,6 +57,7 @@ > #include <WebCore/MIMETypeRegistry.h> > #include <WebCore/MouseEvent.h> > #include <WebCore/NetscapePlugInStreamLoader.h> >+#include <WebCore/NetworkStorageSession.h> > #include <WebCore/Page.h> > #include <WebCore/PlatformMouseEvent.h> > #include <WebCore/ProtectionSpace.h> >@@ -1602,9 +1603,9 @@ bool PluginView::getAuthenticationInfo(c > return false; > > String partitionName = contentDocument->topDocument().domainForCachePartition(); >- Credential credential = CredentialStorage::defaultCredentialStorage().get(partitionName, protectionSpace); >+ Credential credential = NetworkStorageSession::defaultStorageSession().credentialStorage().get(partitionName, protectionSpace); > if (credential.isEmpty()) >- credential = CredentialStorage::defaultCredentialStorage().getFromPersistentStorage(protectionSpace); >+ credential = NetworkStorageSession::defaultStorageSession().credentialStorage().getFromPersistentStorage(protectionSpace); > > if (!credential.hasPassword()) > return false; >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 240014) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2019-01-15 Alex Christensen <achristensen@webkit.org> >+ >+ Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193368 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Misc/WebCache.mm: >+ (+[WebCache clearCachedCredentials]): >+ * Misc/WebDownload.mm: >+ (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]): >+ * Plugins/WebBaseNetscapePluginView.mm: >+ (WebKit::getAuthenticationInfo): >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Stop using CookiesStrategy >Index: Source/WebKitLegacy/mac/Misc/WebCache.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebCache.mm (revision 240014) >+++ Source/WebKitLegacy/mac/Misc/WebCache.mm (working copy) >@@ -37,6 +37,7 @@ > #import <WebCore/CrossOriginPreflightResultCache.h> > #import <WebCore/Document.h> > #import <WebCore/MemoryCache.h> >+#import <WebCore/NetworkStorageSession.h> > #import <wtf/MainThread.h> > #import <wtf/RunLoop.h> > >@@ -213,7 +214,7 @@ + (BOOL)isDisabled > + (void)clearCachedCredentials > { > [WebView _makeAllWebViewsPerformSelector:@selector(_clearCredentials)]; >- WebCore::CredentialStorage::defaultCredentialStorage().clearCredentials(); >+ WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials(); > } > > @end >Index: Source/WebKitLegacy/mac/Misc/WebDownload.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebDownload.mm (revision 240013) >+++ Source/WebKitLegacy/mac/Misc/WebDownload.mm (working copy) >@@ -32,6 +32,7 @@ > #import <WebCore/AuthenticationMac.h> > #import <WebCore/Credential.h> > #import <WebCore/CredentialStorage.h> >+#import <WebCore/NetworkStorageSession.h> > #import <WebCore/ProtectionSpace.h> > #import <WebKitLegacy/WebPanelAuthenticationHandler.h> > #import <pal/spi/cocoa/NSURLDownloadSPI.h> >@@ -94,7 +95,7 @@ - (void)download:(NSURLDownload *)downlo > #if !PLATFORM(IOS_FAMILY) > // Try previously stored credential first. > if (![challenge previousFailureCount]) { >- NSURLCredential *credential = CredentialStorage::defaultCredentialStorage().get(emptyString(), ProtectionSpace([challenge protectionSpace])).nsCredential(); >+ NSURLCredential *credential = NetworkStorageSession::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 240013) >+++ Source/WebKitLegacy/mac/Plugins/WebBaseNetscapePluginView.mm (working copy) >@@ -47,6 +47,7 @@ > #import <WebCore/Frame.h> > #import <WebCore/FrameLoader.h> > #import <WebCore/HTMLPlugInElement.h> >+#import <WebCore/NetworkStorageSession.h> > #import <WebCore/Page.h> > #import <WebCore/ProtectionSpace.h> > #import <WebCore/RenderEmbeddedObject.h> >@@ -871,7 +872,7 @@ if (!protocol) > > RetainPtr<NSURLProtectionSpace> protectionSpace = adoptNS([[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]); > >- NSURLCredential *credential = CredentialStorage::defaultCredentialStorage().get(emptyString(), ProtectionSpace(protectionSpace.get())).nsCredential(); >+ NSURLCredential *credential = WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().get(emptyString(), ProtectionSpace(protectionSpace.get())).nsCredential(); > if (!credential) > credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()]; > if (!credential) >Index: Source/WebKitLegacy/win/ChangeLog >=================================================================== >--- Source/WebKitLegacy/win/ChangeLog (revision 240014) >+++ Source/WebKitLegacy/win/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-01-15 Alex Christensen <achristensen@webkit.org> >+ >+ Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193368 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebDownloadCFNet.cpp: >+ (WebDownload::didReceiveAuthenticationChallenge): >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Stop using CookiesStrategy >Index: Source/WebKitLegacy/win/WebDownloadCFNet.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebDownloadCFNet.cpp (revision 240013) >+++ Source/WebKitLegacy/win/WebDownloadCFNet.cpp (working copy) >@@ -47,6 +47,7 @@ > #include <WebCore/CredentialStorage.h> > #include <WebCore/DownloadBundle.h> > #include <WebCore/LoaderRunLoopCF.h> >+#include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceError.h> > #include <WebCore/ResourceHandle.h> > #include <WebCore/ResourceRequest.h> >@@ -375,7 +376,7 @@ void WebDownload::didReceiveAuthenticati > { > // Try previously stored credential first. > if (!CFURLAuthChallengeGetPreviousFailureCount(challenge)) { >- Credential credential = CredentialStorage::defaultCredentialStorage().get(emptyString(), core(CFURLAuthChallengeGetProtectionSpace(challenge))); >+ Credential credential = WebCore::NetworkStorageSession::defaultStorageSession().credentialStorage().get(emptyString(), core(CFURLAuthChallengeGetProtectionSpace(challenge))); > if (!credential.isEmpty()) { > RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential)); > CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge);
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:
ggaren
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193368
:
358949
|
358951
|
358963
|
358964
|
359055
|
359066
|
359072
| 359221