Changeset 143204 in webkit


Ignore:
Timestamp:
Feb 18, 2013 5:29:35 AM (11 years ago)
Author:
Christophe Dumez
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143202 r143204  
     12013-02-18  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        [Soup] CookieJarSoup::deleteCookie() should stop looking for the cookie after it is removed
     4        https://bugs.webkit.org/show_bug.cgi?id=110100
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        CookieJarSoup::deleteCookie() retrieves the list of cookies that apply to a given URL, then
     9        iterates through the cookies to find the one with the right name and delete it. However, the
     10        current implementation keeps on comparing cookie names after the cookie was removed. This
     11        patch introduces a "wasDeleted" boolean to stop comparing cookie names after the cookie was
     12        deleted. Note that we cannot break as soon as the cookie is found as we need to keep iterating
     13        so that the cookies get freed by GOwnPtr.
     14
     15        No new tests, no behavior change.
     16
     17        * platform/network/soup/CookieJarSoup.cpp:
     18        (WebCore::deleteCookie):
     19
    1202013-02-18  Vsevolod Vlasov  <vsevik@chromium.org>
    221
  • trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp

    r143009 r143204  
    170170
    171171    CString cookieName = name.utf8();
     172    bool wasDeleted = false;
    172173    for (GSList* iter = cookies.get(); iter; iter = g_slist_next(iter)) {
    173174        GOwnPtr<SoupCookie> cookie(static_cast<SoupCookie*>(iter->data));
    174         if (cookieName == cookie->name)
     175        if (!wasDeleted && cookieName == cookie->name) {
    175176            soup_cookie_jar_delete_cookie(jar, cookie.get());
     177            wasDeleted = true;
     178        }
    176179    }
    177180}
Note: See TracChangeset for help on using the changeset viewer.