From f8e4e2d9fe13c5b485982ff724a3fcb6ebd0ef53 Mon Sep 17 00:00:00 2001 From: "kaie%netscape.com" Date: Tue, 28 Aug 2001 04:40:36 +0000 Subject: [PATCH] b=97044 r=dbaron sr=ben a=asa Fix topcrash by adding safety null checks and correcting a typo --- .../resources/locale/en-US/security.properties | 2 +- security/manager/pki/src/nsNSSDialogs.cpp | 18 +++++++++++------- .../resources/locale/en-US/security.properties | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/netwerk/resources/locale/en-US/security.properties b/netwerk/resources/locale/en-US/security.properties index 5b4bb672988..abaec283674 100644 --- a/netwerk/resources/locale/en-US/security.properties +++ b/netwerk/resources/locale/en-US/security.properties @@ -27,7 +27,7 @@ MixedContentMessage=You have requested an encrypted page that contains some unen LeaveSecureMessage=You are about to leave an encrypted page. Information you send or receive from now on could easily be read by a third party. EnterSecureMessage=You have requested an encrypted page. The web site has identified itself correctly, and information you see or enter on this page can't easily be read by a third party. WeakSecureMessage=You have requested a page that uses low-grade encryption. The web site has identified itself correctly, but information you see or enter on this page could be read by a third party. -PostToInsecurefromSecureMessage=Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## +PostToInsecureFromSecureMessage=Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## PostToInsecureFromInsecureMessage=The information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## MixedContentShowAgain=Alert me whenever I'm about to view an encrypted page that contains some unencrypted information. LeaveSecureShowAgain=Alert me whenever I leave an encrypted page for one that isn't encrypted. diff --git a/security/manager/pki/src/nsNSSDialogs.cpp b/security/manager/pki/src/nsNSSDialogs.cpp index 1b7316d77f4..5c9c63e5d57 100644 --- a/security/manager/pki/src/nsNSSDialogs.cpp +++ b/security/manager/pki/src/nsNSSDialogs.cpp @@ -572,11 +572,13 @@ nsNSSDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *prefName, // Get user's preference for this alert // prefName, showAgainName are null if there is no preference for this dialog - PRBool prefValue; + PRBool prefValue = PR_TRUE; + + if (prefName != nsnull) { + rv = mPref->GetBoolPref(prefName, &prefValue); + if (NS_FAILED(rv)) prefValue = PR_TRUE; + } - rv = mPref->GetBoolPref(prefName, &prefValue); - if (NS_FAILED(rv)) prefValue = PR_TRUE; - // Stop if confirm is not requested if (!prefValue) { *_result = PR_TRUE; @@ -594,8 +596,10 @@ nsNSSDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *prefName, getter_Copies(windowTitle)); mStringBundle->GetStringFromName(messageName, getter_Copies(message)); - mStringBundle->GetStringFromName(showAgainName, - getter_Copies(alertMe)); + if (showAgainName != nsnull) { + mStringBundle->GetStringFromName(showAgainName, + getter_Copies(alertMe)); + } mStringBundle->GetStringFromName(NS_LITERAL_STRING("Continue").get(), getter_Copies(cont)); // alertMe is allowed to be null @@ -630,7 +634,7 @@ nsNSSDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *prefName, *_result = PR_FALSE; } - if (!prefValue) { + if (!prefValue && prefName != nsnull) { mPref->SetBoolPref(prefName, PR_FALSE); } diff --git a/security/manager/ssl/resources/locale/en-US/security.properties b/security/manager/ssl/resources/locale/en-US/security.properties index 5b4bb672988..abaec283674 100644 --- a/security/manager/ssl/resources/locale/en-US/security.properties +++ b/security/manager/ssl/resources/locale/en-US/security.properties @@ -27,7 +27,7 @@ MixedContentMessage=You have requested an encrypted page that contains some unen LeaveSecureMessage=You are about to leave an encrypted page. Information you send or receive from now on could easily be read by a third party. EnterSecureMessage=You have requested an encrypted page. The web site has identified itself correctly, and information you see or enter on this page can't easily be read by a third party. WeakSecureMessage=You have requested a page that uses low-grade encryption. The web site has identified itself correctly, but information you see or enter on this page could be read by a third party. -PostToInsecurefromSecureMessage=Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## +PostToInsecureFromSecureMessage=Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## PostToInsecureFromInsecureMessage=The information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.##Are you sure you want to continue sending this information?## MixedContentShowAgain=Alert me whenever I'm about to view an encrypted page that contains some unencrypted information. LeaveSecureShowAgain=Alert me whenever I leave an encrypted page for one that isn't encrypted.