зеркало из https://github.com/mozilla/pjs.git
bug 585326 improve cookie logging
r=dwitte a=jst
This commit is contained in:
Родитель
555d738dd1
Коммит
e7fe043335
|
@ -223,10 +223,10 @@ static PRLogModuleInfo *sCookieLog = PR_NewLogModule("cookie");
|
|||
#define COOKIE_LOGFAILURE(a, b, c, d) LogFailure(a, b, c, d)
|
||||
#define COOKIE_LOGSUCCESS(a, b, c, d, e) LogSuccess(a, b, c, d, e)
|
||||
|
||||
#define COOKIE_LOGEVICTED(a) \
|
||||
#define COOKIE_LOGEVICTED(a, details) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (PR_LOG_TEST(sCookieLog, PR_LOG_DEBUG)) \
|
||||
LogEvicted(a); \
|
||||
LogEvicted(a, details); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define COOKIE_LOGSTRING(lvl, fmt) \
|
||||
|
@ -319,9 +319,10 @@ LogSuccess(PRBool aSetCookie, nsIURI *aHostURI, const char *aCookieString, nsCoo
|
|||
}
|
||||
|
||||
static void
|
||||
LogEvicted(nsCookie *aCookie)
|
||||
LogEvicted(nsCookie *aCookie, const char* details)
|
||||
{
|
||||
PR_LOG(sCookieLog, PR_LOG_DEBUG,("===== COOKIE EVICTED =====\n"));
|
||||
PR_LOG(sCookieLog, PR_LOG_DEBUG,("%s\n", details));
|
||||
|
||||
LogCookie(aCookie);
|
||||
|
||||
|
@ -2219,9 +2220,9 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain,
|
|||
// check if we have to delete an old cookie.
|
||||
nsEnumerationData data(currentTime, LL_MAXINT);
|
||||
if (CountCookiesFromHostInternal(aBaseDomain, data) >= mMaxCookiesPerHost) {
|
||||
// remove the oldest cookie from host
|
||||
// remove the oldest cookie from the domain
|
||||
oldCookie = data.iter.Cookie();
|
||||
COOKIE_LOGEVICTED(oldCookie);
|
||||
COOKIE_LOGEVICTED(oldCookie, "Too many cookies for this domain");
|
||||
RemoveCookieFromList(data.iter);
|
||||
|
||||
NotifyChanged(oldCookie, NS_LITERAL_STRING("deleted").get());
|
||||
|
@ -2945,7 +2946,7 @@ purgeCookiesCallback(nsCookieEntry *aEntry,
|
|||
// check if the cookie has expired
|
||||
if (cookie->Expiry() <= data.currentTime) {
|
||||
data.removedList->AppendElement(cookie, PR_FALSE);
|
||||
COOKIE_LOGEVICTED(cookie);
|
||||
COOKIE_LOGEVICTED(cookie, "Cookie expired");
|
||||
|
||||
// remove from list; do not increment our iterator
|
||||
gCookieService->RemoveCookieFromList(iter, array);
|
||||
|
@ -3022,7 +3023,7 @@ nsCookieService::PurgeCookies(PRInt64 aCurrentTimeInUsec)
|
|||
for (nsPurgeData::ArrayType::index_type i = purgeList.Length(); i--; ) {
|
||||
nsCookie *cookie = purgeList[i].Cookie();
|
||||
removedList->AppendElement(cookie, PR_FALSE);
|
||||
COOKIE_LOGEVICTED(cookie);
|
||||
COOKIE_LOGEVICTED(cookie, "Cookie expired or too old");
|
||||
|
||||
RemoveCookieFromList(purgeList[i], paramsArray);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче