diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index a4b72712224c..e4bf61971699 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -17,6 +17,7 @@ * Netscape Communications Corporation. All Rights Reserved. */ #include "nsIPref.h" +#include "prmem.h" #ifdef XP_MAC #include "nsBrowserWindow.h" @@ -136,6 +137,7 @@ static NS_DEFINE_IID(kIDialogIID, NS_IDIALOG_IID); static NS_DEFINE_IID(kICheckButtonIID, NS_ICHECKBUTTON_IID); static NS_DEFINE_IID(kIRadioButtonIID, NS_IRADIOBUTTON_IID); static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID); +static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID); static const char* gsAOLFormat = "AOLMAIL"; @@ -1553,15 +1555,25 @@ nsBrowserWindow::OnStopBinding(nsIURL* aURL, NS_IMETHODIMP_(void) nsBrowserWindow::Alert(const nsString &aText) { - nsAutoString str(aText); - printf("Browser Window Alert: %s\n", str); + char* msg = nsnull; + + msg = aText.ToNewCString(); + if (nsnull != msg) { + printf("Browser Window Alert: %s\n", msg); + PR_Free(msg); + } } NS_IMETHODIMP_(PRBool) nsBrowserWindow::Confirm(const nsString &aText) { - nsAutoString str(aText); - printf("Browser Window Confirm: %s (returning false)\n", str); + char* msg= nsnull; + + msg = aText.ToNewCString(); + if (nsnull != msg) { + printf("Browser Window Confirm: %s (returning false)\n", msg); + PR_Free(msg); + } return PR_FALSE; } @@ -1571,12 +1583,18 @@ nsBrowserWindow::Prompt(const nsString &aText, const nsString &aDefault, nsString &aResult) { - nsAutoString str(aText); + char* msg = nsnull; char buf[256]; - printf("Browser Window: %s\n", str); - printf("Prompt: "); - scanf("%s", buf); - aResult = buf; + + msg = aText.ToNewCString(); + if (nsnull != msg) { + printf("Browser Window: %s\n", msg); + PR_Free(msg); + + printf("Prompt: "); + scanf("%s", buf); + aResult = buf; + } return (aResult.Length() > 0); } @@ -1586,16 +1604,22 @@ nsBrowserWindow::PromptUserAndPassword(const nsString &aText, nsString &aUser, nsString &aPassword) { - nsAutoString str(aText); + char* msg = nsnull; char buf[256]; - printf("Browser Window: %s\n", str); - printf("User: "); - scanf("%s", buf); - aUser = buf; - printf("Password: "); - scanf("%s", buf); - aPassword = buf; - + + msg = aText.ToNewCString(); + if (nsnull != msg) { + printf("Browser Window: %s\n", msg); + PR_Free(msg); + + printf("User: "); + scanf("%s", buf); + aUser = buf; + + printf("Password: "); + scanf("%s", buf); + aPassword = buf; + } return (aUser.Length() > 0); } @@ -1603,12 +1627,16 @@ NS_IMETHODIMP_(PRBool) nsBrowserWindow::PromptPassword(const nsString &aText, nsString &aPassword) { - nsAutoString str(aText); + char* msg = nsnull; char buf[256]; - printf("Browser Window: %s\n", str); - printf("Password: "); - scanf("%s", buf); - aPassword = buf; + + msg = aText.ToNewCString(); + if (nsnull != msg) { + printf("Browser Window: %s\n", msg); + printf("Password: "); + scanf("%s", buf); + aPassword = buf; + } return PR_TRUE; } diff --git a/xpfe/xpviewer/src/nsBrowserWindow.cpp b/xpfe/xpviewer/src/nsBrowserWindow.cpp index ac5adbae3113..52ddc7020d60 100644 --- a/xpfe/xpviewer/src/nsBrowserWindow.cpp +++ b/xpfe/xpviewer/src/nsBrowserWindow.cpp @@ -23,6 +23,8 @@ #define NS_IMPL_IDS #include "nsBrowserWindow.h" #endif +#include "prmem.h" + #include "nsIStreamListener.h" #include "nsIAppShell.h" #include "nsIWidget.h" @@ -172,6 +174,7 @@ static NS_DEFINE_IID(kIToolbarItemIID, NS_ITOOLBARITEM_IID); static NS_DEFINE_IID(kIPopUpMenuIID, NS_IPOPUPMENU_IID); static NS_DEFINE_IID(kIMenuButtonIID, NS_IMENUBUTTON_IID); static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID); +static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID); static const char* gsAOLFormat = "AOLMAIL"; static const char* gsHTMLFormat = "text/html"; @@ -2485,16 +2488,22 @@ nsBrowserWindow::OnStopBinding(nsIURL* aURL, NS_IMETHODIMP_(void) nsBrowserWindow::Alert(const nsString &aText) { - nsAutoString str(aText); + char *str; + + str = aText.ToNewCString(); printf("Browser Window Alert: %s\n", str); + PR_Free(str); } //---------------------------------------- NS_IMETHODIMP_(PRBool) nsBrowserWindow::Confirm(const nsString &aText) { - nsAutoString str(aText); + char *str; + + str = aText.ToNewCString(); printf("Browser Window Confirm: %s (returning false)\n", str); + PR_Free(str); return PR_FALSE; } @@ -2505,9 +2514,13 @@ nsBrowserWindow::Prompt(const nsString &aText, const nsString &aDefault, nsString &aResult) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("Prompt: "); scanf("%s", buf); aResult = buf; @@ -2521,9 +2534,13 @@ nsBrowserWindow::PromptUserAndPassword(const nsString &aText, nsString &aUser, nsString &aPassword) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("User: "); scanf("%s", buf); aUser = buf; @@ -2539,9 +2556,13 @@ NS_IMETHODIMP_(PRBool) nsBrowserWindow::PromptPassword(const nsString &aText, nsString &aPassword) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("Password: "); scanf("%s", buf); aPassword = buf; diff --git a/xpfe/xpviewer/src/nsXPBaseWindow.cpp b/xpfe/xpviewer/src/nsXPBaseWindow.cpp index 20e903487b0f..52a54db7dfc8 100644 --- a/xpfe/xpviewer/src/nsXPBaseWindow.cpp +++ b/xpfe/xpviewer/src/nsXPBaseWindow.cpp @@ -17,6 +17,7 @@ * Netscape Communications Corporation. All Rights Reserved. */ #include "nsIPref.h" +#include "prmem.h" #ifdef XP_MAC #include "nsXPBaseWindow.h" @@ -77,6 +78,8 @@ static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID); static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID); static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID); +static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID); + //---------------------------------------------------------------------- nsXPBaseWindow::nsXPBaseWindow() : mContentRoot(nsnull), @@ -638,15 +641,21 @@ NS_IMETHODIMP nsXPBaseWindow::OnStopBinding(nsIURL* aURL, PRInt32 status, const //---------------------------------------- NS_IMETHODIMP_(void) nsXPBaseWindow::Alert(const nsString &aText) { - nsAutoString str(aText); + char *str; + + str = aText.ToNewCString(); printf("Browser Window Alert: %s\n", str); + PR_Free(str); } //---------------------------------------- NS_IMETHODIMP_(PRBool) nsXPBaseWindow::Confirm(const nsString &aText) { - nsAutoString str(aText); + char *str; + + str = aText.ToNewCString(); printf("Browser Window Confirm: %s (returning false)\n", str); + PR_Free(str); return PR_FALSE; } @@ -656,9 +665,13 @@ NS_IMETHODIMP_(PRBool) nsXPBaseWindow::Prompt(const nsString &aText, const nsString &aDefault, nsString &aResult) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("Prompt: "); scanf("%s", buf); aResult = buf; @@ -671,9 +684,13 @@ NS_IMETHODIMP_(PRBool) nsXPBaseWindow::PromptUserAndPassword(const nsString &aTe nsString &aUser, nsString &aPassword) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("User: "); scanf("%s", buf); aUser = buf; @@ -688,9 +705,13 @@ NS_IMETHODIMP_(PRBool) nsXPBaseWindow::PromptUserAndPassword(const nsString &aTe NS_IMETHODIMP_(PRBool) nsXPBaseWindow::PromptPassword(const nsString &aText, nsString &aPassword) { - nsAutoString str(aText); + char *str; char buf[256]; + + str = aText.ToNewCString(); printf("Browser Window: %s\n", str); + PR_Free(str); + printf("Password: "); scanf("%s", buf); aPassword = buf;