Bug 1890427 - Part 6: Use an observer to regenerate backups when an address is deleted. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D218876
This commit is contained in:
@@ -3231,7 +3231,8 @@ export class BackupService extends EventTarget {
|
|||||||
case "formautofill-storage-changed": {
|
case "formautofill-storage-changed": {
|
||||||
if (
|
if (
|
||||||
data == "remove" &&
|
data == "remove" &&
|
||||||
subject.wrappedJSObject.collectionName == "creditCards"
|
(subject.wrappedJSObject.collectionName == "creditCards" ||
|
||||||
|
subject.wrappedJSObject.collectionName == "addresses")
|
||||||
) {
|
) {
|
||||||
this.#debounceRegeneration();
|
this.#debounceRegeneration();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,3 +415,27 @@ add_task(async function test_payment_method_removed() {
|
|||||||
await formAutofillStorage.creditCards.remove(guid);
|
await formAutofillStorage.creditCards.remove(guid);
|
||||||
}, "Saw regeneration on payment method removal.");
|
}, "Saw regeneration on payment method removal.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that backup regeneration occurs when removing an address.
|
||||||
|
*/
|
||||||
|
add_task(async function test_address_removed() {
|
||||||
|
await formAutofillStorage.initialize();
|
||||||
|
let guid = await formAutofillStorage.addresses.add({
|
||||||
|
"given-name": "John",
|
||||||
|
"additional-name": "R.",
|
||||||
|
"family-name": "Smith",
|
||||||
|
organization: "World Wide Web Consortium",
|
||||||
|
"street-address": "32 Vassar Street\\\nMIT Room 32-G524",
|
||||||
|
"address-level2": "Cambridge",
|
||||||
|
"address-level1": "MA",
|
||||||
|
"postal-code": "02139",
|
||||||
|
country: "US",
|
||||||
|
tel: "+15195555555",
|
||||||
|
email: "user@example.com",
|
||||||
|
});
|
||||||
|
|
||||||
|
await expectRegeneration(async () => {
|
||||||
|
await formAutofillStorage.addresses.remove(guid);
|
||||||
|
}, "Saw regeneration on address removal.");
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user