Fix removes const keyword from the out param of nsIWebShell::GetURL and fixes a memory leak in viewer when it calls this method. b=102413 r=jaggernaut@netscape.com sr=rpotts@netscape.com

This commit is contained in:
locka%iol.ie 2001-10-08 20:08:30 +00:00
parent c29d058fec
commit fdfe0b65f7
4 changed files with 5 additions and 5 deletions

View File

@ -506,7 +506,7 @@ nsWebShell::GetHistoryIndex(PRInt32& aResult)
}
NS_IMETHODIMP
nsWebShell::GetURL(PRInt32 aIndex, const PRUnichar** aURLResult)
nsWebShell::GetURL(PRInt32 aIndex, PRUnichar** aURLResult)
{
NS_ENSURE_STATE(mSessionHistory);
NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);

View File

@ -83,7 +83,7 @@ public:
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryLength(PRInt32& aResult);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, const PRUnichar** aURLResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
// nsIWebShellContainer
NS_IMETHOD SetHistoryState(nsISupports* aLayoutHistoryState);

View File

@ -131,7 +131,7 @@ public:
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
NS_IMETHOD GetHistoryLength(PRInt32& aResult) = 0;
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, const PRUnichar **aURLResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar **aURLResult) = 0;
// SetToolBar
// SetMenuBar

View File

@ -819,8 +819,8 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
PRInt32 theIndex;
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
webShell->GetHistoryIndex(theIndex);
const PRUnichar* theURL;
webShell->GetURL(theIndex,&theURL);
nsXPIDLString theURL;
webShell->GetURL(theIndex, getter_Copies(theURL));
nsAutoString theString(theURL);
mApp->ViewSource(theString);
//XXX Find out how the string is allocated, and perhaps delete it...