зеркало из https://github.com/mozilla/gecko-dev.git
fix bug 44146, parent window for dialogs, r=dveditz
This commit is contained in:
Родитель
6f4e225a79
Коммит
9f2ec357d2
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIPrompt.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsString.h"
|
||||
|
@ -51,7 +52,7 @@ interface nsIWalletService : nsISupports {
|
|||
[noscript]void WALLET_PostEdit(in nsAutoString walletList);
|
||||
boolean WALLET_ChangePassword();
|
||||
void WALLET_DeleteAll();
|
||||
PRUint32 WALLET_RequestToCapture(in nsIPresShell shell);
|
||||
PRUint32 WALLET_RequestToCapture(in nsIPresShell shell, in nsIDOMWindow win);
|
||||
boolean WALLET_Prefill(in nsIPresShell shell, in boolean quick);
|
||||
[noscript]void WALLET_PrefillReturn(in nsAutoString results);
|
||||
void WALLET_FetchFromNetCenter();
|
||||
|
|
|
@ -89,8 +89,8 @@ NS_IMETHODIMP nsWalletlibService::WALLET_DeleteAll() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_RequestToCapture(nsIPresShell* shell, PRUint32* status) {
|
||||
::WLLT_RequestToCapture(shell, status);
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_RequestToCapture(nsIPresShell* shell, nsIDOMWindow* win, PRUint32* status) {
|
||||
::WLLT_RequestToCapture(shell, win, status);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1912,6 +1912,7 @@ si_RememberSignonData
|
|||
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
|
||||
|
||||
if (si_OkToSave(passwordRealm, data2->value, window)) {
|
||||
Wallet_GiveCaveat(window);
|
||||
for (j=0; j<signonData->Count(); j++) {
|
||||
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));
|
||||
nsAutoString value = data2->value;
|
||||
|
|
|
@ -841,16 +841,18 @@ Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window)
|
|||
}
|
||||
|
||||
PUBLIC void
|
||||
Wallet_Alert(PRUnichar * szMessage)
|
||||
Wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return; // XXX should return the error
|
||||
}
|
||||
|
||||
const nsAutoString message = szMessage;
|
||||
res = dialog->Alert(nsnull, message.GetUnicode());
|
||||
PRUnichar * title = Wallet_Localize("CaveatTitle");
|
||||
res = dialog->Alert(window, title, message.GetUnicode());
|
||||
Recycle(title);
|
||||
return; // XXX should return the error
|
||||
}
|
||||
|
||||
|
@ -1021,14 +1023,6 @@ PRIVATE nsresult EncryptString (const char * text, char *& crypt) {
|
|||
crypt[PL_strlen(PREFIX) + PL_strlen(crypt0)] = '\0';
|
||||
Recycle(crypt0);
|
||||
|
||||
/* test for first obscuring 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);
|
||||
Recycle(message);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1892,6 +1886,17 @@ wallet_ReadFromURLFieldToSchemaFile
|
|||
/* The following are utility routines for the main wallet processing */
|
||||
/*********************************************************************/
|
||||
|
||||
PUBLIC void
|
||||
Wallet_GiveCaveat(nsIDOMWindow* window) {
|
||||
/* 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);
|
||||
Recycle(message);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wallet_GetHostFile(nsIURI * url, nsString& outHostFile)
|
||||
{
|
||||
|
@ -2947,7 +2952,7 @@ if (!changingPassword) {
|
|||
SI_SetBoolPref(pref_Crypto, SI_GetBoolPref(pref_Crypto, PR_TRUE));
|
||||
|
||||
// message = Wallet_Localize("Converted");
|
||||
// Wallet_Alert(message);
|
||||
//????? Wallet_Alert(message);
|
||||
// Recycle(message);
|
||||
level--;
|
||||
return 0; /* this is PREF_NOERROR but we no longer include prefapi.h */
|
||||
|
@ -2957,7 +2962,7 @@ fail:
|
|||
|
||||
/* alert the user to the failure */
|
||||
message = Wallet_Localize("NotConverted");
|
||||
Wallet_Alert(message);
|
||||
//????? Wallet_Alert(message);
|
||||
Recycle(message);
|
||||
level--;
|
||||
return 1;
|
||||
|
@ -3259,7 +3264,8 @@ WLLT_Prefill(nsIPresShell* shell, PRBool quick, PRBool* doPrefillMessage)
|
|||
}
|
||||
|
||||
PUBLIC void
|
||||
WLLT_RequestToCapture(nsIPresShell* shell, PRUint32* status) {
|
||||
WLLT_RequestToCapture(nsIPresShell* shell, nsIDOMWindow* win, PRUint32* status) {
|
||||
|
||||
/* starting with the present shell, get each form element and put them on a list */
|
||||
nsresult result;
|
||||
PRInt32 captureCount = 0;
|
||||
|
@ -3346,6 +3352,8 @@ WLLT_RequestToCapture(nsIPresShell* shell, PRUint32* status) {
|
|||
if (gEncryptionFailure) {
|
||||
*status = -1; /* UnableToCapture */
|
||||
} else if (captureCount) {
|
||||
/* give caveat if this is the first time data is being captured */
|
||||
Wallet_GiveCaveat(win);
|
||||
*status = 0; /* Captured */
|
||||
} else {
|
||||
*status = +1; /* NotCaptured */
|
||||
|
@ -3527,7 +3535,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);
|
||||
Wallet_Alert(notification, window);
|
||||
Recycle(notification);
|
||||
}
|
||||
#else
|
||||
|
@ -3535,6 +3543,9 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindow* window) {
|
|||
if (wallet_GetFormsCapturingPref() &&
|
||||
(OKToPrompt) && wallet_OKToCapture(URLName, window)) {
|
||||
|
||||
/* give caveat if this is the first time data is being captured */
|
||||
Wallet_GiveCaveat(window);
|
||||
|
||||
/* conditions all met, now save it */
|
||||
for (PRUint32 elementY = 0; elementY < numElements; elementY++) {
|
||||
nsIDOMNode* elementNode = nsnull;
|
||||
|
|
|
@ -60,7 +60,7 @@ extern void
|
|||
WLLT_PrefillReturn(const nsString& results);
|
||||
|
||||
extern void
|
||||
WLLT_RequestToCapture(nsIPresShell* shell, PRUint32* status);
|
||||
WLLT_RequestToCapture(nsIPresShell* shell, nsIDOMWindow * win, PRUint32* status);
|
||||
|
||||
extern nsresult
|
||||
WLLT_Prefill(nsIPresShell* shell, PRBool quick, PRBool* doPrefillMessage);
|
||||
|
@ -102,6 +102,8 @@ extern PRBool Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindow* window);
|
|||
|
||||
extern PRInt32 Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window);
|
||||
|
||||
extern void Wallet_GiveCaveat(nsIDOMWindow* window);
|
||||
|
||||
extern nsresult
|
||||
Wallet_Encrypt2(const nsString& text, nsString& crypt);
|
||||
|
||||
|
|
|
@ -64,3 +64,4 @@ PasswordNotChanged = Unable to change the password that protects your sensitive
|
|||
PasswordExpired = Your sensitive information is now locked.
|
||||
PasswordNotExpired = Unable to lock your sensitive information.
|
||||
Caveat = Saving Passwords and Other Sensitive Information##Password Manager and Form Manager will save passwords, user names, and other sensitive information and enter them for you automatically when they are required.#This sensitive information is stored on your computer in a file that's difficult, but not impossible, to read.#If other people have access to your computer, you may want to password protect the stored sensitive information by choosing a Personal Security Password.#If you choose to password protect your stored information, you will be asked to provide your Personal Security Password from time to time. This approach provides better security but is slightly less convenient.#To password protect stored information, choose Preferences from the Edit menu, open the Advanced category, choose Forms and Passwords, and check 'Use encryption when storing sensitive data.'
|
||||
CaveatTitle = Warning
|
||||
|
|
|
@ -929,7 +929,7 @@ nsBrowserInstance::WalletRequestToCapture(nsIDOMWindow* aWin, PRUint32* status)
|
|||
kIWalletServiceIID,
|
||||
(nsISupports **)&walletservice);
|
||||
if ((NS_OK == res) && (nsnull != walletservice)) {
|
||||
res = walletservice->WALLET_RequestToCapture(presShell, status);
|
||||
res = walletservice->WALLET_RequestToCapture(presShell, aWin, status);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, walletservice);
|
||||
return NS_OK;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче