From d5efc7046087920e8ca3cd59e4c7dfa865e36dc1 Mon Sep 17 00:00:00 2001 From: "morse%netscape.com" Date: Sat, 1 Jun 2002 01:11:34 +0000 Subject: [PATCH] bug 148213, flush cookies to disk after a remove-all-cookies, r=pinkerton, sr=beard --- extensions/cookie/nsCookieManager.cpp | 1 + extensions/cookie/nsCookies.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/cookie/nsCookieManager.cpp b/extensions/cookie/nsCookieManager.cpp index f8a1f541458..ea731e2740a 100644 --- a/extensions/cookie/nsCookieManager.cpp +++ b/extensions/cookie/nsCookieManager.cpp @@ -123,6 +123,7 @@ nsresult nsCookieManager::Init() NS_IMETHODIMP nsCookieManager::RemoveAll(void) { ::COOKIE_RemoveAll(); + ::COOKIE_Write(); return NS_OK; } diff --git a/extensions/cookie/nsCookies.cpp b/extensions/cookie/nsCookies.cpp index 7ccd2efb4dc..3c49cc252e8 100644 --- a/extensions/cookie/nsCookies.cpp +++ b/extensions/cookie/nsCookies.cpp @@ -1583,7 +1583,7 @@ COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPromp /* saves out the HTTP cookies to disk */ PUBLIC nsresult COOKIE_Write() { - if (!cookie_changed || !cookie_list) { + if (!cookie_changed) { return NS_OK; } cookie_CookieStruct * cookie_s; @@ -1619,7 +1619,7 @@ COOKIE_Write() { * expires is a time_t integer * cookie can have tabs */ - PRInt32 count = cookie_list->Count(); + PRInt32 count = cookie_list ? cookie_list->Count() : 0; for (PRInt32 i = 0; i < count; ++i) { cookie_s = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(i)); NS_ASSERTION(cookie_s, "corrupt cookie list");