rv = doc->GetDocumentCharacterSet(aCharset); return rv;
aCharset = doc->GetDocumentCharacterSet(); return NS_OK;
static nsresult GetDocumentCharacterSetForURI(const nsAString& aHref, nsACString& aCharset){  aCharset.Truncate();  nsresult rv;  nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv));  NS_ENSURE_SUCCESS(rv, rv);  JSContext *cx;  rv = stack->Peek(&cx);  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIScriptGlobalObject> nativeGlob;  nsJSUtils::GetDynamicScriptGlobal(cx, getter_AddRefs(nativeGlob));  NS_ENSURE_TRUE(nativeGlob, NS_ERROR_FAILURE);  nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(nativeGlob);  NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);  nsCOMPtr<nsIDOMDocument> domDoc;  rv = window->GetDocument(getter_AddRefs(domDoc));  NS_ENSURE_SUCCESS(rv, rv);  if (!domDoc)    return NS_OK;  nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));  NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);  rv = doc->GetDocumentCharacterSet(aCharset);  return rv;}