Bug 1333256 - Bring back the insecure field warning Learn More text in bold on beta. r=adw l10n=flod a=jcristau
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 31 Jan 2017 15:11:14 -0800
changeset 468808 c16a0fc964a5790de244fc3ea3bb5c3d3c18d071
parent 468807 c2d975acbc8308d51d39e006f2fb873869fbd488
child 469065 f39a49e249ecea5f35bc096657fc778619ba60fd
push id43550
push usermozilla@noorenberghe.ca
push dateTue, 31 Jan 2017 23:11:52 +0000
reviewersadw, jcristau
bugs1333256
milestone52.0
Bug 1333256 - Bring back the insecure field warning Learn More text in bold on beta. r=adw l10n=flod a=jcristau MozReview-Commit-ID: 8Z6pKwFqk3M
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
toolkit/components/passwordmgr/test/unit/test_user_autocomplete_result.js
toolkit/content/widgets/autocomplete.xml
toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1314,17 +1314,18 @@ UserAutoCompleteResult.prototype = {
   },
 
   getLabelAt(index) {
     if (index < 0 || index >= this.matchCount) {
       throw new Error("Index out of range.");
     }
 
     if (this._showInsecureFieldWarning && index === 0) {
-      return this._stringBundle.GetStringFromName("insecureFieldWarningDescription");
+      return this._stringBundle.GetStringFromName("insecureFieldWarningDescription") + " " +
+        this._stringBundle.GetStringFromName("insecureFieldWarningLearnMore");
     }
 
     let that = this;
 
     function getLocalizedString(key, formatArgs) {
       if (formatArgs) {
         return that._stringBundle.formatStringFromName(key, formatArgs, formatArgs.length);
       }
--- a/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
@@ -229,17 +229,17 @@ add_task(function* test_form1_warning_en
   restoreForm();
   let shownPromise = promiseACShown();
   doKey("down"); // open
   let results = yield shownPromise;
 
   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 = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
   doKey("down"); // select insecure warning
   checkACForm("", ""); // value shouldn't update just by selecting
@@ -761,17 +761,17 @@ add_task(function* test_form9_filtering(
   checkACForm("form9userAB", "");
   uname.focus();
   doKey("left");
   shownPromise = promiseACShown();
   sendChar("A");
   let results = yield shownPromise;
 
   checkACForm("form9userAAB", "");
-  checkArrayValues(results, ["This connection is not secure. Logins entered here could be compromised.", "form9userAAB"],
+  checkArrayValues(results, ["This connection is not secure. Logins entered here could be compromised. Learn More", "form9userAAB"],
                             "Check dropdown is updated after inserting 'A'");
   doKey("down"); // skip insecure warning
   doKey("down");
   doKey("return");
   yield promiseFormsProcessed();
   checkACForm("form9userAAB", "form9pass");
 });
 
--- a/toolkit/components/passwordmgr/test/unit/test_user_autocomplete_result.js
+++ b/toolkit/components/passwordmgr/test/unit/test_user_autocomplete_result.js
@@ -61,17 +61,17 @@ let expectedResults = [
   {
     insecureFieldWarningEnabled: true,
     insecureAutoFillFormsEnabled: true,
     isSecure: false,
     isPasswordField: false,
     matchingLogins: matchingLogins,
     items: [{
       value: "",
-      label: "This connection is not secure. Logins entered here could be compromised.",
+      label: "This connection is not secure. Logins entered here could be compromised. Learn More",
       style: "insecureWarning"
     }, {
       value: "",
       label: LABEL_NO_USERNAME,
       style: "login",
     }, {
       value: "tempuser1",
       label: "tempuser1",
@@ -121,17 +121,17 @@ let expectedResults = [
   {
     insecureFieldWarningEnabled: true,
     insecureAutoFillFormsEnabled: true,
     isSecure: false,
     isPasswordField: true,
     matchingLogins: matchingLogins,
     items: [{
       value: "",
-      label: "This connection is not secure. Logins entered here could be compromised.",
+      label: "This connection is not secure. Logins entered here could be compromised. Learn More",
       style: "insecureWarning"
     }, {
       value: "emptypass1",
       label: LABEL_NO_USERNAME,
       style: "login",
     }, {
       value: "temppass1",
       label: "tempuser1",
@@ -293,17 +293,17 @@ let expectedResults = [
   {
     insecureFieldWarningEnabled: true,
     insecureAutoFillFormsEnabled: false,
     isSecure: false,
     isPasswordField: false,
     matchingLogins: matchingLogins,
     items: [{
       value: "",
-      label: "This connection is not secure. Logins entered here could be compromised.",
+      label: "This connection is not secure. Logins entered here could be compromised. Learn More",
       style: "insecureWarning"
     }, {
       value: "",
       label: LABEL_NO_USERNAME,
       style: "login",
     }, {
       value: "tempuser1",
       label: "tempuser1",
@@ -353,17 +353,17 @@ let expectedResults = [
   {
     insecureFieldWarningEnabled: true,
     insecureAutoFillFormsEnabled: false,
     isSecure: false,
     isPasswordField: true,
     matchingLogins: matchingLogins,
     items: [{
       value: "",
-      label: "This connection is not secure. Logins entered here could be compromised.",
+      label: "This connection is not secure. Logins entered here could be compromised. Learn More",
       style: "insecureWarning"
     }, {
       value: "emptypass1",
       label: LABEL_NO_USERNAME,
       style: "login",
     }, {
       value: "temppass1",
       label: "tempuser1",
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1531,16 +1531,37 @@ extends="chrome://global/content/binding
 
     <implementation>
       <constructor><![CDATA[
         // Unlike other autocomplete items, the height of the insecure warning
         // increases by wrapping. So "forceHandleUnderflow" is for container to
         // 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>
+
+      <method name="_getSearchTokens">
+        <parameter name="aSearch"/>
+        <body>
+          <![CDATA[
+            return [this._learnMoreString.toLowerCase()];
+          ]]>
+        </body>
+      </method>
+
     </implementation>
   </binding>
 
   <binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
 
     <content align="center"
              onoverflow="this._onOverflow();"
              onunderflow="this._onUnderflow();">
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
@@ -62,9 +62,9 @@ loginsDescriptionFiltered=The following 
 loginHostAge=%1$S (%2$S)
 # LOCALIZATION NOTE (noUsername):
 # String is used on the context menu when a login doesn't have a username.
 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.
-insecureFieldWarningLearnMore = Learn More
+insecureFieldWarningLearnMore = Learn More