Bug 1386922 - Add learn more link to autofill address, r=lchang,MattN
authorScott Wu <scottcwwu@gmail.com>
Fri, 08 Sep 2017 16:37:47 +0800
changeset 429985 834aca219fbbb10e03cc14bb1cfb591e5b777916
parent 429984 06c3517b0f33174055a84a04e61878f7d92ce3cf
child 429986 70d1f53f21f2a3f9cee295d10d7145dbef010994
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslchang, MattN
bugs1386922
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1386922 - Add learn more link to autofill address, r=lchang,MattN 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;