rv = ccm->GetUnicodeDecoder(aDocCharset.get(), getter_AddRefs(decoder));
rv = ccm->GetUnicodeDecoder(PromiseFlatCString(aDocCharset).get(), getter_AddRefs(decoder));
CharsetConvRef(const nsCString& aDocCharset, const nsCString& aRefInDocCharset,               nsString& aRefInUnicode){  nsresult rv;  nsCOMPtr <nsIAtom> docCharsetAtom;  nsCOMPtr<nsICharsetConverterManager> ccm =    do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);  if (NS_FAILED(rv)) {    return rv;  }  nsCOMPtr<nsIUnicodeDecoder> decoder;  rv = ccm->GetUnicodeDecoder(aDocCharset.get(), getter_AddRefs(decoder));  if (NS_FAILED(rv)) {    return rv;  }  PRInt32 srcLen = aRefInDocCharset.Length();  PRInt32 dstLen;  rv = decoder->GetMaxLength(aRefInDocCharset.get(), srcLen, &dstLen);  if (NS_FAILED(rv)) {    return rv;  }  PRUnichar *ustr = (PRUnichar *)nsMemory::Alloc((dstLen + 1) *                                                 sizeof(PRUnichar));  if (!ustr) {    return NS_ERROR_OUT_OF_MEMORY;  }  rv = decoder->Convert(aRefInDocCharset.get(), &srcLen, ustr, &dstLen);  if (NS_SUCCEEDED(rv)) {    ustr[dstLen] = 0;    aRefInUnicode.Assign(ustr, dstLen);  }  nsMemory::Free(ustr);  return rv;}