зеркало из https://github.com/mozilla/pjs.git
Remove #ifndef NECKO around the alert and replace nsINetSupport with nsIPrompt
This commit is contained in:
Родитель
34446224ea
Коммит
95e413cf5a
|
@ -174,12 +174,9 @@ static NS_DEFINE_IID(kIUrlDispatcherIID, NS_IURLDISPATCHER_IID);
|
||||||
#ifdef DEBUG_rods
|
#ifdef DEBUG_rods
|
||||||
#define DEBUG_MENUSDEL 1
|
#define DEBUG_MENUSDEL 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef NECKO
|
#include "nsICommonDialogs.h"
|
||||||
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
|
static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID );
|
||||||
#include "nsINetSupportDialogService.h"
|
static NS_DEFINE_IID( kIPromptIID, NS_IPROMPT_IID );
|
||||||
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsIWebShell.h"
|
#include "nsIWebShell.h"
|
||||||
|
|
||||||
const char * kThrobberOnStr = "resource:/res/throbber/anims07.gif";
|
const char * kThrobberOnStr = "resource:/res/throbber/anims07.gif";
|
||||||
|
@ -304,13 +301,12 @@ nsWebShellWindow::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
NS_ADDREF_THIS();
|
NS_ADDREF_THIS();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#ifndef NECKO
|
if (aIID.Equals(kIPromptIID )) {
|
||||||
if (aIID.Equals(kINetSupportIID )) {
|
*aInstancePtr = (void*)(nsIPrompt*)this;
|
||||||
*aInstancePtr = (void*)(nsINetSupport*)this;
|
|
||||||
NS_ADDREF_THIS();
|
NS_ADDREF_THIS();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (aIID.Equals(kISupportsIID)) {
|
if (aIID.Equals(kISupportsIID)) {
|
||||||
*aInstancePtr = (void*)(nsISupports*)(nsIWebShellContainer*)this;
|
*aInstancePtr = (void*)(nsISupports*)(nsIWebShellContainer*)this;
|
||||||
NS_ADDREF_THIS();
|
NS_ADDREF_THIS();
|
||||||
|
@ -2783,69 +2779,127 @@ nsWebShellWindow::IsIntrinsicallySized(PRBool& aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// nsINetSupport
|
// nsIPrompt
|
||||||
#ifdef NECKO
|
NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar *text)
|
||||||
#else
|
|
||||||
void nsWebShellWindow::Alert(const nsString &aText)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
|
nsIWebShell* tempWebShell;
|
||||||
if ( dialog )
|
GetWebShell(tempWebShell );
|
||||||
dialog->Alert( aText );
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
}
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
|
{
|
||||||
PRBool nsWebShellWindow::Confirm(const nsString &aText)
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
{
|
return rv;
|
||||||
nsresult rv;
|
}
|
||||||
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
|
|
||||||
PRInt32 result = 0;
|
|
||||||
|
|
||||||
if ( dialog )
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
dialog->Confirm( aText,&result );
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
return result ? PR_TRUE : PR_FALSE;
|
rv = dialog->Alert( domWindow, text );
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsWebShellWindow::Prompt(const nsString &aText,
|
NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar *text, PRBool *_retval)
|
||||||
const nsString &aDefault,
|
|
||||||
nsString &aResult)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
PRInt32 result = 0;
|
nsIWebShell* tempWebShell;
|
||||||
if ( dialog )
|
GetWebShell(tempWebShell );
|
||||||
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
{
|
{
|
||||||
dialog->Prompt( aText, aDefault, aResult,&result );
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
}
|
return rv;
|
||||||
return result ? PR_TRUE : PR_FALSE;
|
}
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
|
rv = dialog->Confirm( domWindow, text, _retval );
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsWebShellWindow::PromptUserAndPassword(
|
NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||||
const nsString &aText, nsString &aUser, nsString &aPassword)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
PRInt32 result = 0;
|
nsIWebShell* tempWebShell;
|
||||||
if ( dialog )
|
GetWebShell(tempWebShell );
|
||||||
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
{
|
{
|
||||||
dialog->PromptUserAndPassword( aText, aUser, aPassword, &result );
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
return result ? PR_TRUE : PR_FALSE;
|
|
||||||
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
|
rv =dialog->ConfirmCheck( domWindow, text, checkMsg, checkValue, _retval );
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsWebShellWindow::PromptPassword(const nsString &aText,
|
NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
|
||||||
nsString &aPassword)
|
{
|
||||||
{
|
nsresult rv;
|
||||||
nsresult rv;
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
|
nsIWebShell* tempWebShell;
|
||||||
PRInt32 result = 0;
|
GetWebShell(tempWebShell );
|
||||||
if ( dialog )
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
{
|
{
|
||||||
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
dialog->PromptPassword( aText, aPassword, &result );
|
return rv;
|
||||||
|
}
|
||||||
}
|
|
||||||
return result ? PR_TRUE : PR_FALSE;
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
}
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
#endif
|
rv = dialog->Prompt( domWindow, text, defaultText, result, _retval );
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
|
nsIWebShell* tempWebShell;
|
||||||
|
GetWebShell(tempWebShell );
|
||||||
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
|
{
|
||||||
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
|
rv = dialog->PromptUsernameAndPassword( domWindow, text, user, pwd, _retval );
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar *text, PRUnichar **pwd, PRBool *_retval)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
|
nsIWebShell* tempWebShell;
|
||||||
|
GetWebShell(tempWebShell );
|
||||||
|
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||||
|
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||||
|
{
|
||||||
|
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||||
|
if ( NS_SUCCEEDED( rv ) )
|
||||||
|
rv = dialog->PromptPassword( domWindow, text, pwd, _retval );
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsWebShellWindow::ConfirmYN(const PRUnichar *text, PRBool *_retval)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsWebShellWindow::ConfirmCheckYN(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
|
@ -30,9 +30,9 @@
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsIMenu.h"
|
#include "nsIMenu.h"
|
||||||
#include "nsIUrlDispatcher.h"
|
#include "nsIUrlDispatcher.h"
|
||||||
#ifndef NECKO
|
|
||||||
#include "nsINetSupport.h"
|
#include "nsIPrompt.h"
|
||||||
#endif
|
|
||||||
// can't use forward class decl's because of template bugs on Solaris
|
// can't use forward class decl's because of template bugs on Solaris
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
|
@ -62,10 +62,9 @@ class nsWebShellWindow : public nsIWebShellWindow,
|
||||||
public nsIDocumentLoaderObserver,
|
public nsIDocumentLoaderObserver,
|
||||||
public nsIDocumentObserver,
|
public nsIDocumentObserver,
|
||||||
public nsIUrlDispatcher
|
public nsIUrlDispatcher
|
||||||
#ifdef NECKO
|
|
||||||
#else
|
, public nsIPrompt
|
||||||
, public nsINetSupport
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsWebShellWindow();
|
nsWebShellWindow();
|
||||||
|
@ -255,19 +254,16 @@ public:
|
||||||
|
|
||||||
NS_DECL_IURLDISPATCHER
|
NS_DECL_IURLDISPATCHER
|
||||||
// nsINetSupport
|
// nsINetSupport
|
||||||
#if NECKO
|
|
||||||
#else
|
|
||||||
NS_IMETHOD_(void) Alert(const nsString &aText);
|
NS_IMETHOD Alert(const PRUnichar *text);
|
||||||
NS_IMETHOD_(PRBool) Confirm(const nsString &aText);
|
NS_IMETHOD Confirm(const PRUnichar *text, PRBool *_retval);
|
||||||
NS_IMETHOD_(PRBool) Prompt(const nsString &aText,
|
NS_IMETHOD ConfirmCheck(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval);
|
||||||
const nsString &aDefault,
|
NS_IMETHOD Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval);
|
||||||
nsString &aResult);
|
NS_IMETHOD PromptUsernameAndPassword(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval);
|
||||||
NS_IMETHOD_(PRBool) PromptUserAndPassword(const nsString &aText,
|
NS_IMETHOD PromptPassword(const PRUnichar *text, PRUnichar **pwd, PRBool *_retval);
|
||||||
nsString &aUser,
|
NS_IMETHOD ConfirmYN(const PRUnichar *text, PRBool *_retval);
|
||||||
nsString &aPassword);
|
NS_IMETHOD ConfirmCheckYN(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval);
|
||||||
NS_IMETHOD_(PRBool) PromptPassword(const nsString &aText,
|
|
||||||
nsString &aPassword);
|
|
||||||
#endif
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
PRInt32 GetDocHeight(nsIDocument * aDoc);
|
PRInt32 GetDocHeight(nsIDocument * aDoc);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче