fixes bug 198270 "Trunk crash [@ COOKIE_Write] (nsCookies.cpp line 1734)"
patch=dwitte@stanford.edu r=mvl@exedo.nl sr=darin git-svn-id: svn://10.0.0.236/trunk@139822 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
cbd88e7b46
commit
3c409f7336
@ -1721,8 +1721,11 @@ COOKIE_Write() {
|
||||
dirSpec->AppendNative(NS_LITERAL_CSTRING(kCookiesFileName));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> strm;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(strm),
|
||||
dirSpec);
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(strm),
|
||||
dirSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define COOKIEFILE_LINE1 "# HTTP Cookie File\n"
|
||||
#define COOKIEFILE_LINE2 "# http://www.netscape.com/newsref/std/cookie_spec.html\n"
|
||||
@ -1803,24 +1806,25 @@ COOKIE_Read() {
|
||||
nsCAutoString buffer;
|
||||
PRBool added_to_list;
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
nsCOMPtr<nsIFile> dirSpec;
|
||||
nsresult rv = CKutil_ProfileDirectory(getter_AddRefs(dirSpec));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
dirSpec->AppendNative(NS_LITERAL_CSTRING(kCookiesFileName));
|
||||
|
||||
nsCOMPtr<nsIInputStream> strm;
|
||||
NS_NewLocalFileInputStream(getter_AddRefs(strm),
|
||||
dirSpec);
|
||||
|
||||
PRBool exists = PR_FALSE;;
|
||||
if (NS_FAILED(dirSpec->Exists(&exists)) || !exists) {
|
||||
/* file doesn't exist -- that's not an error */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> strm;
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(strm),
|
||||
dirSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* format is:
|
||||
*
|
||||
* host \t isDomain \t path \t secure \t expires \t name \t cookie
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user