diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm index bfa9272b71e8..0ce5138a7f03 100644 --- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm +++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm @@ -12,6 +12,11 @@ this.EXPORTED_SYMBOLS = ["FormAutofillHeuristics"]; const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; +Cu.import("resource://formautofill/FormAutofillUtils.jsm"); + +this.log = null; +FormAutofillUtils.defineLazyLogGetter(this, this.EXPORTED_SYMBOLS[0]); + /** * Returns the autocomplete information of fields according to heuristics. */ diff --git a/browser/extensions/formautofill/test/fixtures/autocomplete_basic.html b/browser/extensions/formautofill/test/fixtures/autocomplete_basic.html new file mode 100644 index 000000000000..bb74c9da920c --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/autocomplete_basic.html @@ -0,0 +1,23 @@ + + + + + Form Autofill Demo Page + + +

Form Autofill Demo Page

+
+

+

+

+

+

+

+

+

+

+

+
+ + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_Payment.html b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_Payment.html new file mode 100644 index 000000000000..e987ef59cac1 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_Payment.html @@ -0,0 +1,283 @@ + + + + Checkout – Best Buy + + +
+ + + + + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
    +
  • + +
  • +
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_ShippingAddress.html b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_ShippingAddress.html new file mode 100644 index 000000000000..36760a26108e --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/Checkout_ShippingAddress.html @@ -0,0 +1,326 @@ + + + + Checkout – Best Buy + + +
+ + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
    +
  • + +
  • +
+
+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/SignIn.html new file mode 100644 index 000000000000..8111d49c3725 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/BestBuy/SignIn.html @@ -0,0 +1,21 @@ + + + + Sign In to BestBuy.com + + +
+
+ + +
+
+ +
+ +
+
+ +
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_BillingPaymentInfo.html b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_BillingPaymentInfo.html new file mode 100644 index 000000000000..3258417b78cd --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_BillingPaymentInfo.html @@ -0,0 +1,515 @@ + + + + + + Checkout + + + +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+ Tester + Mo +
+
+ Mozilla +
+
331 E. Evelyn Avenue
+
+ Mountain View, + CA + 94041 +
+
+
+ + +
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
The billing address above must match what appears on this credit card's statement.
+
+
+ + +
+
+ + + +
+
+ + + + + +
+
+ + +
+ + +
+
+
+ What is a CVV? +
+ For Visa, MasterCard & Discover, the three digits on the back of your card. +
+ For American Express, the 4 digits on the front of your card. +
+
+
+
+
+
+
+
+
+ +
+ + Verisign Secured + +
+
+ + BBB Accredited Busines + +
+
+
+
+
    +
  • + Edit +
    +
    + Address: +
    +
    +
    + Tester + Mo +
    +
    + Mozilla +
    +
    331 E. Evelyn Avenue
    +
    + Mountain View, + CA + 94041 +
    +
    +
    +
    + Contact Info: +
    +
    +
    + formautofilltester@gmail.com +
    +
    + 650-903-0800 650 +
    +
    +
    +
    +
  • +
  • + Edit +
    +
    Shipping Method
    +
    +
    UPS Ground (2-3 days)
    +
    2-3 business days
    +
    $19.99
    +
    +
    +
  • +
  • + Edit +
    +
    + Billing Address +
    +
    +
    + + + + +
    +
    +
    +
    +
    +
    +
    +
    + +, + + + + +
    +
    +
    Payment Method
    +
    +
    +
    +
  • +
  • +
  • +
+
+ +
+ +
+
+
+
+
+ +
+ +
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_Logon.html b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_Logon.html new file mode 100644 index 000000000000..6ee46c88731b --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_Logon.html @@ -0,0 +1,118 @@ + + + + + + Logon Checkout + + + +
+
+ + + +
+
+ + +
+

You don't need an account to place an order but you will have the option to create one after completing your purchase.

+
+
+
+

Click or touch the House +

