Bug 1333256 - Bring back the insecure field warning Learn More text in bold. r=johannh

MozReview-Commit-ID: CpPgkdmbb2O

--HG--
extra : rebase_source : da03efa9aaaa70a504fb158359f7897c1d4883e3
This commit is contained in:
Matthew Noorenberghe 2017-02-14 02:19:20 +08:00
Родитель 9bdbe1a759
Коммит 97743adb2b
6 изменённых файлов: 39 добавлений и 19 удалений

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

@ -1484,17 +1484,16 @@ UserAutoCompleteResult.prototype = {
throw new Error("Index out of range.");
}
if (this._showInsecureFieldWarning && index === 0) {
return this._stringBundle.GetStringFromName("insecureFieldWarningDescription");
}
let that = this;
function getLocalizedString(key, formatArgs) {
let getLocalizedString = (key, formatArgs = null) => {
if (formatArgs) {
return that._stringBundle.formatStringFromName(key, formatArgs, formatArgs.length);
return this._stringBundle.formatStringFromName(key, formatArgs, formatArgs.length);
}
return that._stringBundle.GetStringFromName(key);
return this._stringBundle.GetStringFromName(key);
};
if (this._showInsecureFieldWarning && index === 0) {
let learnMoreString = getLocalizedString("insecureFieldWarningLearnMore");
return getLocalizedString("insecureFieldWarningDescription3", [learnMoreString]);
}
let login = this.logins[index - this._showInsecureFieldWarning];

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

@ -233,7 +233,7 @@ add_task(function* test_form1_warning_entry() {
let popupState = yield getPopupState();
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised.",
let expectedMenuItems = ["Logins entered here could be compromised. Learn More",
"tempuser1",
"testuser2",
"testuser3",
@ -765,7 +765,7 @@ add_task(function* test_form9_filtering() {
let results = yield shownPromise;
checkACForm("form9userAAB", "");
checkArrayValues(results, ["This connection is not secure. Logins entered here could be compromised.", "form9userAAB"],
checkArrayValues(results, ["Logins entered here could be compromised. Learn More", "form9userAAB"],
"Check dropdown is updated after inserting 'A'");
doKey("down"); // skip insecure warning
doKey("down");

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

@ -198,7 +198,7 @@ add_task(function* test_form1_enabledInsecureFieldWarning_enabledInsecureAutoFil
let popupState = yield getPopupState();
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised.",
let expectedMenuItems = ["Logins entered here could be compromised. Learn More",
"No username (" + DATE_NOW_STRING + ")",
"tempuser1",
"testuser2",
@ -257,7 +257,7 @@ add_task(function* test_form1_enabledInsecureFieldWarning_disabledInsecureAutoFi
let popupState = yield getPopupState();
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised.",
let expectedMenuItems = ["Logins entered here could be compromised. Learn More",
"No username (" + DATE_NOW_STRING + ")",
"tempuser1",
"testuser2",

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

@ -66,7 +66,7 @@ let expectedResults = [
matchingLogins,
items: [{
value: "",
label: "This connection is not secure. Logins entered here could be compromised.",
label: "Logins entered here could be compromised. Learn More",
style: "insecureWarning"
}, {
value: "",
@ -126,7 +126,7 @@ let expectedResults = [
matchingLogins,
items: [{
value: "",
label: "This connection is not secure. Logins entered here could be compromised.",
label: "Logins entered here could be compromised. Learn More",
style: "insecureWarning"
}, {
value: "emptypass1",
@ -298,7 +298,7 @@ let expectedResults = [
matchingLogins,
items: [{
value: "",
label: "This connection is not secure. Logins entered here could be compromised.",
label: "Logins entered here could be compromised. Learn More",
style: "insecureWarning"
}, {
value: "",
@ -358,7 +358,7 @@ let expectedResults = [
matchingLogins,
items: [{
value: "",
label: "This connection is not secure. Logins entered here could be compromised.",
label: "Logins entered here could be compromised. Learn More",
style: "insecureWarning"
}, {
value: "emptypass1",

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

@ -1534,6 +1534,28 @@ extends="chrome://global/content/bindings/popup.xml#popup">
// recalculate an item's height and width.
this.classList.add("forceHandleUnderflow");
]]></constructor>
<property name="_learnMoreString">
<getter><![CDATA[
if (!this.__learnMoreString) {
this.__learnMoreString =
Services.strings.createBundle("chrome://passwordmgr/locale/passwordmgr.properties").
GetStringFromName("insecureFieldWarningLearnMore");
}
return this.__learnMoreString;
]]></getter>
</property>
<!-- Override _getSearchTokens to have the Learn More text emphasized -->
<method name="_getSearchTokens">
<parameter name="aSearch"/>
<body>
<![CDATA[
return [this._learnMoreString.toLowerCase()];
]]>
</body>
</method>
</implementation>
</binding>

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

@ -71,12 +71,11 @@ noUsername=No username
duplicateLoginTitle=Login already exists
duplicateLogin=A duplicate login already exists.
insecureFieldWarningDescription = This connection is not secure. Logins entered here could be compromised.
# LOCALIZATION NOTE (insecureFieldWarningDescription2, insecureFieldWarningDescription3):
# %1$S will contain insecureFieldWarningLearnMore and look like a link to indicate that clicking will open a tab with support information.
insecureFieldWarningDescription2 = This connection is not secure. Logins entered here could be compromised. %1$S
insecureFieldWarningDescription3 = Logins entered here could be compromised. %1$S
insecureFieldWarningLearnMore = Learn More
insecureFieldWarningLearnMore = Learn More
# LOCALIZATION NOTE (removeAll, removeAllShown):
# When only partial sites are shown as a result of keyword search,