Bug 1383065 - Consider the form with 3 address fields as a valid address form. r=lchang
authorSean Lee <selee@mozilla.com>
Mon, 24 Jul 2017 17:33:04 +0800
changeset 421651 22d7b65df1345614ecaded08cb1113a387ee7c52
parent 421650 b217b97a74781c5d8d2f981651467331f04f6078
child 421652 263f0b999ae1239dc1850c528a9f80b4949fc52a
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
bugs1383065
milestone56.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 1383065 - Consider the form with 3 address fields as a valid address form. r=lchang MozReview-Commit-ID: Ck81HbI3zwe
browser/extensions/formautofill/FormAutofillHandler.jsm
browser/extensions/formautofill/test/unit/test_collectFormFields.js
--- a/browser/extensions/formautofill/FormAutofillHandler.jsm
+++ b/browser/extensions/formautofill/FormAutofillHandler.jsm
@@ -64,17 +64,17 @@ FormAutofillHandler.prototype = {
 
   /**
    * Similiar to `fieldDetails`, and `creditCardFieldDetails` contains the
    * Credit Card records only.
    */
   creditCardFieldDetails: null,
 
   get isValidAddressForm() {
-    return this.addressFieldDetails.length > FormAutofillUtils.AUTOFILL_FIELDS_THRESHOLD;
+    return this.addressFieldDetails.length >= FormAutofillUtils.AUTOFILL_FIELDS_THRESHOLD;
   },
 
   get isValidCreditCardForm() {
     return this.creditCardFieldDetails.some(i => i.fieldName == "cc-number");
   },
 
   /**
    * String of the filled profile's guid.
--- a/browser/extensions/formautofill/test/unit/test_collectFormFields.js
+++ b/browser/extensions/formautofill/test/unit/test_collectFormFields.js
@@ -112,47 +112,43 @@ const TESTCASES = [
     },
   },
   {
     description: "It's a valid address and credit card form.",
     document: `<form>
                <input id="given-name" autocomplete="shipping given-name">
                <input id="family-name" autocomplete="shipping family-name">
                <input id="street-addr" autocomplete="shipping street-address">
-               <input id="city" autocomplete="shipping address-level2">
                <input id="cc-number" autocomplete="shipping cc-number">
                </form>`,
     addressFieldDetails: [
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "given-name"},
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "family-name"},
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "street-address"},
-      {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "address-level2"},
     ],
     creditCardFieldDetails: [
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "cc-number"},
     ],
     isValidForm: {
       address: true,
       creditCard: true,
     },
   },
   {
     description: "It's an invalid address and credit form.",
     document: `<form>
                <input id="given-name" autocomplete="shipping given-name">
                <input autocomplete="shipping address-level2">
-               <select autocomplete="shipping country"></select>
                <input id="cc-name" autocomplete="cc-name">
                <input id="cc-exp-month" autocomplete="cc-exp-month">
                <input id="cc-exp-year" autocomplete="cc-exp-year">
                </form>`,
     addressFieldDetails: [
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "given-name"},
       {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "address-level2"},
-      {"section": "", "addressType": "shipping", "contactType": "", "fieldName": "country"},
     ],
     creditCardFieldDetails: [
       {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
       {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
       {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
     ],
     isValidForm: {
       address: false,