diff --git a/mozilla/browser/app/profile/all.js b/mozilla/browser/app/profile/all.js index 3794dbd2c25..c91b069bb16 100644 --- a/mozilla/browser/app/profile/all.js +++ b/mozilla/browser/app/profile/all.js @@ -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); diff --git a/mozilla/browser/app/profile/firebird.js b/mozilla/browser/app/profile/firebird.js index 3794dbd2c25..c91b069bb16 100644 --- a/mozilla/browser/app/profile/firebird.js +++ b/mozilla/browser/app/profile/firebird.js @@ -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); diff --git a/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp b/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp index 1855b68f12f..d9c0d437b1f 100644 --- a/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp +++ b/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp @@ -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 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 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;