+
+
+ +
+
+
+ + +
+
+ + + +
+ +! The validation code entered is incorrect +
+
+
+ Checkout as Guest + +
+
+
+
+
+ Privacy Policy | Terms and Conditions +
+ + + +
+ +
+
+
+
+
+ User Name + Forgot user name? +
+ +
+
+
+ + +
+ + + + +
+
+
+ Password + Forgot password? +
+ +
+
+
+
+
+ ! You have entered an invalid username and/or password. Please re-enter your information. +
+
+ ! + + +
+ +
+
+ + + + + +
+
+ +
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_ShippingInfo.html b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_ShippingInfo.html new file mode 100644 index 000000000000..d461a0050b86 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CDW/Checkout_ShippingInfo.html @@ -0,0 +1,376 @@ + + + + + + Checkout + + + +
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
We will only contact you about your order and shipping.
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + +
+
+
    +
  • + Edit +
    +
    + Address: +
    +
    +
    + + + + +
    +
    + + +
    +
    +
    +
    +
    +
    + +, + + + + +
    +
    +
    +
    + Contact Info: +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
  • +
  • + Edit +
    +
    Shipping Method
    +
    +
    -
    +
    -
    +
    -
    +
    +
    +
  • +
  • + Edit +
    +
    + Billing Address +
    +
    +
    + + + + +
    +
    +
    +
    +
    +
    +
    +
    + +, + + + + +
    +
    +
    Payment Method
    +
    +
    +
    +
  • +
  • +
  • +
+
+
+ +
+
+ +
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CostCo/Payment.html b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/Payment.html new file mode 100644 index 000000000000..e45176cabc26 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/Payment.html @@ -0,0 +1,892 @@ + + + + + + Costco - Payment + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + +
+
+ + +
+
+
+
+ + + +
+
+ + +  ? + +
+
+
+ + +
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + +
+
+ + +
+
+ + +  ? + +
+         More Info - Costco Cash Card + + Costco Cash Card Number + This image highlights the unique number + cashcard-us.gif + used to identify your Costco Cash card. + Pin Number + This number is used to access your + + Costco Cash card. The image shows + where this number is located. + @ 1998-2016 Costco Wholesale Corporation. All rights reserved. +
+
+
+
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+ +

+* Required fields

+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + + +
+ +
+
+ +
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +

+* Required fields

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+
+
[rx-DefaultAddrConfirm]
+
+
    +
  • + You are changing your Costco Default Shipping Address.  All future orders from Costco.com, including Pharmacy Prescription Orders, will be sent to this Address. +
  • +
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CostCo/ShippingAddress.html b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/ShippingAddress.html new file mode 100644 index 000000000000..b9b72eb3385c --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/ShippingAddress.html @@ -0,0 +1,527 @@ + + + + + + + Shipping + + + + + + +
+ + + + + + +
+
+ + + + + + +
+
+
+ +

+ * Required fields

+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + + +
+ +
+
+ +
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +

+* Required fields

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+
+
+ [rx-DefaultAddrConfirm] +
+
+
    +
  • You are changing your Costco Default Shipping Address.  All future orders from Costco.com, including Pharmacy Prescription Orders, will be sent to this Address. +
  • +
