Changeset 239737 in webkit


Ignore:
Timestamp:
Jan 8, 2019 12:49:39 PM (5 years ago)
Author:
achristensen@apple.com
Message:

Stop using NetworkStorageSession in WebProcess
https://bugs.webkit.org/show_bug.cgi?id=193236

Reviewed by Don Olmstead.

Source/WebCore:

No change in behavior. Some code was only used for ResourceHandle, which isn't used in modern WebKit,
and for cookies, which are handled in the NetworkProcess in modern WebKit.

  • loader/CookieJar.cpp:

(WebCore::storageSession):

  • loader/EmptyClients.cpp:
  • platform/network/NetworkingContext.h:
  • platform/network/mac/ResourceHandleMac.mm:

(WebCore::ResourceHandle::createNSURLConnection):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
(WebCore::ResourceHandle::receivedCredential):

Source/WebKit:

  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):

  • Shared/WebProcessCreationParameters.h:
  • Shared/WebsitePoliciesData.cpp:

(WebKit::WebsitePoliciesData::applyToDocumentLoader):

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
(WebKit::WebProcessPool::tryTakePrewarmedProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
(WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
(WebKit::WebProcessPool::processForNavigationInternal):

  • WebProcess/InjectedBundle/InjectedBundle.cpp:

(WebKit::InjectedBundle::setPrivateBrowsingEnabled):

  • WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
  • WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:

(WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
(WebKit::WebFrameNetworkingContext::storageSession const): Deleted.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setSessionID):

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::fetchWebsiteData):
(WebKit::WebProcess::addWebsiteDataStore): Deleted.
(WebKit::WebProcess::destroySession): Deleted.

  • WebProcess/WebProcess.h:
  • WebProcess/WebProcess.messages.in:

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebFrameNetworkingContext.h:
  • WebCoreSupport/WebFrameNetworkingContext.mm:

(WebFrameNetworkingContext::storageSession const):

  • WebCoreSupport/WebPlatformStrategies.h:
  • WebCoreSupport/WebPlatformStrategies.mm:

(WebPlatformStrategies::cookiesForDOM):
(WebPlatformStrategies::setCookiesFromDOM):
(WebPlatformStrategies::cookiesEnabled):
(WebPlatformStrategies::cookieRequestHeaderFieldValue):
(WebPlatformStrategies::getRawCookies):
(WebPlatformStrategies::deleteCookie):

  • WebView/WebView.mm:

(-[WebView _cachedResponseForURL:]):
(-[WebView _clearCredentials]):

Source/WebKitLegacy/win:

  • WebCoreSupport/WebFrameNetworkingContext.cpp:

(WebFrameNetworkingContext::storageSession const):

  • WebCoreSupport/WebFrameNetworkingContext.h:
  • WebCoreSupport/WebPlatformStrategies.cpp:

(WebPlatformStrategies::cookiesForDOM):
(WebPlatformStrategies::setCookiesFromDOM):
(WebPlatformStrategies::cookiesEnabled):
(WebPlatformStrategies::cookieRequestHeaderFieldValue):
(WebPlatformStrategies::getRawCookies):
(WebPlatformStrategies::deleteCookie):

  • WebCoreSupport/WebPlatformStrategies.h:
Location:
trunk/Source
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239735 r239737  
     12019-01-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using NetworkStorageSession in WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=193236
     5
     6        Reviewed by Don Olmstead.
     7
     8        No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
     9        and for cookies, which are handled in the NetworkProcess in modern WebKit.
     10
     11        * loader/CookieJar.cpp:
     12        (WebCore::storageSession):
     13        * loader/EmptyClients.cpp:
     14        * platform/network/NetworkingContext.h:
     15        * platform/network/mac/ResourceHandleMac.mm:
     16        (WebCore::ResourceHandle::createNSURLConnection):
     17        (WebCore::ResourceHandle::start):
     18        (WebCore::ResourceHandle::platformLoadResourceSynchronously):
     19        (WebCore::ResourceHandle::willSendRequest):
     20        (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
     21        (WebCore::ResourceHandle::receivedCredential):
     22
    1232019-01-08  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/loader/CookieJar.cpp

    r239735 r239737  
    4242namespace WebCore {
    4343
    44 static NetworkingContext* networkingContext(const Document& document)
    45 {
    46     // FIXME: Returning 0 means falling back to default context. That's not a choice that is appropriate to do at runtime
    47     Frame* frame = document.frame();
    48     if (!frame)
    49         return nullptr;
    50 
    51     return frame->loader().networkingContext();
    52 }
    53 
    54 inline NetworkStorageSession& storageSession(const Document& document)
    55 {
    56     NetworkingContext* context = networkingContext(document);
    57     return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession();
    58 }
    59 
    6044static IncludeSecureCookies shouldIncludeSecureCookies(const Document& document, const URL& url)
    6145{
     
    7963    auto frame = document.frame();
    8064    if (frame)
    81         result = platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies);
     65        result = platformStrategies()->cookiesStrategy()->cookiesForDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies);
    8266    else
    83         result = platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies);
     67        result = platformStrategies()->cookiesStrategy()->cookiesForDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies);
    8468
    8569    if (result.second)
     
    9478
    9579    CookieRequestHeaderFieldProxy proxy;
    96     proxy.sessionID = storageSession(document).sessionID();
     80    proxy.sessionID = document.sessionID();
    9781    proxy.firstParty = document.firstPartyForCookies();
    9882    proxy.sameSiteInfo = sameSiteInfo(document);
     
    11094    auto frame = document.frame();
    11195    if (frame)
    112         platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookieString);
     96        platformStrategies()->cookiesStrategy()->setCookiesFromDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookieString);
    11397    else
    114         platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookieString);
     98        platformStrategies()->cookiesStrategy()->setCookiesFromDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookieString);
    11599}
    116100
    117101bool cookiesEnabled(const Document& document)
    118102{
    119     return platformStrategies()->cookiesStrategy()->cookiesEnabled(storageSession(document));
     103    return platformStrategies()->cookiesStrategy()->cookiesEnabled(document.sessionID());
    120104}
    121105
     
    127111    auto frame = document.frame();
    128112    if (frame)
    129         result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies);
     113        result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies);
    130114    else
    131         result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies);
     115        result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies);
    132116
    133117    if (result.second)
     
    141125    auto frame = document.frame();
    142126    if (frame)
    143         return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookies);
     127        return platformStrategies()->cookiesStrategy()->getRawCookies(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookies);
    144128
    145     return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookies);
     129    return platformStrategies()->cookiesStrategy()->getRawCookies(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookies);
    146130}
    147131
    148132void deleteCookie(const Document& document, const URL& url, const String& cookieName)
    149133{
    150     platformStrategies()->cookiesStrategy()->deleteCookie(storageSession(document), url, cookieName);
     134    platformStrategies()->cookiesStrategy()->deleteCookie(document.sessionID(), url, cookieName);
    151135}
    152136
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r239735 r239737  
    288288
    289289    bool shouldClearReferrerOnHTTPSToHTTPRedirect() const { return true; }
    290     NetworkStorageSession& storageSession() const final { return NetworkStorageSession::defaultStorageSession(); }
     290    NetworkStorageSession* storageSession() const final { return &NetworkStorageSession::defaultStorageSession(); }
    291291
    292292#if PLATFORM(COCOA)
  • trunk/Source/WebCore/platform/CookiesStrategy.h

    r239427 r239737  
    4141class CookiesStrategy {
    4242public:
    43     virtual std::pair<String, bool> cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0;
    44     virtual void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) = 0;
    45     virtual bool cookiesEnabled(const NetworkStorageSession&) = 0;
    46     virtual std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0;
    47     virtual std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0;
    48     virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>&) = 0;
    49     virtual void deleteCookie(const NetworkStorageSession&, const URL&, const String& cookieName) = 0;
     43    virtual std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0;
     44    virtual void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) = 0;
     45    virtual bool cookiesEnabled(const PAL::SessionID&) = 0;
     46    virtual std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0;
     47    virtual bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>&) = 0;
     48    virtual void deleteCookie(const PAL::SessionID&, const URL&, const String& cookieName) = 0;
    5049
    5150protected:
     
    5453
    5554} // namespace WebCore
    56 
    57 namespace WTF {
    58 
    59 template<> struct EnumTraits<WebCore::IncludeSecureCookies> {
    60     using values = EnumValues<
    61         WebCore::IncludeSecureCookies,
    62         WebCore::IncludeSecureCookies::No,
    63         WebCore::IncludeSecureCookies::Yes
    64     >;
    65 };
    66 
    67 } // namespace WTF
    68 
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp

    r239427 r239737  
    2727#include "NetworkStorageSession.h"
    2828
     29#include "RuntimeApplicationChecks.h"
    2930#include <pal/SessionID.h>
    3031#include <wtf/NeverDestroyed.h>
  • trunk/Source/WebCore/platform/network/NetworkingContext.h

    r239735 r239737  
    5959    virtual String sourceApplicationIdentifier() const { return emptyString(); }
    6060
    61     virtual NetworkStorageSession& storageSession() const = 0;
     61    virtual NetworkStorageSession* storageSession() const = 0;
    6262
    6363#if PLATFORM(WIN)
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r239735 r239737  
    150150            // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication,
    151151            // try and reuse the credential preemptively, as allowed by RFC 2617.
    152             d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(partition, firstRequest().url());
     152            d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(partition, firstRequest().url());
    153153        } else {
    154154            // If there is already a protection space known for the URL, update stored credentials before sending a request.
    155155            // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
    156156            // (so that an authentication dialog doesn't pop up).
    157             d->m_context->storageSession().credentialStorage().set(partition, Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
     157            d->m_context->storageSession()->credentialStorage().set(partition, Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
    158158        }
    159159    }
     
    262262        return false;
    263263
    264     d->m_storageSession = d->m_context->storageSession().platformSession();
     264    d->m_storageSession = d->m_context->storageSession()->platformSession();
    265265
    266266    bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
     
    308308        // URL didn't include credentials of its own.
    309309        if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
    310             Credential credential = d->m_context->storageSession().credentialStorage().get(partition, request.url());
     310            Credential credential = d->m_context->storageSession()->credentialStorage().get(partition, request.url());
    311311            if (!credential.isEmpty()) {
    312312                d->m_initialCredential = credential;
     
    383383        if (challenge.failureResponse().httpStatusCode() == 401)
    384384            urlToStore = challenge.failureResponse().url();
    385         d->m_context->storageSession().credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore);
     385        d->m_context->storageSession()->credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore);
    386386       
    387387        CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
     
    397397            // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
    398398            // but the observable effect should be very minor, if any.
    399             d->m_context->storageSession().credentialStorage().remove(partition, challenge.protectionSpace());
     399            d->m_context->storageSession()->credentialStorage().remove(partition, challenge.protectionSpace());
    400400        }
    401401
    402402        if (!challenge.previousFailureCount()) {
    403             Credential credential = d->m_context->storageSession().credentialStorage().get(partition, challenge.protectionSpace());
     403            Credential credential = d->m_context->storageSession()->credentialStorage().get(partition, challenge.protectionSpace());
    404404            if (!credential.isEmpty() && credential != d->m_initialCredential) {
    405405                ASSERT(credential.persistence() == CredentialPersistenceNone);
    406406                if (challenge.failureResponse().httpStatusCode() == 401) {
    407407                    // Store the credential back, possibly adding it as a default for this directory.
    408                     d->m_context->storageSession().credentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
     408                    d->m_context->storageSession()->credentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
    409409                }
    410410#if PLATFORM(COCOA)
     
    456456            urlToStore = challenge.failureResponse().url();
    457457
    458         d->m_context->storageSession().credentialStorage().set(firstRequest().cachePartition(), webCredential, challenge.protectionSpace(), urlToStore);
     458        d->m_context->storageSession()->credentialStorage().set(firstRequest().cachePartition(), webCredential, challenge.protectionSpace(), urlToStore);
    459459
    460460        if (d->m_connection) {
     
    572572    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, &client, defersLoading, shouldContentSniff, shouldContentEncodingSniff));
    573573
    574     handle->d->m_storageSession = context->storageSession().platformSession();
     574    handle->d->m_storageSession = context->storageSession()->platformSession();
    575575
    576576    if (handle->d->m_scheduledFailureType != NoFailure) {
  • trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm

    r239735 r239737  
    158158            // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication,
    159159            // try and reuse the credential preemptively, as allowed by RFC 2617.
    160             d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
     160            d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
    161161        } else {
    162162            // If there is already a protection space known for the URL, update stored credentials before sending a request.
    163163            // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
    164164            // (so that an authentication dialog doesn't pop up).
    165             d->m_context->storageSession().credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
     165            d->m_context->storageSession()->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
    166166        }
    167167    }
     
    241241        return false;
    242242
    243     d->m_storageSession = d->m_context->storageSession().platformSession();
     243    d->m_storageSession = d->m_context->storageSession()->platformSession();
    244244
    245245    // FIXME: Do not use the sync version of shouldUseCredentialStorage when the client returns true from usesAsyncCallbacks.
     
    368368    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, &client, defersLoading, shouldContentSniff, shouldContentEncodingSniff));
    369369
    370     handle->d->m_storageSession = context->storageSession().platformSession();
     370    handle->d->m_storageSession = context->storageSession()->platformSession();
    371371
    372372    if (context && handle->d->m_scheduledFailureType != NoFailure) {
     
    450450        // URL didn't include credentials of its own.
    451451        if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
    452             Credential credential = d->m_context->storageSession().credentialStorage().get(request.cachePartition(), request.url());
     452            Credential credential = d->m_context->storageSession()->credentialStorage().get(request.cachePartition(), request.url());
    453453            if (!credential.isEmpty()) {
    454454                d->m_initialCredential = credential;
     
    541541            // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
    542542            // but the observable effect should be very minor, if any.
    543             d->m_context->storageSession().credentialStorage().remove(d->m_partition, challenge.protectionSpace());
     543            d->m_context->storageSession()->credentialStorage().remove(d->m_partition, challenge.protectionSpace());
    544544        }
    545545
    546546        if (!challenge.previousFailureCount()) {
    547             Credential credential = d->m_context->storageSession().credentialStorage().get(d->m_partition, challenge.protectionSpace());
     547            Credential credential = d->m_context->storageSession()->credentialStorage().get(d->m_partition, challenge.protectionSpace());
    548548            if (!credential.isEmpty() && credential != d->m_initialCredential) {
    549549                ASSERT(credential.persistence() == CredentialPersistenceNone);
    550550                if (challenge.failureResponse().httpStatusCode() == 401) {
    551551                    // Store the credential back, possibly adding it as a default for this directory.
    552                     d->m_context->storageSession().credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
     552                    d->m_context->storageSession()->credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
    553553                }
    554554                [challenge.sender() useCredential:credential.nsCredential() forAuthenticationChallenge:mac(challenge)];
     
    592592        if (challenge.failureResponse().httpStatusCode() == 401)
    593593            urlToStore = challenge.failureResponse().url();
    594         d->m_context->storageSession().credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
     594        d->m_context->storageSession()->credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
    595595        [[d->m_currentMacChallenge sender] useCredential:webCredential.nsCredential() forAuthenticationChallenge:d->m_currentMacChallenge];
    596596    } else
  • trunk/Source/WebKit/ChangeLog

    r239736 r239737  
     12019-01-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using NetworkStorageSession in WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=193236
     5
     6        Reviewed by Don Olmstead.
     7
     8        * Shared/WebProcessCreationParameters.cpp:
     9        (WebKit::WebProcessCreationParameters::encode const):
     10        (WebKit::WebProcessCreationParameters::decode):
     11        * Shared/WebProcessCreationParameters.h:
     12        * Shared/WebsitePoliciesData.cpp:
     13        (WebKit::WebsitePoliciesData::applyToDocumentLoader):
     14        * UIProcess/WebProcessPool.cpp:
     15        (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
     16        (WebKit::WebProcessPool::tryTakePrewarmedProcess):
     17        (WebKit::WebProcessPool::initializeNewWebProcess):
     18        (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
     19        (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
     20        (WebKit::WebProcessPool::processForNavigationInternal):
     21        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     22        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
     23        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
     24        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
     25        (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
     26        (WebKit::WebFrameNetworkingContext::storageSession const): Deleted.
     27        * WebProcess/WebPage/WebPage.cpp:
     28        (WebKit::WebPage::setSessionID):
     29        * WebProcess/WebProcess.cpp:
     30        (WebKit::WebProcess::initializeWebProcess):
     31        (WebKit::WebProcess::fetchWebsiteData):
     32        (WebKit::WebProcess::addWebsiteDataStore): Deleted.
     33        (WebKit::WebProcess::destroySession): Deleted.
     34        * WebProcess/WebProcess.h:
     35        * WebProcess/WebProcess.messages.in:
     36
    1372019-01-08  Michael Catanzaro  <mcatanzaro@igalia.com>
    238
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r239735 r239737  
    7373    encoder << shouldCaptureDisplayInUIProcess;
    7474#endif
    75     encoder << shouldUseTestingNetworkSession;
    7675    encoder << urlSchemesRegisteredAsEmptyDocument;
    7776    encoder << urlSchemesRegisteredAsSecure;
     
    268267        return false;
    269268#endif
    270     if (!decoder.decode(parameters.shouldUseTestingNetworkSession))
    271         return false;
    272269    if (!decoder.decode(parameters.urlSchemesRegisteredAsEmptyDocument))
    273270        return false;
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r239735 r239737  
    125125    double defaultRequestTimeoutInterval { INT_MAX };
    126126
    127     bool shouldUseTestingNetworkSession { false };
    128127    bool shouldAlwaysUseComplexTextCodePath { false };
    129128    bool shouldEnableMemoryPressureReliefLogging { false };
  • trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp

    r239735 r239737  
    162162    if (websitePolicies.websiteDataStoreParameters) {
    163163        if (auto* frame = documentLoader.frame()) {
    164             if (auto* page = frame->page()) {
    165                 auto sessionID = websitePolicies.websiteDataStoreParameters->networkSessionParameters.sessionID;
    166                 WebProcess::singleton().addWebsiteDataStore(WTFMove(*websitePolicies.websiteDataStoreParameters));
    167                 page->setSessionID(sessionID);
    168             }
     164            if (auto* page = frame->page())
     165                page->setSessionID(websitePolicies.websiteDataStoreParameters->networkSessionParameters.sessionID);
    169166        }
    170167    }
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r239735 r239737  
    690690    if (privateBrowsingEnabled) {
    691691        sendToNetworkingProcess(Messages::NetworkProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()));
    692         sendToAllProcesses(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()));
    693692    } else {
    694693        networkProcess()->removeSession(PAL::SessionID::legacyPrivateSessionID());
    695         sendToAllProcesses(Messages::WebProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()));
    696694    }
    697695}
     
    766764    ASSERT(m_prewarmedProcess->isPrewarmed());
    767765    m_prewarmedProcess->markIsNoLongerInPrewarmedPool();
    768     if (&m_prewarmedProcess->websiteDataStore() != &websiteDataStore)
    769         m_prewarmedProcess->send(Messages::WebProcess::AddWebsiteDataStore(websiteDataStore.parameters()), 0);
    770766
    771767    return std::exchange(m_prewarmedProcess, nullptr);
     
    854850            SandboxExtension::createHandleWithoutResolvingPath(parameters.javaScriptConfigurationDirectory, SandboxExtension::Type::ReadWrite, parameters.javaScriptConfigurationDirectoryExtensionHandle);
    855851    }
    856 
    857     parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession;
    858852
    859853    parameters.cacheModel = cacheModel();
     
    943937#endif
    944938
    945     if (WebPreferences::anyPagesAreUsingPrivateBrowsing())
    946         process.send(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()), 0);
    947 
    948939    if (m_automationSession)
    949940        process.send(Messages::WebProcess::EnsureAutomationSessionProxy(m_automationSession->sessionIdentifier()), 0);
     
    11891180        if (m_networkProcess)
    11901181            m_networkProcess->addSession(makeRef(page.websiteDataStore()));
    1191         page.process().send(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::privateSessionParameters(sessionID)), 0);
    11921182        page.websiteDataStore().clearPendingCookies();
    11931183    } else if (sessionID != PAL::SessionID::defaultSessionID()) {
    11941184        if (m_networkProcess)
    11951185            m_networkProcess->addSession(makeRef(page.websiteDataStore()));
    1196         page.process().send(Messages::WebProcess::AddWebsiteDataStore(page.websiteDataStore().parameters()), 0);
    11971186        page.websiteDataStore().clearPendingCookies();
    11981187    }
     
    12251214        if (networkProcess())
    12261215            networkProcess()->removeSession(sessionID);
    1227         page.process().send(Messages::WebProcess::DestroySession(sessionID), 0);
    12281216    }
    12291217}
     
    22392227            m_suspendedPages.remove(it);
    22402228
    2241         if (&process->websiteDataStore() != &page.websiteDataStore())
    2242             process->send(Messages::WebProcess::AddWebsiteDataStore(page.websiteDataStore().parameters()), 0);
    2243 
    22442229        return completionHandler(WTFMove(process), nullptr, reason);
    22452230    }
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp

    r239735 r239737  
    358358    if (enabled) {
    359359        WebProcess::singleton().ensureLegacyPrivateBrowsingSessionInNetworkProcess();
    360         WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
    361360    } else
    362361        SessionTracker::destroySession(PAL::SessionID::legacyPrivateSessionID());
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r239535 r239737  
    108108// CookiesStrategy
    109109
    110 std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     110std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    111111{
    112112    String cookieString;
    113113    bool secureCookiesAccessed = false;
    114     if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookieString, secureCookiesAccessed), 0))
     114    if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(sessionID, firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookieString, secureCookiesAccessed), 0))
    115115        return { String(), false };
    116116
     
    118118}
    119119
    120 void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
    121 {
    122     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID, cookieString), 0);
    123 }
    124 
    125 bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session)
     120void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
     121{
     122    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(sessionID, firstParty, sameSiteInfo, url, frameID, pageID, cookieString), 0);
     123}
     124
     125bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID)
    126126{
    127127    bool result;
    128     if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(session.sessionID()), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
     128    if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(sessionID), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
    129129        return false;
    130130    return result;
    131131}
    132132
    133 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    134 {
    135     return cookieRequestHeaderFieldValue(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    136 }
    137 
    138 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     133std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    139134{
    140135    String cookieString;
     
    145140}
    146141
    147 bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
    148 {
    149     if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
     142bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
     143{
     144    if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(sessionID, firstParty, sameSiteInfo, url, frameID, pageID), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
    150145        return false;
    151146    return true;
    152147}
    153148
    154 void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
    155 {
    156     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.sessionID(), url, cookieName), 0);
     149void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName)
     150{
     151    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(sessionID, url, cookieName), 0);
    157152}
    158153
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h

    r239427 r239737  
    4848
    4949    // WebCore::CookiesStrategy
    50     std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    51     void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override;
    52     bool cookiesEnabled(const WebCore::NetworkStorageSession&) override;
    53     std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    54     std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    55     bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override;
    56     void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&) override;
     50    std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     51    void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override;
     52    bool cookiesEnabled(const PAL::SessionID&) override;
     53    std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     54    bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override;
     55    void deleteCookie(const PAL::SessionID&, const URL&, const String&) override;
    5756
    5857    // WebCore::PasteboardStrategy
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp

    r239735 r239737  
    5757}
    5858
    59 NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
    60 {
    61     if (frame()) {
    62         if (auto* storageSession = NetworkStorageSession::storageSession(frame()->page()->sessionID()))
    63             return *storageSession;
    64     }
    65     return NetworkStorageSession::defaultStorageSession();
    66 }
    67 
    6859WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
    6960{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h

    r239735 r239737  
    5454    WebFrameNetworkingContext(WebFrame*);
    5555
    56     WebCore::NetworkStorageSession& storageSession() const override;
     56    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
    5757};
    5858
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h

    r239735 r239737  
    5757    String sourceApplicationIdentifier() const override;
    5858    WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
    59     WebCore::NetworkStorageSession& storageSession() const override;
     59    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
    6060};
    6161
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm

    r239735 r239737  
    4444using namespace WebCore;
    4545
    46 void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&& parameters)
    47 {
    48     ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
    49     auto sessionID = parameters.networkSessionParameters.sessionID;
    50     if (NetworkStorageSession::storageSession(sessionID))
    51         return;
    52 
    53     String base = WebProcess::singleton().uiProcessBundleIdentifier();
    54     if (base.isNull())
    55         base = [[NSBundle mainBundle] bundleIdentifier];
    56 
    57     NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
    58 }
    59 
    6046bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
    6147{
     
    8571}
    8672
    87 NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
    88 {
    89     ASSERT(RunLoop::isMain());
    90     ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
    91     if (frame()) {
    92         if (auto* storageSession = WebCore::NetworkStorageSession::storageSession(frame()->page()->sessionID()))
    93             return *storageSession;
    94         // Some requests may still be coming shortly after WebProcess was told to destroy its session.
    95         LOG_ERROR("WEB Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
    96     }
    97     return NetworkStorageSession::defaultStorageSession();
    98 }
    99 
    10073WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
    10174{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp

    r239735 r239737  
    5959}
    6060
    61 NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
    62 {
    63     if (frame()) {
    64         if (auto* storageSession = NetworkStorageSession::storageSession(frame()->page()->sessionID()))
    65             return *storageSession;
    66     }
    67     return NetworkStorageSession::defaultStorageSession();
    68 }
    69 
    7061WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
    7162{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h

    r239735 r239737  
    5252    WebFrameNetworkingContext(WebFrame*);
    5353
    54     WebCore::NetworkStorageSession& storageSession() const override;
     54    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
    5555};
    5656
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r239735 r239737  
    30443044void WebPage::setSessionID(PAL::SessionID sessionID)
    30453045{
    3046     if (sessionID.isEphemeral())
    3047         WebProcess::singleton().addWebsiteDataStore(WebsiteDataStoreParameters::privateSessionParameters(sessionID));
    30483046    m_page->setSessionID(sessionID);
    30493047}
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r239735 r239737  
    382382    setShouldUseFontSmoothing(parameters.shouldUseFontSmoothing);
    383383
    384     if (parameters.shouldUseTestingNetworkSession)
    385         NetworkStorageSession::switchToNewTestingSession();
    386 
    387384    ensureNetworkProcessConnection();
    388385
     
    539536{
    540537    m_fullKeyboardAccessEnabled = fullKeyboardAccessEnabled;
    541 }
    542 
    543 void WebProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters)
    544 {
    545     WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WTFMove(parameters));
    546 }
    547 
    548 void WebProcess::destroySession(PAL::SessionID sessionID)
    549 {
    550     SessionTracker::destroySession(sessionID);
    551538}
    552539
     
    12951282            websiteData.entries.append(WebsiteData::Entry { origin->data(), WebsiteDataType::MemoryCache, 0 });
    12961283    }
    1297 
    1298     if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
    1299         if (NetworkStorageSession::storageSession(sessionID))
    1300             websiteData.originsWithCredentials = NetworkStorageSession::storageSession(sessionID)->credentialStorage().originsWithCredentials();
    1301     }
    13021284}
    13031285
  • trunk/Source/WebKit/WebProcess/WebProcess.h

    r239735 r239737  
    179179
    180180    void ensureLegacyPrivateBrowsingSessionInNetworkProcess();
    181     void addWebsiteDataStore(WebsiteDataStoreParameters&&);
    182     void destroySession(PAL::SessionID);
    183181
    184182    void pageDidEnterWindow(uint64_t pageID);
  • trunk/Source/WebKit/WebProcess/WebProcess.messages.in

    r239735 r239737  
    5353
    5454    ClearCachedCredentials()
    55 
    56     AddWebsiteDataStore(struct WebKit::WebsiteDataStoreParameters websiteDataStoreParameters);
    57     DestroySession(PAL::SessionID sessionID)
    5855
    5956    # Plug-ins.
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r239735 r239737  
     12019-01-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using NetworkStorageSession in WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=193236
     5
     6        Reviewed by Don Olmstead.
     7
     8        * WebCoreSupport/WebFrameNetworkingContext.h:
     9        * WebCoreSupport/WebFrameNetworkingContext.mm:
     10        (WebFrameNetworkingContext::storageSession const):
     11        * WebCoreSupport/WebPlatformStrategies.h:
     12        * WebCoreSupport/WebPlatformStrategies.mm:
     13        (WebPlatformStrategies::cookiesForDOM):
     14        (WebPlatformStrategies::setCookiesFromDOM):
     15        (WebPlatformStrategies::cookiesEnabled):
     16        (WebPlatformStrategies::cookieRequestHeaderFieldValue):
     17        (WebPlatformStrategies::getRawCookies):
     18        (WebPlatformStrategies::deleteCookie):
     19        * WebView/WebView.mm:
     20        (-[WebView _cachedResponseForURL:]):
     21        (-[WebView _clearCredentials]):
     22
    1232019-01-08  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.h

    r239735 r239737  
    5050    String sourceApplicationIdentifier() const override;
    5151    WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
    52     WebCore::NetworkStorageSession& storageSession() const override;
     52    WebCore::NetworkStorageSession* storageSession() const override;
    5353};
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm

    r239735 r239737  
    9191}
    9292
    93 NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
     93NetworkStorageSession* WebFrameNetworkingContext::storageSession() const
    9494{
    9595    ASSERT(isMainThread());
    9696    if (frame() && frame()->page() && frame()->page()->sessionID().isEphemeral()) {
    9797        if (auto* session = NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID()))
    98             return *session;
     98            return session;
    9999        // Some requests may still be coming shortly before WebCore updates the session ID and after WebKit destroys the private browsing session.
    100100        LOG_ERROR("Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
    101101    }
    102     return NetworkStorageSession::defaultStorageSession();
     102    return &NetworkStorageSession::defaultStorageSession();
    103103}
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h

    r239427 r239737  
    4949
    5050    // WebCore::CookiesStrategy
    51     std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    52     void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override;
    53     bool cookiesEnabled(const WebCore::NetworkStorageSession&) override;
    54     std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    55     std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    56     bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override;
    57     void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&) override;
     51    std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     52    void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override;
     53    bool cookiesEnabled(const PAL::SessionID&) override;
     54    std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     55    bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override;
     56    void deleteCookie(const PAL::SessionID&, const URL&, const String&) override;
    5857
    5958    // WebCore::PasteboardStrategy
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm

    r239427 r239737  
    7373}
    7474
    75 std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    76 {
     75std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     76{
     77    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    7778    return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    7879}
    7980
    80 void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
    81 {
     81void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
     82{
     83    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    8284    session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString);
    8385}
    8486
    85 bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session)
    86 {
     87bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID)
     88{
     89    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    8790    return session.cookiesEnabled();
    8891}
    8992
    90 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    91 {
     93std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     94{
     95    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    9296    return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    9397}
    9498
    95 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    96 {
    97     auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    98     return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    99 }
    100 
    101 bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
    102 {
     99bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
     100{
     101    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    103102    return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies);
    104103}
    105104
    106 void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
    107 {
     105void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName)
     106{
     107    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    108108    session.deleteCookie(url, cookieName);
    109109}
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r239735 r239737  
    36693669        return nil;
    36703670
    3671     if (CFURLStorageSessionRef storageSession = _private->page->mainFrame().loader().networkingContext()->storageSession().platformSession())
     3671    if (auto storageSession = _private->page->mainFrame().loader().networkingContext()->storageSession()->platformSession())
    36723672        cachedResponse = cachedResponseForRequest(storageSession, request.get());
    36733673    else
     
    92529252        return;
    92539253
    9254     networkingContext->storageSession().credentialStorage().clearCredentials();
     9254    networkingContext->storageSession()->credentialStorage().clearCredentials();
    92559255}
    92569256
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r239735 r239737  
     12019-01-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using NetworkStorageSession in WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=193236
     5
     6        Reviewed by Don Olmstead.
     7
     8        * WebCoreSupport/WebFrameNetworkingContext.cpp:
     9        (WebFrameNetworkingContext::storageSession const):
     10        * WebCoreSupport/WebFrameNetworkingContext.h:
     11        * WebCoreSupport/WebPlatformStrategies.cpp:
     12        (WebPlatformStrategies::cookiesForDOM):
     13        (WebPlatformStrategies::setCookiesFromDOM):
     14        (WebPlatformStrategies::cookiesEnabled):
     15        (WebPlatformStrategies::cookieRequestHeaderFieldValue):
     16        (WebPlatformStrategies::getRawCookies):
     17        (WebPlatformStrategies::deleteCookie):
     18        * WebCoreSupport/WebPlatformStrategies.h:
     19
    1202019-01-08  Alex Christensen  <achristensen@webkit.org>
    221
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp

    r239735 r239737  
    100100}
    101101
    102 NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
     102NetworkStorageSession* WebFrameNetworkingContext::storageSession() const
    103103{
    104104    ASSERT(isMainThread());
    105105
    106106    if (frame() && frame()->page()->usesEphemeralSession())
    107         return *NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID());
     107        return NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID());
    108108
    109     return NetworkStorageSession::defaultStorageSession();
     109    return &NetworkStorageSession::defaultStorageSession();
    110110}
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.h

    r239735 r239737  
    4848
    4949    WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
    50     WebCore::NetworkStorageSession& storageSession() const override;
     50    WebCore::NetworkStorageSession* storageSession() const override;
    5151};
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp

    r239427 r239737  
    7070}
    7171
    72 std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     72std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    7373{
     74    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    7475    return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    7576}
    7677
    77 void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
     78void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString)
    7879{
     80    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    7981    session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString);
    8082}
    8183
    82 bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session)
     84bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID)
    8385{
     86    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    8487    return session.cookiesEnabled();
    8588}
    8689
    87 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    88 {
    89     return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
    90 }
    91 
    92 std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
     90std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies)
    9391{
    9492    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
     
    9694}
    9795
    98 bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
     96bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies)
    9997{
     98    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    10099    return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies);
    101100}
    102101
    103 void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
     102void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName)
    104103{
     104    auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
    105105    session.deleteCookie(url, cookieName);
    106106}
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h

    r239427 r239737  
    4646
    4747    // WebCore::CookiesStrategy
    48     std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    49     virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&);
    50     virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&);
    51     std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    52     std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
    53     virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&);
    54     virtual void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&);
     48    std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     49    virtual void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&);
     50    virtual bool cookiesEnabled(const PAL::SessionID&);
     51    std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override;
     52    virtual bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&);
     53    virtual void deleteCookie(const PAL::SessionID&, const URL&, const String&);
    5554};
Note: See TracChangeset for help on using the changeset viewer.