From f39aadf915bbc9241ca523b0c20ee95d3bb15211 Mon Sep 17 00:00:00 2001 From: "law%netscape.com" Date: Thu, 18 Aug 2005 11:15:49 +0000 Subject: [PATCH] Bug 22174; add title to SH entries for file:/ftp: directory URLs; r=radha@netscape.com --- docshell/shistory/src/nsSHEntry.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index 4d24b331f7f..6d7e5b30398 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -22,6 +22,7 @@ // Local Includes #include "nsSHEntry.h" +#include "nsXPIDLString.h" //***************************************************************************** //*** nsSHEntry: Object Management @@ -98,6 +99,15 @@ NS_IMETHODIMP nsSHEntry::GetTitle(PRUnichar** aTitle) { NS_ENSURE_ARG_POINTER(aTitle); + // Check for empty title... + if ( mTitle.IsEmpty() && mURI ) { + // Default title is the URL. + nsXPIDLCString spec; + if ( NS_SUCCEEDED( mURI->GetSpec( getter_Copies( spec ) ) ) ) { + mTitle.AssignWithConversion( spec ); + } + } + *aTitle = mTitle.ToNewUnicode(); return NS_OK; }