Title: [143204] trunk/Source/WebCore
Revision
143204
Author
ch.du...@sisa.samsung.com
Date
2013-02-18 05:29:35 -0800 (Mon, 18 Feb 2013)

Log Message

[Soup] CookieJarSoup::deleteCookie() should stop looking for the cookie after it is removed
https://bugs.webkit.org/show_bug.cgi?id=110100

Reviewed by Kenneth Rohde Christiansen.

CookieJarSoup::deleteCookie() retrieves the list of cookies that apply to a given URL, then
iterates through the cookies to find the one with the right name and delete it. However, the
current implementation keeps on comparing cookie names after the cookie was removed. This
patch introduces a "wasDeleted" boolean to stop comparing cookie names after the cookie was
deleted. Note that we cannot break as soon as the cookie is found as we need to keep iterating
so that the cookies get freed by GOwnPtr.

No new tests, no behavior change.

* platform/network/soup/CookieJarSoup.cpp:
(WebCore::deleteCookie):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143203 => 143204)


--- trunk/Source/WebCore/ChangeLog	2013-02-18 13:26:44 UTC (rev 143203)
+++ trunk/Source/WebCore/ChangeLog	2013-02-18 13:29:35 UTC (rev 143204)
@@ -1,3 +1,22 @@
+2013-02-18  Christophe Dumez  <ch.du...@sisa.samsung.com>
+
+        [Soup] CookieJarSoup::deleteCookie() should stop looking for the cookie after it is removed
+        https://bugs.webkit.org/show_bug.cgi?id=110100
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        CookieJarSoup::deleteCookie() retrieves the list of cookies that apply to a given URL, then
+        iterates through the cookies to find the one with the right name and delete it. However, the
+        current implementation keeps on comparing cookie names after the cookie was removed. This
+        patch introduces a "wasDeleted" boolean to stop comparing cookie names after the cookie was
+        deleted. Note that we cannot break as soon as the cookie is found as we need to keep iterating
+        so that the cookies get freed by GOwnPtr.
+
+        No new tests, no behavior change.
+
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::deleteCookie):
+
 2013-02-18  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Create separate project for each domain for UISourceCode based on browser resources.

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


--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2013-02-18 13:26:44 UTC (rev 143203)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2013-02-18 13:29:35 UTC (rev 143204)
@@ -169,10 +169,13 @@
         return;
 
     CString cookieName = name.utf8();
+    bool wasDeleted = false;
     for (GSList* iter = cookies.get(); iter; iter = g_slist_next(iter)) {
         GOwnPtr<SoupCookie> cookie(static_cast<SoupCookie*>(iter->data));
-        if (cookieName == cookie->name)
+        if (!wasDeleted && cookieName == cookie->name) {
             soup_cookie_jar_delete_cookie(jar, cookie.get());
+            wasDeleted = true;
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to