зеркало из https://github.com/mozilla/gecko-dev.git
Changes to unify nsINetPrompt with nsIPrompt, making single sign-on work. Single sign-on API changes. Fixes bugs 34583, 34720, 34725, 24746, 33094. r=sspitzer,morse
This commit is contained in:
Родитель
44d6a93dee
Коммит
618d468469
|
@ -1045,7 +1045,7 @@ NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI)
|
|||
dnsMsg.AppendWithConversion(' ');
|
||||
dnsMsg.Append(messageStr);
|
||||
|
||||
prompter->Alert(dnsMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, dnsMsg.GetUnicode());
|
||||
} // end unknown protocol
|
||||
|
||||
if(!uri)
|
||||
|
|
|
@ -1046,7 +1046,7 @@ nsWebShell::OnOverLink(nsIContent* aContent,
|
|||
NS_IMETHODIMP
|
||||
nsWebShell::GetLinkState(const nsString& aLinkURI, nsLinkState& aState)
|
||||
{
|
||||
aState = eLinkState_Unvisited;
|
||||
aState = eLinkState_Unvisited;
|
||||
|
||||
if(mGlobalHistory)
|
||||
{
|
||||
|
@ -1276,7 +1276,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendWithConversion(' ');
|
||||
errorMsg.Append(messageStr);
|
||||
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
}
|
||||
else if(aStatus == NS_ERROR_CONNECTION_REFUSED)
|
||||
{// Doc failed to load because we couldn't connect to the server.
|
||||
|
@ -1304,7 +1304,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendInt(port);
|
||||
}
|
||||
errorMsg.AppendWithConversion('.');
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
}
|
||||
else if(aStatus == NS_ERROR_NET_TIMEOUT)
|
||||
{// Doc failed to load because the socket function timed out.
|
||||
|
@ -1326,7 +1326,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendWithConversion(host);
|
||||
errorMsg.AppendWithConversion('.');
|
||||
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
} // end NS_ERROR_NET_TIMEOUT
|
||||
} // end mDocLoader == loader
|
||||
|
||||
|
|
|
@ -1166,7 +1166,7 @@ NS_IMETHODIMP GlobalWindowImpl::Alert(JSContext* cx, jsval* argv, PRUint32 argc)
|
|||
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(prompter, NS_ERROR_FAILURE);
|
||||
|
||||
return prompter->Alert(str.GetUnicode());
|
||||
return prompter->Alert(nsnull, str.GetUnicode());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GlobalWindowImpl::Confirm(JSContext* cx, jsval* argv,
|
||||
|
@ -1185,7 +1185,7 @@ NS_IMETHODIMP GlobalWindowImpl::Confirm(JSContext* cx, jsval* argv,
|
|||
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(prompter, NS_ERROR_FAILURE);
|
||||
|
||||
return prompter->Confirm(str.GetUnicode(), aReturn);
|
||||
return prompter->Confirm(nsnull, str.GetUnicode(), aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GlobalWindowImpl::Prompt(JSContext* cx, jsval* argv,
|
||||
|
@ -1213,7 +1213,8 @@ NS_IMETHODIMP GlobalWindowImpl::Prompt(JSContext* cx, jsval* argv,
|
|||
|
||||
PRBool b;
|
||||
PRUnichar* uniResult = nsnull;
|
||||
ret = prompter->Prompt(str.GetUnicode(), initial.GetUnicode(), &uniResult, &b);
|
||||
ret = prompter->Prompt(nsnull, str.GetUnicode(), nsnull,
|
||||
initial.GetUnicode(), &uniResult, &b);
|
||||
aReturn = uniResult;
|
||||
if(uniResult)
|
||||
nsAllocator::Free(uniResult);
|
||||
|
|
|
@ -84,48 +84,53 @@ NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & uuid, void * *res
|
|||
// nsIPrompt
|
||||
|
||||
/* void alert (in wstring text); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::Alert(const PRUnichar *text)
|
||||
NS_IMETHODIMP CWebBrowserContainer::Alert(const PRUnichar* dialogTitle, const PRUnichar *text)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
m_pOwner->MessageBox(W2T(text), _T("Alert"), MB_OK | MB_ICONEXCLAMATION);
|
||||
m_pOwner->MessageBox(W2T(text), W2T(dialogTitle), MB_OK | MB_ICONEXCLAMATION);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* boolean confirm (in wstring text); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::Confirm(const PRUnichar *text, PRBool *_retval)
|
||||
NS_IMETHODIMP CWebBrowserContainer::Confirm(const PRUnichar* dialogTitle, const PRUnichar *text, PRBool *_retval)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
int nAnswer = m_pOwner->MessageBox(W2T(text), _T("Confirm"), MB_YESNO | MB_ICONQUESTION);
|
||||
int nAnswer = m_pOwner->MessageBox(W2T(text), W2T(dialogTitle), MB_YESNO | MB_ICONQUESTION);
|
||||
*_retval = (nAnswer == IDYES) ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* boolean confirmCheck (in wstring text, in wstring checkMsg, out boolean checkValue); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::ConfirmCheck(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||
NS_IMETHODIMP CWebBrowserContainer::ConfirmCheck(const PRUnichar* dialogTitle, const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
// TODO show dialog with check box
|
||||
|
||||
int nAnswer = m_pOwner->MessageBox(W2T(text), _T("Confirm"), MB_YESNO | MB_ICONQUESTION);
|
||||
int nAnswer = m_pOwner->MessageBox(W2T(text), W2T(dialogTitle), MB_YESNO | MB_ICONQUESTION);
|
||||
*_retval = (nAnswer == IDYES) ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* boolean prompt (in wstring text, in wstring defaultText, out wstring result); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
|
||||
NS_IMETHODIMP CWebBrowserContainer::Prompt(const PRUnichar* dialogTitle, const PRUnichar *text, const PRUnichar* passwordRealm,
|
||||
const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean promptUsernameAndPassword (in wstring text, out wstring user, out wstring pwd); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::PromptUsernameAndPassword(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP CWebBrowserContainer::PromptUsernameAndPassword(const PRUnichar* dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar* passwordRealm, PRBool persistPassword,
|
||||
PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean promptPassword (in wstring text, in wstring title, out wstring pwd); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::PromptPassword(const PRUnichar *text, const PRUnichar *title, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP CWebBrowserContainer::PromptPassword(const PRUnichar* dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar* passwordRealm, PRBool persistPassword,
|
||||
PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,8 @@ char * PromptUserCallback(void *arg, char *prompt, int isPasswd)
|
|||
NS_WITH_PROXIED_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, NS_UI_THREAD_EVENTQ, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = dialog->PromptPassword(NS_ConvertASCIItoUCS2(prompt).GetUnicode(), NS_ConvertASCIItoUCS2(" ").GetUnicode(), &password, &value);
|
||||
rv = dialog->PromptPassword(nsnull, NS_ConvertASCIItoUCS2(prompt).GetUnicode(),
|
||||
NS_ConvertASCIItoUCS2(" ").GetUnicode(), PR_TRUE, &password, &value);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsString a(password);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURL.idl"
|
||||
#include "nsIPrompt.idl"
|
||||
|
||||
%{ C++
|
||||
|
@ -32,11 +31,12 @@
|
|||
#define NS_WALLETSERVICE_CID \
|
||||
{ 0x738cfd52, 0xabcf, 0x11d2, { 0xab, 0x4b, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96 } }
|
||||
|
||||
#define NS_WALLETSERVICE_PROGID "component://netscape/wallet"
|
||||
#define NS_WALLETSERVICE_PROGID "component://netscape/wallet/wallet-service"
|
||||
#define NS_WALLETSERVICE_CLASSNAME "Auto Form Fill and Wallet"
|
||||
%}
|
||||
|
||||
interface nsIPresShell;
|
||||
|
||||
native nsAutoString(nsAutoString);
|
||||
[ref] native nsAutoStringRef(nsAutoString);
|
||||
|
||||
|
@ -57,13 +57,10 @@ interface nsIWalletService : nsISupports {
|
|||
void WALLET_FetchFromNetCenter();
|
||||
void WALLET_ExpirePassword();
|
||||
|
||||
boolean PromptUsernameAndPasswordURL(in wstring text, out wstring user, out wstring pwd, in string urlname, in boolean stripUrl, in nsIPrompt dialog);
|
||||
boolean PromptPasswordURL(in wstring text, out wstring pwd, in string urlname, in boolean stripUrl, in nsIPrompt dialog);
|
||||
boolean PromptURL(in wstring text, in wstring defaultText, out wstring result, in string urlname, in boolean stripUrl, in nsIPrompt dialog);
|
||||
void SI_RemoveUser(in string URLName, in boolean stripUrl, in wstring userName);
|
||||
void SI_StorePassword(in string URLName, in boolean stripUrl, in wstring userName, in wstring pwd);
|
||||
void SI_RemoveUser(in string key, in wstring userName);
|
||||
void SI_StorePassword(in string key, in wstring userName, in wstring pwd);
|
||||
|
||||
boolean haveData(in string url, in wstring userName, in boolean stripUrl);
|
||||
boolean haveData(in string key, in wstring userName);
|
||||
|
||||
[noscript] void WALLET_GetNopreviewListForViewer(in nsAutoStringRef aNopreviewList);
|
||||
[noscript] void WALLET_GetNocaptureListForViewer(in nsAutoStringRef aNocaptureList);
|
||||
|
@ -75,3 +72,45 @@ interface nsIWalletService : nsISupports {
|
|||
string WALLET_Encrypt(in wstring text);
|
||||
wstring WALLET_Decrypt(in string crypt);
|
||||
};
|
||||
|
||||
[scriptable, uuid(6228d644-17fe-11d4-8cee-0060b0fc14a3)]
|
||||
interface nsISingleSignOnPrompt : nsIPrompt
|
||||
{
|
||||
void init(in nsIPrompt dialogs);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_SINGLESIGNONPROMPT_CID \
|
||||
{ /* 64997e60-17fe-11d4-8cee-0060b0fc14a3 */ \
|
||||
0x64997e60, \
|
||||
0x17fe, \
|
||||
0x11d4, \
|
||||
{0x8c, 0xee, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
#define NS_SINGLESIGNONPROMPT_CLASSNAME "Single Sign-On Prompt"
|
||||
#define NS_SINGLESIGNONPROMPT_PROGID "component://netscape/wallet/single-sign-on-prompt"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
inline nsresult
|
||||
NS_NewSingleSignOnPrompt(nsIPrompt* *result, nsIPrompt* dialogs)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISingleSignOnPrompt> prompt;
|
||||
static NS_DEFINE_CID(kSingleSignOnPromptCID, NS_SINGLESIGNONPROMPT_CID);
|
||||
rv = nsComponentManager::CreateInstance(kSingleSignOnPromptCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsISingleSignOnPrompt),
|
||||
getter_AddRefs(prompt));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = prompt->Init(dialogs);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
*result = prompt;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
@ -34,6 +34,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWalletlibService)
|
|||
static nsModuleComponentInfo components[] = {
|
||||
{ NS_WALLETSERVICE_CLASSNAME, NS_WALLETSERVICE_CID,
|
||||
NS_WALLETSERVICE_PROGID, nsWalletlibServiceConstructor },
|
||||
{ NS_SINGLESIGNONPROMPT_CLASSNAME, NS_SINGLESIGNONPROMPT_CID,
|
||||
NS_SINGLESIGNONPROMPT_PROGID, nsSingleSignOnPrompt::Create }
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsWalletModule", components)
|
||||
|
|
|
@ -109,33 +109,13 @@ NS_IMETHODIMP nsWalletlibService::WALLET_ExpirePassword(){
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::PromptUsernameAndPasswordURL
|
||||
(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *returnValue) {
|
||||
return ::SINGSIGN_PromptUsernameAndPassword
|
||||
(text, user, pwd, urlname, dialog, returnValue, stripUrl);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::PromptPasswordURL
|
||||
(const PRUnichar *text, PRUnichar **pwd, const char *urlname, PRBool stripUrl,
|
||||
nsIPrompt* dialog, PRBool *returnValue) {
|
||||
return ::SINGSIGN_PromptPassword(text, pwd, urlname, dialog, returnValue, stripUrl);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::PromptURL
|
||||
(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
|
||||
const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *returnValue) {
|
||||
return ::SINGSIGN_Prompt
|
||||
(text, defaultText, resultText, urlname, dialog, returnValue, stripUrl);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_RemoveUser(const char *URLName, PRBool stripUrl, const PRUnichar *userName) {
|
||||
::SINGSIGN_RemoveUser(URLName, userName, stripUrl);
|
||||
NS_IMETHODIMP nsWalletlibService::SI_RemoveUser(const char *key, const PRUnichar *userName) {
|
||||
::SINGSIGN_RemoveUser(key, userName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_StorePassword(const char *URLName, PRBool stripUrl, const PRUnichar *userName, const PRUnichar *password) {
|
||||
::SINGSIGN_StorePassword(URLName, userName, password, stripUrl);
|
||||
NS_IMETHODIMP nsWalletlibService::SI_StorePassword(const char *key, const PRUnichar *userName, const PRUnichar *password) {
|
||||
::SINGSIGN_StorePassword(key, userName, password);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -397,9 +377,9 @@ nsWalletlibService::GetPassword(PRUnichar **password)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval)
|
||||
nsWalletlibService::HaveData(const char *key, const PRUnichar *userName, PRBool *_retval)
|
||||
{
|
||||
return ::SINGSIGN_HaveData(url, userName, stripUrl, _retval);
|
||||
return ::SINGSIGN_HaveData(key, userName, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -419,3 +399,113 @@ nsWalletlibService::WALLET_Decrypt (const char *crypt, PRUnichar **text) {
|
|||
*text = textAutoString.ToNewUnicode();
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsSingleSignOnPrompt
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSingleSignOnPrompt, nsISingleSignOnPrompt, nsIPrompt)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
|
||||
{
|
||||
return mPrompt->Alert(dialogTitle, text);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::Confirm(const PRUnichar *dialogTitle, const PRUnichar *text, PRBool *_retval)
|
||||
{
|
||||
return mPrompt->Confirm(dialogTitle, text, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::ConfirmCheck(const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||
{
|
||||
return mPrompt->ConfirmCheck(dialogTitle, text, checkMsg, checkValue, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm, const PRUnichar *defaultText,
|
||||
PRUnichar **result, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString realm;
|
||||
realm.AssignWithConversion(passwordRealm); // XXX should be PRUnichar*
|
||||
rv = SINGSIGN_Prompt(dialogTitle, text, defaultText, result, realm.GetBuffer(), mPrompt, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm, PRBool persistPassword,
|
||||
PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString realm;
|
||||
realm.AssignWithConversion(passwordRealm); // XXX should be PRUnichar*
|
||||
rv = SINGSIGN_PromptUsernameAndPassword(dialogTitle, text, user, pwd,
|
||||
realm.GetBuffer(), mPrompt, _retval, persistPassword);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text, const PRUnichar *passwordRealm,
|
||||
PRBool persistPassword, PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString realm;
|
||||
realm.AssignWithConversion(passwordRealm); // XXX should be PRUnichar*
|
||||
rv = SINGSIGN_PromptPassword(dialogTitle, text, pwd,
|
||||
realm.GetBuffer(), mPrompt, _retval, persistPassword);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::Select(const PRUnichar *dialogTitle, const PRUnichar *text, PRUint32 count,
|
||||
const PRUnichar **selectList, PRInt32 *outSelection, PRBool *_retval)
|
||||
{
|
||||
return mPrompt->Select(dialogTitle, text, count, selectList, outSelection, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::UniversalDialog(const PRUnichar *titleMessage, const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text, const PRUnichar *checkboxMsg, const PRUnichar *button0Text,
|
||||
const PRUnichar *button1Text, const PRUnichar *button2Text,
|
||||
const PRUnichar *button3Text, const PRUnichar *editfield1Msg,
|
||||
const PRUnichar *editfield2Msg, PRUnichar **editfield1Value,
|
||||
PRUnichar **editfield2Value, const PRUnichar *iconURL,
|
||||
PRBool *checkboxState, PRInt32 numberButtons, PRInt32 numberEditfields,
|
||||
PRInt32 editField1Password, PRInt32 *buttonPressed)
|
||||
{
|
||||
return mPrompt->UniversalDialog(titleMessage, dialogTitle, text, checkboxMsg, button0Text, button1Text,
|
||||
button2Text, button3Text, editfield1Msg, editfield2Msg, editfield1Value,
|
||||
editfield2Value, iconURL, checkboxState, numberButtons, numberEditfields,
|
||||
editField1Password, buttonPressed);
|
||||
}
|
||||
|
||||
// nsISingleSignOnPrompt methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingleSignOnPrompt::Init(nsIPrompt* dialogs)
|
||||
{
|
||||
mPrompt = dialogs;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSingleSignOnPrompt::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsSingleSignOnPrompt* prompt = new nsSingleSignOnPrompt();
|
||||
if (prompt == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(prompt);
|
||||
nsresult rv = prompt->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(prompt);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsIDocumentLoaderObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIPasswordSink.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
|
@ -41,54 +42,17 @@ class nsWalletlibService : public nsIWalletService,
|
|||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWALLETSERVICE
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIDOCUMENTLOADEROBSERVER
|
||||
NS_DECL_NSIPASSWORDSINK
|
||||
// NS_DECL_NSSUPPORTSWEAKREFERENCE
|
||||
|
||||
nsWalletlibService();
|
||||
|
||||
/* Implementation of the nsIWalletService interface */
|
||||
|
||||
NS_IMETHOD WALLET_PreEdit(nsAutoString& walletList);
|
||||
NS_IMETHOD WALLET_PostEdit(nsAutoString walletList);
|
||||
NS_IMETHOD WALLET_ChangePassword();
|
||||
NS_IMETHOD WALLET_ReencryptAll();
|
||||
NS_IMETHOD WALLET_RequestToCapture(nsIPresShell* shell);
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, PRBool quick);
|
||||
NS_IMETHOD WALLET_PrefillReturn(nsAutoString results);
|
||||
NS_IMETHOD WALLET_FetchFromNetCenter();
|
||||
NS_IMETHOD WALLET_ExpirePassword();
|
||||
|
||||
NS_IMETHOD PromptUsernameAndPasswordURL
|
||||
(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *_retval);
|
||||
NS_IMETHOD PromptPasswordURL
|
||||
(const PRUnichar *text, PRUnichar **pwd, const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *_retval);
|
||||
NS_IMETHOD PromptURL
|
||||
(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result,
|
||||
const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *_retval);
|
||||
|
||||
NS_IMETHOD SI_RemoveUser(const char *URLName, PRBool stripUrl, const PRUnichar *userName);
|
||||
NS_IMETHOD SI_StorePassword(const char *URLName, PRBool stripUrl, const PRUnichar *userName, const PRUnichar *password);
|
||||
|
||||
NS_IMETHOD HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval);
|
||||
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsAutoString& aNopreviewList);
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsAutoString& aNocaptureList);
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsAutoString& aPrefillList);
|
||||
NS_IMETHOD SI_GetSignonListForViewer(nsAutoString& aSignonList);
|
||||
NS_IMETHOD SI_GetRejectListForViewer(nsAutoString& aRejectList);
|
||||
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results);
|
||||
|
||||
NS_IMETHOD WALLET_Encrypt (const PRUnichar *text, char **crypt);
|
||||
NS_IMETHOD WALLET_Decrypt (const char *crypt, PRUnichar **text);
|
||||
|
||||
// nsIObserver
|
||||
NS_DECL_NSIOBSERVER
|
||||
// NS_DECL_NSIFORMSUBMITOBSERVER
|
||||
NS_IMETHOD Notify(nsIContent* formNode, nsIDOMWindow* window, nsIURI* actionURL);
|
||||
|
||||
// nsIDocumentLoaderObserver
|
||||
NS_DECL_NSIDOCUMENTLOADEROBSERVER
|
||||
|
||||
// nsIPasswordSink
|
||||
NS_DECL_NSIPASSWORDSINK
|
||||
|
||||
protected:
|
||||
virtual ~nsWalletlibService();
|
||||
|
||||
|
@ -96,5 +60,25 @@ private:
|
|||
void Init();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsSingleSignOnPrompt : public nsISingleSignOnPrompt
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROMPT
|
||||
NS_DECL_NSISINGLESIGNONPROMPT
|
||||
|
||||
nsSingleSignOnPrompt() { NS_INIT_REFCNT(); }
|
||||
virtual ~nsSingleSignOnPrompt() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIPrompt> mPrompt;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsWalletService_h___ */
|
||||
|
|
|
@ -559,24 +559,24 @@ Local_SACopy(char **destination, const char *source) {
|
|||
const char* empty = "empty";
|
||||
|
||||
PRIVATE char*
|
||||
si_StrippedURL (const char* URLName) {
|
||||
si_StrippedURL (const char* passwordRealm) {
|
||||
char *result = 0;
|
||||
char *s, *t;
|
||||
|
||||
/* check for null URLName */
|
||||
if (URLName == NULL || PL_strlen(URLName) == 0) {
|
||||
/* check for null passwordRealm */
|
||||
if (passwordRealm == NULL || PL_strlen(passwordRealm) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove protocol */
|
||||
s = (char*) PL_strchr(URLName +1, '/');
|
||||
s = (char*) PL_strchr(passwordRealm +1, '/');
|
||||
if (s && *s == '/' && *(s+1) == '/') {
|
||||
s += 2;
|
||||
}
|
||||
if (s) {
|
||||
StrAllocCopy(result, s);
|
||||
} else {
|
||||
StrAllocCopy(result, URLName);
|
||||
StrAllocCopy(result, passwordRealm);
|
||||
}
|
||||
|
||||
/* remove everything after hostname */
|
||||
|
@ -709,8 +709,8 @@ public:
|
|||
|
||||
class si_SignonURLStruct {
|
||||
public:
|
||||
si_SignonURLStruct() : URLName(NULL), chosen_user(NULL), signonUser_list(NULL) {}
|
||||
char * URLName;
|
||||
si_SignonURLStruct() : passwordRealm(NULL), chosen_user(NULL), signonUser_list(NULL) {}
|
||||
char * passwordRealm;
|
||||
si_SignonUserStruct* chosen_user; /* this is a state variable */
|
||||
nsVoidArray * signonUser_list;
|
||||
};
|
||||
|
@ -718,8 +718,8 @@ public:
|
|||
|
||||
class si_Reject {
|
||||
public:
|
||||
si_Reject() : URLName(NULL) {}
|
||||
char * URLName;
|
||||
si_Reject() : passwordRealm(NULL) {}
|
||||
char * passwordRealm;
|
||||
nsAutoString userName;
|
||||
};
|
||||
|
||||
|
@ -734,14 +734,14 @@ public:
|
|||
//} si_SignonUserStruct;
|
||||
|
||||
//typedef struct _SignonURLStruct {
|
||||
// char * URLName;
|
||||
// char * passwordRealm;
|
||||
// si_SignonUserStruct* chosen_user; /* this is a state variable */
|
||||
// nsVoidArray * signonUser_list;
|
||||
//} si_SignonURLStruct;
|
||||
|
||||
|
||||
//typedef struct _RejectStruct {
|
||||
// char * URLName;
|
||||
// char * passwordRealm;
|
||||
// nsAutoString userName;
|
||||
//} si_Reject;
|
||||
|
||||
|
@ -756,29 +756,30 @@ PRIVATE PRBool si_signon_list_changed = PR_FALSE;
|
|||
* This routine is called only when holding the signon lock!!!
|
||||
*/
|
||||
PRIVATE si_SignonURLStruct *
|
||||
si_GetURL(const char * URLName) {
|
||||
si_GetURL(const char * passwordRealm) {
|
||||
si_SignonURLStruct * url;
|
||||
char *strippedURLName = 0;
|
||||
if (!URLName) {
|
||||
/* no URLName specified, return first URL (returns NULL if not URLs) */
|
||||
char *strippedRealm = 0;
|
||||
if (!passwordRealm) {
|
||||
/* no passwordRealm specified, return first URL (returns NULL if not URLs) */
|
||||
if (LIST_COUNT(si_signon_list)==0) {
|
||||
return NULL;
|
||||
}
|
||||
return (si_SignonURLStruct *) (si_signon_list->ElementAt(0));
|
||||
}
|
||||
strippedURLName = si_StrippedURL(URLName);
|
||||
strippedRealm = si_StrippedURL(passwordRealm);
|
||||
PRInt32 urlCount = LIST_COUNT(si_signon_list);
|
||||
for (PRInt32 i=0; i<urlCount; i++) {
|
||||
url = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(i));
|
||||
if(url->URLName && !PL_strcmp(strippedURLName, url->URLName)) {
|
||||
PR_Free(strippedURLName);
|
||||
if(url->passwordRealm && !PL_strcmp(strippedRealm, url->passwordRealm)) {
|
||||
PR_Free(strippedRealm);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
PR_Free(strippedURLName);
|
||||
PR_Free(strippedRealm);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static nsresult MangleUrl(const char *url, char **result)
|
||||
{
|
||||
if (!url || !result) return NS_ERROR_FAILURE;
|
||||
|
@ -799,11 +800,11 @@ static nsresult MangleUrl(const char *url, char **result)
|
|||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove a user node from a given URL node */
|
||||
PRIVATE PRBool
|
||||
si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool strip) {
|
||||
nsresult res;
|
||||
si_RemoveUser(const char *passwordRealm, nsAutoString userName, PRBool save) {
|
||||
si_SignonURLStruct * url;
|
||||
si_SignonUserStruct * user;
|
||||
si_SignonDataStruct * data;
|
||||
|
@ -813,13 +814,15 @@ si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool st
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* convert URLName to a uri so we can parse out the username and hostname */
|
||||
#if 0
|
||||
nsresult res;
|
||||
/* convert passwordRealm to a uri so we can parse out the username and hostname */
|
||||
nsXPIDLCString host;
|
||||
if (strip) {
|
||||
if (URLName) {
|
||||
if (passwordRealm) {
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(URLName);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
/* uri is of the form <scheme>://<username>:<password>@<host>:<portnumber>/<pathname>) */
|
||||
|
@ -847,14 +850,15 @@ si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool st
|
|||
}
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(URLName, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
si_lock_signon_list();
|
||||
|
||||
/* get URL corresponding to host */
|
||||
url = si_GetURL((const char *)host);
|
||||
url = si_GetURL(passwordRealm);
|
||||
if (!url) {
|
||||
/* URL not found */
|
||||
si_unlock_signon_list();
|
||||
|
@ -894,7 +898,7 @@ si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool st
|
|||
|
||||
/* remove this URL if it contains no more users */
|
||||
if (LIST_COUNT(url->signonUser_list) == 0) {
|
||||
PR_Free(url->URLName);
|
||||
PR_Free(url->passwordRealm);
|
||||
si_signon_list->RemoveElement(url);
|
||||
}
|
||||
|
||||
|
@ -909,14 +913,14 @@ si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool st
|
|||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
SINGSIGN_RemoveUser(const char *URLName, const PRUnichar *userName, PRBool strip) {
|
||||
return si_RemoveUser(URLName, nsAutoString(userName), PR_TRUE, strip);
|
||||
SINGSIGN_RemoveUser(const char *passwordRealm, const PRUnichar *userName) {
|
||||
return si_RemoveUser(passwordRealm, nsAutoString(userName), PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* Determine if a specified url/user exists */
|
||||
PRIVATE PRBool
|
||||
si_CheckForUser(char *URLName, nsAutoString userName) {
|
||||
si_CheckForUser(char *passwordRealm, nsAutoString userName) {
|
||||
si_SignonURLStruct * url;
|
||||
si_SignonUserStruct * user;
|
||||
si_SignonDataStruct * data;
|
||||
|
@ -928,8 +932,8 @@ si_CheckForUser(char *URLName, nsAutoString userName) {
|
|||
|
||||
si_lock_signon_list();
|
||||
|
||||
/* get URL corresponding to URLName */
|
||||
url = si_GetURL(URLName);
|
||||
/* get URL corresponding to passwordRealm */
|
||||
url = si_GetURL(passwordRealm);
|
||||
if (!url) {
|
||||
/* URL not found */
|
||||
si_unlock_signon_list();
|
||||
|
@ -961,13 +965,13 @@ si_CheckForUser(char *URLName, nsAutoString userName) {
|
|||
* This routine is called only if signon pref is enabled!!!
|
||||
*/
|
||||
PRIVATE si_SignonUserStruct*
|
||||
si_GetUser(const char* URLName, PRBool pickFirstUser, nsAutoString userText) {
|
||||
si_GetUser(const char* passwordRealm, PRBool pickFirstUser, nsAutoString userText) {
|
||||
si_SignonURLStruct* url;
|
||||
si_SignonUserStruct* user = nsnull;
|
||||
si_SignonDataStruct* data;
|
||||
|
||||
/* get to node for this URL */
|
||||
url = si_GetURL(URLName);
|
||||
url = si_GetURL(passwordRealm);
|
||||
if (url != NULL) {
|
||||
|
||||
/* node for this URL was found */
|
||||
|
@ -1068,7 +1072,7 @@ si_GetUser(const char* URLName, PRBool pickFirstUser, nsAutoString userText) {
|
|||
*/
|
||||
|
||||
#ifdef junk
|
||||
NET_RemoveURLFromCache(NET_CreateURLStruct((char *)URLName, NET_DONT_RELOAD));
|
||||
NET_RemoveURLFromCache(NET_CreateURLStruct((char *)passwordRealm, NET_DONT_RELOAD));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -1086,13 +1090,13 @@ si_GetUser(const char* URLName, PRBool pickFirstUser, nsAutoString userText) {
|
|||
* This routine is called only if signon pref is enabled!!!
|
||||
*/
|
||||
PRIVATE si_SignonUserStruct*
|
||||
si_GetSpecificUser(const char* URLName, nsAutoString userName, nsAutoString userText) {
|
||||
si_GetSpecificUser(const char* passwordRealm, nsAutoString userName, nsAutoString userText) {
|
||||
si_SignonURLStruct* url;
|
||||
si_SignonUserStruct* user;
|
||||
si_SignonDataStruct* data;
|
||||
|
||||
/* get to node for this URL */
|
||||
url = si_GetURL(URLName);
|
||||
url = si_GetURL(passwordRealm);
|
||||
if (url != NULL) {
|
||||
|
||||
/* step through set of user nodes for this URL looking for specified username */
|
||||
|
@ -1118,7 +1122,7 @@ si_GetSpecificUser(const char* URLName, nsAutoString userName, nsAutoString user
|
|||
*/
|
||||
|
||||
#ifdef junk
|
||||
NET_RemoveURLFromCache(NET_CreateURLStruct((char *)URLName, NET_DONT_RELOAD));
|
||||
NET_RemoveURLFromCache(NET_CreateURLStruct((char *)passwordRealm, NET_DONT_RELOAD));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -1186,7 +1190,7 @@ si_GetURLAndUserForChangeForm(nsAutoString password)
|
|||
|
||||
nsAutoString userName;
|
||||
if (NS_SUCCEEDED(si_Decrypt (data->value, userName))) {
|
||||
nsAutoString temp; temp.AssignWithConversion(url->URLName);
|
||||
nsAutoString temp; temp.AssignWithConversion(url->passwordRealm);
|
||||
temp.AppendWithConversion(":");
|
||||
temp.Append(userName);
|
||||
|
||||
|
@ -1242,7 +1246,7 @@ PUBLIC void
|
|||
SI_RemoveAllSignonData() {
|
||||
if (si_PartiallyLoaded) {
|
||||
/* repeatedly remove first user node of first URL node */
|
||||
while (si_RemoveUser(NULL, nsAutoString(), PR_FALSE, PR_TRUE)) {
|
||||
while (si_RemoveUser(NULL, nsAutoString(), PR_FALSE)) {
|
||||
}
|
||||
}
|
||||
si_PartiallyLoaded = PR_FALSE;
|
||||
|
@ -1273,12 +1277,12 @@ si_FreeReject(si_Reject * reject) {
|
|||
return;
|
||||
}
|
||||
si_reject_list->RemoveElement(reject);
|
||||
PR_FREEIF(reject->URLName);
|
||||
PR_FREEIF(reject->passwordRealm);
|
||||
PR_Free(reject);
|
||||
}
|
||||
|
||||
PRIVATE PRBool
|
||||
si_CheckForReject(char * URLName, nsAutoString userName) {
|
||||
si_CheckForReject(char * passwordRealm, nsAutoString userName) {
|
||||
si_Reject * reject;
|
||||
|
||||
si_lock_signon_list();
|
||||
|
@ -1286,9 +1290,9 @@ si_CheckForReject(char * URLName, nsAutoString userName) {
|
|||
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
||||
for (PRInt32 i=0; i<rejectCount; i++) {
|
||||
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
||||
if(!PL_strcmp(URLName, reject->URLName)) {
|
||||
if(!PL_strcmp(passwordRealm, reject->passwordRealm)) {
|
||||
// No need for username check on a rejectlist entry. URL check is sufficient
|
||||
// if(!PL_strcmp(userName, reject->userName) && !PL_strcmp(URLName, reject->URLName)) {
|
||||
// if(!PL_strcmp(userName, reject->userName) && !PL_strcmp(passwordRealm, reject->passwordRealm)) {
|
||||
si_unlock_signon_list();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1299,8 +1303,8 @@ si_CheckForReject(char * URLName, nsAutoString userName) {
|
|||
}
|
||||
|
||||
PRIVATE void
|
||||
si_PutReject(char * URLName, nsAutoString userName, PRBool save) {
|
||||
char * URLName2=NULL;
|
||||
si_PutReject(char * passwordRealm, nsAutoString userName, PRBool save) {
|
||||
char * passwordRealm2=NULL;
|
||||
nsAutoString userName2;
|
||||
si_Reject * reject = new si_Reject;
|
||||
|
||||
|
@ -1318,15 +1322,15 @@ si_PutReject(char * URLName, nsAutoString userName, PRBool save) {
|
|||
si_lock_signon_list();
|
||||
}
|
||||
|
||||
StrAllocCopy(URLName2, URLName);
|
||||
StrAllocCopy(passwordRealm2, passwordRealm);
|
||||
userName2 = userName;
|
||||
reject->URLName = URLName2;
|
||||
reject->passwordRealm = passwordRealm2;
|
||||
reject->userName = userName2;
|
||||
|
||||
if(!si_reject_list) {
|
||||
si_reject_list = new nsVoidArray();
|
||||
if(!si_reject_list) {
|
||||
PR_Free(reject->URLName);
|
||||
PR_Free(reject->passwordRealm);
|
||||
PR_Free(reject);
|
||||
if (save) {
|
||||
si_unlock_signon_list();
|
||||
|
@ -1342,7 +1346,7 @@ si_PutReject(char * URLName, nsAutoString userName, PRBool save) {
|
|||
for (PRInt32 i = 0; i<rejectCount; ++i) {
|
||||
tmp_reject = NS_STATIC_CAST(si_Reject *, si_reject_list->ElementAt(i));
|
||||
if (tmp_reject) {
|
||||
if (PL_strcasecmp(reject->URLName, tmp_reject->URLName)<0) {
|
||||
if (PL_strcasecmp(reject->passwordRealm, tmp_reject->passwordRealm)<0) {
|
||||
si_reject_list->InsertElementAt(reject, i);
|
||||
rejectAdded = PR_TRUE;
|
||||
break;
|
||||
|
@ -1375,7 +1379,7 @@ si_PutReject(char * URLName, nsAutoString userName, PRBool save) {
|
|||
* This routine is called only if signon pref is enabled!!!
|
||||
*/
|
||||
PRIVATE void
|
||||
si_PutData(const char * URLName, nsVoidArray * signonData, PRBool save) {
|
||||
si_PutData(const char * passwordRealm, nsVoidArray * signonData, PRBool save) {
|
||||
PRBool added_to_list = PR_FALSE;
|
||||
si_SignonURLStruct * url;
|
||||
si_SignonUserStruct * user;
|
||||
|
@ -1417,7 +1421,7 @@ si_PutData(const char * URLName, nsVoidArray * signonData, PRBool save) {
|
|||
}
|
||||
|
||||
/* find node in signon list having the same URL */
|
||||
if ((url = si_GetURL(URLName)) == NULL) {
|
||||
if ((url = si_GetURL(passwordRealm)) == NULL) {
|
||||
|
||||
/* doesn't exist so allocate new node to be put into signon list */
|
||||
url = new si_SignonURLStruct;
|
||||
|
@ -1429,8 +1433,8 @@ si_PutData(const char * URLName, nsVoidArray * signonData, PRBool save) {
|
|||
}
|
||||
|
||||
/* fill in fields of new node */
|
||||
url->URLName = si_StrippedURL(URLName);
|
||||
if (!url->URLName) {
|
||||
url->passwordRealm = si_StrippedURL(passwordRealm);
|
||||
if (!url->passwordRealm) {
|
||||
PR_Free(url);
|
||||
if (save) {
|
||||
si_unlock_signon_list();
|
||||
|
@ -1440,7 +1444,7 @@ si_PutData(const char * URLName, nsVoidArray * signonData, PRBool save) {
|
|||
|
||||
url->signonUser_list = new nsVoidArray();
|
||||
if(!url->signonUser_list) {
|
||||
PR_Free(url->URLName);
|
||||
PR_Free(url->passwordRealm);
|
||||
PR_Free(url);
|
||||
}
|
||||
|
||||
|
@ -1453,7 +1457,7 @@ si_PutData(const char * URLName, nsVoidArray * signonData, PRBool save) {
|
|||
for (PRInt32 ii = 0; ii<urlCount; ++ii) {
|
||||
tmp_URL = NS_STATIC_CAST(si_SignonURLStruct *, si_signon_list->ElementAt(ii));
|
||||
if (tmp_URL) {
|
||||
if (PL_strcasecmp(url->URLName, tmp_URL->URLName)<0) {
|
||||
if (PL_strcasecmp(url->passwordRealm, tmp_URL->passwordRealm)<0) {
|
||||
si_signon_list->InsertElementAt(url, ii);
|
||||
added_to_list = PR_TRUE;
|
||||
break;
|
||||
|
@ -1666,7 +1670,7 @@ si_ReadLine
|
|||
*/
|
||||
PUBLIC int
|
||||
SI_LoadSignonData() {
|
||||
char * URLName;
|
||||
char * passwordRealm;
|
||||
nsAutoString buffer;
|
||||
PRBool badInput = PR_FALSE;
|
||||
|
||||
|
@ -1710,15 +1714,15 @@ SI_LoadSignonData() {
|
|||
break; /* end of reject list */
|
||||
}
|
||||
si_StripLF(buffer);
|
||||
URLName = buffer.ToNewCString();
|
||||
si_PutReject(URLName, buffer, PR_FALSE); /* middle parameter is obsolete */
|
||||
Recycle (URLName);
|
||||
passwordRealm = buffer.ToNewCString();
|
||||
si_PutReject(passwordRealm, buffer, PR_FALSE); /* middle parameter is obsolete */
|
||||
Recycle (passwordRealm);
|
||||
}
|
||||
|
||||
/* read the URL line */
|
||||
while(!NS_FAILED(si_ReadLine(strm, buffer))) {
|
||||
si_StripLF(buffer);
|
||||
URLName = buffer.ToNewCString();
|
||||
passwordRealm = buffer.ToNewCString();
|
||||
|
||||
/* prepare to read the name/value pairs */
|
||||
badInput = PR_FALSE;
|
||||
|
@ -1767,15 +1771,15 @@ SI_LoadSignonData() {
|
|||
}
|
||||
|
||||
/* store the info for this URL into memory-resident data structure */
|
||||
if (!URLName || PL_strlen(URLName) == 0) {
|
||||
if (!passwordRealm || PL_strlen(passwordRealm) == 0) {
|
||||
badInput = PR_TRUE;
|
||||
}
|
||||
if (!badInput) {
|
||||
si_PutData(URLName, signonData, PR_FALSE);
|
||||
si_PutData(passwordRealm, signonData, PR_FALSE);
|
||||
}
|
||||
|
||||
/* free up all the allocations done for processing this URL */
|
||||
Recycle(URLName);
|
||||
Recycle(passwordRealm);
|
||||
if (badInput) {
|
||||
si_unlock_signon_list();
|
||||
return -1;
|
||||
|
@ -1852,9 +1856,9 @@ si_SaveSignonDataLocked() {
|
|||
si_WriteLine(strm, NS_ConvertToString(HEADER_VERSION));
|
||||
|
||||
/* format for next part of file shall be:
|
||||
* URLName -- first url/username on reject list
|
||||
* passwordRealm -- first url/username on reject list
|
||||
* userName
|
||||
* URLName -- second url/username on reject list
|
||||
* passwordRealm -- second url/username on reject list
|
||||
* userName
|
||||
* ... -- etc.
|
||||
* . -- end of list
|
||||
|
@ -1865,7 +1869,7 @@ si_SaveSignonDataLocked() {
|
|||
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
||||
for (PRInt32 i=0; i<rejectCount; i++) {
|
||||
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
||||
si_WriteLine(strm, NS_ConvertToString(reject->URLName));
|
||||
si_WriteLine(strm, NS_ConvertToString(reject->passwordRealm));
|
||||
}
|
||||
}
|
||||
si_WriteLine(strm, NS_ConvertToString("."));
|
||||
|
@ -1886,7 +1890,7 @@ si_SaveSignonDataLocked() {
|
|||
for (PRInt32 i3=0; i3<userCount; i3++) {
|
||||
user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(i3));
|
||||
si_WriteLine
|
||||
(strm, NS_ConvertToString(url->URLName));
|
||||
(strm, NS_ConvertToString(url->passwordRealm));
|
||||
|
||||
/* write out each data node of the user node */
|
||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||
|
@ -1915,11 +1919,11 @@ si_SaveSignonDataLocked() {
|
|||
|
||||
/* Ask user if it is ok to save the signon data */
|
||||
PRIVATE PRBool
|
||||
si_OkToSave(char *URLName, nsAutoString userName) {
|
||||
char *strippedURLName = 0;
|
||||
si_OkToSave(char *passwordRealm, nsAutoString userName) {
|
||||
char *strippedRealm = 0;
|
||||
|
||||
/* if url/user already exists, then it is safe to save it again */
|
||||
if (si_CheckForUser(URLName, userName)) {
|
||||
if (si_CheckForUser(passwordRealm, userName)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1937,19 +1941,19 @@ si_OkToSave(char *URLName, nsAutoString userName) {
|
|||
}
|
||||
#endif
|
||||
|
||||
strippedURLName = si_StrippedURL(URLName);
|
||||
if (si_CheckForReject(strippedURLName, userName)) {
|
||||
PR_Free(strippedURLName);
|
||||
strippedRealm = si_StrippedURL(passwordRealm);
|
||||
if (si_CheckForReject(strippedRealm, userName)) {
|
||||
PR_Free(strippedRealm);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUnichar * message = Wallet_Localize("WantToSavePassword?");
|
||||
PRInt32 button = si_3ButtonConfirm(message);
|
||||
if (button == NEVER_BUTTON) {
|
||||
si_PutReject(strippedURLName, userName, PR_TRUE);
|
||||
si_PutReject(strippedRealm, userName, PR_TRUE);
|
||||
}
|
||||
Recycle(message);
|
||||
PR_Free(strippedURLName);
|
||||
PR_Free(strippedRealm);
|
||||
return (button == YES_BUTTON);
|
||||
}
|
||||
|
||||
|
@ -1957,7 +1961,7 @@ si_OkToSave(char *URLName, nsAutoString userName) {
|
|||
* Check for a signon submission and remember the data if so
|
||||
*/
|
||||
PUBLIC void
|
||||
SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData)
|
||||
SINGSIGN_RememberSignonData (char* passwordRealm, nsVoidArray * signonData)
|
||||
{
|
||||
int passwordCount = 0;
|
||||
int pswd[3];
|
||||
|
@ -1998,7 +2002,7 @@ SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData)
|
|||
if (j<signonData->Count()) {
|
||||
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
|
||||
|
||||
if (si_OkToSave(URLName, data2->value)) {
|
||||
if (si_OkToSave(passwordRealm, data2->value)) {
|
||||
for (j=0; j<signonData->Count(); j++) {
|
||||
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
|
||||
nsAutoString value = data2->value;
|
||||
|
@ -2006,7 +2010,7 @@ SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData)
|
|||
return;
|
||||
}
|
||||
}
|
||||
si_PutData(URLName, signonData, PR_TRUE);
|
||||
si_PutData(passwordRealm, signonData, PR_TRUE);
|
||||
}
|
||||
}
|
||||
} else if (passwordCount == 2) {
|
||||
|
@ -2068,7 +2072,7 @@ SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData)
|
|||
}
|
||||
|
||||
PUBLIC void
|
||||
SINGSIGN_RestoreSignonData (char* URLName, PRUnichar* name, PRUnichar** value, PRUint32 elementNumber) {
|
||||
SINGSIGN_RestoreSignonData (char* passwordRealm, PRUnichar* name, PRUnichar** value, PRUint32 elementNumber) {
|
||||
si_SignonUserStruct* user;
|
||||
si_SignonDataStruct* data;
|
||||
nsAutoString correctedName;
|
||||
|
@ -2101,7 +2105,7 @@ SINGSIGN_RestoreSignonData (char* URLName, PRUnichar* name, PRUnichar** value, P
|
|||
|
||||
/* determine if name has been saved (avoids unlocking the database if not) */
|
||||
PRBool nameFound = PR_FALSE;
|
||||
user = si_GetUser(URLName, PR_FALSE, correctedName);
|
||||
user = si_GetUser(passwordRealm, PR_FALSE, correctedName);
|
||||
if (user) {
|
||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||
for (PRInt32 i=0; i<dataCount; i++) {
|
||||
|
@ -2125,12 +2129,12 @@ SINGSIGN_RestoreSignonData (char* URLName, PRUnichar* name, PRUnichar** value, P
|
|||
*/
|
||||
/* see if this is first item in form and is a password */
|
||||
/* get first saved user just so we can see the name of the first item on the form */
|
||||
user = si_GetUser(URLName, PR_TRUE, NULL); /* this is the first saved user */
|
||||
user = si_GetUser(passwordRealm, PR_TRUE, NULL); /* this is the first saved user */
|
||||
if (user) {
|
||||
data = (si_SignonDataStruct *) (user->signonData_list->ElementAt(0)); /* 1st item on form */
|
||||
if(data->isPassword && correctedName.Length() && (data->name == correctedName)) {
|
||||
/* current item is first item on form and is a password */
|
||||
user = (URLName, MK_SIGNON_PASSWORDS_FETCH);
|
||||
user = (passwordRealm, MK_SIGNON_PASSWORDS_FETCH);
|
||||
if (user) {
|
||||
/* user has confirmed it's a change-of-password form */
|
||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||
|
@ -2152,7 +2156,7 @@ SINGSIGN_RestoreSignonData (char* URLName, PRUnichar* name, PRUnichar** value, P
|
|||
|
||||
/* restore the data from previous time this URL was visited */
|
||||
|
||||
user = si_GetUser(URLName, PR_FALSE, correctedName);
|
||||
user = si_GetUser(passwordRealm, PR_FALSE, correctedName);
|
||||
if (user) {
|
||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||
for (PRInt32 i=0; i<dataCount; i++) {
|
||||
|
@ -2174,7 +2178,7 @@ SINGSIGN_RestoreSignonData (char* URLName, PRUnichar* name, PRUnichar** value, P
|
|||
* Remember signon data from a browser-generated password dialog
|
||||
*/
|
||||
PRIVATE void
|
||||
si_RememberSignonDataFromBrowser(const char* URLName, nsAutoString username, nsAutoString password) {
|
||||
si_RememberSignonDataFromBrowser(const char* passwordRealm, nsAutoString username, nsAutoString password) {
|
||||
/* do nothing if signon preference is not enabled */
|
||||
if (!si_GetSignonRememberingPref()){
|
||||
return;
|
||||
|
@ -2197,7 +2201,7 @@ si_RememberSignonDataFromBrowser(const char* URLName, nsAutoString username, nsA
|
|||
signonData->AppendElement(data2);
|
||||
|
||||
/* Save the signon data */
|
||||
si_PutData(URLName, signonData, PR_TRUE);
|
||||
si_PutData(passwordRealm, signonData, PR_TRUE);
|
||||
|
||||
/* Deallocate */
|
||||
delete data1;
|
||||
|
@ -2211,16 +2215,16 @@ si_RememberSignonDataFromBrowser(const char* URLName, nsAutoString username, nsA
|
|||
*/
|
||||
PRIVATE void
|
||||
si_RestoreOldSignonDataFromBrowser
|
||||
(const char* URLName, PRBool pickFirstUser, nsAutoString& username, nsAutoString& password) {
|
||||
(const char* passwordRealm, PRBool pickFirstUser, nsAutoString& username, nsAutoString& password) {
|
||||
si_SignonUserStruct* user;
|
||||
si_SignonDataStruct* data;
|
||||
|
||||
/* get the data from previous time this URL was visited */
|
||||
si_lock_signon_list();
|
||||
if (username.Length() != 0) {
|
||||
user = si_GetSpecificUser(URLName, username, NS_ConvertToString(USERNAMEFIELD));
|
||||
user = si_GetSpecificUser(passwordRealm, username, NS_ConvertToString(USERNAMEFIELD));
|
||||
} else {
|
||||
user = si_GetUser(URLName, pickFirstUser, NS_ConvertToString(USERNAMEFIELD));
|
||||
user = si_GetUser(passwordRealm, pickFirstUser, NS_ConvertToString(USERNAMEFIELD));
|
||||
}
|
||||
if (!user) {
|
||||
/* leave original username and password from caller unchanged */
|
||||
|
@ -2247,18 +2251,19 @@ si_RestoreOldSignonDataFromBrowser
|
|||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
SINGSIGN_StorePassword(const char *URLName, const PRUnichar *user, const PRUnichar *password, PRBool strip) {
|
||||
nsresult res;
|
||||
|
||||
SINGSIGN_StorePassword(const char *passwordRealm, const PRUnichar *user, const PRUnichar *password) {
|
||||
nsAutoString userName(user);
|
||||
|
||||
/* convert URLName to a uri so we can parse out the username and hostname */
|
||||
#if 0
|
||||
nsresult res;
|
||||
|
||||
/* convert passwordRealm to a uri so we can parse out the username and hostname */
|
||||
nsXPIDLCString host;
|
||||
if (strip) {
|
||||
if (URLName) {
|
||||
if (passwordRealm) {
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(URLName);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
/* uri is of the form <scheme>://<username>:<password>@<host>:<portnumber>/<pathname>) */
|
||||
|
@ -2286,11 +2291,12 @@ SINGSIGN_StorePassword(const char *URLName, const PRUnichar *user, const PRUnich
|
|||
}
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(URLName, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
si_RememberSignonDataFromBrowser ((const char *)host, userName, nsAutoString(password));
|
||||
si_RememberSignonDataFromBrowser(passwordRealm, userName, nsAutoString(password));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2310,20 +2316,23 @@ SINGSIGN_StorePassword(const char *URLName, const PRUnichar *user, const PRUnich
|
|||
|
||||
PUBLIC nsresult
|
||||
SINGSIGN_PromptUsernameAndPassword
|
||||
(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char *urlname, nsIPrompt* dialog, PRBool *pressedOK, PRBool strip) {
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char *passwordRealm, nsIPrompt* dialog, PRBool *pressedOK, PRBool persistPassword) {
|
||||
|
||||
nsresult res;
|
||||
|
||||
/* do only the dialog if signon preference is not enabled */
|
||||
if (!si_GetSignonRememberingPref()){
|
||||
return dialog->PromptUsernameAndPassword(text, user, pwd, pressedOK);
|
||||
nsString realm = NS_ConvertToString(passwordRealm); // XXX hack
|
||||
return dialog->PromptUsernameAndPassword(dialogTitle, text, realm.GetUnicode(),
|
||||
persistPassword, user, pwd, pressedOK);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* convert to a uri so we can parse out the hostname */
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(urlname);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
@ -2338,15 +2347,16 @@ SINGSIGN_PromptUsernameAndPassword
|
|||
return res;
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(urlname, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* prefill with previous username/password if any */
|
||||
nsAutoString username, password;
|
||||
si_RestoreOldSignonDataFromBrowser((const char*)host, PR_FALSE, username, password);
|
||||
si_RestoreOldSignonDataFromBrowser(passwordRealm, PR_FALSE, username, password);
|
||||
|
||||
/* get new username/password from user */
|
||||
*user = username.ToNewUnicode();
|
||||
|
@ -2361,7 +2371,7 @@ SINGSIGN_PromptUsernameAndPassword
|
|||
return NS_OK;
|
||||
}
|
||||
if (checked) {
|
||||
si_RememberSignonDataFromBrowser ((const char*)host, nsAutoString(*user), nsAutoString(*pwd));
|
||||
si_RememberSignonDataFromBrowser (passwordRealm, nsAutoString(*user), nsAutoString(*pwd));
|
||||
}
|
||||
|
||||
/* cleanup and return */
|
||||
|
@ -2371,8 +2381,8 @@ SINGSIGN_PromptUsernameAndPassword
|
|||
|
||||
PUBLIC nsresult
|
||||
SINGSIGN_PromptPassword
|
||||
(const PRUnichar *text, PRUnichar **pwd, const char *urlname,
|
||||
nsIPrompt* dialog, PRBool *pressedOK, PRBool strip)
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **pwd, const char *passwordRealm,
|
||||
nsIPrompt* dialog, PRBool *pressedOK, PRBool persistPassword)
|
||||
{
|
||||
|
||||
nsresult res;
|
||||
|
@ -2381,15 +2391,19 @@ SINGSIGN_PromptPassword
|
|||
/* do only the dialog if signon preference is not enabled */
|
||||
if (!si_GetSignonRememberingPref()){
|
||||
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
|
||||
res = dialog->PromptPassword(text, prompt_string, pwd, pressedOK);
|
||||
nsString realm = NS_ConvertToString(passwordRealm); // XXX hack
|
||||
res = dialog->PromptPassword(prompt_string,
|
||||
text, realm.GetUnicode(), persistPassword,
|
||||
pwd, pressedOK);
|
||||
Recycle(prompt_string);
|
||||
return res;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* convert to a uri so we can parse out the username and hostname */
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(urlname);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
@ -2404,7 +2418,7 @@ SINGSIGN_PromptPassword
|
|||
return res;
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(urlname, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
@ -2425,9 +2439,10 @@ SINGSIGN_PromptPassword
|
|||
prehost.Left(username, colon);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get previous password used with this username, pick first user if no username found */
|
||||
si_RestoreOldSignonDataFromBrowser((const char *)host, (username.Length() == 0), username, password);
|
||||
si_RestoreOldSignonDataFromBrowser(passwordRealm, (username.Length() == 0), username, password);
|
||||
|
||||
/* return if a password was found */
|
||||
if (password.Length() != 0) {
|
||||
|
@ -2447,7 +2462,7 @@ SINGSIGN_PromptPassword
|
|||
return NS_OK;
|
||||
}
|
||||
if (checked) {
|
||||
si_RememberSignonDataFromBrowser ((const char *)host, username, nsAutoString(*pwd));
|
||||
si_RememberSignonDataFromBrowser(passwordRealm, username, nsAutoString(*pwd));
|
||||
}
|
||||
|
||||
/* cleanup and return */
|
||||
|
@ -2457,8 +2472,8 @@ SINGSIGN_PromptPassword
|
|||
|
||||
PUBLIC nsresult
|
||||
SINGSIGN_Prompt
|
||||
(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
|
||||
const char *urlname, nsIPrompt* dialog, PRBool *pressedOK, PRBool strip)
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
|
||||
const char *passwordRealm, nsIPrompt* dialog, PRBool *pressedOK)
|
||||
{
|
||||
nsresult res;
|
||||
nsAutoString data, emptyUsername;
|
||||
|
@ -2466,15 +2481,17 @@ SINGSIGN_Prompt
|
|||
/* do only the dialog if signon preference is not enabled */
|
||||
if (!si_GetSignonRememberingPref()){
|
||||
PRUnichar * prompt_string = Wallet_Localize("PromptForData");
|
||||
res = dialog->Prompt(text, prompt_string, resultText, pressedOK);
|
||||
nsString realm = NS_ConvertToString(passwordRealm); // XXX hack
|
||||
res = dialog->Prompt(dialogTitle, text, realm.GetUnicode(), prompt_string, resultText, pressedOK);
|
||||
Recycle(prompt_string);
|
||||
return res;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* convert to a uri so we can parse out the hostname */
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(urlname);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
@ -2487,14 +2504,15 @@ SINGSIGN_Prompt
|
|||
return res;
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(urlname, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get previous data used with this hostname */
|
||||
si_RestoreOldSignonDataFromBrowser((const char *)host, PR_TRUE, emptyUsername, data);
|
||||
si_RestoreOldSignonDataFromBrowser(passwordRealm, PR_TRUE, emptyUsername, data);
|
||||
|
||||
/* return if data was found */
|
||||
if (data.Length() != 0) {
|
||||
|
@ -2514,7 +2532,7 @@ SINGSIGN_Prompt
|
|||
return NS_OK;
|
||||
}
|
||||
if (checked) {
|
||||
si_RememberSignonDataFromBrowser ((const char *)host, emptyUsername, nsAutoString(*resultText));
|
||||
si_RememberSignonDataFromBrowser(passwordRealm, emptyUsername, nsAutoString(*resultText));
|
||||
}
|
||||
|
||||
/* cleanup and return */
|
||||
|
@ -2606,7 +2624,7 @@ SINGSIGN_SignonViewerReturn (nsAutoString results) {
|
|||
/* do the deletion */
|
||||
nsAutoString userName;
|
||||
if (NS_SUCCEEDED(si_Decrypt(data->value, userName))) {
|
||||
si_RemoveUser(url->URLName, userName, PR_TRUE, PR_TRUE);
|
||||
si_RemoveUser(url->passwordRealm, userName, PR_TRUE);
|
||||
si_signon_list_changed = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -2669,7 +2687,7 @@ SINGSIGN_GetSignonListForViewer(nsAutoString& aSignonList)
|
|||
buffer.AppendWithConversion("<OPTION value=");
|
||||
buffer.AppendInt(signonNum, 10);
|
||||
buffer.AppendWithConversion(">");
|
||||
buffer.AppendWithConversion(url->URLName);
|
||||
buffer.AppendWithConversion(url->passwordRealm);
|
||||
buffer.AppendWithConversion(":");
|
||||
if (!data->isPassword) { /* need this test in case all fields are passwords */
|
||||
buffer += userName;
|
||||
|
@ -2745,7 +2763,7 @@ SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
|
|||
buffer.AppendWithConversion("<OPTION value=");
|
||||
buffer.AppendInt(rejectNum, 10);
|
||||
buffer.AppendWithConversion(">");
|
||||
buffer.AppendWithConversion(reject->URLName);
|
||||
buffer.AppendWithConversion(reject->passwordRealm);
|
||||
buffer.AppendWithConversion(":");
|
||||
buffer += reject->userName;
|
||||
buffer.AppendWithConversion("</OPTION>\n");
|
||||
|
@ -2755,9 +2773,8 @@ SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
|
|||
}
|
||||
|
||||
PUBLIC nsresult
|
||||
SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval)
|
||||
SINGSIGN_HaveData(const char *passwordRealm, const PRUnichar *userName, PRBool *retval)
|
||||
{
|
||||
nsresult res;
|
||||
nsAutoString data, usernameForLookup;
|
||||
|
||||
*retval = PR_FALSE;
|
||||
|
@ -2766,12 +2783,14 @@ SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBo
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult res;
|
||||
NS_ASSERTION(strip == PR_FALSE, "this code needs to be finished for the strip case");
|
||||
|
||||
/* convert to a uri so we can parse out the username and hostname */
|
||||
nsCOMPtr<nsIURL> uri;
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
|
||||
res = uri->SetSpec(url);
|
||||
res = uri->SetSpec(passwordRealm);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
/* get host part of the uri */
|
||||
|
@ -2782,18 +2801,19 @@ SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBo
|
|||
return res;
|
||||
}
|
||||
} else {
|
||||
res = MangleUrl(url, getter_Copies(host));
|
||||
res = MangleUrl(passwordRealm, getter_Copies(host));
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
if (strip) {
|
||||
/* convert url to a uri so we can parse out the username and hostname */
|
||||
/* convert passwordRealm to a uri so we can parse out the username and hostname */
|
||||
/* if no username given, extract it from uri -- note: prehost is <username>:<password> */
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get previous data used with this username, pick first user if no username found */
|
||||
si_RestoreOldSignonDataFromBrowser((const char *)host, (usernameForLookup.Length() == 0), usernameForLookup, data);
|
||||
si_RestoreOldSignonDataFromBrowser(passwordRealm, (usernameForLookup.Length() == 0), usernameForLookup, data);
|
||||
|
||||
if (data.Length()) {
|
||||
*retval = PR_TRUE;
|
||||
|
@ -2829,7 +2849,7 @@ si_KeychainCallback( KCEvent keychainEvent, KCCallbackInfo *info, void *userCont
|
|||
*/
|
||||
PRIVATE int
|
||||
si_LoadSignonDataFromKeychain() {
|
||||
char * URLName;
|
||||
char * passwordRealm;
|
||||
si_FormSubmitData submit;
|
||||
nsAutoString name_array[MAX_ARRAY_SIZE];
|
||||
nsAutoString value_array[MAX_ARRAY_SIZE];
|
||||
|
@ -2903,8 +2923,8 @@ si_LoadSignonDataFromKeychain() {
|
|||
|
||||
/* null terminate */
|
||||
buffer[actualSize] = 0;
|
||||
URLName = NULL;
|
||||
StrAllocCopy(URLName, buffer);
|
||||
passwordRealm = NULL;
|
||||
StrAllocCopy(passwordRealm, buffer);
|
||||
if (!reject) {
|
||||
/* get the password data */
|
||||
status = KCGetData(itemRef, BUFFER_SIZE, buffer, &actualSize);
|
||||
|
@ -2963,19 +2983,19 @@ si_LoadSignonDataFromKeychain() {
|
|||
}
|
||||
submit.value_cnt++;
|
||||
/* store the info for this URL into memory-resident data structure */
|
||||
if (!URLName || PL_strlen(URLName) == 0) {
|
||||
if (!passwordRealm || PL_strlen(passwordRealm) == 0) {
|
||||
badInput = PR_TRUE;
|
||||
}
|
||||
if (!badInput) {
|
||||
si_PutData(URLName, &submit, PR_FALSE);
|
||||
si_PutData(passwordRealm, &submit, PR_FALSE);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* reject */
|
||||
si_PutReject(URLName, nsAutoString(buffer), PR_FALSE);
|
||||
si_PutReject(passwordRealm, nsAutoString(buffer), PR_FALSE);
|
||||
}
|
||||
reject = PR_FALSE; /* reset reject flag */
|
||||
PR_Free(URLName);
|
||||
PR_Free(passwordRealm);
|
||||
KCReleaseItemRef( &itemRef );
|
||||
status = KCFindNextItem( searchRef, &itemRef);
|
||||
}
|
||||
|
@ -3032,7 +3052,7 @@ si_SaveSignonDataInKeychain() {
|
|||
for (PRInt32 i=0; i<rejectCount; i++) {
|
||||
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
||||
status = kcaddinternetpassword
|
||||
(reject->URLName, nil,
|
||||
(reject->passwordRealm, nil,
|
||||
reject->userName,
|
||||
kAnyPort,
|
||||
kNetscapeProtocolType,
|
||||
|
@ -3101,7 +3121,7 @@ si_SaveSignonDataInKeychain() {
|
|||
}
|
||||
/* if it's already there, we just want to change the password */
|
||||
status = kcfindinternetpassword
|
||||
(URL->URLName,
|
||||
(URL->passwordRealm,
|
||||
nil,
|
||||
account,
|
||||
kAnyPort,
|
||||
|
@ -3121,7 +3141,7 @@ si_SaveSignonDataInKeychain() {
|
|||
} else {
|
||||
/* wasn't there, let's add it */
|
||||
status = kcaddinternetpassword
|
||||
(URL->URLName,
|
||||
(URL->passwordRealm,
|
||||
nil,
|
||||
account,
|
||||
kAnyPort,
|
||||
|
|
|
@ -44,33 +44,33 @@ extern void
|
|||
SINGSIGN_SignonViewerReturn(nsAutoString results);
|
||||
|
||||
extern void
|
||||
SINGSIGN_RestoreSignonData(char* URLName, PRUnichar* name, PRUnichar** value, PRUint32 elementNumber);
|
||||
SINGSIGN_RestoreSignonData(char* passwordRealm, PRUnichar* name, PRUnichar** value, PRUint32 elementNumber);
|
||||
|
||||
extern nsresult
|
||||
SINGSIGN_PromptUsernameAndPassword
|
||||
(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char *urlname,nsIPrompt* dialog, PRBool *returnValue, PRBool strip);
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
|
||||
const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue, PRBool persistPassword = PR_TRUE);
|
||||
|
||||
extern nsresult
|
||||
SINGSIGN_PromptPassword
|
||||
(const PRUnichar *text, PRUnichar **pwd, const char *urlname,
|
||||
nsIPrompt* dialog, PRBool *returnValue, PRBool strip);
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **pwd, const char* passwordRealm,
|
||||
nsIPrompt* dialog, PRBool *returnValue, PRBool persistPassword = PR_TRUE);
|
||||
|
||||
extern nsresult
|
||||
SINGSIGN_Prompt
|
||||
(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
|
||||
const char *urlname,nsIPrompt* dialog, PRBool *returnValue, PRBool strip);
|
||||
(const PRUnichar *dialogTitle, const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
|
||||
const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue);
|
||||
|
||||
extern PRBool
|
||||
SINGSIGN_RemoveUser
|
||||
(const char *URLName, const PRUnichar *userName, PRBool strip);
|
||||
(const char* passwordRealm, const PRUnichar *userName);
|
||||
|
||||
extern PRBool
|
||||
SINGSIGN_StorePassword
|
||||
(const char *URLName, const PRUnichar *userName, const PRUnichar *password, PRBool strip);
|
||||
(const char* passwordRealm, const PRUnichar *userName, const PRUnichar *password);
|
||||
|
||||
extern nsresult
|
||||
SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval);
|
||||
SINGSIGN_HaveData(const char* passwordRealm, const PRUnichar *userName, PRBool *retval);
|
||||
|
||||
|
||||
XP_END_PROTOS
|
||||
|
|
|
@ -755,7 +755,7 @@ Wallet_Confirm(PRUnichar * szMessage)
|
|||
|
||||
const nsAutoString message = szMessage;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
res = dialog->Confirm(message.GetUnicode(), &retval);
|
||||
res = dialog->Confirm(nsnull, message.GetUnicode(), &retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ Wallet_Alert(PRUnichar * szMessage)
|
|||
}
|
||||
|
||||
const nsAutoString message = szMessage;
|
||||
res = dialog->Alert(message.GetUnicode());
|
||||
res = dialog->Alert(nsnull, message.GetUnicode());
|
||||
return; // XXX should return the error
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ nsAbSync::DisplayErrorMessage(const PRUnichar * msg)
|
|||
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = dialog->Alert(msg);
|
||||
rv = dialog->Alert(nsnull, msg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsISmtpServer.h"
|
||||
#include "nsIAddbookUrl.h"
|
||||
#include "nsAbCardProperty.h"
|
||||
|
|
|
@ -103,7 +103,7 @@ interface nsIMsgIncomingServer : nsISupports {
|
|||
|
||||
|
||||
/* the RDF URI for the root mail folder */
|
||||
readonly attribute string serverURI;
|
||||
readonly attribute string serverPasswordRealm;
|
||||
|
||||
/* the root folder for this server */
|
||||
attribute nsIFolder RootFolder;
|
||||
|
|
|
@ -989,8 +989,9 @@ nsMessenger::Alert(const char *stringName)
|
|||
{
|
||||
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(mDocShell));
|
||||
|
||||
if (dialog)
|
||||
rv = dialog->Alert(errorMessage.GetUnicode());
|
||||
if (dialog) {
|
||||
rv = dialog->Alert(nsnull, errorMessage.GetUnicode());
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ nsSubscribableServer::SetAsSubscribedInSubscribeDS(const char *aName)
|
|||
|
||||
nsXPIDLCString serverUri;
|
||||
|
||||
rv = mIncomingServer->GetServerURI(getter_Copies(serverUri));
|
||||
rv = mIncomingServer->GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString uri;
|
||||
|
@ -157,7 +157,7 @@ nsSubscribableServer::AddToSubscribeDS(const char *aName)
|
|||
#endif
|
||||
nsXPIDLCString serverUri;
|
||||
|
||||
rv = mIncomingServer->GetServerURI(getter_Copies(serverUri));
|
||||
rv = mIncomingServer->GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString uri;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIWalletService.h"
|
||||
|
||||
#include "nsIRDFService.h"
|
||||
|
@ -52,6 +52,7 @@
|
|||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#define DEBUG_MSGINCOMING_SERVER
|
||||
|
@ -181,7 +182,7 @@ nsMsgIncomingServer::CloseCachedConnections()
|
|||
|
||||
// construct <localStoreType>://[<username>@]<hostname
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetServerURI(char **aResult)
|
||||
nsMsgIncomingServer::GetServerPasswordRealm(char* *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
nsresult rv;
|
||||
|
@ -228,7 +229,7 @@ nsMsgIncomingServer::CreateRootFolder()
|
|||
nsresult rv;
|
||||
// get the URI from the incoming server
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
rv = GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIRDFService, rdf,
|
||||
|
@ -609,7 +610,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
NS_ENSURE_ARG_POINTER(okayValue);
|
||||
|
||||
if (m_password.IsEmpty()) {
|
||||
nsCOMPtr<nsINetPrompt> dialog;
|
||||
nsCOMPtr<nsIPrompt> dialog;
|
||||
// aMsgWindow is required if we need to prompt
|
||||
if (aMsgWindow)
|
||||
{
|
||||
|
@ -617,13 +618,10 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
nsCOMPtr<nsIDocShell> docShell;
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// get top level window
|
||||
nsCOMPtr<nsIWebShellContainer> topLevelWindow;
|
||||
rv = webShell->GetTopLevelWindow(getter_AddRefs(topLevelWindow));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
dialog = do_QueryInterface( topLevelWindow, &rv );
|
||||
dialog = do_GetInterface(webShell, &rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -641,10 +639,12 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
{
|
||||
nsXPIDLString uniPassword;
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
rv = GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = dialog->PromptPassword(serverUri, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniPassword), okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage,
|
||||
NS_ConvertToString(serverUri).GetUnicode(), PR_TRUE,
|
||||
getter_Copies(uniPassword), okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!*okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
|
@ -677,11 +677,11 @@ nsMsgIncomingServer::StorePassword()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
rv = GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString password; password.AssignWithConversion((const char *)pwd);
|
||||
rv = walletservice->SI_StorePassword((const char *)serverUri, PR_FALSE, nsnull, password.GetUnicode());
|
||||
rv = walletservice->SI_StorePassword((const char *)serverUri, nsnull, password.GetUnicode());
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -694,14 +694,14 @@ nsMsgIncomingServer::ForgetPassword()
|
|||
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
rv = GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = SetPassword("");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)serverUri, PR_FALSE, nsnull);
|
||||
rv = walletservice->SI_RemoveUser((const char *)serverUri, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *c
|
|||
default:
|
||||
break;
|
||||
}
|
||||
dialog->Alert(alertMsg.GetUnicode());
|
||||
dialog->Alert(nsnull, alertMsg.GetUnicode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsINetPrompt;
|
||||
interface nsIPrompt;
|
||||
|
||||
[scriptable, uuid(6a0b35ce-54e4-11d3-81df-006008948010)]
|
||||
interface nsISmtpServer : nsISupports {
|
||||
|
@ -38,6 +38,6 @@ interface nsISmtpServer : nsISupports {
|
|||
|
||||
readonly attribute string serverURI;
|
||||
string getPasswordWithUI(in wstring promptString, in wstring promptTitle,
|
||||
in nsINetPrompt netPrompt);
|
||||
in nsIPrompt netPrompt);
|
||||
void forgetPassword();
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ interface nsIURI;
|
|||
interface nsIUrlListener;
|
||||
interface nsISupportsArray;
|
||||
interface nsIMsgIdentity;
|
||||
interface nsINetPrompt;
|
||||
interface nsIPrompt;
|
||||
|
||||
[scriptable, uuid(FBAF0F10-CA9B-11d2-8063-006008128C4E)]
|
||||
interface nsISmtpService : nsISupports {
|
||||
|
@ -55,7 +55,7 @@ interface nsISmtpService : nsISupports {
|
|||
in nsIMsgIdentity aSenderIdentity,
|
||||
in nsIUrlListener aUrlListener,
|
||||
in nsISmtpServer aServer,
|
||||
in nsINetPrompt aNetPrompt,
|
||||
in nsIPrompt aNetPrompt,
|
||||
out nsIURI aURL);
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
%}
|
||||
|
||||
interface nsIMsgIdentity;
|
||||
interface nsINetPrompt;
|
||||
interface nsIPrompt;
|
||||
interface nsISmtpServer;
|
||||
|
||||
[scriptable, uuid(16ADF2F1-BBAD-11d2-804E-006008128C4E)]
|
||||
|
@ -64,7 +64,7 @@ interface nsISmtpUrl : nsISupports {
|
|||
// NOTE: the SMTP username and SMTP server are in the smtp url
|
||||
// smtp://sspitzer@tintin/...
|
||||
attribute nsIMsgIdentity senderIdentity;
|
||||
attribute nsINetPrompt netPrompt;
|
||||
attribute nsIPrompt prompt;
|
||||
attribute nsISmtpServer smtpServer;
|
||||
};
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ LocateMessageFolder(nsIMsgIdentity *userIdentity,
|
|||
// newsgroup://news.mozilla.org/netscape.test
|
||||
//
|
||||
char *serverURI = nsnull;
|
||||
rv = inServer->GetServerURI(&serverURI);
|
||||
rv = inServer->GetServerPasswordRealm(&serverURI);
|
||||
if ( NS_FAILED(rv) || (!serverURI) || !(*serverURI) )
|
||||
continue;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ nsMsgDisplayMessageByString(const PRUnichar * msg)
|
|||
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = dialog->Alert(msg);
|
||||
rv = dialog->Alert(nsnull, msg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ nsMsgAskBooleanQuestionByString(const PRUnichar * msg, PRBool *answer)
|
|||
|
||||
if (dialog)
|
||||
{
|
||||
rv = dialog->Confirm(msg, &result);
|
||||
rv = dialog->Confirm(nsnull, msg, &result);
|
||||
if (result == 1)
|
||||
*answer = PR_TRUE;
|
||||
else
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include "nsIMsgMailSession.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsMailHeaders.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -2811,13 +2811,11 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
|||
NS_NewFileSpecWithSpec(*mTempFileSpec, getter_AddRefs(aFileSpec));
|
||||
|
||||
// rhp: we don't always have a mDocShell...
|
||||
nsCOMPtr<nsINetPrompt> netPrompt = nsnull;
|
||||
nsCOMPtr<nsIPrompt> netPrompt;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
if (webShell)
|
||||
{
|
||||
nsCOMPtr<nsIWebShellContainer> topLevelWindow;
|
||||
rv = webShell->GetTopLevelWindow(getter_AddRefs(topLevelWindow));
|
||||
netPrompt = do_QueryInterface(topLevelWindow, &rv);
|
||||
netPrompt = do_GetInterface(webShell, &rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2829,7 +2827,7 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
|||
appshellservice->GetHiddenWindow(getter_AddRefs(xulWindow));
|
||||
if (xulWindow)
|
||||
{
|
||||
netPrompt = do_QueryInterface(xulWindow, &rv);
|
||||
netPrompt = do_GetInterface(xulWindow, &rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsISmtpServer.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "prtime.h"
|
||||
|
@ -112,7 +111,7 @@ nsresult nsExplainErrorDetails(int code, ...)
|
|||
}
|
||||
|
||||
if (msg) {
|
||||
rv = dialog->Alert(msg);
|
||||
rv = dialog->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
}
|
||||
|
||||
|
@ -1490,8 +1489,8 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
|||
nsCRT::free(*aPassword);
|
||||
*aPassword = 0;
|
||||
|
||||
nsCOMPtr<nsINetPrompt> netPrompt;
|
||||
rv = smtpUrl->GetNetPrompt(getter_AddRefs(netPrompt));
|
||||
nsCOMPtr<nsIPrompt> netPrompt;
|
||||
rv = smtpUrl->GetPrompt(getter_AddRefs(netPrompt));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString username;
|
||||
|
@ -1605,8 +1604,9 @@ NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionError(const PRUnichar *pErrMsg,
|
|||
|
||||
// step (2) alert the user about the error
|
||||
nsCOMPtr<nsIPrompt> dialog (do_GetService(kCNetSupportDialogCID));
|
||||
if (dialog && pErrMsg && pErrMsg[0])
|
||||
dialog->Alert(pErrMsg);
|
||||
if (dialog && pErrMsg && pErrMsg[0]) {
|
||||
dialog->Alert(nsnull, pErrMsg);
|
||||
}
|
||||
|
||||
// step (3) if they entered a bad password, forget about it!
|
||||
if (aBadPassword && smtpServer)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsSmtpServer.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
|
@ -199,7 +199,7 @@ nsSmtpServer::SetPassword(const char * aPassword)
|
|||
NS_IMETHODIMP
|
||||
nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||
PRUnichar *aPromptTitle,
|
||||
nsINetPrompt* aDialog,
|
||||
nsIPrompt* aDialog,
|
||||
char **aPassword)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -217,8 +217,10 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aDialog->PromptPassword(serverUri, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniPassword), &okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage,
|
||||
NS_ConvertToString(serverUri).GetUnicode(), PR_TRUE,
|
||||
getter_Copies(uniPassword), &okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
|
@ -254,7 +256,7 @@ nsSmtpServer::ForgetPassword()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)serverUri, PR_FALSE, nsnull);
|
||||
rv = walletservice->SI_RemoveUser((const char *)serverUri, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
|
||||
typedef struct _findServerByKeyEntry {
|
||||
|
@ -63,7 +63,7 @@ NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
|
|||
const char* aRecipients,
|
||||
nsIMsgIdentity * aSenderIdentity,
|
||||
nsIUrlListener * aUrlListener,
|
||||
nsINetPrompt * aNetPrompt,
|
||||
nsIPrompt * aNetPrompt,
|
||||
nsIURI ** aUrl);
|
||||
|
||||
nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer);
|
||||
|
@ -89,7 +89,7 @@ nsresult nsSmtpService::SendMailMessage(nsIFileSpec * aFilePath,
|
|||
nsIMsgIdentity * aSenderIdentity,
|
||||
nsIUrlListener * aUrlListener,
|
||||
nsISmtpServer * aServer,
|
||||
nsINetPrompt * aNetPrompt,
|
||||
nsIPrompt * aNetPrompt,
|
||||
nsIURI ** aURL)
|
||||
{
|
||||
nsIURI * urlToRun = nsnull;
|
||||
|
@ -152,7 +152,7 @@ nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
|
|||
const char * aRecipients,
|
||||
nsIMsgIdentity * aSenderIdentity,
|
||||
nsIUrlListener * aUrlListener,
|
||||
nsINetPrompt * aNetPrompt,
|
||||
nsIPrompt * aNetPrompt,
|
||||
nsIURI ** aUrl)
|
||||
{
|
||||
// mscott: this function is a convience hack until netlib actually dispatches smtp urls.
|
||||
|
@ -174,10 +174,10 @@ nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
|
|||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(smtpUrl);
|
||||
url->SetSpec(urlSpec);
|
||||
smtpUrl->SetRecipients(aRecipients);
|
||||
smtpUrl->SetRecipients(aRecipients);
|
||||
smtpUrl->SetPostMessageFile(aFilePath);
|
||||
smtpUrl->SetSenderIdentity(aSenderIdentity);
|
||||
smtpUrl->SetNetPrompt(aNetPrompt);
|
||||
smtpUrl->SetPrompt(aNetPrompt);
|
||||
url->RegisterListener(aUrlListener);
|
||||
PR_Free(urlSpec);
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ nsSmtpUrl::SetSenderIdentity(nsIMsgIdentity * aSenderIdentity)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSmtpUrl::SetNetPrompt(nsINetPrompt *aNetPrompt)
|
||||
nsSmtpUrl::SetPrompt(nsIPrompt *aNetPrompt)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNetPrompt);
|
||||
m_netPrompt = aNetPrompt;
|
||||
|
@ -519,7 +519,7 @@ nsSmtpUrl::SetNetPrompt(nsINetPrompt *aNetPrompt)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSmtpUrl::GetNetPrompt(nsINetPrompt **aNetPrompt)
|
||||
nsSmtpUrl::GetPrompt(nsIPrompt **aNetPrompt)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNetPrompt);
|
||||
if (!m_netPrompt) return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsISmtpServer.h"
|
||||
|
||||
class nsMailtoUrl : public nsIMailtoUrl, public nsIURI
|
||||
|
@ -99,7 +99,7 @@ protected:
|
|||
nsCString m_userName;
|
||||
nsCOMPtr<nsIFileSpec> m_fileName;
|
||||
nsCOMPtr<nsIMsgIdentity> m_senderIdentity;
|
||||
nsCOMPtr<nsINetPrompt> m_netPrompt;
|
||||
nsCOMPtr<nsIPrompt> m_netPrompt;
|
||||
nsCOMPtr<nsISmtpServer> m_smtpServer;
|
||||
|
||||
// it is possible to encode the message to parse in the form of a url.
|
||||
|
|
|
@ -702,7 +702,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
|||
nsCAutoString uri;
|
||||
nsXPIDLCString serverUri;
|
||||
|
||||
GetServerURI(getter_Copies(serverUri));
|
||||
GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
|
||||
uri.Assign(serverUri);
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ nsImapIncomingServer::FEAlert(const PRUnichar* aString)
|
|||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
|
||||
rv = dialog->Alert(aString);
|
||||
rv = dialog->Alert(nsnull, aString);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ NS_IMETHODIMP nsImapIncomingServer::FEAlertFromServer(const char *aString)
|
|||
{
|
||||
nsAutoString message(serverSaidPrefix);
|
||||
message.AppendWithConversion(whereRealMessage ? whereRealMessage : serverSaid);
|
||||
rv = dialog->Alert(message.GetUnicode());
|
||||
rv = dialog->Alert(nsnull, message.GetUnicode());
|
||||
|
||||
PR_Free(serverSaidPrefix);
|
||||
}
|
||||
|
|
|
@ -1519,8 +1519,9 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
|
|||
if (docShell) dialog = do_GetInterface(docShell);
|
||||
PRUnichar *moveToTrashStr = IMAPGetStringByID(IMAP_MOVE_FOLDER_TO_TRASH);
|
||||
|
||||
if (dialog && moveToTrashStr)
|
||||
dialog->Confirm (moveToTrashStr, &moveToTrash);
|
||||
if (dialog && moveToTrashStr) {
|
||||
dialog->Confirm(nsnull, moveToTrashStr, &moveToTrash);
|
||||
}
|
||||
|
||||
for (i = 0; i < folderCount; i++)
|
||||
{
|
||||
|
|
|
@ -1273,7 +1273,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::DeleteSubFolders(
|
|||
if (dialog)
|
||||
{
|
||||
PRBool okToDelete = PR_FALSE;
|
||||
dialog->Confirm(alertString, &okToDelete);
|
||||
dialog->Confirm(nsnull, alertString, &okToDelete);
|
||||
if (okToDelete)
|
||||
return nsMsgFolder::DeleteSubFolders(folders, msgWindow);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ static char *nsMailboxGetURI(const char *nativepath)
|
|||
PRInt32 len = PL_strlen(serverPath);
|
||||
if (PL_strncasecmp(serverPath, filePath, len) == 0) {
|
||||
nsXPIDLCString serverURI;
|
||||
rv = server->GetServerURI(getter_Copies(serverURI));
|
||||
rv = server->GetServerPasswordRealm(getter_Copies(serverURI));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// the relpath is just past the serverpath
|
||||
|
|
|
@ -796,9 +796,10 @@ nsPop3Protocol::Error(PRInt32 err_code)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUnichar * alertString = nsnull;
|
||||
mStringService->GetStringByID(err_code, &alertString);
|
||||
if (alertString)
|
||||
dialog->Alert(alertString);
|
||||
mStringService->GetStringByID(err_code, &alertString);
|
||||
if (alertString) {
|
||||
dialog->Alert(nsnull, alertString);
|
||||
}
|
||||
nsCRT::free(alertString);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@
|
|||
#include "nsIPref.h"
|
||||
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nntpCore.h"
|
||||
|
||||
#undef GetPort // XXX Windows!
|
||||
|
@ -3867,7 +3868,7 @@ PRInt32 nsNNTPProtocol::DoCancel()
|
|||
|
||||
if (!cancelInfo.from) {
|
||||
GetNewsStringByName("cancelDisallowed", getter_Copies(alertText));
|
||||
rv = dialog->Alert(alertText);
|
||||
rv = dialog->Alert(nsnull, alertText);
|
||||
// XXX: todo, check rv?
|
||||
|
||||
status = MK_NNTP_CANCEL_DISALLOWED;
|
||||
|
@ -3892,7 +3893,7 @@ PRInt32 nsNNTPProtocol::DoCancel()
|
|||
/* Last chance to cancel the cancel.
|
||||
*/
|
||||
GetNewsStringByName("cancelConfirm", getter_Copies(confirmText));
|
||||
rv = dialog->Confirm(confirmText, &confirmCancelResult);
|
||||
rv = dialog->Confirm(nsnull, confirmText, &confirmCancelResult);
|
||||
// XXX: todo, check rv?
|
||||
}
|
||||
else {
|
||||
|
@ -3965,7 +3966,7 @@ PRInt32 nsNNTPProtocol::DoCancel()
|
|||
rv = prefs->GetBoolPref(PREF_NEWS_CANCEL_ALERT_ON_SUCCESS, &showAlertAfterCancel);
|
||||
if (NS_FAILED(rv) || showAlertAfterCancel) {
|
||||
GetNewsStringByName("messageCancelled", getter_Copies(alertText));
|
||||
rv = dialog->Alert(alertText);
|
||||
rv = dialog->Alert(nsnull, alertText);
|
||||
// XXX: todo, check rv?
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "nsIMsgWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
|
@ -70,6 +70,7 @@
|
|||
#include "nsIAppShellService.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
|
@ -1373,7 +1374,7 @@ NS_IMETHODIMP nsMsgNewsFolder::ForgetGroupUsername()
|
|||
rv = CreateNewsgroupUsernameUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, PR_FALSE, nsnull);
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1391,7 @@ NS_IMETHODIMP nsMsgNewsFolder::ForgetGroupPassword()
|
|||
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, PR_FALSE, nsnull);
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1400,32 +1401,28 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
nsIMsgWindow* aMsgWindow,
|
||||
char **aGroupPassword)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aGroupPassword);
|
||||
NS_ENSURE_ARG_POINTER(aGroupPassword);
|
||||
|
||||
if (!mGroupPassword) {
|
||||
// prompt the user for the password
|
||||
if (!mGroupPassword) {
|
||||
// prompt the user for the password
|
||||
|
||||
nsCOMPtr<nsINetPrompt> dialog;
|
||||
nsCOMPtr<nsIPrompt> dialog;
|
||||
|
||||
NS_ASSERTION(aMsgWindow,"no msg window, fix this, for now, use the hidden window");
|
||||
NS_ASSERTION(aMsgWindow,"no msg window, fix this, for now, use the hidden window");
|
||||
if (aMsgWindow) {
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get top level window
|
||||
nsCOMPtr<nsIWebShellContainer> topLevelWindow;
|
||||
rv = webShell->GetTopLevelWindow(getter_AddRefs(topLevelWindow));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
dialog = do_QueryInterface(topLevelWindow, &rv);
|
||||
dialog = do_GetInterface(webShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr <nsIAppShellService> appshellservice = do_GetService(kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1436,39 +1433,41 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!xulWindow) return NS_ERROR_FAILURE;
|
||||
|
||||
dialog = do_QueryInterface(xulWindow, &rv);
|
||||
dialog = do_GetInterface(xulWindow, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
NS_ASSERTION(dialog,"we didn't get a net prompt");
|
||||
if (dialog) {
|
||||
nsXPIDLString uniGroupPassword;
|
||||
if (dialog) {
|
||||
nsXPIDLString uniGroupPassword;
|
||||
|
||||
PRBool okayValue = PR_TRUE;
|
||||
PRBool okayValue = PR_TRUE;
|
||||
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = dialog->PromptPassword((const char *)signonURL, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniGroupPassword), &okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString realm = NS_ConvertToString(signonURL);
|
||||
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage, realm.GetUnicode(), PR_TRUE,
|
||||
getter_Copies(uniGroupPassword), &okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
*aGroupPassword = nsnull;
|
||||
return rv;
|
||||
}
|
||||
if (!okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
*aGroupPassword = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// we got a password back...so remember it
|
||||
nsCString aCStr; aCStr.AssignWithConversion(uniGroupPassword);
|
||||
rv = SetGroupPassword((const char *) aCStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// we got a password back...so remember it
|
||||
nsCString aCStr; aCStr.AssignWithConversion(uniGroupPassword);
|
||||
rv = SetGroupPassword((const char *) aCStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
} // if we got a prompt dialog
|
||||
} // if the password is empty
|
||||
} // if we got a prompt dialog
|
||||
} // if the password is empty
|
||||
|
||||
rv = GetGroupPassword(aGroupPassword);
|
||||
return rv;
|
||||
rv = GetGroupPassword(aGroupPassword);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1484,23 +1483,19 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const
|
|||
if (!mGroupUsername) {
|
||||
// prompt the user for the username
|
||||
|
||||
nsCOMPtr<nsINetPrompt> dialog;
|
||||
nsCOMPtr<nsIPrompt> dialog;
|
||||
|
||||
NS_ASSERTION(aMsgWindow,"no msg window, fix this, for now, use the hidden window");
|
||||
if (aMsgWindow) {
|
||||
// prompt the user for the password
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// get top level window
|
||||
nsCOMPtr<nsIWebShellContainer> topLevelWindow;
|
||||
rv = webShell->GetTopLevelWindow(getter_AddRefs(topLevelWindow));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
dialog = do_QueryInterface(topLevelWindow, &rv);
|
||||
// prompt the user for the password
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
dialog = do_GetInterface(webShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr <nsIAppShellService> appshellservice = do_GetService(kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1511,7 +1506,7 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!xulWindow) return NS_ERROR_FAILURE;
|
||||
|
||||
dialog = do_QueryInterface(xulWindow, &rv);
|
||||
dialog = do_GetInterface(xulWindow, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -1525,7 +1520,9 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const
|
|||
rv = CreateNewsgroupUsernameUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = dialog->Prompt((const char *)signonURL, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniGroupUsername), &okayValue);
|
||||
nsAutoString realm = NS_ConvertToString(signonURL);
|
||||
rv = dialog->Prompt(aPromptTitle, aPromptMessage, realm.GetUnicode(), nsnull,
|
||||
getter_Copies(uniGroupUsername), &okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!okayValue) // if the user pressed cancel, just return NULL;
|
||||
|
|
|
@ -1052,7 +1052,7 @@ NS_IMETHODIMP nsNntpService::CancelMessages(const char *hostname, const char *ne
|
|||
if (!messages) {
|
||||
nsAutoString alertText; alertText.AssignWithConversion("No articles are selected.");
|
||||
if (dialog)
|
||||
rv = dialog->Alert(alertText.GetUnicode());
|
||||
rv = dialog->Alert(nsnull, alertText.GetUnicode());
|
||||
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
@ -1068,7 +1068,7 @@ NS_IMETHODIMP nsNntpService::CancelMessages(const char *hostname, const char *ne
|
|||
if (count != 1) {
|
||||
nsAutoString alertText; alertText.AssignWithConversion("You can only cancel one article at a time.");
|
||||
if (dialog)
|
||||
rv = dialog->Alert(alertText.GetUnicode());
|
||||
rv = dialog->Alert(nsnull, alertText.GetUnicode());
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ NS_IMETHODIMP nsNntpService::Search(nsIMsgSearchSession *aSearchSession, nsIMsgW
|
|||
nsCOMPtr<nsIURI> uri;
|
||||
nsXPIDLCString serverUri;
|
||||
nsXPIDLString newsgroupName;
|
||||
rv = server->GetServerURI(getter_Copies(serverUri));
|
||||
rv = server->GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
aMsgFolder->GetName(getter_Copies(newsgroupName));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1309,7 +1309,7 @@ nsNntpService::UpdateCounts(nsINntpIncomingServer *aNntpServer, nsIMsgWindow *aM
|
|||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = server->GetServerURI(getter_Copies(serverUri));
|
||||
rv = server->GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = ConstructNntpUrl((const char *)serverUri, "", nsMsgKey_None, nsnull, getter_AddRefs(uri));
|
||||
|
@ -1337,7 +1337,7 @@ nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer, nsIM
|
|||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = server->GetServerURI(getter_Copies(serverUri));
|
||||
rv = server->GetServerPasswordRealm(getter_Copies(serverUri));
|
||||
|
||||
nsCAutoString uriStr;
|
||||
uriStr += (const char *)serverUri;
|
||||
|
|
|
@ -30,23 +30,21 @@ interface nsINetPrompt : nsISupports
|
|||
/**
|
||||
* Puts up an alert dialog with an OK button.
|
||||
*/
|
||||
void alert( in string url, in boolean stripurl, in wstring title, in wstring text);
|
||||
void alert(in string key, in wstring title, in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirm( in string url, in boolean stripurl, in wstring title, in wstring text);
|
||||
boolean confirm(in string key, in wstring title, in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a username/password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptUsernameAndPassword(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
boolean promptUsernameAndPassword(in string key,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring user,
|
||||
out wstring pwd);
|
||||
|
||||
|
@ -54,23 +52,19 @@ interface nsINetPrompt : nsISupports
|
|||
* Puts up a password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptPassword(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
boolean promptPassword(in string key,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a prompt dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean prompt(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring pwd);
|
||||
boolean prompt(in string key,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring pwd);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -28,20 +28,23 @@ interface nsIPrompt : nsISupports
|
|||
/**
|
||||
* Puts up an alert dialog with an OK button.
|
||||
*/
|
||||
void alert(in wstring text);
|
||||
void alert(in wstring dialogTitle,
|
||||
in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirm(in wstring text);
|
||||
boolean confirm(in wstring dialogTitle,
|
||||
in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons, and
|
||||
* a message with a single checkbox.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirmCheck(in wstring text,
|
||||
boolean confirmCheck(in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
|
@ -49,7 +52,9 @@ interface nsIPrompt : nsISupports
|
|||
* Puts up a text input dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean prompt(in wstring text,
|
||||
boolean prompt(in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in wstring defaultText,
|
||||
out wstring result);
|
||||
|
||||
|
@ -57,7 +62,10 @@ interface nsIPrompt : nsISupports
|
|||
* Puts up a username/password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptUsernameAndPassword(in wstring text,
|
||||
boolean promptUsernameAndPassword(in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in boolean persistPassword,
|
||||
out wstring user,
|
||||
out wstring pwd);
|
||||
|
||||
|
@ -65,38 +73,40 @@ interface nsIPrompt : nsISupports
|
|||
* Puts up a password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptPassword(in wstring text,
|
||||
in wstring title,
|
||||
boolean promptPassword(in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in boolean persistPassword,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a dialog box which has a list box of strings
|
||||
*/
|
||||
boolean select(in wstring inDialogTitle,
|
||||
in wstring inMsg,
|
||||
in PRUint32 inCount,
|
||||
[array, size_is(inCount)] in wstring inList,
|
||||
boolean select(in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in PRUint32 count,
|
||||
[array, size_is(count)] in wstring selectList,
|
||||
out long outSelection);
|
||||
|
||||
/**
|
||||
* Put up a universal dialog
|
||||
*/
|
||||
void universalDialog(in wstring inTitleMessage,
|
||||
in wstring inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
in wstring inMsg, /* main message for dialog */
|
||||
in wstring inCheckboxMsg, /* message for checkbox */
|
||||
in wstring inButton0Text, /* text for first button */
|
||||
in wstring inButton1Text, /* text for second button */
|
||||
in wstring inButton2Text, /* text for third button */
|
||||
in wstring inButton3Text, /* text for fourth button */
|
||||
in wstring inEditfield1Msg, /*message for first edit field */
|
||||
in wstring inEditfield2Msg, /* message for second edit field */
|
||||
inout wstring inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
inout wstring inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
in wstring inIConURL, /* url of icon to be displayed in dialog */
|
||||
inout boolean inoutCheckboxState, /* initial and final state of checkbox */
|
||||
in PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
in PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
in PRInt32 inEditField1Password, /* ??? */
|
||||
out PRInt32 outButtonPressed); /* number of button that was pressed (0 to 3) */
|
||||
void universalDialog(in wstring titleMessage,
|
||||
in wstring dialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
in wstring text, /* main message for dialog */
|
||||
in wstring checkboxMsg, /* message for checkbox */
|
||||
in wstring button0Text, /* text for first button */
|
||||
in wstring button1Text, /* text for second button */
|
||||
in wstring button2Text, /* text for third button */
|
||||
in wstring button3Text, /* text for fourth button */
|
||||
in wstring editfield1Msg, /*message for first edit field */
|
||||
in wstring editfield2Msg, /* message for second edit field */
|
||||
inout wstring editfield1Value, /* initial and final value for first edit field */
|
||||
inout wstring editfield2Value, /* initial and final value for second edit field */
|
||||
in wstring iconURL, /* url of icon to be displayed in dialog */
|
||||
inout boolean checkboxState, /* initial and final state of checkbox */
|
||||
in PRInt32 numberButtons, /* total number of buttons (0 to 4) */
|
||||
in PRInt32 numberEditfields, /* total number of edit fields (0 to 2) */
|
||||
in PRInt32 editField1Password, /* ??? */
|
||||
out PRInt32 buttonPressed); /* number of button that was pressed (0 to 3) */
|
||||
};
|
||||
|
|
|
@ -810,8 +810,11 @@ nsFtpConnectionThread::S_user() {
|
|||
message.AssignWithConversion("Enter username and password for "); //TODO localize it!
|
||||
message.AppendWithConversion(host);
|
||||
|
||||
rv = proxyprompter->PromptUsernameAndPassword(message.GetUnicode(),
|
||||
&user, &passwd, &retval);
|
||||
nsAutoString realm = NS_ConvertToString(host); // XXX i18n
|
||||
rv = proxyprompter->PromptUsernameAndPassword(nsnull,
|
||||
message.GetUnicode(),
|
||||
realm.GetUnicode(), PR_FALSE,
|
||||
&user, &passwd, &retval);
|
||||
|
||||
// if the user canceled or didn't supply a username we want to fail
|
||||
if (!retval || (user && !*user) )
|
||||
|
@ -889,9 +892,10 @@ nsFtpConnectionThread::S_pass() {
|
|||
message.AppendWithConversion(" on ");
|
||||
message.AppendWithConversion(host);
|
||||
|
||||
rv = proxyprompter->PromptPassword(message.GetUnicode(),
|
||||
title.GetUnicode(),
|
||||
&passwd, &retval);
|
||||
rv = proxyprompter->PromptPassword(title.GetUnicode(),
|
||||
message.GetUnicode(),
|
||||
NS_ConvertASCIItoUCS2(host).GetUnicode(),
|
||||
PR_FALSE, &passwd, &retval);
|
||||
|
||||
// we want to fail if the user canceled or didn't enter a password.
|
||||
if (!retval || (passwd && !*passwd) )
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
// Once other kinds of auth are up change TODO
|
||||
#include "nsBasicAuth.h"
|
||||
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
#include "nsINetPrompt.h"
|
||||
#include "nsProxiedService.h"
|
||||
|
||||
static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID);
|
||||
|
@ -1781,14 +1780,17 @@ nsHTTPChannel::Authenticate(const char *iChallenge, PRBool iProxyAuth)
|
|||
message.AppendWithConversion(iChallenge);
|
||||
|
||||
// Get url
|
||||
nsXPIDLCString urlCString;
|
||||
nsXPIDLCString urlCString;
|
||||
mURI->GetHost(getter_Copies(urlCString));
|
||||
|
||||
rv = mPrompter->PromptUsernameAndPassword(
|
||||
message.GetUnicode(),
|
||||
&user,
|
||||
&passwd,
|
||||
&retval);
|
||||
nsAutoString hostname = NS_ConvertToString(urlCString); // XXX i18n
|
||||
rv = mPrompter->PromptUsernameAndPassword(nsnull,
|
||||
message.GetUnicode(),
|
||||
hostname.GetUnicode(),
|
||||
PR_FALSE,
|
||||
&user,
|
||||
&passwd,
|
||||
&retval);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && (retval))
|
||||
{
|
||||
|
|
|
@ -1046,7 +1046,7 @@ nsWebShell::OnOverLink(nsIContent* aContent,
|
|||
NS_IMETHODIMP
|
||||
nsWebShell::GetLinkState(const nsString& aLinkURI, nsLinkState& aState)
|
||||
{
|
||||
aState = eLinkState_Unvisited;
|
||||
aState = eLinkState_Unvisited;
|
||||
|
||||
if(mGlobalHistory)
|
||||
{
|
||||
|
@ -1276,7 +1276,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendWithConversion(' ');
|
||||
errorMsg.Append(messageStr);
|
||||
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
}
|
||||
else if(aStatus == NS_ERROR_CONNECTION_REFUSED)
|
||||
{// Doc failed to load because we couldn't connect to the server.
|
||||
|
@ -1304,7 +1304,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendInt(port);
|
||||
}
|
||||
errorMsg.AppendWithConversion('.');
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
}
|
||||
else if(aStatus == NS_ERROR_NET_TIMEOUT)
|
||||
{// Doc failed to load because the socket function timed out.
|
||||
|
@ -1326,7 +1326,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
errorMsg.AppendWithConversion(host);
|
||||
errorMsg.AppendWithConversion('.');
|
||||
|
||||
prompter->Alert(errorMsg.GetUnicode());
|
||||
prompter->Alert(nsnull, errorMsg.GetUnicode());
|
||||
} // end NS_ERROR_NET_TIMEOUT
|
||||
} // end mDocLoader == loader
|
||||
|
||||
|
|
|
@ -2186,7 +2186,7 @@ nsBrowserWindow::OnStatus(nsIChannel* channel, nsISupports *ctxt, const PRUnicha
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Alert(const PRUnichar *text)
|
||||
nsBrowserWindow::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
|
||||
{
|
||||
nsCAutoString str; str.AssignWithConversion(text);
|
||||
printf("%cBrowser Window Alert: %s\n", '\007', str.GetBuffer());
|
||||
|
@ -2195,7 +2195,8 @@ nsBrowserWindow::Alert(const PRUnichar *text)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Confirm(const PRUnichar *text,
|
||||
nsBrowserWindow::Confirm(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
PRBool *result)
|
||||
{
|
||||
nsCAutoString str; str.AssignWithConversion(text);
|
||||
|
@ -2220,16 +2221,19 @@ nsBrowserWindow::Confirm(const PRUnichar *text,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::ConfirmCheck(const PRUnichar *text,
|
||||
nsBrowserWindow::ConfirmCheck(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *result)
|
||||
{
|
||||
return Confirm(text, result);
|
||||
return Confirm(dialogTitle, text, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Prompt(const PRUnichar *text,
|
||||
nsBrowserWindow::Prompt(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
const PRUnichar *defaultText,
|
||||
PRUnichar **result,
|
||||
PRBool *_retval)
|
||||
|
@ -2253,7 +2257,10 @@ nsBrowserWindow::Prompt(const PRUnichar *text,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::PromptUsernameAndPassword(const PRUnichar *text,
|
||||
nsBrowserWindow::PromptUsernameAndPassword(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar **user,
|
||||
PRUnichar **pwd,
|
||||
PRBool *_retval)
|
||||
|
@ -2283,8 +2290,10 @@ nsBrowserWindow::PromptUsernameAndPassword(const PRUnichar *text,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::PromptPassword(const PRUnichar *text,
|
||||
const PRUnichar *title,
|
||||
nsBrowserWindow::PromptPassword(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar **pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
|
|
|
@ -25,12 +25,13 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
/* Forward declarations.... */
|
||||
class nsIWebShell;
|
||||
class nsIWidget;
|
||||
class nsString;
|
||||
class nsIDOMWindow;
|
||||
class nsIPrompt;
|
||||
|
||||
// Interface ID for nsIWebShellWindow
|
||||
#define NS_IWEBSHELL_WINDOW_IID \
|
||||
{ 0x28dce479, 0xbf73, 0x11d2, { 0x96, 0xc8, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56}}
|
||||
|
@ -61,6 +62,8 @@ public:
|
|||
* @return always NS_OK
|
||||
*/
|
||||
NS_IMETHOD ShouldLoadDefaultPage(PRBool *aYes) = 0;
|
||||
|
||||
NS_IMETHOD GetPrompter(nsIPrompt* *result) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
|
|||
NS_ENSURE_ARG_POINTER(aSink);
|
||||
|
||||
if(aIID.Equals(NS_GET_IID(nsIPrompt)))
|
||||
return mXULWindow->QueryInterface(aIID, aSink);
|
||||
return mXULWindow->GetInterface(aIID, aSink);
|
||||
else
|
||||
return QueryInterface(aIID, aSink);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
|
|||
if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome)))
|
||||
*aSink = NS_STATIC_CAST(nsIWebBrowserChrome*, this);
|
||||
else if(aIID.Equals(NS_GET_IID(nsIPrompt)))
|
||||
return mXULWindow->QueryInterface(aIID, aSink);
|
||||
return mXULWindow->GetInterface(aIID, aSink);
|
||||
else
|
||||
return QueryInterface(aIID, aSink);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
/* Define Class IDs */
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
@ -46,7 +47,7 @@ PRBool GetNSIPrompt( nsCOMPtr<nsIPrompt> & outPrompt )
|
|||
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appShellService->GetHiddenWindow(getter_AddRefs(xulWindow));
|
||||
outPrompt = do_QueryInterface(xulWindow);
|
||||
outPrompt = do_GetInterface(xulWindow);
|
||||
if(outPrompt)
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
|
@ -63,29 +64,30 @@ nsNetSupportDialog::~nsNetSupportDialog()
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::Alert(const PRUnichar *text)
|
||||
NS_IMETHODIMP nsNetSupportDialog::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
|
||||
{
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->Alert( text );
|
||||
rv = dialogService->Alert(dialogTitle, text);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::Confirm(const PRUnichar *text, PRBool *returnValue)
|
||||
NS_IMETHODIMP nsNetSupportDialog::Confirm(const PRUnichar *dialogTitle, const PRUnichar *text, PRBool *returnValue)
|
||||
{
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->Confirm( text, returnValue );
|
||||
rv = dialogService->Confirm(dialogTitle, text, returnValue);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::ConfirmCheck(const PRUnichar *text,
|
||||
NS_IMETHODIMP nsNetSupportDialog::ConfirmCheck(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *returnValue)
|
||||
|
@ -94,7 +96,7 @@ NS_IMETHODIMP nsNetSupportDialog::ConfirmCheck(const PRUnichar *text,
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->ConfirmCheck( text, checkMsg, checkValue, returnValue );
|
||||
rv = dialogService->ConfirmCheck(dialogTitle, text, checkMsg, checkValue, returnValue);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -139,7 +141,9 @@ NS_IMETHODIMP nsNetSupportDialog::UniversalDialog
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::Prompt(const PRUnichar *text,
|
||||
NS_IMETHODIMP nsNetSupportDialog::Prompt(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
const PRUnichar *defaultText,
|
||||
PRUnichar **resultText,
|
||||
PRBool *returnValue)
|
||||
|
@ -148,12 +152,15 @@ NS_IMETHODIMP nsNetSupportDialog::Prompt(const PRUnichar *text,
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->Prompt( text, defaultText, resultText, returnValue );
|
||||
rv = dialogService->Prompt(dialogTitle, text, passwordRealm, defaultText, resultText, returnValue);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::PromptUsernameAndPassword(const PRUnichar *text,
|
||||
NS_IMETHODIMP nsNetSupportDialog::PromptUsernameAndPassword(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar **user,
|
||||
PRUnichar **pwd,
|
||||
PRBool *returnValue)
|
||||
|
@ -162,22 +169,32 @@ NS_IMETHODIMP nsNetSupportDialog::PromptUsernameAndPassword(const PRUnichar *tex
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->PromptUsernameAndPassword( text, user, pwd, returnValue );
|
||||
rv = dialogService->PromptUsernameAndPassword(dialogTitle, text, passwordRealm, persistPassword, user, pwd, returnValue);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::PromptPassword(const PRUnichar *text, const PRUnichar *title, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP nsNetSupportDialog::PromptPassword(const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar **pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
if( GetNSIPrompt( dialogService ) )
|
||||
rv = dialogService->PromptPassword( text, title, pwd, _retval );
|
||||
rv = dialogService->PromptPassword(dialogTitle, text, passwordRealm, persistPassword, pwd, _retval);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsNetSupportDialog::Select(const PRUnichar *inDialogTitle, const PRUnichar *inMsg, PRUint32 inCount, const PRUnichar **inList, PRInt32 *outSelection, PRBool *_retval)
|
||||
nsresult nsNetSupportDialog::Select(const PRUnichar *inDialogTitle,
|
||||
const PRUnichar *inMsg,
|
||||
PRUint32 inCount,
|
||||
const PRUnichar **inList,
|
||||
PRInt32 *outSelection,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr< nsIPrompt> dialogService;
|
||||
|
|
|
@ -256,8 +256,6 @@ NS_INTERFACE_MAP_BEGIN(nsWebShellWindow)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIWebShellWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocumentLoaderObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
|
||||
NS_INTERFACE_MAP_ENTRY(nsINetPrompt)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXULWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||
|
@ -1432,7 +1430,7 @@ void nsWebShellWindow::LoadContentAreas() {
|
|||
char *urlChar;
|
||||
nsIWebShell *contentShell;
|
||||
nsresult rv;
|
||||
for (endPos = 0; endPos < searchSpec.Length(); ) {
|
||||
for (endPos = 0; endPos < (PRInt32)searchSpec.Length(); ) {
|
||||
// extract contentAreaID and URL substrings
|
||||
begPos = endPos;
|
||||
eqPos = searchSpec.FindChar('=', PR_FALSE,begPos);
|
||||
|
@ -1730,8 +1728,264 @@ NS_IMETHODIMP nsWebShellWindow::Destroy()
|
|||
return nsXULWindow::Destroy();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XXX What a mess we have here w.r.t. our prompting interfaces. As far as I
|
||||
// can tell, the situation looks something like this:
|
||||
//
|
||||
// - clients get the nsIPrompt from the web shell window
|
||||
// - the web shell window passes control to nsCommonDialogs
|
||||
// - nsCommonDialogs calls into js with the current dom window
|
||||
// - the dom window gets the nsIPrompt of its tree owner
|
||||
// - somewhere along the way a real dialog comes up
|
||||
//
|
||||
// This little transducer maps the nsIPrompt interface to the nsICommonDialogs
|
||||
// interface. Ideally, nsIPrompt would be implemented by nsIDOMWindow which
|
||||
// would eliminate the need for this.
|
||||
|
||||
class nsDOMWindowPrompter : public nsIPrompt
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROMPT
|
||||
|
||||
nsDOMWindowPrompter(nsIDOMWindow* window);
|
||||
virtual ~nsDOMWindowPrompter() {}
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMWindow> mDOMWindow;
|
||||
nsCOMPtr<nsICommonDialogs> mCommonDialogs;
|
||||
};
|
||||
|
||||
static nsresult
|
||||
NS_NewDOMWindowPrompter(nsIPrompt* *result, nsIDOMWindow* window)
|
||||
{
|
||||
nsresult rv;
|
||||
nsDOMWindowPrompter* prompter = new nsDOMWindowPrompter(window);
|
||||
if (prompter == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(prompter);
|
||||
rv = prompter->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(prompter);
|
||||
return rv;
|
||||
}
|
||||
*result = prompter;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMWindowPrompter, nsIPrompt)
|
||||
|
||||
nsDOMWindowPrompter::nsDOMWindowPrompter(nsIDOMWindow* window)
|
||||
: mDOMWindow(window)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMWindowPrompter::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mCommonDialogs = do_GetService(kCommonDialogsCID, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::Alert(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Alert"); // XXX i18n
|
||||
rv = mCommonDialogs->Alert(mDOMWindow, title.GetUnicode(), text);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::Confirm(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Confirm"); // XXX i18n
|
||||
rv = mCommonDialogs->Confirm(mDOMWindow, title.GetUnicode(), text, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::ConfirmCheck(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Confirm"); // XXX i18n
|
||||
rv = mCommonDialogs->ConfirmCheck(mDOMWindow, title.GetUnicode(), text,
|
||||
checkMsg, checkValue, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::Prompt(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
const PRUnichar* defaultText,
|
||||
PRUnichar* *result,
|
||||
PRBool *_retval)
|
||||
{
|
||||
// ignore passwordRealm here?
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Prompt"); // XXX i18n
|
||||
rv = mCommonDialogs->Prompt(mDOMWindow, title.GetUnicode(), text,
|
||||
defaultText, result, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::PromptUsernameAndPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar* *user,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
// ignore passwordRealm and persistPassword here?
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Prompt"); // XXX i18n
|
||||
rv = mCommonDialogs->PromptUsernameAndPassword(mDOMWindow, title.GetUnicode(), text,
|
||||
user, pwd, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::PromptPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
// ignore passwordRealm and persistPassword here?
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Prompt"); // XXX i18n
|
||||
rv = mCommonDialogs->PromptPassword(mDOMWindow, title.GetUnicode(), text,
|
||||
pwd, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::Select(const PRUnichar *dialogTitle,
|
||||
const PRUnichar* inMsg,
|
||||
PRUint32 inCount,
|
||||
const PRUnichar **inList,
|
||||
PRInt32 *outSelection,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString title(dialogTitle);
|
||||
if (title == nsnull)
|
||||
title.AssignWithConversion("Select"); // XXX i18n
|
||||
rv = mCommonDialogs->Select(mDOMWindow, title.GetUnicode(), inMsg,
|
||||
inCount, inList, outSelection, _retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowPrompter::UniversalDialog(const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
const PRUnichar *inMsg, /* main message for dialog */
|
||||
const PRUnichar *inCheckboxMsg, /* message for checkbox */
|
||||
const PRUnichar *inButton0Text, /* text for first button */
|
||||
const PRUnichar *inButton1Text, /* text for second button */
|
||||
const PRUnichar *inButton2Text, /* text for third button */
|
||||
const PRUnichar *inButton3Text, /* text for fourth button */
|
||||
const PRUnichar *inEditfield1Msg, /*message for first edit field */
|
||||
const PRUnichar *inEditfield2Msg, /* message for second edit field */
|
||||
PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */
|
||||
/* examples are
|
||||
"chrome://global/skin/question-icon.gif" for question mark,
|
||||
"chrome://global/skin/alert-icon.gif" for exclamation mark
|
||||
*/
|
||||
PRBool *inoutCheckboxState, /* initial and final state of check box */
|
||||
PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mCommonDialogs->UniversalDialog(mDOMWindow,
|
||||
inTitleMessage,
|
||||
inDialogTitle,
|
||||
inMsg,
|
||||
inCheckboxMsg,
|
||||
inButton0Text,
|
||||
inButton1Text,
|
||||
inButton2Text,
|
||||
inButton3Text,
|
||||
inEditfield1Msg,
|
||||
inEditfield2Msg,
|
||||
inoutEditfield1Value,
|
||||
inoutEditfield2Value,
|
||||
inIConURL,
|
||||
inoutCheckboxState,
|
||||
inNumberButtons,
|
||||
inNumberEditfields,
|
||||
inEditField1Password,
|
||||
outButtonPressed);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShellWindow::GetPrompter(nsIPrompt* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mPrompter == nsnull) {
|
||||
nsIWebShell* tempWebShell;
|
||||
GetWebShell(tempWebShell);
|
||||
nsCOMPtr<nsIWebShell> webShell(dont_AddRef(tempWebShell));
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
rv = NS_NewDOMWindowPrompter(getter_AddRefs(prompt), domWindow);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// wrap the nsDOMWindowPrompter in a nsISingleSignOnPrompt:
|
||||
rv = NS_NewSingleSignOnPrompt(getter_AddRefs(mPrompter), prompt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
*result = mPrompter;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIPrompt
|
||||
NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar *text)
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1752,7 +2006,9 @@ NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar *text)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar *text, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1772,7 +2028,11 @@ NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar *text, PRBool *_retval)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1841,7 +2101,12 @@ NS_IMETHODIMP nsWebShellWindow::UniversalDialog
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
const PRUnichar* defaultText,
|
||||
PRUnichar* *result,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1862,7 +2127,13 @@ NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar *text, const PRUnichar *d
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar* *user,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1884,7 +2155,12 @@ nsString defaultTitle; defaultTitle.AssignWithConversion("Prompt Username and Pa
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar *text, const PRUnichar *title, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRBool persistPassword,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
|
@ -1899,7 +2175,7 @@ NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar *text, const PRUn
|
|||
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||
if ( NS_SUCCEEDED( rv ) )
|
||||
rv = dialog->PromptPassword( domWindow, title, text, pwd, _retval );
|
||||
rv = dialog->PromptPassword( domWindow, dialogTitle, text, pwd, _retval );
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1922,30 +2198,30 @@ NS_IMETHODIMP nsWebShellWindow::Select( const PRUnichar *inDialogTitle, const PR
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Alert(const char *url, PRBool stripUrl, const PRUnichar *title, const PRUnichar *text)
|
||||
NS_IMETHODIMP nsWebShellWindow::Alert(const char *key, const PRUnichar *title, const PRUnichar *text)
|
||||
{
|
||||
return Alert( text );
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Confirm(const char *url, PRBool stripUrl, const PRUnichar *title, const PRUnichar *text, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::Confirm(const char *key, const PRUnichar *title, const PRUnichar *text, PRBool *_retval)
|
||||
{
|
||||
return Confirm( text, _retval );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const char *url, PRBool stripUrl, const PRUnichar *title, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return PromptUsernameAndPassword(text,user, pwd, _retval);
|
||||
return PromptUsernameAndPassword(text, user, pwd, _retval);
|
||||
}
|
||||
nsCOMPtr<nsIPrompt> prompter = this;
|
||||
return wallet->PromptUsernameAndPasswordURL(text,user, pwd, url, stripUrl, prompter, _retval);
|
||||
return wallet->PromptUsernameAndPassword(text, user, pwd, key, prompter, PR_TRUE, _retval);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const char *url, PRBool stripUrl, const PRUnichar *title, const PRUnichar *text, PRUnichar **pwd, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
|
||||
|
@ -1953,10 +2229,10 @@ NS_IMETHODIMP nsWebShellWindow::PromptPassword(const char *url, PRBool stripUrl,
|
|||
return PromptPassword(text, title, pwd, _retval);
|
||||
}
|
||||
nsCOMPtr<nsIPrompt> prompter = this;
|
||||
return wallet->PromptPasswordURL(text, pwd, url, stripUrl, prompter, _retval);
|
||||
return wallet->PromptPassword(text, pwd, key, prompter, PR_TRUE, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Prompt(const char *url, PRBool stripUrl, const PRUnichar *title, const PRUnichar *text, PRUnichar **value, PRBool *_retval)
|
||||
NS_IMETHODIMP nsWebShellWindow::Prompt(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **value, PRBool *_retval)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
|
||||
|
@ -1964,5 +2240,11 @@ NS_IMETHODIMP nsWebShellWindow::Prompt(const char *url, PRBool stripUrl, const P
|
|||
return Prompt(text, title, value, _retval);
|
||||
}
|
||||
nsCOMPtr<nsIPrompt> prompter = this;
|
||||
return wallet->PromptURL(text, nsnull, value, url, stripUrl, prompter, _retval);
|
||||
return wallet->Prompt(text, nsnull, value, key, prompter, _retval);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "nsITimer.h"
|
||||
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsINetPrompt.h"
|
||||
// can't use forward class decl's because of template bugs on Solaris
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -62,9 +61,7 @@ class nsWebShellWindow : public nsXULWindow,
|
|||
public nsIWebShellWindow,
|
||||
public nsIWebShellContainer,
|
||||
public nsIDocumentLoaderObserver,
|
||||
public nsIDocumentObserver,
|
||||
public nsIPrompt,
|
||||
public nsINetPrompt
|
||||
public nsIDocumentObserver
|
||||
|
||||
{
|
||||
public:
|
||||
|
@ -90,6 +87,7 @@ public:
|
|||
NS_IMETHOD GetWidget(nsIWidget *& aWidget);
|
||||
NS_IMETHOD GetDOMWindow(nsIDOMWindow** aDOMWindow);
|
||||
NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindow** aDOMWindow);
|
||||
NS_IMETHOD GetPrompter(nsIPrompt* *result);
|
||||
// nsWebShellWindow methods...
|
||||
nsresult Initialize(nsIXULWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl,
|
||||
PRBool aCreatedVisible, PRBool aLoadDefaultPage,
|
||||
|
@ -167,11 +165,6 @@ public:
|
|||
// nsIBaseWindow
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
// nsIPrompt
|
||||
NS_DECL_NSIPROMPT
|
||||
|
||||
// nsINetPrompt
|
||||
NS_DECL_NSINETPROMPT
|
||||
protected:
|
||||
|
||||
void LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWindow);
|
||||
|
@ -206,6 +199,7 @@ protected:
|
|||
nsCOMPtr<nsITimer> mSPTimer;
|
||||
PRBool mSPTimerSize, mSPTimerPosition;
|
||||
PRLock * mSPTimerLock;
|
||||
nsCOMPtr<nsIPrompt> mPrompter;
|
||||
|
||||
void SetPersistenceTimer(PRBool aSize, PRBool aPosition);
|
||||
static void FirePersistenceTimer(nsITimer *aTimer, void *aClosure);
|
||||
|
|
|
@ -101,8 +101,16 @@ NS_INTERFACE_MAP_END
|
|||
|
||||
NS_IMETHODIMP nsXULWindow::GetInterface(const nsIID& aIID, void** aSink)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(aSink);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
|
||||
// XXX until nsIWebShellWindow goes away:
|
||||
nsCOMPtr<nsIWebShellWindow> webShellWin =
|
||||
do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this), &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return webShellWin->GetPrompter((nsIPrompt**)aSink);
|
||||
}
|
||||
if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome)) &&
|
||||
NS_SUCCEEDED(EnsureContentTreeOwner()) &&
|
||||
NS_SUCCEEDED(mContentTreeOwner->QueryInterface(aIID, aSink)))
|
||||
|
|
|
@ -2644,8 +2644,8 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
|||
nsAutoString stopOption;
|
||||
getLocaleString("WebPageAskStopOption", stopOption);
|
||||
PRBool stopCheckingFlag = PR_FALSE;
|
||||
rv = dialog->ConfirmCheck(promptStr.GetUnicode(), stopOption.GetUnicode(),
|
||||
&stopCheckingFlag, &openURLFlag);
|
||||
rv = dialog->ConfirmCheck(nsnull, promptStr.GetUnicode(), stopOption.GetUnicode(),
|
||||
&stopCheckingFlag, &openURLFlag);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
openURLFlag = PR_FALSE;
|
||||
|
|
|
@ -2393,7 +2393,7 @@ nsInstall::Alert(nsString& string)
|
|||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
return dialog->Alert(string.GetUnicode());
|
||||
return dialog->Alert(nsnull, string.GetUnicode());
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -2406,7 +2406,7 @@ nsInstall::Confirm(nsString& string, PRBool* aReturn)
|
|||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
return dialog->Confirm(string.GetUnicode(), aReturn);
|
||||
return dialog->Confirm(nsnull, string.GetUnicode(), aReturn);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -335,7 +335,8 @@ PRBool nsXPInstallManager::ConfirmChromeInstall()
|
|||
NS_WITH_SERVICE(nsIPrompt, dlgService, kNetSupportDialogCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = dlgService->ConfirmCheck( confirmText,
|
||||
rv = dlgService->ConfirmCheck( nsnull,
|
||||
confirmText,
|
||||
applyNowText,
|
||||
&mSelectChrome,
|
||||
&bInstall );
|
||||
|
|
Загрузка…
Ссылка в новой задаче