bugs 74049 (cookies permission file garbled) and 74489 (crash bringing up cookie viewer), r=valeski, sr=alecf

This commit is contained in:
morse%netscape.com 2001-04-04 02:39:39 +00:00
Родитель 64e229e8c2
Коммит a40c62d861
4 изменённых файлов: 36 добавлений и 20 удалений

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

@ -57,13 +57,17 @@ class nsCookieEnumerator : public nsISimpleEnumerator
char * path;
PRBool isSecure;
PRUint64 expires;
(void) COOKIE_Enumerate
nsresult rv = COOKIE_Enumerate
(mCookieCount++, &name, &value, &isDomain, &host, &path, &isSecure, &expires);
nsICookie *cookie =
new nsCookie(name, value, isDomain, host, path, isSecure, expires);
*result = cookie;
NS_ADDREF(*result);
return NS_OK;
if (NS_SUCCEEDED(rv)) {
nsICookie *cookie =
new nsCookie(name, value, isDomain, host, path, isSecure, expires);
*result = cookie;
NS_ADDREF(*result);
} else {
*result = nsnull;
}
return rv;
}
virtual ~nsCookieEnumerator()

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

@ -1149,10 +1149,15 @@ COOKIE_Write() {
return NS_OK;
}
strm.write("# HTTP Cookie File\n", 19);
strm.write("# http://www.netscape.com/newsref/std/cookie_spec.html\n", 55);
strm.write("# This is a generated file! Do not edit.\n", 42);
strm.write("# To delete cookies, use the Cookie Manager.\n\n", 46);
#define COOKIEFILE_LINE1 "# HTTP Cookie File\n"
#define COOKIEFILE_LINE2 "# http://www.netscape.com/newsref/std/cookie_spec.html\n"
#define COOKIEFILE_LINE3 "# This is a generated file! Do not edit.\n"
#define COOKIEFILE_LINE4 "# To delete cookies, use the Cookie Manager.\n\n"
strm.write(COOKIEFILE_LINE1, PL_strlen(COOKIEFILE_LINE1));
strm.write(COOKIEFILE_LINE2, PL_strlen(COOKIEFILE_LINE2));
strm.write(COOKIEFILE_LINE3, PL_strlen(COOKIEFILE_LINE3));
strm.write(COOKIEFILE_LINE4, PL_strlen(COOKIEFILE_LINE4));
/* format shall be:
*
@ -1389,10 +1394,15 @@ COOKIE_Count() {
if (!cookie_list) {
return 0;
}
/* Get rid of any expired cookies now so user doesn't
* think/see that we're keeping cookies in memory.
*/
cookie_RemoveExpiredCookies();
return cookie_list->Count();
}
PUBLIC void
PUBLIC nsresult
COOKIE_Enumerate
(PRInt32 count,
char **name,
@ -1402,11 +1412,8 @@ COOKIE_Enumerate
char ** path,
PRBool * isSecure,
PRUint64 * expires) {
if (count == 0) {
/* Get rid of any expired cookies now so user doesn't
* think/see that we're keeping cookies in memory.
*/
cookie_RemoveExpiredCookies();
if (count > COOKIE_Count()) {
return NS_ERROR_FAILURE;
}
cookie_CookieStruct *cookie;
cookie = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(count));
@ -1430,6 +1437,7 @@ COOKIE_Enumerate
}
// *expires = expiresTime; -- no good no mac, using next line instead
LL_UI2L(*expires, expiresTime);
return NS_OK;
}
PUBLIC void

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

@ -45,7 +45,7 @@ extern void COOKIE_RegisterPrefCallbacks(void);
extern void COOKIE_RemoveAll(void);
extern void COOKIE_DeletePersistentUserData(void);
extern PRInt32 COOKIE_Count();
extern void COOKIE_Enumerate
extern nsresult COOKIE_Enumerate
(PRInt32 count,
char **name,
char **value,

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

@ -377,9 +377,13 @@ Permission_Save() {
return;
}
strm.write("# HTTP Permission File\n", 30);
strm.write("# http://www.netscape.com/newsref/std/cookie_spec.html\n", 55);
strm.write("# This is a generated file! Do not edit.\n\n", 43);
#define PERMISSIONFILE_LINE1 "# HTTP Permission File\n"
#define PERMISSIONFILE_LINE2 "# http://www.netscape.com/newsref/std/cookie_spec.html\n"
#define PERMISSIONFILE_LINE3 "# This is a generated file! Do not edit.\n\n"
strm.write(PERMISSIONFILE_LINE1, PL_strlen(PERMISSIONFILE_LINE1));
strm.write(PERMISSIONFILE_LINE2, PL_strlen(PERMISSIONFILE_LINE2));
strm.write(PERMISSIONFILE_LINE3, PL_strlen(PERMISSIONFILE_LINE3));
/* format shall be:
* host \t permission \t permission ... \n