From 0f1118935fad99c8722ebe620c5de13070dcd9a3 Mon Sep 17 00:00:00 2001 From: Simon Friedberger Date: Mon, 19 May 2025 18:59:46 +0000 Subject: [PATCH] Bug 1960313: Stop throwing unneeded notification for stale credit card entry notifications r=dimi Differential Revision: https://phabricator.services.mozilla.com/D250037 --- .../extensions/formautofill/test/unit/test_addressRecords.js | 5 ----- .../formautofill/test/unit/test_creditCardRecords.js | 5 ----- .../components/formautofill/FormAutofillStorageBase.sys.mjs | 4 +++- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/browser/extensions/formautofill/test/unit/test_addressRecords.js b/browser/extensions/formautofill/test/unit/test_addressRecords.js index e76a031f4968..8bde51306fc5 100644 --- a/browser/extensions/formautofill/test/unit/test_addressRecords.js +++ b/browser/extensions/formautofill/test/unit/test_addressRecords.js @@ -366,11 +366,6 @@ add_task(async function test_notifyUsed() { getSyncChangeCounter(profileStorage.addresses, guid), changeCounter ); - - Assert.throws( - () => profileStorage.addresses.notifyUsed("INVALID_GUID"), - /No matching record\./ - ); }); add_task(async function test_remove() { diff --git a/browser/extensions/formautofill/test/unit/test_creditCardRecords.js b/browser/extensions/formautofill/test/unit/test_creditCardRecords.js index de9752f09ad9..13c4799a9784 100644 --- a/browser/extensions/formautofill/test/unit/test_creditCardRecords.js +++ b/browser/extensions/formautofill/test/unit/test_creditCardRecords.js @@ -469,11 +469,6 @@ add_task(async function test_notifyUsed() { Assert.equal(creditCard.timesUsed, timesUsed + 1); Assert.notEqual(creditCard.timeLastUsed, timeLastUsed); - - Assert.throws( - () => profileStorage.creditCards.notifyUsed("INVALID_GUID"), - /No matching record\./ - ); }); add_task(async function test_remove() { diff --git a/toolkit/components/formautofill/FormAutofillStorageBase.sys.mjs b/toolkit/components/formautofill/FormAutofillStorageBase.sys.mjs index f2b46bebcc01..39dd1aa1c25f 100644 --- a/toolkit/components/formautofill/FormAutofillStorageBase.sys.mjs +++ b/toolkit/components/formautofill/FormAutofillStorageBase.sys.mjs @@ -539,7 +539,9 @@ class AutofillRecords { let recordFound = this._findByGUID(guid); if (!recordFound) { - throw new Error("No matching record."); + // record must have been deleted, nothing to update + this.log.debug("Cannot notify. No record found with guid:", guid); + return; } recordFound.timesUsed++;