[Webkit-unassigned] [Bug 79870] [BlackBerry]Array of Cookies in HTTP request header are not in order.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 29 12:32:57 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=79870


Joe Mason <jmason at rim.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmason at rim.com




--- Comment #3 from Joe Mason <jmason at rim.com>  2012-02-29 12:32:48 PST ---
The refactor of removeCookie doesn't do the right thing.  Without this patch it was:

ParsedCookie* CookieMap::removeCookie(const ParsedCookie* cookie)
{
    // Find a previous entry for deletion
    String key = cookie->name() + cookie->path();
    ParsedCookie* prevCookie = m_cookieMap.take(key);

    if (!prevCookie)
        return 0;

    if (prevCookie == m_oldestCookie)
        updateOldestCookie();
    else if (prevCookie != cookie) {
        // The cookie we used to search is force expired, we must do the same
        // to the cookie in memory too.
        if (cookie->isForceExpired())
            prevCookie->forceExpire();
        delete cookie;
    }

    if (!prevCookie->isSession())
        cookieManager().removedCookie();
    return prevCookie;
}

And it was called from two places.  The new removeCookieAtIndex only does the equivalent of m_cookieMap.take(key), and so when it's called from getAllCookies, all the other bookkeeping done by removeCookie is skipped.

removeCookieAtIndex should be:

ParsedCookie* CookieMap::removeCookieAtIndex(size_t position)
{
    ASSERT(0 <= position && position < m_cookieVector.size());
    ParsedCookie* prevCookie = m_cookieVector[position];
    m_cookieVector.remove(position);

    if (prevCookie == m_oldestCookie)
        updateOldestCookie();
    else if (prevCookie != cookie) {
        // The cookie we used to search is force expired, we must do the same
        // to the cookie in memory too.
        if (cookie->isForceExpired())
            prevCookie->forceExpire();
        delete cookie;
    }

    if (!prevCookie->isSession())
        cookieManager().removedCookie();
    return prevCookie;
}

And then removeCookie is just:

ParsedCookie* CookieMap::removeCookie(const ParsedCookie* cookie)
{
    size_t cookieCount = m_cookieVector.size();
    for (int position = 0; position < cookieCount; ++position) {
        if (m_cookieVector[position]->name() == cookie->name() && m_cookieVector[position]->path() == cookie->path())
            return removeCookieAtIndex(position);
    }
    return 0;
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list