mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 608545 - Set cookie: unexpected "deleted" observer notification when cookie already exists. r=sdwilsh, a=b7+
This commit is contained in:
parent
8ce4f994ed
commit
2e9595d37a
@ -1314,7 +1314,7 @@ nsCookieService::NotifyRejected(nsIURI *aHostURI)
|
||||
// "added" means a cookie was added. aSubject is the added cookie.
|
||||
// "changed" means a cookie was altered. aSubject is the new cookie.
|
||||
// "cleared" means the entire cookie list was cleared. aSubject is null.
|
||||
// "batch-deleted" means multiple cookies were deleted. aSubject is the list of
|
||||
// "batch-deleted" means a set of cookies was purged. aSubject is the list of
|
||||
// cookies.
|
||||
void
|
||||
nsCookieService::NotifyChanged(nsISupports *aSubject,
|
||||
@ -2334,10 +2334,13 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain,
|
||||
|
||||
// Remove the stale cookie and notify.
|
||||
RemoveCookieFromList(matchIter);
|
||||
|
||||
COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, aCookieHeader,
|
||||
"stale cookie was deleted");
|
||||
NotifyChanged(oldCookie, NS_LITERAL_STRING("deleted").get());
|
||||
"stale cookie was purged");
|
||||
|
||||
nsCOMPtr<nsIMutableArray> removedList =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
removedList->AppendElement(oldCookie, PR_FALSE);
|
||||
NotifyChanged(removedList, NS_LITERAL_STRING("batch-deleted").get());
|
||||
|
||||
// We've done all we need to wrt removing and notifying the stale cookie.
|
||||
// From here on out, we pretend pretend it didn't exist, so that we
|
||||
@ -2352,16 +2355,15 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain,
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the old cookie and notify.
|
||||
// Remove the old cookie.
|
||||
RemoveCookieFromList(matchIter);
|
||||
|
||||
COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, aCookieHeader,
|
||||
"previously stored cookie was deleted");
|
||||
NotifyChanged(oldCookie, NS_LITERAL_STRING("deleted").get());
|
||||
|
||||
// If the new cookie has expired -- i.e. the intent was simply to delete
|
||||
// the old cookie -- then we're done.
|
||||
if (aCookie->Expiry() <= currentTime) {
|
||||
COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, aCookieHeader,
|
||||
"previously stored cookie was deleted");
|
||||
NotifyChanged(oldCookie, NS_LITERAL_STRING("deleted").get());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2382,12 +2384,16 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain,
|
||||
if (entry && entry->GetCookies().Length() >= mMaxCookiesPerHost) {
|
||||
nsListIter iter;
|
||||
FindStaleCookie(entry, currentTime, iter);
|
||||
oldCookie = iter.Cookie();
|
||||
|
||||
// remove the oldest cookie from the domain
|
||||
COOKIE_LOGEVICTED(iter.Cookie(), "Too many cookies for this domain");
|
||||
RemoveCookieFromList(iter);
|
||||
COOKIE_LOGEVICTED(oldCookie, "Too many cookies for this domain");
|
||||
|
||||
NotifyChanged(iter.Cookie(), NS_LITERAL_STRING("deleted").get());
|
||||
nsCOMPtr<nsIMutableArray> removedList =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
removedList->AppendElement(oldCookie, PR_FALSE);
|
||||
NotifyChanged(removedList, NS_LITERAL_STRING("batch-deleted").get());
|
||||
|
||||
} else if (mDBState->cookieCount >= ADD_TEN_PERCENT(mMaxNumberOfCookies)) {
|
||||
PRInt64 maxAge = aCurrentTimeInUsec - mDBState->cookieOldestTime;
|
||||
|
@ -66,9 +66,10 @@ interface nsIChannel;
|
||||
* the new cookie. (note that host, path, and name are invariant
|
||||
* for a given cookie; other parameters may change.)
|
||||
* "batch-deleted"
|
||||
* a batch of cookies was deleted (for instance, as part of a purging
|
||||
* operation). the subject is an nsIArray of nsICookie2's representing
|
||||
* the deleted cookies.
|
||||
* a set of cookies was purged (typically, because they have either
|
||||
* expired or because the cookie list has grown too large). The subject
|
||||
* is an nsIArray of nsICookie2's representing the deleted cookies.
|
||||
* Note that the array could contain a single cookie.
|
||||
* "cleared"
|
||||
* the entire cookie list was cleared. the subject is null.
|
||||
* "reload"
|
||||
|
Loading…
Reference in New Issue
Block a user