Bug 306730 - Do not include the token name in prompts for the internal key slot. r=keeler draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 12 Sep 2017 14:42:19 -0700
changeset 663321 eacd92dfa3937f8f05f4de0617eb09099517a504
parent 663134 a73cc4e08bf5a005722c95b43f84ab0c8ff2bc7c
child 731170 053779f5be0081f96ebb9d0e3b786465c62c422d
push id79400
push usermozilla@noorenberghe.ca
push dateTue, 12 Sep 2017 21:45:14 +0000
reviewerskeeler
bugs306730
milestone57.0a1
Bug 306730 - Do not include the token name in prompts for the internal key slot. r=keeler MozReview-Commit-ID: 3TPZrTQxQC5
browser/extensions/formautofill/test/unit/test_masterPassword.js
security/manager/locales/en-US/chrome/pipnss/pipnss.properties
security/manager/locales/en-US/chrome/pippki/pippki.properties
security/manager/ssl/nsNSSCallbacks.cpp
security/manager/ssl/tests/unit/test_certDB_import_with_master_password.js
security/manager/ssl/tests/unit/test_password_prompt.js
--- a/browser/extensions/formautofill/test/unit/test_masterPassword.js
+++ b/browser/extensions/formautofill/test/unit/test_masterPassword.js
@@ -33,17 +33,17 @@ let gMockPrompter = {
   // where in the context of the arrow function, |this != gMockPrompter| due to
   // how objects get wrapped when going across xpcom boundaries.
   promptPassword(dialogTitle, text, password, checkMsg, checkValue) {
     this.numPrompts++;
     if (this.numPrompts > 1) { // don't keep retrying a bad password
       return false;
     }
     equal(text,
-          "Please enter the master password for the Software Security Device.",
+          "Please enter your master password.",
           "password prompt text should be as expected");
     equal(checkMsg, null, "checkMsg should be null");
     ok(this.passwordToTry, "passwordToTry should be non-null");
     password.value = this.passwordToTry;
     return true;
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]),
--- a/security/manager/locales/en-US/chrome/pipnss/pipnss.properties
+++ b/security/manager/locales/en-US/chrome/pipnss/pipnss.properties
@@ -1,14 +1,17 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CertPassPrompt=Please enter the master password for the %S.
+
+CertPassPromptDefault=Please enter your master password.
+
 # the following strings have special requirements:
 # they must fit in a 32 or 64 byte buffer after being translated
 # to UTF8.  Note to translator. It's not easy for you to figure
 # whether the escaped unicode string you produce will fit in 
 # the space allocated.
 #
 # 64 bytes long after conversion to UTF8
 RootCertModuleName=Builtin Roots Module
--- a/security/manager/locales/en-US/chrome/pippki/pippki.properties
+++ b/security/manager/locales/en-US/chrome/pippki/pippki.properties
@@ -1,14 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-CertPassPrompt=Please enter the Personal Security Password for the PSM Private Keys security device.
-
 # LOCALIZATION NOTE(certWithSerial): Used for semi-uniquely representing a cert.
 # %1$S is the serial number of the cert in AA:BB:CC hex format.
 certWithSerial=Certificate with serial number: %1$S
 
 # Download Cert dialog
 # LOCALIZATION NOTE(newCAMessage1):
 # %S is a string representative of the certificate being downloaded/imported.
 newCAMessage1=Do you want to trust ā€œ%Sā€ for the following purposes?
--- a/security/manager/ssl/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/nsNSSCallbacks.cpp
@@ -783,25 +783,30 @@ PK11PasswordPromptRunnable::RunOnTargetT
     return;
   }
 
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID));
   if (!nssComponent) {
     return;
   }
 
-  NS_ConvertUTF8toUTF16 tokenName(PK11_GetTokenName(mSlot));
-  const char16_t* formatStrings[] = {
-    tokenName.get(),
-  };
   nsAutoString promptString;
-  rv = nssComponent->PIPBundleFormatStringFromName("CertPassPrompt",
-                                                   formatStrings,
-                                                   ArrayLength(formatStrings),
-                                                   promptString);
+  if (PK11_IsInternal(mSlot)) {
+    rv = nssComponent->GetPIPNSSBundleString("CertPassPromptDefault",
+                                             promptString);
+  } else {
+    NS_ConvertUTF8toUTF16 tokenName(PK11_GetTokenName(mSlot));
+    const char16_t* formatStrings[] = {
+      tokenName.get(),
+    };
+    rv = nssComponent->PIPBundleFormatStringFromName("CertPassPrompt",
+                                                     formatStrings,
+                                                     ArrayLength(formatStrings),
+                                                     promptString);
+  }
   if (NS_FAILED(rv)) {
     return;
   }
 
   nsString password;
   // |checkState| is unused because |checkMsg| (the argument just before it) is
   // null, but XPConnect requires it to point to a valid bool nonetheless.
   bool checkState = false;
--- a/security/manager/ssl/tests/unit/test_certDB_import_with_master_password.js
+++ b/security/manager/ssl/tests/unit/test_certDB_import_with_master_password.js
@@ -48,17 +48,17 @@ var gMockPrompter = {
   // where in the context of the arrow function, |this != gMockPrompter| due to
   // how objects get wrapped when going across xpcom boundaries.
   promptPassword(dialogTitle, text, password, checkMsg, checkValue) {
     this.numPrompts++;
     if (this.numPrompts > 1) { // don't keep retrying a bad password
       return false;
     }
     equal(text,
-          "Please enter the master password for the Software Security Device.",
+          "Please enter your master password.",
           "password prompt text should be as expected");
     equal(checkMsg, null, "checkMsg should be null");
     ok(this.passwordToTry, "passwordToTry should be non-null");
     password.value = this.passwordToTry;
     return true;
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]),
--- a/security/manager/ssl/tests/unit/test_password_prompt.js
+++ b/security/manager/ssl/tests/unit/test_password_prompt.js
@@ -17,17 +17,17 @@ var gMockPrompter = {
   // where in the context of the arrow function, |this != gMockPrompter| due to
   // how objects get wrapped when going across xpcom boundaries.
   promptPassword(dialogTitle, text, password, checkMsg, checkValue) {
     this.numPrompts++;
     if (this.numPrompts > 1) { // don't keep retrying a bad password
       return false;
     }
     equal(text,
-          "Please enter the master password for the Software Security Device.",
+          "Please enter your master password.",
           "password prompt text should be as expected");
     equal(checkMsg, null, "checkMsg should be null");
     ok(this.passwordToTry, "passwordToTry should be non-null");
     password.value = this.passwordToTry;
     return true;
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]),