Changeset 212626 in webkit


Ignore:
Timestamp:
Feb 20, 2017 12:30:50 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
https://bugs.webkit.org/show_bug.cgi?id=168375

Reviewed by Alex Christensen.

Source/WebCore:

Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
set.

  • platform/network/NetworkStorageSession.h:
  • platform/network/soup/CookieStorageSoup.cpp:

(WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
(WebCore::stopObservingCookieChanges): Ditto.
(WebCore::cookieChangeCallbackMap): Deleted.
(WebCore::soupCookiesChanged): Deleted.

  • platform/network/soup/NetworkStorageSessionSoup.cpp:

(WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
(WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
(WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
(WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
(WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
(WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
(WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.

Source/WebKit2:

Simplify the cookies change notification. The current approach of the UI process telling the network process
when to start and stop observing cookie changes is quite fragile and error prone. In the GTK+ port we always
observe cookies, so our cookie manager always calls start in the constructor and stop in the destructor.
Everything would be a lot simpler if the network process always monitored cookies.

  • NetworkProcess/soup/NetworkSessionSoup.cpp:

(WebKit::NetworkSessionSoup::NetworkSessionSoup): Set cookies observer handler for the session.
(WebKit::NetworkSessionSoup::~NetworkSessionSoup): Remove the cookies observer handler.

  • UIProcess/API/gtk/WebKitCookieManager.cpp:

(_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate): Remove the cookies observer callback.
(webkit_cookie_manager_class_init): Remove dispose implementation that is no longer needed.
(webkitCookieManagerCreate): Set the cookies observer callback.
(webkit_cookie_manager_set_persistent_storage): Remove code to start/stop observing cookies when the jar
changes, the network process deals with that now.
(webkitCookieManagerDispose): Deleted.

  • UIProcess/WebCookieManagerProxy.cpp:

(WebKit::WebCookieManagerProxy::startObservingCookieChanges): Remove the optional callback method in favor of an
explicit method to the set the callback that doesn't send the StartObservingCookieChanges message to the network
process.
(WebKit::WebCookieManagerProxy::stopObservingCookieChanges): Do not change the callback map here.
(WebKit::WebCookieManagerProxy::setCookieObserverCallback): Add the callback to the map or remove the session if
nullptr is given.

  • UIProcess/WebCookieManagerProxy.h:
  • WebProcess/Cookies/WebCookieManager.cpp:

(WebKit::WebCookieManager::notifyCookiesDidChange): Send CookiesDidChange message to the UI process.
(WebKit::WebCookieManager::startObservingCookieChanges): Use notifyCookiesDidChange().

  • WebProcess/Cookies/WebCookieManager.h:
  • WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:

(WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Set the policy on all sessions. Code moved from
WebFrameNetworkingContext since it doesn't belong there.
(WebKit::WebCookieManager::setCookiePersistentStorage): Use new method to set the cookie storage in the
NetworkStorageSession.

  • WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:

(WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.

  • WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r212625 r212626  
     12017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
     4        https://bugs.webkit.org/show_bug.cgi?id=168375
     5
     6        Reviewed by Alex Christensen.
     7
     8        Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
     9        cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
     10        session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
     11        set.
     12
     13        * platform/network/NetworkStorageSession.h:
     14        * platform/network/soup/CookieStorageSoup.cpp:
     15        (WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
     16        (WebCore::stopObservingCookieChanges): Ditto.
     17        (WebCore::cookieChangeCallbackMap): Deleted.
     18        (WebCore::soupCookiesChanged): Deleted.
     19        * platform/network/soup/NetworkStorageSessionSoup.cpp:
     20        (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
     21        (WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
     22        (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
     23        (WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
     24        (WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
     25        (WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
     26        needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
     27        (WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.
     28
    1292017-02-19  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r210786 r212626  
    7575    SoupNetworkSession& getOrCreateSoupNetworkSession() const;
    7676    SoupCookieJar* cookieStorage() const;
     77    void setCookieStorage(SoupCookieJar*);
     78    void setCookieObserverHandler(Function<void ()>&&);
    7779    void getCredentialFromPersistentStorage(const ProtectionSpace&, Function<void (Credential&&)> completionHandler);
    7880    void saveCredentialToPersistentStorage(const ProtectionSpace&, const Credential&);
     
    9193    RetainPtr<CFURLStorageSessionRef> m_platformSession;
    9294#elif USE(SOUP)
     95    static void cookiesDidChange(NetworkStorageSession*);
     96
    9397    mutable std::unique_ptr<SoupNetworkSession> m_session;
    94     mutable GRefPtr<SoupCookieJar> m_cookieStorage;
     98    GRefPtr<SoupCookieJar> m_cookieStorage;
     99    Function<void ()> m_cookieObserverHandler;
    95100#if USE(LIBSECRET)
    96101    Function<void (Credential&&)> m_persisentStorageCompletionHandler;
  • trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp

    r212283 r212626  
    2222#if USE(SOUP)
    2323
    24 #include "NetworkStorageSession.h"
    25 #include <libsoup/soup.h>
    26 #include <wtf/HashMap.h>
    27 #include <wtf/NeverDestroyed.h>
    28 
    2924namespace WebCore {
    3025
    31 static HashMap<SoupCookieJar*, std::function<void ()>>& cookieChangeCallbackMap()
     26void startObservingCookieChanges(const NetworkStorageSession&, std::function<void ()>&&)
    3227{
    33     static NeverDestroyed<HashMap<SoupCookieJar*, std::function<void ()>>> map;
    34     return map;
     28    ASSERT_NOT_REACHED();
    3529}
    3630
    37 static void soupCookiesChanged(SoupCookieJar* jar)
     31void stopObservingCookieChanges(const NetworkStorageSession&)
    3832{
    39     if (auto callback = cookieChangeCallbackMap().get(jar))
    40         callback();
    41 }
    42 
    43 void startObservingCookieChanges(const NetworkStorageSession& storageSession, std::function<void ()>&& callback)
    44 {
    45     auto* jar = storageSession.cookieStorage();
    46     ASSERT(!cookieChangeCallbackMap().contains(jar));
    47     cookieChangeCallbackMap().add(jar, WTFMove(callback));
    48     g_signal_connect(jar, "changed", G_CALLBACK(soupCookiesChanged), nullptr);
    49 }
    50 
    51 void stopObservingCookieChanges(const NetworkStorageSession& storageSession)
    52 {
    53     auto* jar = storageSession.cookieStorage();
    54     ASSERT(cookieChangeCallbackMap().contains(jar));
    55     cookieChangeCallbackMap().remove(jar);
    56     g_signal_handlers_disconnect_by_func(jar, reinterpret_cast<void*>(soupCookiesChanged), nullptr);
     33    ASSERT_NOT_REACHED();
    5734}
    5835
  • trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp

    r210786 r212626  
    5252    , m_session(WTFMove(session))
    5353{
     54    setCookieStorage(m_session ? m_session->cookieJar() : nullptr);
    5455}
    5556
    5657NetworkStorageSession::~NetworkStorageSession()
    5758{
     59    g_signal_handlers_disconnect_matched(m_cookieStorage.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
     60
    5861#if USE(LIBSECRET)
    5962    g_cancellable_cancel(m_persisentStorageCancellable.get());
     
    9093{
    9194    if (!m_session)
    92         m_session = std::make_unique<SoupNetworkSession>(cookieStorage());
     95        m_session = std::make_unique<SoupNetworkSession>(m_cookieStorage.get());
    9396    return *m_session;
    9497}
    9598
     99void NetworkStorageSession::cookiesDidChange(NetworkStorageSession* session)
     100{
     101    if (session->m_cookieObserverHandler)
     102        session->m_cookieObserverHandler();
     103}
     104
    96105SoupCookieJar* NetworkStorageSession::cookieStorage() const
    97106{
    98     if (m_session) {
    99         m_cookieStorage = nullptr;
    100         ASSERT(m_session->cookieJar());
    101         return m_session->cookieJar();
    102     }
    103 
    104     if (!m_cookieStorage) {
     107    RELEASE_ASSERT(!m_session || m_session->cookieJar() == m_cookieStorage.get());
     108    return m_cookieStorage.get();
     109}
     110
     111void NetworkStorageSession::setCookieStorage(SoupCookieJar* jar)
     112{
     113    if (m_cookieStorage)
     114        g_signal_handlers_disconnect_matched(m_cookieStorage.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
     115
     116    // We always have a valid cookieStorage.
     117    if (jar)
     118        m_cookieStorage = jar;
     119    else {
    105120        m_cookieStorage = adoptGRef(soup_cookie_jar_new());
    106121        soup_cookie_jar_set_accept_policy(m_cookieStorage.get(), SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY);
    107122    }
    108     return m_cookieStorage.get();
     123    g_signal_connect_swapped(m_cookieStorage.get(), "changed", G_CALLBACK(cookiesDidChange), this);
     124    if (m_session && m_session->cookieJar() != m_cookieStorage.get())
     125        m_session->setCookieJar(m_cookieStorage.get());
     126}
     127
     128void NetworkStorageSession::setCookieObserverHandler(Function<void ()>&& handler)
     129{
     130    m_cookieObserverHandler = WTFMove(handler);
    109131}
    110132
  • trunk/Source/WebKit2/ChangeLog

    r212619 r212626  
     12017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
     4        https://bugs.webkit.org/show_bug.cgi?id=168375
     5
     6        Reviewed by Alex Christensen.
     7
     8        Simplify the cookies change notification. The current approach of the UI process telling the network process
     9        when to start and stop observing cookie changes is quite fragile and error prone. In the GTK+ port we always
     10        observe cookies, so our cookie manager always calls start in the constructor and stop in the destructor.
     11        Everything would be a lot simpler if the network process always monitored cookies.
     12
     13        * NetworkProcess/soup/NetworkSessionSoup.cpp:
     14        (WebKit::NetworkSessionSoup::NetworkSessionSoup): Set cookies observer handler for the session.
     15        (WebKit::NetworkSessionSoup::~NetworkSessionSoup): Remove the cookies observer handler.
     16        * UIProcess/API/gtk/WebKitCookieManager.cpp:
     17        (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate): Remove the cookies observer callback.
     18        (webkit_cookie_manager_class_init): Remove dispose implementation that is no longer needed.
     19        (webkitCookieManagerCreate): Set the cookies observer callback.
     20        (webkit_cookie_manager_set_persistent_storage): Remove code to start/stop observing cookies when the jar
     21        changes, the network process deals with that now.
     22        (webkitCookieManagerDispose): Deleted.
     23        * UIProcess/WebCookieManagerProxy.cpp:
     24        (WebKit::WebCookieManagerProxy::startObservingCookieChanges): Remove the optional callback method in favor of an
     25        explicit method to the set the callback that doesn't send the StartObservingCookieChanges message to the network
     26        process.
     27        (WebKit::WebCookieManagerProxy::stopObservingCookieChanges): Do not change the callback map here.
     28        (WebKit::WebCookieManagerProxy::setCookieObserverCallback): Add the callback to the map or remove the session if
     29        nullptr is given.
     30        * UIProcess/WebCookieManagerProxy.h:
     31        * WebProcess/Cookies/WebCookieManager.cpp:
     32        (WebKit::WebCookieManager::notifyCookiesDidChange): Send CookiesDidChange message to the UI process.
     33        (WebKit::WebCookieManager::startObservingCookieChanges): Use notifyCookiesDidChange().
     34        * WebProcess/Cookies/WebCookieManager.h:
     35        * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
     36        (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Set the policy on all sessions. Code moved from
     37        WebFrameNetworkingContext since it doesn't belong there.
     38        (WebKit::WebCookieManager::setCookiePersistentStorage): Use new method to set the cookie storage in the
     39        NetworkStorageSession.
     40        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
     41        (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
     42        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
     43
    1442017-02-19  Chris Dumez  <cdumez@apple.com>
    245
  • trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp

    r210786 r212626  
    2727#include "NetworkSessionSoup.h"
    2828
     29#include "NetworkProcess.h"
     30#include "WebCookieManager.h"
    2931#include <WebCore/NetworkStorageSession.h>
    3032#include <WebCore/SoupNetworkSession.h>
     
    3840    : NetworkSession(sessionID)
    3941{
     42    networkStorageSession().setCookieObserverHandler([this] {
     43        NetworkProcess::singleton().supplement<WebCookieManager>()->notifyCookiesDidChange(m_sessionID);
     44    });
    4045}
    4146
    4247NetworkSessionSoup::~NetworkSessionSoup()
    4348{
     49    if (auto* storageSession = NetworkStorageSession::storageSession(m_sessionID))
     50        storageSession->setCookieObserverHandler(nullptr);
    4451}
    4552
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp

    r212345 r212626  
    5252
    5353struct _WebKitCookieManagerPrivate {
     54    ~_WebKitCookieManagerPrivate()
     55    {
     56        auto sessionID = webkitWebsiteDataManagerGetDataStore(dataManager).websiteDataStore().sessionID();
     57        for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(dataManager))
     58            processPool->supplement<WebCookieManagerProxy>()->setCookieObserverCallback(sessionID, nullptr);
     59    }
     60
    5461    WebKitWebsiteDataManager* dataManager;
    5562};
     
    102109}
    103110
    104 static void webkitCookieManagerDispose(GObject* object)
    105 {
    106     WebKitCookieManager* manager = WEBKIT_COOKIE_MANAGER(object);
    107     if (manager->priv->dataManager) {
    108         auto sessionID = webkitWebsiteDataManagerGetDataStore(manager->priv->dataManager).websiteDataStore().sessionID();
    109         for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(manager->priv->dataManager))
    110             processPool->supplement<WebCookieManagerProxy>()->stopObservingCookieChanges(sessionID);
    111 
    112         manager->priv->dataManager = nullptr;
    113     }
    114 
    115     G_OBJECT_CLASS(webkit_cookie_manager_parent_class)->dispose(object);
    116 }
    117 
    118111static void webkit_cookie_manager_class_init(WebKitCookieManagerClass* findClass)
    119112{
    120113    GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass);
    121     gObjectClass->dispose = webkitCookieManagerDispose;
    122114
    123115    /**
     
    142134    auto sessionID = webkitWebsiteDataManagerGetDataStore(manager->priv->dataManager).websiteDataStore().sessionID();
    143135    for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(manager->priv->dataManager)) {
    144         processPool->supplement<WebCookieManagerProxy>()->startObservingCookieChanges(sessionID, [manager] {
     136        processPool->supplement<WebCookieManagerProxy>()->setCookieObserverCallback(sessionID, [manager] {
    145137            g_signal_emit(manager, signals[CHANGED], 0);
    146138        });
     
    171163    g_return_if_fail(!webkit_website_data_manager_is_ephemeral(manager->priv->dataManager));
    172164
    173     for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(manager->priv->dataManager)) {
    174         auto* cookieManager = processPool->supplement<WebCookieManagerProxy>();
    175 
    176         cookieManager->stopObservingCookieChanges(WebCore::SessionID::defaultSessionID());
    177         cookieManager->setCookiePersistentStorage(String::fromUTF8(filename), toSoupCookiePersistentStorageType(storage));
    178         cookieManager->startObservingCookieChanges(WebCore::SessionID::defaultSessionID(), [manager] {
    179             g_signal_emit(manager, signals[CHANGED], 0);
    180         });
    181     }
     165    for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(manager->priv->dataManager))
     166        processPool->supplement<WebCookieManagerProxy>()->setCookiePersistentStorage(String::fromUTF8(filename), toSoupCookiePersistentStorageType(storage));
    182167}
    183168
  • trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp

    r212283 r212626  
    134134}
    135135
    136 void WebCookieManagerProxy::startObservingCookieChanges(WebCore::SessionID sessionID, std::function<void ()>&& callback)
     136void WebCookieManagerProxy::startObservingCookieChanges(WebCore::SessionID sessionID)
    137137{
    138     if (callback)
    139         m_cookieObservers.set(sessionID, WTFMove(callback));
    140138    processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::StartObservingCookieChanges(sessionID));
    141139}
     
    143141void WebCookieManagerProxy::stopObservingCookieChanges(WebCore::SessionID sessionID)
    144142{
    145     m_cookieObservers.remove(sessionID);
    146143    processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::StopObservingCookieChanges(sessionID));
     144}
     145
     146void WebCookieManagerProxy::setCookieObserverCallback(WebCore::SessionID sessionID, std::function<void ()>&& callback)
     147{
     148    if (callback)
     149        m_cookieObservers.set(sessionID, WTFMove(callback));
     150    else
     151        m_cookieObservers.remove(sessionID);
    147152}
    148153
  • trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h

    r212283 r212626  
    7575    void getHTTPCookieAcceptPolicy(std::function<void (HTTPCookieAcceptPolicy, CallbackBase::Error)>);
    7676
    77     void startObservingCookieChanges(WebCore::SessionID, std::function<void ()>&& = nullptr);
     77    void startObservingCookieChanges(WebCore::SessionID);
    7878    void stopObservingCookieChanges(WebCore::SessionID);
     79
     80    void setCookieObserverCallback(WebCore::SessionID, std::function<void ()>&&);
    7981
    8082#if USE(SOUP)
  • trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp

    r212283 r212626  
    9090}
    9191
     92void WebCookieManager::notifyCookiesDidChange(SessionID sessionID)
     93{
     94    ASSERT(RunLoop::isMain());
     95    m_process->send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
     96}
     97
    9298void WebCookieManager::startObservingCookieChanges(SessionID sessionID)
    9399{
    94100    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) {
    95101        WebCore::startObservingCookieChanges(*storageSession, [this, sessionID] {
    96             ASSERT(RunLoop::isMain());
    97             m_process->send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
     102            notifyCookiesDidChange(sessionID);
    98103        });
    99104    }
  • trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h

    r212283 r212626  
    6060#endif
    6161
     62    void notifyCookiesDidChange(WebCore::SessionID);
     63
    6264private:
    6365    // IPC::MessageReceiver
  • trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp

    r210786 r212626  
    2828
    2929#include "ChildProcess.h"
    30 #include "WebFrameNetworkingContext.h"
    3130#include "WebKitSoupCookieJarSqlite.h"
    3231#include <WebCore/NetworkStorageSession.h>
     
    4241void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
    4342{
    44     WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(policy);
     43    SoupCookieJarAcceptPolicy soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
     44    switch (policy) {
     45    case HTTPCookieAcceptPolicyAlways:
     46        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
     47        break;
     48    case HTTPCookieAcceptPolicyNever:
     49        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
     50        break;
     51    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
     52        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
     53        break;
     54    }
     55
     56    NetworkStorageSession::forEach([soupPolicy] (const NetworkStorageSession& session) {
     57        soup_cookie_jar_set_accept_policy(session.cookieStorage(), soupPolicy);
     58    });
    4559}
    4660
     
    7690    auto& storageSession = NetworkStorageSession::defaultStorageSession();
    7791    soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(storageSession.cookieStorage()));
    78     storageSession.getOrCreateSoupNetworkSession().setCookieJar(jar.get());
     92    storageSession.setCookieStorage(jar.get());
    7993}
    8094
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp

    r210729 r212626  
    5353}
    5454
    55 void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
    56 {
    57     SoupCookieJarAcceptPolicy soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
    58     switch (policy) {
    59     case HTTPCookieAcceptPolicyAlways:
    60         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
    61         break;
    62     case HTTPCookieAcceptPolicyNever:
    63         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
    64         break;
    65     case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
    66         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
    67         break;
    68     }
    69 
    70     soup_cookie_jar_set_accept_policy(NetworkStorageSession::defaultStorageSession().cookieStorage(), soupPolicy);
    71 
    72     NetworkStorageSession::forEach([&] (const NetworkStorageSession& session) {
    73         soup_cookie_jar_set_accept_policy(session.cookieStorage(), soupPolicy);
    74     });
    75 }
    76 
    7755WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame)
    7856    : FrameNetworkingContext(frame->coreFrame())
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h

    r209871 r212626  
    2626 */
    2727
    28 #ifndef WebFrameNetworkingContext_h
    29 #define WebFrameNetworkingContext_h
     28#pragma once
    3029
    31 #include "HTTPCookieAcceptPolicy.h"
    3230#include <WebCore/FrameNetworkingContext.h>
    3331#include <WebCore/SessionID.h>
     
    4644
    4745    static void ensurePrivateBrowsingSession(WebCore::SessionID);
    48     static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
    4946
    5047    WebFrameLoaderClient* webFrameLoaderClient() const;
     
    5754
    5855}
    59 
    60 #endif // WebFrameNetworkingContext_h
Note: See TracChangeset for help on using the changeset viewer.