Title: [101474] trunk/Source/WebCore
Revision
101474
Author
commit-qu...@webkit.org
Date
2011-11-30 03:07:50 -0800 (Wed, 30 Nov 2011)

Log Message

[SOUP][WK2] Implement the functions to manager cookies in CookieJar for WebKit2
https://bugs.webkit.org/show_bug.cgi?id=72353

r79722 inserted the functions to manange cookies from web process.
(getHostnamesWithCookies,deleteCookiesForHostname,deleteAllCookies)
Implement the functions for soup network backend.

Patch by Jongseok Yang <js45.y...@samsung.com> on 2011-11-30
Reviewed by Martin Robinson.

* platform/network/soup/CookieJarSoup.cpp:
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostname):
(WebCore::deleteAllCookies):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101473 => 101474)


--- trunk/Source/WebCore/ChangeLog	2011-11-30 11:06:29 UTC (rev 101473)
+++ trunk/Source/WebCore/ChangeLog	2011-11-30 11:07:50 UTC (rev 101474)
@@ -1,3 +1,19 @@
+2011-11-30  Jongseok Yang  <js45.y...@samsung.com>
+
+        [SOUP][WK2] Implement the functions to manager cookies in CookieJar for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=72353
+
+        r79722 inserted the functions to manange cookies from web process.
+        (getHostnamesWithCookies,deleteCookiesForHostname,deleteAllCookies)
+        Implement the functions for soup network backend.
+
+        Reviewed by Martin Robinson.
+
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::getHostnamesWithCookies):
+        (WebCore::deleteCookiesForHostname):
+        (WebCore::deleteAllCookies):
+
 2011-11-30  Daniel Sievers  <siev...@chromium.org>
 
         [Chromium] Avoid ASSERT_NOT_REACHED() from creating FBO with content texture of size 0

Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (101473 => 101474)


--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2011-11-30 11:06:29 UTC (rev 101473)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2011-11-30 11:07:50 UTC (rev 101474)
@@ -124,17 +124,40 @@
 
 void getHostnamesWithCookies(HashSet<String>& hostnames)
 {
-    // FIXME: Not yet implemented
+    SoupCookieJar* cookieJar = WebCore::defaultCookieJar();
+    GSList* cookies = soup_cookie_jar_all_cookies(cookieJar);
+    for (GSList* item = cookies; item; item = item->next) {
+        SoupCookie* soupCookie = static_cast<SoupCookie*>(item->data);
+        if (char* domain = const_cast<char*>(soup_cookie_get_domain(soupCookie)))
+            hostnames.add(String::fromUTF8(domain));
+    }
+
+    soup_cookies_free(cookies);
 }
 
 void deleteCookiesForHostname(const String& hostname)
 {
-    // FIXME: Not yet implemented
+    CString hostNameString = hostname.utf8();
+
+    SoupCookieJar* cookieJar = WebCore::defaultCookieJar();
+    GSList* cookies = soup_cookie_jar_all_cookies(cookieJar);
+    for (GSList* item = cookies; item; item = item->next) {
+        SoupCookie* soupCookie = static_cast<SoupCookie*>(item->data);
+        if (hostNameString == soup_cookie_get_domain(soupCookie))
+            soup_cookie_jar_delete_cookie(cookieJar, soupCookie);
+    }
+
+    soup_cookies_free(cookies);
 }
 
 void deleteAllCookies()
 {
-    // FIXME: Not yet implemented
+    SoupCookieJar* cookieJar = WebCore::defaultCookieJar();
+    GSList* cookies = soup_cookie_jar_all_cookies(cookieJar);
+    for (GSList* item = cookies; item; item = item->next)
+        soup_cookie_jar_delete_cookie(cookieJar, static_cast<SoupCookie*>(item->data));
+
+    soup_cookies_free(cookies);
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to