Fix the security warning dialogs to work as designed for Firebird:

- All dialogs will appear the first time a user encounters them
 - The "show every time" checkbox will default to off
 - If the user checks the checkbox to see the dialogs every time, the choice will be remembered.

Because of the change in default prefs, this will cause Firebird users to see these dialogs again (but defaulted to not show after that) when upgrading.  Bug 172091, r=brendan, sr=ben.
This commit is contained in:
bryner%brianryner.com 2003-12-31 23:03:08 +00:00
Родитель 04a0be1315
Коммит cb9dbe008a
3 изменённых файлов: 40 добавлений и 12 удалений

Просмотреть файл

@ -651,9 +651,9 @@ pref("network.protocol-handler.external.news" , true); // for news
// failing over to the system handlers.
pref("network.protocol-handler.expose-all", true);
// Default security warning dialogs to off
pref("security.warn_entering_secure", false);
pref("security.warn_entering_weak", false);
pref("security.warn_leaving_secure", false);
pref("security.warn_viewing_mixed", false);
pref("security.warn_submit_insecure", false);
// Default security warning dialogs to show once.
pref("security.warn_entering_secure.show_once", true);
pref("security.warn_entering_weak.show_once", true);
pref("security.warn_leaving_secure.show_once", true);
pref("security.warn_viewing_mixed.show_once", true);
pref("security.warn_submit_insecure.show_once", true);

Просмотреть файл

@ -651,9 +651,9 @@ pref("network.protocol-handler.external.news" , true); // for news
// failing over to the system handlers.
pref("network.protocol-handler.expose-all", true);
// Default security warning dialogs to off
pref("security.warn_entering_secure", false);
pref("security.warn_entering_weak", false);
pref("security.warn_leaving_secure", false);
pref("security.warn_viewing_mixed", false);
pref("security.warn_submit_insecure", false);
// Default security warning dialogs to show once.
pref("security.warn_entering_secure.show_once", true);
pref("security.warn_entering_weak.show_once", true);
pref("security.warn_leaving_secure.show_once", true);
pref("security.warn_viewing_mixed.show_once", true);
pref("security.warn_submit_insecure.show_once", true);

Просмотреть файл

@ -137,6 +137,20 @@ nsSecurityWarningDialogs::AlertDialog(nsIInterfaceRequestor *ctx, const char *pr
// Stop if alert is not requested
if (!prefValue) return NS_OK;
// Check for a show-once pref for this dialog.
// If the show-once pref is set to true:
// - The default value of the "show every time" checkbox is unchecked
// - If the user checks the checkbox, we clear the show-once pref.
nsCAutoString showOncePref(prefName);
showOncePref += ".show_once";
PRBool showOnce = PR_FALSE;
mPref->GetBoolPref(showOncePref.get(), &showOnce);
if (showOnce)
prefValue = PR_FALSE;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -157,6 +171,8 @@ nsSecurityWarningDialogs::AlertDialog(nsIInterfaceRequestor *ctx, const char *pr
if (!prefValue) {
mPref->SetBoolPref(prefName, PR_FALSE);
} else if (showOnce) {
mPref->SetBoolPref(showOncePref.get(), PR_FALSE);
}
return rv;
@ -211,6 +227,16 @@ nsSecurityWarningDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *
return NS_OK;
}
// See AlertDialog() for a description of how showOnce works.
nsCAutoString showOncePref(prefName);
showOncePref += ".show_once";
PRBool showOnce = PR_FALSE;
mPref->GetBoolPref(showOncePref.get(), &showOnce);
if (showOnce)
prefValue = PR_FALSE;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -260,6 +286,8 @@ nsSecurityWarningDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *
if (!prefValue && prefName != nsnull) {
mPref->SetBoolPref(prefName, PR_FALSE);
} else if (prefValue && showOnce) {
mPref->SetBoolPref(showOncePref.get(), PR_TRUE);
}
return rv;