Bug 1144856 - Change the doorhanger messages to mention "login" instead of "password"

--HG--
extra : commitid : LYxFzg6ODwT
extra : rebase_source : 9084f29d102a63c6762e2de19a6f54b8c08c3c36
This commit is contained in:
Riadh Chtara 2015-07-10 12:58:52 -07:00
parent ad3716c05d
commit b3d2ceea5e
3 changed files with 37 additions and 15 deletions

View File

@ -16,6 +16,8 @@ const LoginInfo =
Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
"nsILoginInfo", "init");
const BRAND_BUNDLE = "chrome://branding/locale/brand.properties";
/**
* Constants for password prompt telemetry.
* Mirrored in mobile/android/components/LoginManagerPrompter.js */
@ -775,22 +777,27 @@ LoginManagerPrompter.prototype = {
let { browser } = this._getNotifyWindow();
let saveMsgNames = {
prompt: "rememberPasswordMsgNoUsername",
buttonLabel: "notifyBarRememberPasswordButtonText",
buttonAccessKey: "notifyBarRememberPasswordButtonAccessKey",
prompt: login.username === "" ? "rememberLoginMsgNoUser"
: "rememberLoginMsg",
buttonLabel: "rememberLoginButtonText",
buttonAccessKey: "rememberLoginButtonAccessKey",
};
let changeMsgNames = {
// We reuse the existing message, even if it expects a username, until we
// switch to the final terminology in bug 1144856.
prompt: "updatePasswordMsg",
buttonLabel: "notifyBarUpdateButtonText",
buttonAccessKey: "notifyBarUpdateButtonAccessKey",
prompt: login.username === "" ? "updateLoginMsgNoUser"
: "updateLoginMsg",
buttonLabel: "updateLoginButtonText",
buttonAccessKey: "updateLoginButtonAccessKey",
};
let initialMsgNames = type == "password-save" ? saveMsgNames
: changeMsgNames;
let brandBundle = Services.strings.createBundle(BRAND_BUNDLE);
let brandShortName = brandBundle.GetStringFromName("brandShortName");
let promptMsg = type == "password-save" ? this._getLocalizedString(saveMsgNames.prompt, [brandShortName])
: this._getLocalizedString(changeMsgNames.prompt);
let histogramName = type == "password-save" ? "PWMGR_PROMPT_REMEMBER_ACTION"
: "PWMGR_PROMPT_UPDATE_ACTION";
let histogram = Services.telemetry.getHistogramById(histogramName);
@ -960,7 +967,7 @@ LoginManagerPrompter.prototype = {
this._getPopupNote().show(
browser,
"password",
this._getLocalizedString(initialMsgNames.prompt, [displayHost]),
promptMsg,
"password-notification-icon",
mainAction,
secondaryActions,

View File

@ -21,6 +21,10 @@ Login Manager test: notifications
/** Test for Login Manager: notifications. **/
const { Services } = SpecialPowers.Cu.import("resource://gre/modules/Services.jsm");
const BRAND_BUNDLE = "chrome://branding/locale/brand.properties";
// Set testpath to the directory where we live. Used to load tests from
// alternate Mochitest servers (different hostnames, same content).
var testpath = document.location.pathname + "/../";
@ -95,6 +99,8 @@ function checkTest() {
var gotUser = SpecialPowers.wrap(iframe).contentDocument.getElementById("user").textContent;
var gotPass = SpecialPowers.wrap(iframe).contentDocument.getElementById("pass").textContent;
let brandBundle = Services.strings.createBundle(BRAND_BUNDLE);
let brandShortName = brandBundle.GetStringFromName("brandShortName");
switch(testNum) {
@ -356,8 +362,8 @@ function checkTest() {
ok(popup, "got notification popup");
// Check the text, which comes from the localized saveLoginText string.
notificationText = popup.message;
expectedText = /^Would you like to remember the password on example.org\?$/;
ok(expectedText.test(notificationText), "Checking text: " + notificationText);
expectedText = "Would you like " + brandShortName + " to remember this login?";
is(expectedText, notificationText, "Checking text: " + notificationText);
popup.remove();
break;
@ -369,8 +375,8 @@ function checkTest() {
ok(popup, "got notification popup");
// Check the text, which comes from the localized saveLoginText string.
notificationText = popup.message;
expectedText = /^Would you like to remember the password on example.org\?$/;
ok(expectedText.test(notificationText), "Checking text: " + notificationText);
expectedText = "Would you like " + brandShortName + " to remember this login\?";
is(expectedText, notificationText, "Checking text: " + notificationText);
popup.remove();
break;
@ -382,8 +388,8 @@ function checkTest() {
ok(popup, "got notification popup");
// Check the text, which comes from the localized saveLoginTextNoUser string.
notificationText = popup.message;
expectedText = /^Would you like to remember the password on example.org\?$/;
ok(expectedText.test(notificationText), "Checking text: " + notificationText);
expectedText = "Would you like " + brandShortName + " to remember this password\?";
is(expectedText, notificationText, "Checking text: " + notificationText);
popup.remove();
break;

View File

@ -5,6 +5,15 @@
rememberValue = Use Password Manager to remember this value.
rememberPassword = Use Password Manager to remember this password.
savePasswordTitle = Confirm
# LOCALIZATION NOTE (rememberLoginMsg, rememberLoginMsgNoUser): %S is brandShortName
rememberLoginMsg = Would you like %S to remember this login?
rememberLoginMsgNoUser = Would you like %S to remember this password?
rememberLoginButtonText = Remember
rememberLoginButtonAccessKey = R
updateLoginMsg = Would you like to update this login?
updateLoginMsgNoUser = Would you like to update this password?
updateLoginButtonText = Update
updateLoginButtonAccessKey = U
# LOCALIZATION NOTE (rememberPasswordMsg):
# 1st string is the username for the login, 2nd is the login's hostname.
# Note that long usernames may be truncated.