Skip to content
Permalink
Browse files
[SOUP] Assertion in startObservingCookieChanges()
https://bugs.webkit.org/show_bug.cgi?id=229708

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2021-08-31
Reviewed by Philippe Normand.

Source/WebCore:

Add an implementation for startObservingCookieChanges() and stopObservingCookieChanges() setting the cookies
observer callback on the given storage session.

* platform/network/CookieStorage.h:
* platform/network/cf/CookieStorageCFNet.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/curl/CookieStorageCurl.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/mac/CookieStorageMac.mm:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/soup/CookieStorageSoup.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):

Source/WebKit:

Do not observe cookies changes unconditionally on session creation/destruction.

* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):
(WebKit::NetworkSessionSoup::~NetworkSessionSoup):

Canonical link: https://commits.webkit.org/241138@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos authored and webkit-commit-queue committed Aug 31, 2021
1 parent 1e97b65 commit 5ac8745e1d054e6a856cbc8bb3b3021ffda65d64
Showing 8 changed files with 53 additions and 21 deletions.
@@ -1,3 +1,27 @@
2021-08-31 Carlos Garcia Campos <cgarcia@igalia.com>

[SOUP] Assertion in startObservingCookieChanges()
https://bugs.webkit.org/show_bug.cgi?id=229708

Reviewed by Philippe Normand.

Add an implementation for startObservingCookieChanges() and stopObservingCookieChanges() setting the cookies
observer callback on the given storage session.

* platform/network/CookieStorage.h:
* platform/network/cf/CookieStorageCFNet.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/curl/CookieStorageCurl.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/mac/CookieStorageMac.mm:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):
* platform/network/soup/CookieStorageSoup.cpp:
(WebCore::startObservingCookieChanges):
(WebCore::stopObservingCookieChanges):

2021-08-31 Alan Bujtas <zalan@apple.com>

[LFC][Integration] Make naming more consistent across Layout::Run and Integration::Run structs
@@ -31,8 +31,8 @@ namespace WebCore {

class NetworkStorageSession;

WEBCORE_EXPORT void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void ()>&&);
WEBCORE_EXPORT void stopObservingCookieChanges(const NetworkStorageSession&);
WEBCORE_EXPORT void startObservingCookieChanges(NetworkStorageSession&, WTF::Function<void()>&&);
WEBCORE_EXPORT void stopObservingCookieChanges(NetworkStorageSession&);

}

@@ -63,7 +63,7 @@ static inline CFRunLoopRef cookieStorageObserverRunLoop()
return loaderRunLoop();
}

void startObservingCookieChanges(const NetworkStorageSession& storageSession, WTF::Function<void ()>&& callback)
void startObservingCookieChanges(NetworkStorageSession& storageSession, WTF::Function<void()>&& callback)
{
ASSERT(isMainThread());

@@ -80,7 +80,7 @@ void startObservingCookieChanges(const NetworkStorageSession& storageSession, WT
CFHTTPCookieStorageAddObserver(cookieStorage.get(), runLoop, kCFRunLoopDefaultMode, notifyCookiesChanged, 0);
}

void stopObservingCookieChanges(const NetworkStorageSession& storageSession)
void stopObservingCookieChanges(NetworkStorageSession& storageSession)
{
ASSERT(isMainThread());

@@ -32,12 +32,12 @@

namespace WebCore {

void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void()>&&)
void startObservingCookieChanges(NetworkStorageSession&, WTF::Function<void()>&&)
{
notImplemented();
}

void stopObservingCookieChanges(const NetworkStorageSession&)
void stopObservingCookieChanges(NetworkStorageSession&)
{
notImplemented();
}
@@ -31,12 +31,12 @@

namespace WebCore {

void startObservingCookieChanges(const NetworkStorageSession& storageSession, WTF::Function<void()>&& callback)
void startObservingCookieChanges(NetworkStorageSession& storageSession, WTF::Function<void()>&& callback)
{
storageSession.cookieStorageObserver().startObserving(WTFMove(callback));
}

void stopObservingCookieChanges(const NetworkStorageSession& storageSession)
void stopObservingCookieChanges(NetworkStorageSession& storageSession)
{
storageSession.cookieStorageObserver().stopObserving();
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 Igalia S.L.
* Copyright (C) 2021 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,19 +20,20 @@
#include "CookieStorage.h"

#if USE(SOUP)
#include "NetworkStorageSession.h"

namespace WebCore {

void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void ()>&&)
void startObservingCookieChanges(NetworkStorageSession& storageSession, Function<void()>&& callback)
{
ASSERT_NOT_REACHED();
storageSession.setCookieObserverHandler(WTFMove(callback));
}

void stopObservingCookieChanges(const NetworkStorageSession&)
void stopObservingCookieChanges(NetworkStorageSession& storageSession)
{
ASSERT_NOT_REACHED();
storageSession.setCookieObserverHandler(nullptr);
}

}
} // namespace WebCore

#endif
#endif // USE(SOUP)
@@ -1,3 +1,16 @@
2021-08-31 Carlos Garcia Campos <cgarcia@igalia.com>

[SOUP] Assertion in startObservingCookieChanges()
https://bugs.webkit.org/show_bug.cgi?id=229708

Reviewed by Philippe Normand.

Do not observe cookies changes unconditionally on session creation/destruction.

* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):
(WebKit::NetworkSessionSoup::~NetworkSessionSoup):

2021-08-31 Myles C. Maxfield <mmaxfield@apple.com>

[Cocoa] Drawing system fallback fonts to canvas causes a crash
@@ -59,18 +59,12 @@ NetworkSessionSoup::NetworkSessionSoup(NetworkProcess& networkProcess, NetworkSe
else
m_networkSession->setCookieJar(storageSession->cookieStorage());

storageSession->setCookieObserverHandler([this] {
this->networkProcess().supplement<WebCookieManager>()->notifyCookiesDidChange(m_sessionID);
});

if (!parameters.hstsStorageDirectory.isEmpty())
m_networkSession->setHSTSPersistentStorage(parameters.hstsStorageDirectory);
}

NetworkSessionSoup::~NetworkSessionSoup()
{
if (auto* storageSession = networkProcess().storageSession(m_sessionID))
storageSession->setCookieObserverHandler(nullptr);
}

SoupSession* NetworkSessionSoup::soupSession() const

0 comments on commit 5ac8745

Please sign in to comment.