if (NS_FAILED(rv) || !firstHost) { return PR_FALSE; }
cookie_isForeign (char * curURL, char * firstURL, nsIIOService* ioService) {  if (!firstURL) {    return PR_FALSE;  }  char *curHost = nsnull;  char *firstHost = nsnull;  PRUint32 start,end;  nsresult rv;  NS_ASSERTION(ioService, "IOService not available");  // Get hosts  rv = ioService->ExtractUrlPart(curURL, nsIIOService::url_Host |                                 nsIIOService::url_Port, &start, &end,                                  &curHost);  rv = ioService->ExtractUrlPart(firstURL, nsIIOService::url_Host |                                 nsIIOService::url_Port, &start, &end,                                  &firstHost);  char * curHostColon = 0;  char * firstHostColon = 0;  /* strip ports */  curHostColon = PL_strchr(curHost, ':');  if(curHostColon) {    *curHostColon = '\0';  }  firstHostColon = PL_strchr(firstHost, ':');  if(firstHostColon) {    *firstHostColon = '\0';  }  /* determine if it's foreign */  PRBool retval = (!cookie_SameDomain(curHost, firstHost));  /* clean up our garbage and return */  if(curHostColon) {    *curHostColon = ':';  }  if(firstHostColon) {    *firstHostColon = ':';  }  PR_FREEIF(curHost);  PR_FREEIF(firstHost);  return retval;}