Title: [281801] trunk/Source
Revision
281801
Author
[email protected]
Date
2021-08-31 07:19:28 -0700 (Tue, 31 Aug 2021)

Log Message

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

Patch by Carlos Garcia Campos <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281800 => 281801)


--- trunk/Source/WebCore/ChangeLog	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/ChangeLog	2021-08-31 14:19:28 UTC (rev 281801)
@@ -1,3 +1,27 @@
+2021-08-31  Carlos Garcia Campos  <[email protected]>
+
+        [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  <[email protected]>
 
         [LFC][Integration] Make naming more consistent across Layout::Run and Integration::Run structs

Modified: trunk/Source/WebCore/platform/network/CookieStorage.h (281800 => 281801)


--- trunk/Source/WebCore/platform/network/CookieStorage.h	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/platform/network/CookieStorage.h	2021-08-31 14:19:28 UTC (rev 281801)
@@ -31,8 +31,8 @@
 
 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&);
 
 }
 

Modified: trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp (281800 => 281801)


--- trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp	2021-08-31 14:19:28 UTC (rev 281801)
@@ -63,7 +63,7 @@
     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 @@
     CFHTTPCookieStorageAddObserver(cookieStorage.get(), runLoop, kCFRunLoopDefaultMode, notifyCookiesChanged, 0);
 }
 
-void stopObservingCookieChanges(const NetworkStorageSession& storageSession)
+void stopObservingCookieChanges(NetworkStorageSession& storageSession)
 {
     ASSERT(isMainThread());
 

Modified: trunk/Source/WebCore/platform/network/curl/CookieStorageCurl.cpp (281800 => 281801)


--- trunk/Source/WebCore/platform/network/curl/CookieStorageCurl.cpp	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/platform/network/curl/CookieStorageCurl.cpp	2021-08-31 14:19:28 UTC (rev 281801)
@@ -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();
 }

Modified: trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm (281800 => 281801)


--- trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm	2021-08-31 14:19:28 UTC (rev 281801)
@@ -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();
 }

Modified: trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp (281800 => 281801)


--- trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp	2021-08-31 14:19:28 UTC (rev 281801)
@@ -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)

Modified: trunk/Source/WebKit/ChangeLog (281800 => 281801)


--- trunk/Source/WebKit/ChangeLog	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebKit/ChangeLog	2021-08-31 14:19:28 UTC (rev 281801)
@@ -1,3 +1,16 @@
+2021-08-31  Carlos Garcia Campos  <[email protected]>
+
+        [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  <[email protected]>
 
         [Cocoa] Drawing system fallback fonts to canvas causes a crash

Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp (281800 => 281801)


--- trunk/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp	2021-08-31 13:47:17 UTC (rev 281800)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp	2021-08-31 14:19:28 UTC (rev 281801)
@@ -59,10 +59,6 @@
     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);
 }
@@ -69,8 +65,6 @@
 
 NetworkSessionSoup::~NetworkSessionSoup()
 {
-    if (auto* storageSession = networkProcess().storageSession(m_sessionID))
-        storageSession->setCookieObserverHandler(nullptr);
 }
 
 SoupSession* NetworkSessionSoup::soupSession() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to