} else { nsCOMPtr<nsIBaseWindow> parentWin(do_QueryInterface(parent)); parentWin->SetTitle(aTitle); NS_RELEASE(parent);
NS_IMETHODIMP nsWebShell::SetTitle(const PRUnichar* aTitle){  // Record local title  mTitle = aTitle;  // Title's set on the top level web-shell are passed ont to the container  nsIWebShell* parent;  GetParent(parent);  if (nsnull == parent) {    nsIBrowserWindow *browserWindow = GetBrowserWindow();    if (nsnull != browserWindow) {      browserWindow->SetTitle(aTitle);      NS_RELEASE(browserWindow);      // Oh this hack sucks. But there isn't any other way that I can      // reliably get the title text. Sorry.      do {        nsresult rv;        NS_WITH_SERVICE(nsIGlobalHistory, history, "component://netscape/browser/global-history", &rv);        if (NS_FAILED(rv)) break;        rv = history->SetPageTitle(nsCAutoString(mURL), aTitle);        if (NS_FAILED(rv)) break;      } while (0);    }  } else {    nsCOMPtr<nsIBaseWindow> parentWin(do_QueryInterface(parent));    parentWin->SetTitle(aTitle);    NS_RELEASE(parent);  }  return NS_OK;}