Bug 1386922 - Add learn more link to autofill address. r=lchang, r=MattN, a=lizzard, l10n=lizzard
authorScott Wu <scottcwwu@gmail.com>
Wed, 13 Sep 2017 16:54:00 -0400
changeset 424100 faf98f63da30ed2715f6a51d45cbc84dd76efeb4
parent 424099 e342ff01ad5566180910859946df3ea792279239
child 424101 fbef00b40b98333a637211cd284db9e3f5348f07
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslchang, MattN, lizzard
bugs1386922
milestone56.0
Bug 1386922 - Add learn more link to autofill address. r=lchang, r=MattN, a=lizzard, l10n=lizzard MozReview-Commit-ID: LloJRy8srb1
browser/extensions/formautofill/FormAutofillPreferences.jsm
browser/extensions/formautofill/locales/en-US/formautofill.properties
browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
--- a/browser/extensions/formautofill/FormAutofillPreferences.jsm
+++ b/browser/extensions/formautofill/FormAutofillPreferences.jsm
@@ -68,17 +68,19 @@ FormAutofillPreferences.prototype = {
   /**
    * Create Form Autofill preference group
    *
    * @param  {XULDocument} document
    */
   createPreferenceGroup(document) {
     let formAutofillGroup;
     let addressAutofill = document.createElementNS(XUL_NS, "hbox");
+    let addressAutofillCheckboxGroup = document.createElementNS(XUL_NS, "description");
     let addressAutofillCheckbox = document.createElementNS(XUL_NS, "checkbox");
+    let addressAutofillLearnMore = document.createElementNS(XUL_NS, "label");
     let savedAddressesBtn = document.createElementNS(XUL_NS, "button");
 
     if (this.useOldOrganization) {
       let caption = document.createElementNS(XUL_NS, "caption");
       let captionLabel = document.createElementNS(XUL_NS, "label");
 
       formAutofillGroup = document.createElementNS(XUL_NS, "groupbox");
       formAutofillGroup.hidden = document.location.href != "about:preferences#privacy";
@@ -95,28 +97,37 @@ FormAutofillPreferences.prototype = {
     this.refs = {
       formAutofillGroup,
       addressAutofillCheckbox,
       savedAddressesBtn,
     };
 
     formAutofillGroup.id = "formAutofillGroup";
     addressAutofill.id = "addressAutofill";
+    addressAutofillLearnMore.id = "addressAutofillLearnMore";
+    addressAutofillLearnMore.className = "learnMore text-link";
+
+    addressAutofillLearnMore.setAttribute("value", this.bundle.GetStringFromName("learnMore"));
+    addressAutofillCheckbox.setAttribute("label", this.bundle.GetStringFromName("enableAddressAutofill"));
     savedAddressesBtn.setAttribute("label", this.bundle.GetStringFromName("savedAddresses"));
-    addressAutofillCheckbox.setAttribute("label", this.bundle.GetStringFromName("enableAddressAutofill"));
+
+    let learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "autofill-card-address";
+    addressAutofillLearnMore.setAttribute("href", learnMoreURL);
 
     // Manually set the checked state
     if (this.isAutofillEnabled) {
       addressAutofillCheckbox.setAttribute("checked", true);
     }
 
-    addressAutofillCheckbox.flex = 1;
+    addressAutofillCheckboxGroup.flex = 1;
 
     formAutofillGroup.appendChild(addressAutofill);
-    addressAutofill.appendChild(addressAutofillCheckbox);
+    addressAutofill.appendChild(addressAutofillCheckboxGroup);
+    addressAutofillCheckboxGroup.appendChild(addressAutofillCheckbox);
+    addressAutofillCheckboxGroup.appendChild(addressAutofillLearnMore);
     addressAutofill.appendChild(savedAddressesBtn);
   },
 
   /**
    * Handle events
    *
    * @param  {DOMEvent} event
    */
--- a/browser/extensions/formautofill/locales/en-US/formautofill.properties
+++ b/browser/extensions/formautofill/locales/en-US/formautofill.properties
@@ -1,14 +1,15 @@
 # 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/.
 
 preferenceGroupTitle = Form Autofill
 enableAddressAutofill = Autofill addresses
+learnMore = Learn more
 savedAddresses = Saved Addresses…
 saveAddressesMessage = Firefox now saves addresses so you can fill out forms faster.
 viewAutofillOptionsLink = View Form Autofill Options
 changeAutofillOptions = Change Form Autofill Options
 viewAutofillOptionsLinkOSX = View Form Autofill Preferences
 changeAutofillOptionsOSX = Change Form Autofill Preferences
 addressesSyncCheckbox = Share addresses with synced devices
 updateAddressMessage = Would you like to update your address with this new information?
--- a/browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
+++ b/browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
@@ -3,16 +3,17 @@
 const PAGE_PREFS = "about:preferences";
 const PAGE_PRIVACY = PAGE_PREFS + "#privacy";
 const GROUP_AUTOFILL = "#passwordsGroup";
 const CHECKBOX_AUTOFILL = "#addressAutofill checkbox";
 const PREF_AUTOFILL_ENABLED = "extensions.formautofill.addresses.enabled";
 const TEST_SELECTORS = {
   group: GROUP_AUTOFILL,
   checkbox: CHECKBOX_AUTOFILL,
+  addressAutofillLearnMore: "#addressAutofillLearnMore",
 };
 
 // Visibility of form autofill group should be hidden when opening
 // preferences page.
 add_task(async function test_aboutPreferences() {
   await BrowserTestUtils.withNewTab({gBrowser, url: PAGE_PREFS}, async function(browser) {
     await ContentTask.spawn(browser, TEST_SELECTORS, (args) => {
       is(content.document.querySelector(args.group).hidden, true,
@@ -25,16 +26,18 @@ add_task(async function test_aboutPrefer
 // directly to privacy page. Checkbox is checked by default.
 add_task(async function test_aboutPreferencesPrivacy() {
   await BrowserTestUtils.withNewTab({gBrowser, url: PAGE_PRIVACY}, async function(browser) {
     await ContentTask.spawn(browser, TEST_SELECTORS, (args) => {
       is(content.document.querySelector(args.group).hidden, false,
         "Form Autofill group should be visible");
       is(content.document.querySelector(args.checkbox).checked, true,
         "Checkbox should be checked");
+      ok(content.document.querySelector(args.addressAutofillLearnMore).href.includes("autofill-card-address"),
+         "Autofill addresses learn more link should contain autofill-card-address");
     });
   });
 });
 
 // Checkbox should be unchecked when form autofill is disabled.
 add_task(async function test_autofillDisabledCheckbox() {
   SpecialPowers.pushPrefEnv({set: [[PREF_AUTOFILL_ENABLED, false]]});