Checking error status on no url spec and returning error properly. r=morse@netscape.com

git-svn-id: svn://10.0.0.236/trunk@55474 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dp%netscape.com 1999-12-06 23:29:41 +00:00
parent cc1f31cb8e
commit 5b4c24a5a0

View File

@ -32,6 +32,7 @@
#include "nsCookie.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsXPIDLString.h"
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -118,17 +119,17 @@ nsresult nsCookieService::Init() {
NS_IMETHODIMP
nsCookieService::GetCookieString(nsIURI *aURL, nsString& aCookie) {
char *spec = NULL;
nsresult result = aURL->GetSpec(&spec);
NS_ASSERTION(result == NS_OK, "deal with this");
char *cookie = COOKIE_GetCookie((char *)spec);
nsXPIDLCString spec;
nsresult rv = aURL->GetSpec(getter_Copies(spec));
if (NS_FAILED(rv)) return rv;
char *cookie = COOKIE_GetCookie((char *)(const char *)spec);
if (nsnull != cookie) {
aCookie.SetString(cookie);
nsCRT::free(cookie);
} else {
// No Cookie isn't an error condition.
aCookie.SetString("");
}
nsCRT::free(spec);
return NS_OK;
}