Bug 1617379 follow-up - Delete address book at the end of a test. rs=bustage-fix
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 01 Apr 2020 11:44:25 +1300
changeset 38643 5117addf33591f9a5bdf80f6430c80a584a5e5b2
parent 38642 e3d8ac839e6882e94f640d02883993757591fda5
child 38644 3c16add31ebc743d7cb8e0b18f037b3ac6e95572
push id400
push userclokep@gmail.com
push dateMon, 04 May 2020 18:56:09 +0000
reviewersbustage-fix
bugs1617379
Bug 1617379 follow-up - Delete address book at the end of a test. rs=bustage-fix
mail/components/extensions/test/xpcshell/test_ext_experiments.js
--- a/mail/components/extensions/test/xpcshell/test_ext_experiments.js
+++ b/mail/components/extensions/test/xpcshell/test_ext_experiments.js
@@ -249,9 +249,23 @@ add_task(async function test_managers() 
 
   await extension.startup();
   await extension.awaitMessage("get UIDs");
   extension.sendMessage(book.UID, contact.UID, list.UID);
   await extension.awaitFinish("finished");
   await extension.unload();
 
   Services.prefs.clearUserPref("extensions.webextensions.messagesPerPage");
+
+  await new Promise(resolve => {
+    let observer = {
+      onItemRemoved() {
+        MailServices.ab.removeAddressBookListener(this);
+        resolve();
+      },
+    };
+    MailServices.ab.addAddressBookListener(
+      observer,
+      Ci.nsIAbListener.directoryRemoved
+    );
+    MailServices.ab.deleteAddressBook(book.URI);
+  });
 });