bug 45981, no blue-box dialog for browser-generated login forms, r=dveditz

git-svn-id: svn://10.0.0.236/trunk@74691 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
morse%netscape.com 2000-07-24 21:16:18 +00:00
parent 711d526c7d
commit f4a060f4d6
3 changed files with 28 additions and 11 deletions

View File

@ -1921,7 +1921,7 @@ si_RememberSignonData
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
if (si_OkToSave(passwordRealm, data2->value, window)) {
Wallet_GiveCaveat(window);
Wallet_GiveCaveat(window, nsnull);
for (j=0; j<signonData->Count(); j++) {
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
nsAutoString value = data2->value;
@ -2264,6 +2264,7 @@ SINGSIGN_PromptUsernameAndPassword
return NS_OK;
}
if (checked) {
Wallet_GiveCaveat(nsnull, dialog);
si_RememberSignonDataFromBrowser (passwordRealm, nsAutoString(*user), nsAutoString(*pwd));
}

View File

@ -840,8 +840,8 @@ Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window)
return buttonPressed;
}
PUBLIC void
Wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
{
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
@ -856,6 +856,17 @@ Wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
return; // XXX should return the error
}
PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIPrompt* dialog)
{
nsresult res;
const nsAutoString message = szMessage;
PRUnichar * title = Wallet_Localize("CaveatTitle");
res = dialog->Alert(title, message.GetUnicode());
Recycle(title);
return; // XXX should return the error
}
PUBLIC PRBool
Wallet_CheckConfirmYN
(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue,
@ -1887,12 +1898,16 @@ wallet_ReadFromURLFieldToSchemaFile
/*********************************************************************/
PUBLIC void
Wallet_GiveCaveat(nsIDOMWindow* window) {
Wallet_GiveCaveat(nsIDOMWindow* window, nsIPrompt* dialog) {
/* test for first capturing of data ever and give caveat if so */
if (!SI_GetBoolPref(pref_Caveat, PR_FALSE)) {
SI_SetBoolPref(pref_Caveat, PR_TRUE);
PRUnichar * message = Wallet_Localize("Caveat");
Wallet_Alert(message, window);
if (window) {
wallet_Alert(message, window);
} else {
wallet_Alert(message, dialog);
}
Recycle(message);
}
}
@ -2956,7 +2971,7 @@ if (!changingPassword) {
SI_SetBoolPref(pref_Crypto, SI_GetBoolPref(pref_Crypto, PR_TRUE));
// message = Wallet_Localize("Converted");
// Wallet_Alert(message, (nsIDOMWindow *)window);
// wallet_Alert(message, (nsIDOMWindow *)window);
// Recycle(message);
level--;
return 0; /* this is PREF_NOERROR but we no longer include prefapi.h */
@ -2966,7 +2981,7 @@ fail:
/* alert the user to the failure */
message = Wallet_Localize("NotConverted");
Wallet_Alert(message, (nsIDOMWindow *)window);
wallet_Alert(message, (nsIDOMWindow *)window);
Recycle(message);
level--;
return 1;
@ -3364,7 +3379,7 @@ WLLT_RequestToCapture(nsIPresShell* shell, nsIDOMWindow* win, PRUint32* status)
*status = -1; /* UnableToCapture */
} else if (captureCount) {
/* give caveat if this is the first time data is being captured */
Wallet_GiveCaveat(win);
Wallet_GiveCaveat(win, nsnull);
*status = 0; /* Captured */
} else {
*status = +1; /* NotCaptured */
@ -3546,7 +3561,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindow* window) {
/* conditions all met, now give notification */
PRUnichar * notification = Wallet_Localize("WalletNotification");
wallet_SetWalletNotificationPref(PR_TRUE);
Wallet_Alert(notification, window);
wallet_Alert(notification, window);
Recycle(notification);
}
#else
@ -3555,7 +3570,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindow* window) {
(OKToPrompt) && wallet_OKToCapture(URLName, window)) {
/* give caveat if this is the first time data is being captured */
Wallet_GiveCaveat(window);
Wallet_GiveCaveat(window, nsnull);
/* conditions all met, now save it */
for (PRUint32 elementY = 0; elementY < numElements; elementY++) {

View File

@ -33,6 +33,7 @@
#include "nsIPresShell.h"
#include "nsString.h"
#include "nsFileSpec.h"
#include "nsIPrompt.h"
XP_BEGIN_PROTOS
@ -102,7 +103,7 @@ extern PRBool Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindow* window);
extern PRInt32 Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window);
extern void Wallet_GiveCaveat(nsIDOMWindow* window);
extern void Wallet_GiveCaveat(nsIDOMWindow* window, nsIPrompt* dialog);
extern nsresult
Wallet_Encrypt2(const nsString& text, nsString& crypt);