Bug 1386922 - Add learn more link to autofill credit card, r=lchang,MattN
authorScott Wu <scottcwwu@gmail.com>
Fri, 08 Sep 2017 16:39:08 +0800
changeset 429986 70d1f53f21f2a3f9cee295d10d7145dbef010994
parent 429985 834aca219fbbb10e03cc14bb1cfb591e5b777916
child 429987 84abfad4ada97255d6e1e4dbbb44029b1600eca0
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 credit card, r=lchang,MattN MozReview-Commit-ID: HVmbSjSKmrM
browser/extensions/formautofill/FormAutofillPreferences.jsm
browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
--- a/browser/extensions/formautofill/FormAutofillPreferences.jsm
+++ b/browser/extensions/formautofill/FormAutofillPreferences.jsm
@@ -63,63 +63,71 @@ FormAutofillPreferences.prototype = {
   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 creditCardAutofillCheckboxGroup = document.createElementNS(XUL_NS, "description");
     let creditCardAutofillCheckbox = document.createElementNS(XUL_NS, "checkbox");
+    let creditCardAutofillLearnMore = document.createElementNS(XUL_NS, "label");
     let savedCreditCardsBtn = document.createElementNS(XUL_NS, "button");
 
     savedAddressesBtn.className = "accessory-button";
     savedCreditCardsBtn.className = "accessory-button";
     addressAutofillLearnMore.className = "learnMore text-link";
+    creditCardAutofillLearnMore.className = "learnMore text-link";
 
     this.refs = {
       formAutofillGroup,
       addressAutofillCheckbox,
       savedAddressesBtn,
       creditCardAutofillCheckbox,
       savedCreditCardsBtn,
     };
 
     formAutofillGroup.id = "formAutofillGroup";
     addressAutofill.id = "addressAutofill";
     addressAutofillLearnMore.id = "addressAutofillLearnMore";
+    creditCardAutofill.id = "creditCardAutofill";
+    creditCardAutofillLearnMore.id = "creditCardAutofillLearnMore";
 
     addressAutofillLearnMore.setAttribute("value", this.bundle.GetStringFromName("learnMore"));
     addressAutofillCheckbox.setAttribute("label", this.bundle.GetStringFromName("enableAddressAutofill"));
     savedAddressesBtn.setAttribute("label", this.bundle.GetStringFromName("savedAddresses"));
-    creditCardAutofill.id = "creditCardAutofill";
+    creditCardAutofillLearnMore.setAttribute("value", this.bundle.GetStringFromName("learnMore"));
     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);
+    creditCardAutofillLearnMore.setAttribute("href", learnMoreURL);
 
     // Manually set the checked state
     if (FormAutofillUtils.isAutofillAddressesEnabled) {
       addressAutofillCheckbox.setAttribute("checked", true);
     }
     if (FormAutofillUtils.isAutofillCreditCardsEnabled) {
       creditCardAutofillCheckbox.setAttribute("checked", true);
     }
 
     addressAutofillCheckboxGroup.flex = 1;
-    creditCardAutofillCheckbox.flex = 1;
+    creditCardAutofillCheckboxGroup.flex = 1;
 
     formAutofillGroup.appendChild(addressAutofill);
     addressAutofill.appendChild(addressAutofillCheckboxGroup);
     addressAutofillCheckboxGroup.appendChild(addressAutofillCheckbox);
     addressAutofillCheckboxGroup.appendChild(addressAutofillLearnMore);
     addressAutofill.appendChild(savedAddressesBtn);
     formAutofillGroup.appendChild(creditCardAutofill);
-    creditCardAutofill.appendChild(creditCardAutofillCheckbox);
+    creditCardAutofill.appendChild(creditCardAutofillCheckboxGroup);
+    creditCardAutofillCheckboxGroup.appendChild(creditCardAutofillCheckbox);
+    creditCardAutofillCheckboxGroup.appendChild(creditCardAutofillLearnMore);
     creditCardAutofill.appendChild(savedCreditCardsBtn);
   },
 
   /**
    * Handle events
    *
    * @param  {DOMEvent} event
    */
--- a/browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
+++ b/browser/extensions/formautofill/test/browser/browser_privacyPreferences.js
@@ -4,16 +4,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",
+  creditCardAutofillLearnMore: "#creditCardAutofillLearnMore",
 };
 
 // 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;
@@ -34,16 +35,18 @@ add_task(async function test_aboutPrefer
       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");
+      ok(content.document.querySelector(selectors.creditCardAutofillLearnMore).href.includes("autofill-card-address"),
+        "Autofill credit cards 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;