From 8693f977422dbcc44006f9c4a2ef4daf54d3fa4d Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Mon, 8 Oct 2001 20:08:30 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@104815 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 2 +- mozilla/docshell/base/nsWebShell.h | 2 +- mozilla/webshell/public/nsIWebShell.h | 2 +- mozilla/webshell/tests/viewer/nsBrowserWindow.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 2f35f8d1712..f51ff23e93f 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -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); diff --git a/mozilla/docshell/base/nsWebShell.h b/mozilla/docshell/base/nsWebShell.h index 61dbeead362..512963d9345 100644 --- a/mozilla/docshell/base/nsWebShell.h +++ b/mozilla/docshell/base/nsWebShell.h @@ -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); diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index b1e5d2c1a8f..fde40ab213b 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -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 diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index 9fc02b02abd..1485cd90629 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -819,8 +819,8 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID) PRInt32 theIndex; nsCOMPtr 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...