+
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+
+
+
+ + +
+ + +
+
+ + + + + + +
+ + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/CostCo/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/SignIn.html new file mode 100644 index 000000000000..afcd5fe6f09b --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/CostCo/SignIn.html @@ -0,0 +1,374 @@ + + + + + + Sign In + + + + + + +
+ + +
+ + + + + +
+
+
+
+
+ +
+ +
+ + +
+
+ + + + +
+
+
+
+
  • + +
  • +
    +
    +
    + + +
    +
    +
    + + + + + + + +

    Please provide your email address and password to access your account.† +

    +
    + + +
    +
    +
    + + +

    Passwords are case sensitive.

    +
    +
    +
    + + +
    + +
    + +
    +
    +
    + + + + + + + + + + +

    To reset your password, enter the email address associated with your Costco.com account. Instructions to create a new password will be sent to your address. +

    +
    + + +
    + +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + +

    Enter your email address and create a password below to register.† +

    +
    +* Required fields +
    +
    + + +
    +
    + + +
    + +
    +

    Password must meet the following:

    +
    +
      +
    • Use between 8 and 20 characters
    • +
    • Include at least one letter
    • +
    • Does not contain blank spaces or the following special characters: < > " \ . +
    • +
    • Passwords match
    • +
    +
    +

    Password Strength : + +

    +
      +
    • Too Short
    • +
    • Weak
    • +
    • Fair
    • +
    • Good
    • +
    • Strong
    • +
    +

    +

    +

    To improve strength, increase password length and use capital letters, numbers, and special characters + (except < > " \ .) +

    +
    +
    +
    +
    + + +
    +
    + + +
    +

    +Non-members may be assessed an additional surcharge. The surcharge does not apply to prescription items. Executive Members need to provide a membership number to receive credit for their 2% rebate. +

    +
    + + +
    + +
    + +
    +
    + +
    +
    + ???LANGUAGE_REGION_MODAL_TITLE??? +
    +
    +
    +

    ???LANGUAGE_REGION_MODAL_CHOOSE_LANGUAGE???

    + +
    +
    +
    +

    ???LANGUAGE_REGION_MODAL_CHOOSE_REGION???

    +
    + + + + + + + +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/Checkout_ShippingPayment.html b/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/Checkout_ShippingPayment.html new file mode 100644 index 000000000000..182535065101 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/Checkout_ShippingPayment.html @@ -0,0 +1,381 @@ + + + + + + + The Home Depot - Checkout + + + + +
    + + +
    +
    +
    +
    + + + + + + +
    +
    + + + + + + +
    +
    +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    +Create an account to track your order history and check out faster - all we need is a password.
    +
    +

    Check out faster, access past orders, and organize products into lists.

    +
    +
    +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    + Passwords are case sensitive and must be at least 8 characters. +
    + Create a strong password by: +
      +
    • Including numbers or symbols
    • +
    • Mixing upper/lowercase
    • +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    +
    + +
    + + +
    + +
    +
    +
    +
    +
    +
    +Add an apartment, suite, building, etc. +
    +
    +
    + + + + +
    +
    + + + +MOUNTAIN VIEW, CA + +
    + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    + Payment +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + + + + + +
    +
    +
    +
    +
    + Expiration + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + + + + +
    +
    +
    + Apply a Gift Card +  |  + Have a PO/Job Code for this order? +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    + + + + +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +Have a promo code? +
    +
    +
    + + + + +
    +
    +
    + + + + + +Apply + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/SignIn.html new file mode 100644 index 000000000000..b741ce5f0c20 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/HomeDepot/SignIn.html @@ -0,0 +1,83 @@ + + + + + The Home Depot - SignIn + + + + + + + +
    + + + + + + + + + + + +
    + + + + +
    +
    +

    You will have the opportunity to create an account and track your order once you complete your checkout. +

    +

    +

    +
    +
    + +
    +
    +
    + + +

    I'm a Returning Customer +

    +
    + Your sign in is incorrect. Please enter your email address or password. Note: One more invalid attempt will lock your account. +
    +
    + We periodically require password updates. Please reset your password or continue as a guest. +
    +
    + + + + +
    +
    + + + + + +
    +
    +
    + +
    +
    + Reset Password +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_Payment.html b/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_Payment.html new file mode 100644 index 000000000000..4ec11c2b857f --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_Payment.html @@ -0,0 +1,478 @@ + + + + + Macy's Checkout + + + + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + + +
    +
    +
    +
    + Note: PayPal can't be used with Gift Cards, Reward Cards and Credit Cards. + Plenti points can be earned but not used with PayPal. +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Secure payment + more info +

    +
    +
    +
    +
    + + +
    Your Shipping, Plenti, and Gift Card information can be found and verified at the top of this page"
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    Please enter the 4 digit security code on the front of your credit card
    +
    Please enter the 3 digit security code on the back of your credit card
    +
    +
    + + + + +
    +
    +
    +
    +
    +
    +
    + Note: PayPal can't be used with Gift Cards, Reward Cards and Credit Cards. + Plenti points can be earned but not used with PayPal. +
    +
    +
    +
    + You will login on PayPal's site on the next page and review your order, then you will finish the transaction at macy's.com +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Vance Chen

    +

    1099 Maiden Lane

    +

    102

    +

    Ann Arbor, MI 48105

    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + We'll only contact you if we have questions about this order. +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_ShippingAddress.html b/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_ShippingAddress.html new file mode 100644 index 000000000000..7ed68344fa90 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Macys/Checkout_ShippingAddress.html @@ -0,0 +1,439 @@ + + + + + Macy's Checkout + + + + + + +
    +
    +
    +
    +
    + + +Please enter a first name. +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + Shipping method +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    $10.95 +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    $19.95 +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    $29.95 +
    +
    +
    +
    +

    +Note: We'll send you an email to schedule your delivery. +

    +

    +Note: Some items in your order may ship separately. Transit time is the time between leaving our fulfillment center & delivery to you. +

    +
    +
    +
    +
    +
    +
    + + Gift Options + +
    +
    +
    +
    + +
    + "Selecting this checkbox will expand additional gift options" +
    + + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + Write a personal message. We'll print it on a card & send it along with the order. +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Macys/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/Macys/SignIn.html new file mode 100644 index 000000000000..51dff05d0464 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Macys/SignIn.html @@ -0,0 +1,208 @@ + + + + + Sign In - Macy's Checkout + + + + + + +
    +
    + +
    +
    +Password is case sensitive +
    +
    + Forgot Your Password? +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/BillingInfo.html b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/BillingInfo.html new file mode 100644 index 000000000000..c614660e1093 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/BillingInfo.html @@ -0,0 +1,1083 @@ + + + + + Newegg.com - Billing Info + + + + + + + + + +
    +
    + Redeem Newegg gift cards + +
    +
    +
    +
    +
    + + + +
    +
    + + + +
    +
    +
    + + + + Enter A Gift Card + + + +
    + + + +
    +
    + EggPoints +
    +
    + +
    + Payment Methods + + +
    +

    Some payment methods may not be eligible for your order. Please review the full list by clicking here for payment restrictions.

    +
    + + +
    +
    + + +
    +
    + Billing Address + + +
    + + + + + + + + + + + + +
    +
    +
    +
    +
    + +
    + + + + + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/Login.html b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/Login.html new file mode 100644 index 000000000000..a5f149b68362 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/Login.html @@ -0,0 +1,156 @@ + + + + + Newegg.com - Login + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    +
    + + CONTINUE AS A GUEST + +
    +
    + + + + + + + +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/ShippingInfo.html b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/ShippingInfo.html new file mode 100644 index 000000000000..14bd9502afe4 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/NewEgg/ShippingInfo.html @@ -0,0 +1,270 @@ + + + + + Newegg.com - Shipping Info + + + + + + + + + +
    + + + + + + +
    + + + + +
    + + +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/Payment.html b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/Payment.html new file mode 100644 index 000000000000..06b9f8e7632b --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/Payment.html @@ -0,0 +1,672 @@ + + + + + + + + + + + + + + + + + Office Supplies, Furniture, Technology at Offic Depot + + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + + +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + + +Need Help? +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + +
    +
    +
    +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +

    + +

    + + 87 +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + + + + + +
    + + + + + + +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/ShippingAddress.html b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/ShippingAddress.html new file mode 100644 index 000000000000..849e3be49559 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/ShippingAddress.html @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + Office Supplies, Furniture, Technology at Office Depot + + + +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + + +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + +
    + + + + + + +
    +
    +
    +
    +
    +
    + + + + + + + + + + +
    +
    + + +
    +
    +
    +
    + + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/SignIn.html new file mode 100644 index 000000000000..70b55fedddb3 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/OfficeDepot/SignIn.html @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + Office Supplies, Furniture, Technology at Office Depot + + + +
    + + + + + +
    + + + +
    +
    + + + +Forgot login name/password? + +
    +
    + Keep me logged in +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/QVC/PaymentMethod.html b/browser/extensions/formautofill/test/fixtures/third_party/QVC/PaymentMethod.html new file mode 100644 index 000000000000..9d51db7c5d8c --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/QVC/PaymentMethod.html @@ -0,0 +1,527 @@ + + + + + + + + + Payment Method + + +
    + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +
      +
    • + + +
    • +
    • + + +
    • +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + +
    + + + (formerly Bill Me Later®) +
    +
    +
    + + +
    +
    + + +
    +
    + XXX-XX- +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    + +      +
    +
    +
    + + + + + +
    + + +
    +
    +
    +
    +   +
    +
    +
    + + + + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + + + + + + Enter Another Card + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + Continue Checkout + + + Continue Checkout + + + + + Edit Shopping cart + +
    +
    +
    +
    + + * + + + + *You're signing up to receive QVC promotional email. +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/QVC/SignIn.html b/browser/extensions/formautofill/test/fixtures/third_party/QVC/SignIn.html new file mode 100644 index 000000000000..a056ccfc5cc5 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/QVC/SignIn.html @@ -0,0 +1,80 @@ + + + + + + + + QVC.com Sign In + + +
    +
    + + + + + + +
    +
    +
    + +
    + + + + + + + + +
    +
    + + +
    + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + Create Password + + + + Continue + + +
    +
    + + Sign In + + +
    +
    +
    + +
    +
    +
    + +
    + + Continue + + +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/QVC/YourInformation.html b/browser/extensions/formautofill/test/fixtures/third_party/QVC/YourInformation.html new file mode 100644 index 000000000000..7af160e354cc --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/QVC/YourInformation.html @@ -0,0 +1,522 @@ + + + + + + + + + Payment Method + + +
    + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • + + +
    • +
    • + + +
    • +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    + XXX-XX- +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    + +      +
    +
    +
    + + + + + +
    + + +
    +
    +
    +
    +   +
    +
    +
    + + + Add My QCard + + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + + + + + + Enter Another Card + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + Continue Checkout + + + Continue Checkout + + + + + Edit Shopping cart + +
    +
    +
    +
    + + * + + + + *You're signing up to receive QVC promotional email. +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/README b/browser/extensions/formautofill/test/fixtures/third_party/README new file mode 100644 index 000000000000..ca4750ec08cf --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/README @@ -0,0 +1,4 @@ +This directory contains pages downloaded from the web for the purpose of testing +Form Autofill against pages from the real world. These files are not made +available under an open source license. + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Sears/PaymentOptions.html b/browser/extensions/formautofill/test/fixtures/third_party/Sears/PaymentOptions.html new file mode 100644 index 000000000000..5f6ecd24d9d7 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Sears/PaymentOptions.html @@ -0,0 +1,566 @@ + + + + + + + + + + + Payment Options | Sears PartsDirect + + + + +
    +
    + + + + + + +
    +
    +
    + + + + + + + +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + + + + + + +
    + + +
    +
    + + +
    + +
    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    + + + + +
    +
    +
    +
    +
    + + +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Sears/ShippingAddress.html b/browser/extensions/formautofill/test/fixtures/third_party/Sears/ShippingAddress.html new file mode 100644 index 000000000000..a9d1f5cd0f3f --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Sears/ShippingAddress.html @@ -0,0 +1,447 @@ + + + + + + + + + + + Shipping address | Sears PartsDirect + + + + +
    +
    + + + + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    +
    +
    +

    +

    +
    + + + +
    +
    + +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + +
    24 character limit
    +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + + +
    +
    + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +
    + + + + + +
    + + +
    +
    + + +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic.html b/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic.html new file mode 100644 index 000000000000..cf9e892cb2b2 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic.html @@ -0,0 +1,117 @@ + + + + + It's easy to find the Office Supplies, Copy Paper, + Furniture, Ink, Toner, Cleaning Products, Electronics and the + Technology you need | Staples® + + + + + + + + + + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic_ac_on.html b/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic_ac_on.html new file mode 100644 index 000000000000..d3ba1116aabf --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Staples/Basic_ac_on.html @@ -0,0 +1,117 @@ + + + + + It's easy to find the Office Supplies, Copy Paper, + Furniture, Ink, Toner, Cleaning Products, Electronics and the + Technology you need | Staples® + + + + + + + + + + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling.html b/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling.html new file mode 100644 index 000000000000..37dadeb514a9 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling.html @@ -0,0 +1,99 @@ + + + + + It's easy to find the Office Supplies, Copy Paper, + Furniture, Ink, Toner, Cleaning Products, Electronics and the + Technology you need | Staples® + + + + + + + + + + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    +

    Purchase Order # (optional) Add +

    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    +By placing your order, you agree to + Staples + +Terms & + Conditions. + +

    +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling_ac_on.html b/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling_ac_on.html new file mode 100644 index 000000000000..98c9fb85555b --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Staples/PaymentBilling_ac_on.html @@ -0,0 +1,98 @@ + + + + + It's easy to find the Office Supplies, Copy Paper, + Furniture, Ink, Toner, Cleaning Products, Electronics and the + Technology you need | Staples® + + + + + + + + + + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    +

    Purchase Order # (optional) Add +

    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    +By placing your order, you agree to + Staples + +Terms & + Conditions. + +

    +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Checkout.html b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Checkout.html new file mode 100644 index 000000000000..0d59eec17280 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Checkout.html @@ -0,0 +1,243 @@ + + + + + + + + + + + + +
    +

    Enter new zip code:

    + +
    +

    + +

    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    *required field
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +By clicking Create Account, you acknowledge you + have read and agreed to our +Terms of + Use +and +Privacy + Policy +. + +
    + +
    +
    + + +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Payment.html b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Payment.html new file mode 100644 index 000000000000..26936843291a --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Payment.html @@ -0,0 +1,235 @@ + + + + + + + + + Checkout + + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    * required field
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + +
    + + + +
    +  /  +
    + + + +
    +
    +
    +
    + + +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +

    +22F., No.55, Haiiu 1st Rd., Bafu Dist., +
    + +San Bruno +, + + +CA + +94066 +

    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Shipping.html b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Shipping.html new file mode 100644 index 000000000000..908453b7f1e0 --- /dev/null +++ b/browser/extensions/formautofill/test/fixtures/third_party/Walmart/Shipping.html @@ -0,0 +1,234 @@ + + + + + + + + + Checkout + + + + + + + + + + + +
    +

    Enter new zip code:

    + +
    +

    + +

    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    +
    *required field
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + diff --git a/browser/extensions/formautofill/test/unit/head.js b/browser/extensions/formautofill/test/unit/head.js index a49757a340ba..0bf3608ba4e4 100644 --- a/browser/extensions/formautofill/test/unit/head.js +++ b/browser/extensions/formautofill/test/unit/head.js @@ -2,7 +2,7 @@ * Provides infrastructure for automated formautofill components tests. */ -/* exported loadFormAutofillContent, getTempFile, sinon */ +/* exported getTempFile, loadFormAutofillContent, runHeuristicsTest, sinon */ "use strict"; @@ -79,6 +79,45 @@ function getTempFile(leafName) { return file; } +function runHeuristicsTest(patterns, fixturePathPrefix) { + Cu.import("resource://gre/modules/FormLikeFactory.jsm"); + Cu.import("resource://formautofill/FormAutofillHeuristics.jsm"); + + // TODO: "select" and "textarea" will be included eventually. + const QUERY_STRING = ["input"]; + patterns.forEach(testPattern => { + add_task(function* () { + do_print("Starting test fixture: " + testPattern.fixturePath); + let file = do_get_file(fixturePathPrefix + testPattern.fixturePath); + let doc = MockDocument.createTestDocumentFromFile("http://localhost:8080/test/", file); + + let forms = []; + + for (let query of QUERY_STRING) { + for (let field of doc.querySelectorAll(query)) { + let formLike = FormLikeFactory.createFromField(field); + if (!forms.some(form => form.rootElement === formLike.rootElement)) { + forms.push(formLike); + } + } + } + + Assert.equal(forms.length, testPattern.expectedResult.length, "Expected form count."); + + forms.forEach((form, formIndex) => { + let formInfo = FormAutofillHeuristics.getFormInfo(form); + // TODO: This line should be uncommented to make sure every field are verified. + // Assert.equal(formInfo.length, testPattern.expectedResult[formIndex].length, "Expected field count."); + formInfo.forEach((field, fieldIndex) => { + let expectedField = testPattern.expectedResult[formIndex][fieldIndex]; + expectedField.elementWeakRef = field.elementWeakRef; + Assert.deepEqual(field, expectedField); + }); + }); + }); + }); +} + add_task(function* head_initialize() { Services.prefs.setBoolPref("browser.formautofill.experimental", true); Services.prefs.setBoolPref("dom.forms.autocomplete.experimental", true); diff --git a/browser/extensions/formautofill/test/unit/heuristics/test_basic.js b/browser/extensions/formautofill/test/unit/heuristics/test_basic.js new file mode 100644 index 000000000000..5f3c7759c85e --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/test_basic.js @@ -0,0 +1,22 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "autocomplete_basic.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "street-address"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../fixtures/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_BestBuy.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_BestBuy.js new file mode 100644 index 000000000000..60df0f661a29 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_BestBuy.js @@ -0,0 +1,56 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Checkout_ShippingAddress.html", + expectedResult: [ + [], // Search form + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO:select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + [ // Sign up + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ // unknown + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + ], + ], + }, { + fixturePath: "Checkout_Payment.html", + expectedResult: [ + [], // Search form + [ // Sign up + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO:select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + [ + // unknown + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + ], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [ // Sign in + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../../fixtures/third_party/BestBuy/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js new file mode 100644 index 000000000000..6c7a5fe0d2b8 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js @@ -0,0 +1,55 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Checkout_ShippingInfo.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + ], + [], + ], + }, { + fixturePath: "Checkout_BillingPaymentInfo.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + [ + /* TODO: Credit Card + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, +*/ + ], + ], + }, { + fixturePath: "Checkout_Logon.html", + expectedResult: [ + [], + [], + [], + ], + }, +], "../../../fixtures/third_party/CDW/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js new file mode 100644 index 000000000000..f5e77d42fe77 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js @@ -0,0 +1,124 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "ShippingAddress.html", + expectedResult: [ + [], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "additional-name"}, // middle-name initial + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select,country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, // TODO: fix the regexp + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "additional-name"}, // middle-name initial + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select,country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, // TODO: fix the regexp + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select,state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, { + fixturePath: "Payment.html", + expectedResult: [ + [ +/* TODO: credit card + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, // ac-off +*/ + ], + [], + [], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "additional-name"}, // middle-name initial + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select, country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, // TODO: fix the regexp + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "additional-name"}, // middle-name initial + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select, country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, // TODO: fix the regexp + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + [ // Forgot password + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, + ], + [ // Sign up + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, +], "../../../fixtures/third_party/CostCo/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js new file mode 100644 index 000000000000..77993b6c66a9 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js @@ -0,0 +1,34 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Checkout_ShippingPayment.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, + ], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../../fixtures/third_party/HomeDepot/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Macys.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Macys.js new file mode 100644 index 000000000000..6885819df561 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Macys.js @@ -0,0 +1,67 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Checkout_ShippingAddress.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // select + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + ], + [ +/* +*/ + ], + ], + }, { + fixturePath: "Checkout_Payment.html", + expectedResult: [ + [ + /* + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off +*/ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // select + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [ // Sign in + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, + ], + [ // Forgot password + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + [], + [], + ], + }, +], "../../../fixtures/third_party/Macys/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js new file mode 100644 index 000000000000..d5479f364d52 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js @@ -0,0 +1,66 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "ShippingInfo.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select, country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, { + fixturePath: "BillingInfo.html", + expectedResult: [ + [ +/* TODO: Should match the following fields. + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, +*/ +// {"section": "", "addressType": "", "contactType": "", "fieldName": "country"}, // TODO: select, country + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, country + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, // TODO +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // TODO +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, // TODO +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, // TODO + ], + [], + [], + [], + ], + }, { + fixturePath: "Login.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../../fixtures/third_party/NewEgg/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js new file mode 100644 index 000000000000..c553615c765f --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js @@ -0,0 +1,64 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "ShippingAddress.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + + // TODO: telphone relative fields should be fixed: + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-area-code"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-prefix"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-suffix"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, + + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, { + fixturePath: "Payment.html", + expectedResult: [ + [ +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + + // TODO: telphone relative fields should be fixed: + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-area-code"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-prefix"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-suffix"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, + + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [ // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../../fixtures/third_party/OfficeDepot/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js new file mode 100644 index 000000000000..d2b088ca9d49 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js @@ -0,0 +1,54 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "YourInformation.html", + expectedResult: [ + [ +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, { + fixturePath: "PaymentMethod.html", + expectedResult: [ + [ +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, // ac-off + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"}, // select +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"}, // select +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"}, // select +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, // select +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"}, // select +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, { + fixturePath: "SignIn.html", + expectedResult: [ + [ + // Unknown + ], + [ // Sign in + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [], + ], + }, +], "../../../fixtures/third_party/QVC/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js new file mode 100644 index 000000000000..60fe39e55ad2 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js @@ -0,0 +1,87 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "ShippingAddress.html", + expectedResult: [ + [], + [], // search form, ac-off + [ // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ // check-out, ac-off +/* + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +*/ + ], + [ // ac-off +/* + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "new-password"}, +*/ + ], + [ // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + [ // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, { + fixturePath: "PaymentOptions.html", + expectedResult: [ + [], + [], // search + [ // credit card +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, + ], + [ // Another billing address + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, + ], + [ // check out + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: Wrong. This is for Driver's license. +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"}, + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + ], + ], + }, +], "../../../fixtures/third_party/Sears/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js new file mode 100644 index 000000000000..240aa0fbbea3 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js @@ -0,0 +1,48 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Basic.html", + expectedResult: [ + [ // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + ], + ], + }, { + fixturePath: "Basic_ac_on.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"}, + ], + ], + }, { + fixturePath: "PaymentBilling.html", + expectedResult: [ + [], + ], + }, { + fixturePath: "PaymentBilling_ac_on.html", + expectedResult: [ + [ +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, + ], + ], + }, +], "../../../fixtures/third_party/Staples/"); + diff --git a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js new file mode 100644 index 000000000000..4d8d67953a63 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js @@ -0,0 +1,62 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest([ + { + fixturePath: "Checkout.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + [ + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, // ac-off + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"}, // ac-off +// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, // ac-off + ], + ], + }, { + fixturePath: "Payment.html", + expectedResult: [ + [ + ], + [ + {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "family-name"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, + {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "tel"}, + ], + ], + }, { + fixturePath: "Shipping.html", + expectedResult: [ + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + [ + ], + [ + {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"}, +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"}, // TODO: fix the regexp + {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city +// {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: select, state + {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"}, + ], + ], + }, +], "../../../fixtures/third_party/Walmart/"); + diff --git a/browser/extensions/formautofill/test/unit/xpcshell.ini b/browser/extensions/formautofill/test/unit/xpcshell.ini index 78c472186503..724e799c2e71 100644 --- a/browser/extensions/formautofill/test/unit/xpcshell.ini +++ b/browser/extensions/formautofill/test/unit/xpcshell.ini @@ -2,7 +2,20 @@ firefox-appdir = browser head = head.js support-files = + ../fixtures/** +[heuristics/test_basic.js] +[heuristics/third_party/test_BestBuy.js] +[heuristics/third_party/test_CDW.js] +[heuristics/third_party/test_CostCo.js] +[heuristics/third_party/test_HomeDepot.js] +[heuristics/third_party/test_Macys.js] +[heuristics/third_party/test_NewEgg.js] +[heuristics/third_party/test_OfficeDepot.js] +[heuristics/third_party/test_QVC.js] +[heuristics/third_party/test_Sears.js] +[heuristics/third_party/test_Staples.js] +[heuristics/third_party/test_Walmart.js] [test_autofillFormFields.js] [test_collectFormFields.js] [test_enabledStatus.js] diff --git a/toolkit/modules/tests/modules/MockDocument.jsm b/toolkit/modules/tests/modules/MockDocument.jsm index 3cae9bb910e0..a4048dac9a01 100644 --- a/toolkit/modules/tests/modules/MockDocument.jsm +++ b/toolkit/modules/tests/modules/MockDocument.jsm @@ -10,6 +10,8 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.importGlobalProperties(["URL"]); +const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {}); + const MockDocument = { /** * Create a document for the given URL containing the given HTML with the ownerDocument of all
    s having a mocked location. @@ -46,5 +48,15 @@ const MockDocument = { }); }, + createTestDocumentFromFile(aDocumentURL, aFile) { + let fileStream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fileStream.init(aFile, -1, -1, 0); + + let data = NetUtil.readInputStreamToString(fileStream, fileStream.available()); + + return this.createTestDocument(aDocumentURL, data); + }, + };