nsHTMLValue val(srcString);
nsImageDocument::CreateSyntheticDocument(){  // Synthesize an html document that refers to the image  nsresult rv;  nsCOMPtr<nsINodeInfo> nodeInfo;  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIHTMLContent> root;  rv = NS_NewHTMLHtmlElement(getter_AddRefs(root), nodeInfo);  if (NS_FAILED(rv)) {    return rv;  }  root->SetDocument(this, PR_FALSE, PR_TRUE);  SetRootContent(root);  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::body, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIHTMLContent> body;  rv = NS_NewHTMLBodyElement(getter_AddRefs(body), nodeInfo);  if (NS_FAILED(rv)) {    return rv;  }  body->SetDocument(this, PR_FALSE, PR_TRUE);  mBodyContent = do_QueryInterface(body);  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIHTMLContent> image;  rv = NS_NewHTMLImageElement(getter_AddRefs(image), nodeInfo);  if (NS_FAILED(rv)) {    return rv;  }  image->SetDocument(this, PR_FALSE, PR_TRUE);  mImageElement = do_QueryInterface(image);  nsCAutoString src;  mDocumentURL->GetSpec(src);  NS_ConvertUTF8toUCS2 srcString(src);  nsHTMLValue val(srcString);  image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE);  if (mStringBundle) {    const PRUnichar* formatString[1] = { srcString.get() };    nsXPIDLString errorMsg;    rv = mStringBundle->FormatStringFromName(NS_LITERAL_STRING("InvalidImage").get(),      formatString, 1, getter_Copies(errorMsg));    nsHTMLValue errorText(errorMsg);    image->SetHTMLAttribute(nsHTMLAtoms::alt, errorText, PR_FALSE);  }  root->AppendChildTo(body, PR_FALSE, PR_FALSE);  body->AppendChildTo(image, PR_FALSE, PR_FALSE);  return NS_OK;}