Bug 1395019 - [Form Autofill] Part 1: The raw data of credit card fields shouldn't include "cc-exp". r=seanlee
authorLuke Chang <lchang@mozilla.com>
Wed, 30 Aug 2017 11:29:59 +0800
changeset 377785 b15742c2bf22a5c925866a424dda26e67dd5414c
parent 377784 1a1f4fe397d9c41e71b44645c85399ae0726bfd1
child 377786 96bea603414ca6b452ff87eb65e41501f4cfe918
push id94338
push userkwierso@gmail.com
push dateThu, 31 Aug 2017 02:58:58 +0000
treeherdermozilla-inbound@9ca18987dabb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseanlee
bugs1395019
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 1395019 - [Form Autofill] Part 1: The raw data of credit card fields shouldn't include "cc-exp". r=seanlee MozReview-Commit-ID: 4OSOgeEgWh9
browser/extensions/formautofill/ProfileStorage.jsm
browser/extensions/formautofill/test/unit/test_creditCardRecords.js
--- a/browser/extensions/formautofill/ProfileStorage.jsm
+++ b/browser/extensions/formautofill/ProfileStorage.jsm
@@ -64,16 +64,17 @@
  *       cc-exp-year,          // 2-digit year will be converted to 4 digits
  *                             // upon saving
  *
  *       // computed fields (These fields are computed based on the above fields
  *       // and are not allowed to be modified directly.)
  *       cc-given-name,
  *       cc-additional-name,
  *       cc-family-name,
+ *       cc-exp,
  *
  *       // metadata
  *       timeCreated,          // in ms
  *       timeLastUsed,         // in ms
  *       timeLastModified,     // in ms
  *       timesUsed
  *       _sync: { ... optional sync metadata },
  *     }
@@ -185,16 +186,17 @@ const VALID_CREDIT_CARD_FIELDS = [
   "cc-exp-month",
   "cc-exp-year",
 ];
 
 const VALID_CREDIT_CARD_COMPUTED_FIELDS = [
   "cc-given-name",
   "cc-additional-name",
   "cc-family-name",
+  "cc-exp",
 ];
 
 const INTERNAL_FIELDS = [
   "guid",
   "version",
   "timeCreated",
   "timeLastUsed",
   "timeLastModified",
--- a/browser/extensions/formautofill/test/unit/test_creditCardRecords.js
+++ b/browser/extensions/formautofill/test/unit/test_creditCardRecords.js
@@ -123,21 +123,23 @@ add_task(async function test_getAll() {
 
   do_check_eq(creditCards.length, 2);
   do_check_credit_card_matches(creditCards[0], TEST_CREDIT_CARD_1);
   do_check_credit_card_matches(creditCards[1], TEST_CREDIT_CARD_2);
 
   // Check computed fields.
   do_check_eq(creditCards[0]["cc-given-name"], "John");
   do_check_eq(creditCards[0]["cc-family-name"], "Doe");
+  do_check_eq(creditCards[0]["cc-exp"], "2017-04");
 
   // Test with rawData set.
   creditCards = profileStorage.creditCards.getAll({rawData: true});
   do_check_eq(creditCards[0]["cc-given-name"], undefined);
   do_check_eq(creditCards[0]["cc-family-name"], undefined);
+  do_check_eq(creditCards[0]["cc-exp"], undefined);
 
   // Modifying output shouldn't affect the storage.
   creditCards[0]["cc-name"] = "test";
   do_check_credit_card_matches(profileStorage.creditCards.getAll()[0], TEST_CREDIT_CARD_1);
 });
 
 add_task(async function test_get() {
   let path = getTempFile(TEST_STORE_FILE_NAME).path;