Bug 744061 - Fix random orange in test-address-book.js::setupModule caused by not destroying a fake address book. r=bienvenu.
authorMike Conley <mconley@mozilla.com>
Thu, 12 Apr 2012 16:50:53 -0400
changeset 11603 c418e4b2019c658fa8b30d24096bb2e42d393ef0
parent 11602 f2d47bbb6bf3d64147367a8d013e95c000de9aba
child 11604 f62eaa1c5b0de23f4254701aaafb34512b36b317
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs744061
Bug 744061 - Fix random orange in test-address-book.js::setupModule caused by not destroying a fake address book. r=bienvenu.
mail/test/mozmill/addrbook/test-update-mailing-list.js
mail/test/mozmill/shared-modules/test-address-book-helpers.js
--- a/mail/test/mozmill/addrbook/test-update-mailing-list.js
+++ b/mail/test/mozmill/addrbook/test-update-mailing-list.js
@@ -58,9 +58,12 @@ function test_contact_in_mailing_list_up
   ml = ab.childNodes.getNext();
 
   // Ensure that the primary email address for the contact changed
   // in the mailing list as well.
   assert_equals(1, ml.addressLists.length,
                 "There should only be one contact in the mailing list");
   let mlContact = ml.addressLists.queryElementAt(0, Ci.nsIAbCard);
   assert_equals(kNewAddress, mlContact.primaryEmail);
+
+  // Destroy the address book that we created.
+  delete_address_book(ab);
 }
--- a/mail/test/mozmill/shared-modules/test-address-book-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-address-book-helpers.js
@@ -99,16 +99,17 @@ function installInto(module) {
   module.select_address_book = select_address_book;
   module.get_contact_ab_view_index = get_contact_ab_view_index;
   // select_contact is aliased for select_contacts, since they
   // share the same code.
   module.select_contact = select_contacts;
   module.select_contacts = select_contacts;
   module.edit_selected_contact = edit_selected_contact;
   module.accept_contact_changes = accept_contact_changes;
+  module.delete_address_book = delete_address_book;
 }
 
 /**
  * Make sure that there is a card for this email address
  * @param emailAddress the address that should have a card
  * @param displayName the display name the card should have
  * @param preferDisplayName |true| if the card display name should override the
  *                          header display name
@@ -477,8 +478,16 @@ function edit_selected_contact(aControll
  *
  * @param aController the contact editing dialog controller to use.
  */
 function accept_contact_changes(aController)
 {
   if (!aController.window.document.documentElement.acceptDialog())
     throw new Error("Could not close the contact editing dialog!");
 }
+
+/**
+ * Deletes an address book.
+ */
+function delete_address_book(aAddrBook)
+{
+  MailServices.ab.deleteAddressBook(aAddrBook.URI);
+}