Bug 1386922 - Add learn more link to autofill address, r=MattN,lchang draft
authorScott Wu <scottcwwu@gmail.com>
Fri, 08 Sep 2017 16:37:47 +0800
changeset 663451 71afba946d21e468f7500dd57255579164e8b643
parent 662738 bda524beac249b64aa36016800502a34073bf35a
child 663452 414dec488e9e8d8ba42185efa39b7a719452154a
push id79450
push userbmo:scwwu@mozilla.com
push dateWed, 13 Sep 2017 03:36:37 +0000
reviewersMattN, lchang
bugs1386922
milestone57.0a1
Bug 1386922 - Add learn more link to autofill address, r=MattN,lchang 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
@@ -58,54 +58,65 @@ FormAutofillPreferences.prototype = {
   /**
    * Create Form Autofill preference group
    *
    * @param  {XULDocument} document
    */
   createPreferenceGroup(document) {
     let formAutofillGroup = document.createElementNS(XUL_NS, "vbox");
     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");
     let creditCardAutofill = document.createElementNS(XUL_NS, "hbox");
     let creditCardAutofillCheckbox = document.createElementNS(XUL_NS, "checkbox");
     let savedCreditCardsBtn = document.createElementNS(XUL_NS, "button");
 
     savedAddressesBtn.className = "accessory-button";
     savedCreditCardsBtn.className = "accessory-button";
+    addressAutofillLearnMore.className = "learnMore text-link";
 
     this.refs = {
       formAutofillGroup,
       addressAutofillCheckbox,
       savedAddressesBtn,
       creditCardAutofillCheckbox,
       savedCreditCardsBtn,
     };
 
     formAutofillGroup.id = "formAutofillGroup";
     addressAutofill.id = "addressAutofill";
+    addressAutofillLearnMore.id = "addressAutofillLearnMore";
+
+    addressAutofillLearnMore.setAttribute("value", this.bundle.GetStringFromName("learnMore"));
     addressAutofillCheckbox.setAttribute("label", this.bundle.GetStringFromName("enableAddressAutofill"));
     savedAddressesBtn.setAttribute("label", this.bundle.GetStringFromName("savedAddresses"));
     creditCardAutofill.id = "creditCardAutofill";
     creditCardAutofillCheckbox.setAttribute("label", this.bundle.GetStringFromName("enableCreditCardAutofill"));
     savedCreditCardsBtn.setAttribute("label", this.bundle.GetStringFromName("savedCreditCards"));
 
+    let learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "autofill-card-address";
+    addressAutofillLearnMore.setAttribute("href", learnMoreURL);
+
     // Manually set the checked state
     if (FormAutofillUtils.isAutofillAddressesEnabled) {
       addressAutofillCheckbox.setAttribute("checked", true);
     }
     if (FormAutofillUtils.isAutofillCreditCardsEnabled) {
       creditCardAutofillCheckbox.setAttribute("checked", true);
     }
 
-    addressAutofillCheckbox.flex = 1;
+    addressAutofillCheckboxGroup.flex = 1;
     creditCardAutofillCheckbox.flex = 1;
 
     formAutofillGroup.appendChild(addressAutofill);
-    addressAutofill.appendChild(addressAutofillCheckbox);
+    addressAutofill.appendChild(addressAutofillCheckboxGroup);
+    addressAutofillCheckboxGroup.appendChild(addressAutofillCheckbox);
+    addressAutofillCheckboxGroup.appendChild(addressAutofillLearnMore);
     addressAutofill.appendChild(savedAddressesBtn);
     formAutofillGroup.appendChild(creditCardAutofill);
     creditCardAutofill.appendChild(creditCardAutofillCheckbox);
     creditCardAutofill.appendChild(savedCreditCardsBtn);
   },
 
   /**
    * Handle events
--- 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…
 enableCreditCardAutofill = Autofill credit cards
 savedCreditCards = Saved Credit Cards…
 saveAddressesMessage = Firefox now saves addresses so you can fill out forms faster.
 autofillOptionsLink = Form Autofill Options
 autofillSecurityOptionsLink = Form Autofill & Security Options
 changeAutofillOptions = Change Form Autofill Options
 autofillOptionsLinkOSX = Form Autofill Preferences
--- 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 SELECTORS = {
   group: "#passwordsGroup",
   addressAutofillCheckbox: "#addressAutofill checkbox",
   creditCardAutofillCheckbox: "#creditCardAutofill checkbox",
   savedAddressesBtn: "#addressAutofill button",
   savedCreditCardsBtn: "#creditCardAutofill button",
+  addressAutofillLearnMore: "#addressAutofillLearnMore",
 };
 
 // Visibility of form autofill group should be hidden when opening
 // preferences page.
 add_task(async function test_aboutPreferences() {
   let finalPrefPaneLoaded = TestUtils.topicObserved("sync-pane-loaded", () => true);
   await BrowserTestUtils.withNewTab({gBrowser, url: PAGE_PREFS}, async function(browser) {
     await finalPrefPaneLoaded;
@@ -31,16 +32,18 @@ add_task(async function test_aboutPrefer
     await finalPrefPaneLoaded;
     await ContentTask.spawn(browser, SELECTORS, (selectors) => {
       is(content.document.querySelector(selectors.group).hidden, false,
         "Form Autofill group should be visible");
       is(content.document.querySelector(selectors.addressAutofillCheckbox).checked, true,
         "Autofill addresses checkbox should be checked");
       is(content.document.querySelector(selectors.creditCardAutofillCheckbox).checked, true,
         "Autofill credit cards checkbox should be checked");
+      ok(content.document.querySelector(selectors.addressAutofillLearnMore).href.includes("autofill-card-address"),
+        "Autofill addresses learn more link should contain autofill-card-address");
     });
   });
 });
 
 add_task(async function test_openManageAutofillDialogs() {
   let finalPrefPaneLoaded = TestUtils.topicObserved("sync-pane-loaded", () => true);
   await BrowserTestUtils.withNewTab({gBrowser, url: PAGE_PRIVACY}, async function(browser) {
     await finalPrefPaneLoaded;