text->SetText(mTitle, PR_TRUE);
text->SetText(title, PR_TRUE);
HTMLContentSink::SetDocumentTitle(const nsAString& aTitle){  MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::SetDocumentTitle()\n"));  MOZ_TIMER_START(mWatch);  NS_ASSERTION(mCurrentContext == mHeadContext, "title not in head");  if (!mTitle.IsVoid()) {    // If the title was already set then don't try to overwrite it    // when a new title is encountered - For backwards compatiblity    //*mTitle = aValue;    MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetDocumentTitle()\n"));    MOZ_TIMER_STOP(mWatch);    return NS_OK;  }  mTitle.Assign(aTitle);  mTitle.CompressWhitespace(PR_TRUE, PR_TRUE);  nsCOMPtr<nsIDOMHTMLDocument> domDoc(do_QueryInterface(mHTMLDocument));  if (domDoc) {    domDoc->SetTitle(mTitle);  }  nsCOMPtr<nsINodeInfo> nodeInfo;  nsresult rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull,                                              kNameSpaceID_None,                                              getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIHTMLContent> it = NS_NewHTMLTitleElement(nodeInfo);  if (!it) {    return NS_ERROR_OUT_OF_MEMORY;  }  nsCOMPtr<nsITextContent> text;  rv = NS_NewTextNode(getter_AddRefs(text));  NS_ENSURE_SUCCESS(rv, rv);  text->SetText(mTitle, PR_TRUE);  it->AppendChildTo(text, PR_FALSE, PR_FALSE);  text->SetDocument(mDocument, PR_FALSE, PR_TRUE);  mHead->AppendChildTo(it, PR_FALSE, PR_FALSE);  MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetDocumentTitle()\n"));  MOZ_TIMER_STOP(mWatch);  return NS_OK;}