char* resultStr; char* specStr = ToNewUTF8String(spec); if (!specStr) { return NS_ERROR_OUT_OF_MEMORY; } nsresult rv = NS_MakeAbsoluteURI(&resultStr, specStr, baseURI, ioService); nsMemory::Free(specStr); if (NS_FAILED(rv)) return rv;  result.Assign(NS_ConvertUTF8toUCS2(resultStr));  nsMemory::Free(resultStr); return rv;
NS_ASSERTION(baseURI, "It doesn't make sense to not supply a base URI");  if (spec == nsnull) return baseURI->GetSpec(result);  return baseURI->Resolve(spec, result);
NS_MakeAbsoluteURI(nsAWritableString& result,                   const nsAReadableString& spec,                    nsIURI* baseURI = nsnull,                   nsIIOService* ioService = nsnull)     // pass in nsIIOService to optimize callers{    char* resultStr;    char* specStr = ToNewUTF8String(spec);    if (!specStr) {        return NS_ERROR_OUT_OF_MEMORY;    }    nsresult rv = NS_MakeAbsoluteURI(&resultStr, specStr, baseURI, ioService);    nsMemory::Free(specStr);    if (NS_FAILED(rv)) return rv;    result.Assign(NS_ConvertUTF8toUCS2(resultStr));       nsMemory::Free(resultStr);    return rv;}