const nsString* docTitle = doc->GetDocumentTitle(); if (docTitle && !docTitle->IsEmpty()) { *aTitle = ToNewUnicode(*docTitle); }  nsCOMPtr<nsIURI> url; doc->GetDocumentURL(getter_AddRefs(url)); if (url) { nsXPIDLCString urlCStr; url->GetSpec(getter_Copies(urlCStr)); if (urlCStr.get()) { *aURLStr = ToNewUnicode(urlCStr);
if (docTitleStrPS == nsnull) { const nsString* docTitle = doc->GetDocumentTitle(); if (docTitle && !docTitle->IsEmpty()) { *aTitle = ToNewUnicode(*docTitle);
DocumentViewerImpl::GetWebShellTitleAndURL(nsIWebShell * aWebShell,                                            PRUnichar**   aTitle,                                            PRUnichar**   aURLStr){  NS_ASSERTION(aWebShell, "Pointer is null!");  NS_ASSERTION(aTitle, "Pointer is null!");  NS_ASSERTION(aURLStr, "Pointer is null!");  *aTitle  = nsnull;  *aURLStr = nsnull;  nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aWebShell));  if (docShell) {    nsCOMPtr<nsIPresShell> presShell;    docShell->GetPresShell(getter_AddRefs(presShell));    if (presShell) {      nsCOMPtr<nsIDocument> doc;      presShell->GetDocument(getter_AddRefs(doc));      if (doc) {        const nsString* docTitle = doc->GetDocumentTitle();        if (docTitle && !docTitle->IsEmpty()) {          *aTitle = ToNewUnicode(*docTitle);        }        nsCOMPtr<nsIURI> url;        doc->GetDocumentURL(getter_AddRefs(url));        if (url) {          nsXPIDLCString urlCStr;          url->GetSpec(getter_Copies(urlCStr));          if (urlCStr.get()) {            *aURLStr = ToNewUnicode(urlCStr);          }        }      }    }  }}