bug 148213, flush cookies to disk after a remove-all-cookies, r=pinkerton, sr=beard

This commit is contained in:
morse%netscape.com 2002-06-01 01:11:34 +00:00
Родитель 5e6b930253
Коммит d5efc70460
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -123,6 +123,7 @@ nsresult nsCookieManager::Init()
NS_IMETHODIMP nsCookieManager::RemoveAll(void) { NS_IMETHODIMP nsCookieManager::RemoveAll(void) {
::COOKIE_RemoveAll(); ::COOKIE_RemoveAll();
::COOKIE_Write();
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -1583,7 +1583,7 @@ COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPromp
/* saves out the HTTP cookies to disk */ /* saves out the HTTP cookies to disk */
PUBLIC nsresult PUBLIC nsresult
COOKIE_Write() { COOKIE_Write() {
if (!cookie_changed || !cookie_list) { if (!cookie_changed) {
return NS_OK; return NS_OK;
} }
cookie_CookieStruct * cookie_s; cookie_CookieStruct * cookie_s;
@ -1619,7 +1619,7 @@ COOKIE_Write() {
* expires is a time_t integer * expires is a time_t integer
* cookie can have tabs * cookie can have tabs
*/ */
PRInt32 count = cookie_list->Count(); PRInt32 count = cookie_list ? cookie_list->Count() : 0;
for (PRInt32 i = 0; i < count; ++i) { for (PRInt32 i = 0; i < count; ++i) {
cookie_s = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(i)); cookie_s = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(i));
NS_ASSERTION(cookie_s, "corrupt cookie list"); NS_ASSERTION(cookie_s, "corrupt cookie list");