Bug 1614265 - Reinstate Mac OS, Outlook, and LDAP directory types. r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 18 Feb 2020 08:27:05 +0000
changeset 37388 a04956310d2fe4df06c9ba41cb7bb239a09341d4
parent 37387 d575c65cb9ea5c7f01c7eedf861f3e0425ab72db
child 37389 3d4077ea41a58b0e2a2a4308839ea7215865b5f0
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1614265
Bug 1614265 - Reinstate Mac OS, Outlook, and LDAP directory types. r=mkmelin This required some adjustment in the C++ implementation of these types. The Outlook directory factory interface has been repurposed to do the minimum required - talk to the MAPI code and find directories. Differential Revision: https://phabricator.services.mozilla.com/D62395
mail/base/modules/MailMigrator.jsm
mail/components/addrbook/content/abTrees.js
mail/components/addrbook/test/browser/browser.ini
mailnews/addrbook/jsaddrbook/AddrBookManager.jsm
mailnews/addrbook/public/moz.build
mailnews/addrbook/public/nsAbBaseCID.h
mailnews/addrbook/public/nsIAbOutlookInterface.idl
mailnews/addrbook/src/moz.build
mailnews/addrbook/src/nsAbOSXDirectory.mm
mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
mailnews/addrbook/src/nsAbOutlookDirFactory.h
mailnews/addrbook/src/nsAbOutlookInterface.cpp
mailnews/addrbook/src/nsAbOutlookInterface.h
mailnews/addrbook/test/unit/xpcshell.ini
mailnews/addrbook/test/unit/xpcshell_migration.ini
mailnews/build/nsMailModule.cpp
--- a/mail/base/modules/MailMigrator.jsm
+++ b/mail/base/modules/MailMigrator.jsm
@@ -815,32 +815,32 @@ var MailMigrator = {
       backupFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
       console.log(`Renaming ${fileName}.mab to ${backupFile.leafName}`);
       oldFile.renameTo(profileDir, backupFile.leafName);
     }
 
     let profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
     for (let name of Services.prefs.getChildList("ldap_2.servers.")) {
       try {
-        if (
-          name.endsWith(".uri") &&
-          Services.prefs.getStringPref(name).startsWith("ldap://")
-        ) {
-          let prefName = name.substring(0, name.length - 4);
-          let fileName = Services.prefs.getStringPref(
-            `${prefName}.filename`,
-            ""
-          );
-          if (fileName.endsWith(".mab")) {
-            fileName = fileName.replace(/\.mab$/, "");
-            Services.prefs.setStringPref(
+        if (name.endsWith(".uri")) {
+          let uri = Services.prefs.getStringPref(name);
+          if (uri.startsWith("ldap://") || uri.startsWith("ldaps://")) {
+            let prefName = name.substring(0, name.length - 4);
+            let fileName = Services.prefs.getStringPref(
               `${prefName}.filename`,
-              `${fileName}.sqlite`
+              ""
             );
-            await migrateBook(fileName);
+            if (fileName.endsWith(".mab")) {
+              fileName = fileName.replace(/\.mab$/, "");
+              Services.prefs.setStringPref(
+                `${prefName}.filename`,
+                `${fileName}.sqlite`
+              );
+              await migrateBook(fileName);
+            }
           }
         } else if (
           name.endsWith(".dirType") &&
           Services.prefs.getIntPref(name) == 2
         ) {
           let prefName = name.substring(0, name.length - 8);
           let fileName = Services.prefs.getStringPref(`${prefName}.filename`);
           fileName = fileName.replace(/\.mab$/, "");
--- a/mail/components/addrbook/content/abTrees.js
+++ b/mail/components/addrbook/content/abTrees.js
@@ -27,17 +27,17 @@ function getDirectoryValue(aDir, aKey) {
       return "aab";
     }
     if (aDir._directory.URI == kPersonalAddressbookURI) {
       return "pab";
     }
     if (aDir._directory.URI == kCollectedAddressbookURI) {
       return "cab";
     }
-    if (aDir._directory.dirType == DIRTYPE_JS) {
+    if (aDir._directory.URI.startsWith("jsaddrbook://")) {
       return "js";
     }
     if (aDir._directory instanceof Ci.nsIAbLDAPDirectory) {
       return "ldap";
     }
 
     // If there is any other AB type.
     return "mapi+other";
--- a/mail/components/addrbook/test/browser/browser.ini
+++ b/mail/components/addrbook/test/browser/browser.ini
@@ -7,11 +7,10 @@ prefs =
   mail.provider.suppress_dialog_on_startup=true
   mail.spotlight.firstRunDone=true
   mail.winsearch.firstRunDone=true
   mailnews.start_page.override_url=about:blank
   mailnews.start_page.url=about:blank
 subsuite = thunderbird
 
 [browser_ldap_search.js]
-fail-if = true
 support-files = ../../../../../mailnews/addrbook/test/unit/data/ldap_contacts.json
 [browser_mailing_lists.js]
--- a/mailnews/addrbook/jsaddrbook/AddrBookManager.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookManager.jsm
@@ -20,16 +20,26 @@ ChromeUtils.defineModuleGetter(
   "resource://gre/modules/Services.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "SimpleEnumerator",
   "resource:///modules/AddrBookUtils.jsm"
 );
 
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+XPCOMUtils.defineLazyServiceGetter(
+  this,
+  "env",
+  "@mozilla.org/process/environment;1",
+  "nsIEnvironment"
+);
+
 /** Directory type constants, as defined in nsDirPrefs.h. */
 const LDAP_DIRECTORY_TYPE = 0;
 const MAPI_DIRECTORY_TYPE = 3;
 const JS_DIRECTORY_TYPE = 101;
 
 /** Test for valid directory URIs. */
 const URI_REGEXP = /^([\w-]+):\/\/([\w\.-]*)([?/:].*|$)/;
 
@@ -84,24 +94,58 @@ function createDirectoryObject(uri, shou
 function ensureInitialized() {
   if (store !== null) {
     return;
   }
 
   store = new Map();
 
   for (let pref of Services.prefs.getChildList("ldap_2.servers.")) {
-    if (pref.endsWith(".dirType")) {
-      let prefName = pref.substring(0, pref.length - 8);
-      let dirType = Services.prefs.getIntPref(pref);
-      let fileName = Services.prefs.getStringPref(`${prefName}.filename`, "");
-      if (dirType == JS_DIRECTORY_TYPE && fileName) {
-        let uri = `jsaddrbook://${fileName}`;
-        createDirectoryObject(uri, true);
+    try {
+      if (pref.endsWith(".uri")) {
+        let uri = Services.prefs.getStringPref(pref);
+        if (uri.startsWith("ldap://") || uri.startsWith("ldaps://")) {
+          let prefName = pref.substring(0, pref.length - 4);
+
+          uri = `moz-abldapdirectory://${prefName}`;
+          createDirectoryObject(uri, true);
+        }
+      } else if (pref.endsWith(".dirType")) {
+        let prefName = pref.substring(0, pref.length - 8);
+        let dirType = Services.prefs.getIntPref(pref);
+        let fileName = Services.prefs.getStringPref(`${prefName}.filename`, "");
+        let uri = Services.prefs.getStringPref(`${prefName}.uri`, "");
+
+        switch (dirType) {
+          case MAPI_DIRECTORY_TYPE:
+            if (env.exists("MOZ_AUTOMATION")) {
+              break;
+            }
+            if (AppConstants.platform == "macosx") {
+              createDirectoryObject(uri, true);
+            } else if (AppConstants.platform == "win") {
+              let outlookInterface = Cc[
+                "@mozilla.org/addressbook/outlookinterface;1"
+              ].getService(Ci.nsIAbOutlookInterface);
+              for (let folderURI of outlookInterface.getFolderURIs(uri)) {
+                let dir = createDirectoryObject(folderURI, true);
+                store.set(folderURI, dir);
+              }
+            }
+            break;
+          case JS_DIRECTORY_TYPE:
+            if (fileName) {
+              let uri = `jsaddrbook://${fileName}`;
+              createDirectoryObject(uri, true);
+            }
+            break;
+        }
       }
+    } catch (ex) {
+      Cu.reportError(ex);
     }
   }
 }
 
 Services.obs.addObserver(() => {
   // Clear the store. The next call to ensureInitialized will recreate it.
   store = null;
 }, "addrbook-reload");
@@ -134,18 +178,18 @@ AddrBookManager.prototype = {
     if (store.has(uri)) {
       return store.get(uri);
     }
 
     let uriParts = URI_REGEXP.exec(uri);
     if (!uriParts) {
       throw Cr.NS_ERROR_UNEXPECTED;
     }
-    let [, , , tail] = uriParts;
-    if (tail) {
+    let [, scheme, , tail] = uriParts;
+    if (tail && types.includes(scheme)) {
       // `tail` could either point to a mailing list or a query.
       // Both of these will be handled differently in future.
       return createDirectoryObject(uri);
     }
     return null;
   },
   getDirectoryFromId(dirPrefId) {
     ensureInitialized();
@@ -172,31 +216,96 @@ AddrBookManager.prototype = {
     }
 
     if (!dirName) {
       throw Cr.NS_ERROR_UNEXPECTED;
     }
 
     ensureInitialized();
 
-    let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
-    file.append("abook.sqlite");
-    file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
-    file.remove(false);
-    uri = `jsaddrbook://${file.leafName}`;
+    switch (type) {
+      case LDAP_DIRECTORY_TYPE: {
+        let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
+        file.append("ldap.sqlite");
+        file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
+
+        ensureUniquePrefName();
+        Services.prefs.setStringPref(`${prefName}.description`, dirName);
+        Services.prefs.setStringPref(`${prefName}.filename`, file.leafName);
+        Services.prefs.setStringPref(`${prefName}.uri`, uri);
+
+        uri = `moz-abldapdirectory://${prefName}`;
+        let dir = createDirectoryObject(uri, true);
+        this.notifyDirectoryItemAdded(null, dir);
+        break;
+      }
+      case MAPI_DIRECTORY_TYPE: {
+        if (AppConstants.platform == "macosx") {
+          uri = "moz-abosxdirectory:///";
+          if (store.has(uri)) {
+            throw Cr.NS_ERROR_UNEXPECTED;
+          }
+          prefName = "ldap_2.servers.osx";
+        } else if (AppConstants.platform == "win") {
+          if (
+            ![
+              "moz-aboutlookdirectory://oe/",
+              "moz-aboutlookdirectory://op/",
+            ].includes(uri)
+          ) {
+            throw Cr.NS_ERROR_UNEXPECTED;
+          }
+          if (store.has(uri)) {
+            throw Cr.NS_ERROR_UNEXPECTED;
+          }
+          prefName = "ldap_2.servers.oe";
+        } else {
+          throw Cr.NS_ERROR_UNEXPECTED;
+        }
 
-    ensureUniquePrefName();
-    Services.prefs.setStringPref(`${prefName}.description`, dirName);
-    Services.prefs.setIntPref(`${prefName}.dirType`, type);
-    Services.prefs.setStringPref(`${prefName}.filename`, file.leafName);
-    Services.prefs.setStringPref(`${prefName}.uri`, uri);
+        Services.prefs.setIntPref(`${prefName}.dirType`, MAPI_DIRECTORY_TYPE);
+        Services.prefs.setStringPref(
+          `${prefName}.description`,
+          "chrome://messenger/locale/addressbook/addressBook.properties"
+        );
+        Services.prefs.setStringPref(`${prefName}.uri`, uri);
 
-    uri = `jsaddrbook://${file.leafName}`;
-    let dir = createDirectoryObject(uri, true);
-    this.notifyDirectoryItemAdded(null, dir);
+        if (AppConstants.platform == "macosx") {
+          let dir = createDirectoryObject(uri, true);
+          this.notifyDirectoryItemAdded(null, dir);
+        } else if (AppConstants.platform == "win") {
+          let outlookInterface = Cc[
+            "@mozilla.org/addressbook/outlookinterface;1"
+          ].getService(Ci.nsIAbOutlookInterface);
+          for (let folderURI of outlookInterface.getFolderURIs(uri)) {
+            let dir = createDirectoryObject(folderURI, true);
+            this.notifyDirectoryItemAdded(null, dir);
+          }
+        }
+        break;
+      }
+      case JS_DIRECTORY_TYPE: {
+        let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
+        file.append("abook.sqlite");
+        file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
+
+        ensureUniquePrefName();
+        Services.prefs.setStringPref(`${prefName}.description`, dirName);
+        Services.prefs.setIntPref(`${prefName}.dirType`, type);
+        Services.prefs.setStringPref(`${prefName}.filename`, file.leafName);
+
+        uri = `jsaddrbook://${file.leafName}`;
+        let dir = createDirectoryObject(uri, true);
+        this.notifyDirectoryItemAdded(null, dir);
+        break;
+      }
+      default:
+        throw Cr.NS_ERROR_UNEXPECTED;
+    }
+
     return prefName;
   },
   deleteAddressBook(uri) {
     let uriParts = URI_REGEXP.exec(uri);
     if (!uriParts) {
       throw Cr.NS_ERROR_UNEXPECTED;
     }
 
@@ -221,26 +330,30 @@ AddrBookManager.prototype = {
     let prefName = dir.dirPrefId;
     fileName = dir.fileName;
 
     Services.prefs.clearUserPref(`${prefName}.description`);
     Services.prefs.clearUserPref(`${prefName}.dirType`);
     Services.prefs.clearUserPref(`${prefName}.filename`);
     Services.prefs.clearUserPref(`${prefName}.uid`);
     Services.prefs.clearUserPref(`${prefName}.uri`);
-    store.delete(`jsaddrbook://${fileName}`);
+    store.delete(uri);
 
-    let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
-    file.append(fileName);
-    closeConnectionTo(file).then(() => {
-      if (file.exists()) {
-        file.remove(false);
-      }
+    if (fileName) {
+      let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
+      file.append(fileName);
+      closeConnectionTo(file).then(() => {
+        if (file.exists()) {
+          file.remove(false);
+        }
+        this.notifyDirectoryDeleted(null, dir);
+      });
+    } else {
       this.notifyDirectoryDeleted(null, dir);
-    });
+    }
   },
   exportAddressBook(parentWin, directory) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   addAddressBookListener(listener, notifyFlags) {
     listeners.set(listener, notifyFlags);
   },
   removeAddressBookListener(listener) {
--- a/mailnews/addrbook/public/moz.build
+++ b/mailnews/addrbook/public/moz.build
@@ -26,14 +26,19 @@ if CONFIG['MOZ_LDAP_XPCOM']:
     XPIDL_SOURCES += [
         'nsIAbLDAPCard.idl',
         'nsIAbLDAPDirectory.idl',
         'nsIAbLDAPReplicationData.idl',
         'nsIAbLDAPReplicationQuery.idl',
         'nsIAbLDAPReplicationService.idl',
     ]
 
+if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MAPI_SUPPORT']:
+    XPIDL_SOURCES += [
+        'nsIAbOutlookInterface.idl',
+    ]
+
 XPIDL_MODULE = 'addrbook'
 
 EXPORTS += [
     'nsAbBaseCID.h',
 ]
 
--- a/mailnews/addrbook/public/nsAbBaseCID.h
+++ b/mailnews/addrbook/public/nsAbBaseCID.h
@@ -150,20 +150,20 @@
       0x9cc57822, 0x0599, 0x4c47, {                    \
         0xa3, 0x99, 0x1c, 0x6f, 0xa1, 0x85, 0xa0, 0x5c \
       }                                                \
     }
 
 //
 // Outlook directory factory
 //
-#  define NS_ABOUTLOOKDIRFACTORY_CONTRACTID \
-    NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX "moz-aboutlookdirectory"
+#  define NS_ABOUTLOOKINTERFACE_CONTRACTID \
+    "@mozilla.org/addressbook/outlookinterface;1"
 
-#  define NS_ABOUTLOOKDIRFACTORY_CID                   \
+#  define NS_ABOUTLOOKINTERFACE_CID                    \
     {                                                  \
       0x558ccc0f, 0x2681, 0x4dac, {                    \
         0xa0, 0x66, 0xde, 0xbd, 0x8d, 0x26, 0xfa, 0xf6 \
       }                                                \
     }
 #endif
 
 //
new file mode 100644
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbOutlookInterface.idl
@@ -0,0 +1,12 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(088d3dea-4a6a-41ce-b974-5043d00f1798)]
+interface nsIAbOutlookInterface : nsISupports
+{
+  Array<ACString> getFolderURIs(in ACString aURI);
+};
--- a/mailnews/addrbook/src/moz.build
+++ b/mailnews/addrbook/src/moz.build
@@ -26,16 +26,17 @@ SOURCES += [
     'nsMsgVCardService.cpp',
     'nsVCard.cpp',
     'nsVCardObj.cpp',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MAPI_SUPPORT']:
     SOURCES += [
         'nsAbOutlookDirectory.cpp',
+        'nsAbOutlookInterface.cpp',
         'nsAbWinHelper.cpp',
         'nsMapiAddressBook.cpp',
         'nsWabAddressBook.cpp',
     ]
 
 if CONFIG['OS_ARCH'] == 'Darwin':
     SOURCES += [
         'nsAbOSXCard.mm',
--- a/mailnews/addrbook/src/nsAbOSXDirectory.mm
+++ b/mailnews/addrbook/src/nsAbOSXDirectory.mm
@@ -519,16 +519,20 @@ nsAbOSXDirectory::Init(const char *aUri)
     NS_ENSURE_SUCCESS(rv, rv);
 
     // If we're not a query directory, we're going to want to
     // tell the AB Manager that we've added some cards so that they
     // show up in the address book views.
     if (!mIsQueryURI) AssertCard(abManager, card);
   }
 
+  if (isRootOSXDirectory) {
+    AssertChildNodes();
+  }
+
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
 nsAbOSXDirectory::GetURI(nsACString &aURI) {
   if (mURI.IsEmpty()) return NS_ERROR_NOT_INITIALIZED;
rename from mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
rename to mailnews/addrbook/src/nsAbOutlookInterface.cpp
--- a/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookInterface.cpp
@@ -1,73 +1,51 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "nsAbOutlookDirFactory.h"
+#include "nsAbOutlookInterface.h"
 #include "nsAbWinHelper.h"
-#include "nsIAbDirectory.h"
-#include "nsIAbManager.h"
-#include "nsEnumeratorUtils.h"
-#include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
-#include "nsIMutableArray.h"
-#include "nsArrayEnumerator.h"
 #include "nsAbBaseCID.h"
-#include "mozilla/Logging.h"
+
+NS_IMPL_ISUPPORTS(nsAbOutlookInterface, nsIAbOutlookInterface)
 
-NS_IMPL_ISUPPORTS(nsAbOutlookDirFactory, nsIAbDirFactory)
+nsAbOutlookInterface::nsAbOutlookInterface(void) {}
 
-nsAbOutlookDirFactory::nsAbOutlookDirFactory(void) {}
-
-nsAbOutlookDirFactory::~nsAbOutlookDirFactory(void) {}
+nsAbOutlookInterface::~nsAbOutlookInterface(void) {}
 
 extern const char *kOutlookDirectoryScheme;
 
 NS_IMETHODIMP
-nsAbOutlookDirFactory::GetDirectories(const nsAString &aDirName,
-                                      const nsACString &aURI,
-                                      const nsACString &aPrefName,
-                                      nsISimpleEnumerator **aDirectories) {
-  NS_ENSURE_ARG_POINTER(aDirectories);
+nsAbOutlookInterface::GetFolderURIs(const nsACString &aURI,
+                                    nsTArray<nsCString> &uris) {
+  uris.Clear();
 
-  *aDirectories = nullptr;
   nsresult rv = NS_OK;
   nsCString stub;
   nsCString entry;
   nsAbWinType abType =
       getAbWinType(kOutlookDirectoryScheme, nsCString(aURI).get(), stub, entry);
 
   if (abType == nsAbWinType_Unknown) {
     return NS_ERROR_FAILURE;
   }
   nsAbWinHelperGuard mapiAddBook(abType);
   nsMapiEntryArray folders;
-  nsCOMPtr<nsIMutableArray> directories(do_CreateInstance(NS_ARRAY_CONTRACTID));
   NS_ENSURE_SUCCESS(rv, rv);
   if (!mapiAddBook->IsOK() || !mapiAddBook->GetFolders(folders)) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
-  NS_ENSURE_SUCCESS(rv, rv);
+  uris.SetCapacity(folders.mNbEntries);
+
   nsAutoCString entryId;
   nsAutoCString uri;
 
   for (ULONG i = 0; i < folders.mNbEntries; ++i) {
     folders.mEntries[i].ToString(entryId);
     buildAbWinUri(kOutlookDirectoryScheme, abType, uri);
     uri.Append(entryId);
-
-    nsCOMPtr<nsIAbDirectory> directory;
-    rv = abManager->GetDirectory(uri, getter_AddRefs(directory));
-    NS_ENSURE_SUCCESS(rv, rv);
-    directories->AppendElement(directory);
+    uris.AppendElement(uri);
   }
-  return NS_NewArrayEnumerator(aDirectories, directories,
-                               NS_GET_IID(nsIAbDirectory));
-}
-
-// No actual deletion, since you cannot create the address books from Mozilla.
-NS_IMETHODIMP nsAbOutlookDirFactory::DeleteDirectory(
-    nsIAbDirectory *aDirectory) {
   return NS_OK;
 }
rename from mailnews/addrbook/src/nsAbOutlookDirFactory.h
rename to mailnews/addrbook/src/nsAbOutlookInterface.h
--- a/mailnews/addrbook/src/nsAbOutlookDirFactory.h
+++ b/mailnews/addrbook/src/nsAbOutlookInterface.h
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsAbOutlookDirFactory_h___
-#define nsAbOutlookDirFactory_h___
+#ifndef nsAbOutlookInterface_h___
+#define nsAbOutlookInterface_h___
 
-#include "nsIAbDirFactory.h"
+#include "nsIAbOutlookInterface.h"
 
-class nsAbOutlookDirFactory : public nsIAbDirFactory {
+class nsAbOutlookInterface : public nsIAbOutlookInterface {
  public:
-  nsAbOutlookDirFactory(void);
+  nsAbOutlookInterface(void);
 
   NS_DECL_ISUPPORTS
-  NS_DECL_NSIABDIRFACTORY
+  NS_DECL_NSIABOUTLOOKINTERFACE
 
  private:
-  virtual ~nsAbOutlookDirFactory(void);
+  virtual ~nsAbOutlookInterface(void);
 };
 
-#endif  // nsAbOutlookDirFactory_h___
+#endif  // nsAbOutlookInterface_h___
--- a/mailnews/addrbook/test/unit/xpcshell.ini
+++ b/mailnews/addrbook/test/unit/xpcshell.ini
@@ -2,32 +2,27 @@
 head = head.js
 support-files = data/*
 
 [test_basic_nsIAbCard.js]
 [test_basic_nsIAbDirectory.js]
 [test_bug387403.js]
 [test_bug448165.js]
 [test_bug534822.js]
-fail-if = true
 [test_bug1522453.js]
 [test_cardForEmail.js]
 [test_collection.js]
 [test_collection_2.js]
 [test_db_enumerator.js]
 [test_jsaddrbook.js]
 [test_jsaddrbook_inner.js]
 [test_ldap1.js]
-fail-if = true
 [test_ldap2.js]
-fail-if = true
 [test_ldapOffline.js]
-fail-if = true
 [test_ldapReplication.js]
-fail-if = true
 skip-if = debug # Fails for unknown reasons.
 [test_mailList1.js]
 [test_notifications.js]
 [test_nsAbAutoCompleteMyDomain.js]
 [test_nsAbAutoCompleteSearch1.js]
 [test_nsAbAutoCompleteSearch2.js]
 [test_nsAbAutoCompleteSearch3.js]
 [test_nsAbAutoCompleteSearch4.js]
--- a/mailnews/addrbook/test/unit/xpcshell_migration.ini
+++ b/mailnews/addrbook/test/unit/xpcshell_migration.ini
@@ -5,9 +5,8 @@ support-files = data/*
 [test_migration1.js]
 [test_migration2.js]
 [test_migration3.js]
 [test_migration4.js]
 [test_migration5.js]
 [test_migration6.js]
 [test_migration7.js]
 [test_migration8.js]
-fail-if = true
--- a/mailnews/build/nsMailModule.cpp
+++ b/mailnews/build/nsMailModule.cpp
@@ -134,17 +134,17 @@
 #  include "nsAbLDAPReplicationData.h"
 // XXX These files are not being built as they don't work. Bug 311632 should
 // fix them.
 //#include "nsAbLDAPChangeLogQuery.h"
 //#include "nsAbLDAPChangeLogData.h"
 #endif
 
 #if defined(MOZ_MAPI_SUPPORT)
-#  include "nsAbOutlookDirFactory.h"
+#  include "nsAbOutlookInterface.h"
 #  include "nsAbOutlookDirectory.h"
 #endif
 
 #ifdef XP_MACOSX
 #  include "nsAbOSXDirectory.h"
 #  include "nsAbOSXCard.h"
 #endif
 
@@ -434,17 +434,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirPr
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCardProperty)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrDatabase)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbAddressCollector, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddbookUrl)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddbookProtocolHandler)
 
 #if defined(MOZ_MAPI_SUPPORT)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOutlookDirectory)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOutlookDirFactory)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOutlookInterface)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirectoryQueryArguments)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbBooleanConditionString)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbBooleanExpression)
 
 #if defined(MOZ_LDAP_XPCOM)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPDirectory)
@@ -476,17 +476,17 @@ NS_DEFINE_NAMED_CID(NS_ABADDRESSCOLLECTO
 NS_DEFINE_NAMED_CID(NS_ADDBOOKURL_CID);
 NS_DEFINE_NAMED_CID(NS_ADDBOOK_HANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_ABCONTENTHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_ABDIRECTORYQUERYARGUMENTS_CID);
 NS_DEFINE_NAMED_CID(NS_BOOLEANCONDITIONSTRING_CID);
 NS_DEFINE_NAMED_CID(NS_BOOLEANEXPRESSION_CID);
 #if defined(MOZ_MAPI_SUPPORT)
 NS_DEFINE_NAMED_CID(NS_ABOUTLOOKDIRECTORY_CID);
-NS_DEFINE_NAMED_CID(NS_ABOUTLOOKDIRFACTORY_CID);
+NS_DEFINE_NAMED_CID(NS_ABOUTLOOKINTERFACE_CID);
 #endif
 
 #if defined(MOZ_LDAP_XPCOM)
 NS_DEFINE_NAMED_CID(NS_ABLDAPDIRECTORY_CID);
 NS_DEFINE_NAMED_CID(NS_ABLDAPDIRECTORYQUERY_CID);
 NS_DEFINE_NAMED_CID(NS_ABLDAPCARD_CID);
 NS_DEFINE_NAMED_CID(NS_ABLDAP_REPLICATIONSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_ABLDAP_REPLICATIONQUERY_CID);
@@ -887,18 +887,17 @@ const mozilla::Module::CIDEntry kMailNew
     {&kNS_ABDIRPROPERTY_CID, false, NULL, nsAbDirPropertyConstructor},
     {&kNS_ABADDRESSCOLLECTOR_CID, false, NULL, nsAbAddressCollectorConstructor},
     {&kNS_ADDBOOKURL_CID, false, NULL, nsAddbookUrlConstructor},
     {&kNS_ADDBOOK_HANDLER_CID, false, NULL,
      nsAddbookProtocolHandlerConstructor},
     {&kNS_ABCONTENTHANDLER_CID, false, NULL, nsAbContentHandlerConstructor},
 #if defined(MOZ_MAPI_SUPPORT)
     {&kNS_ABOUTLOOKDIRECTORY_CID, false, NULL, nsAbOutlookDirectoryConstructor},
-    {&kNS_ABOUTLOOKDIRFACTORY_CID, false, NULL,
-     nsAbOutlookDirFactoryConstructor},
+    {&kNS_ABOUTLOOKINTERFACE_CID, false, NULL, nsAbOutlookInterfaceConstructor},
 #endif
     {&kNS_ABDIRECTORYQUERYARGUMENTS_CID, false, NULL,
      nsAbDirectoryQueryArgumentsConstructor},
     {&kNS_BOOLEANCONDITIONSTRING_CID, false, NULL,
      nsAbBooleanConditionStringConstructor},
     {&kNS_BOOLEANEXPRESSION_CID, false, NULL, nsAbBooleanExpressionConstructor},
 
 #if defined(MOZ_LDAP_XPCOM)
@@ -1124,17 +1123,17 @@ const mozilla::Module::ContractIDEntry k
     {NS_ADDBOOKURL_CONTRACTID, &kNS_ADDBOOKURL_CID},
     {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "addbook", &kNS_ADDBOOK_HANDLER_CID},
     {NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-addvcard",
      &kNS_ABCONTENTHANDLER_CID},
     {NS_CONTENT_HANDLER_CONTRACTID_PREFIX "text/x-vcard",
      &kNS_ABCONTENTHANDLER_CID},
 #if defined(MOZ_MAPI_SUPPORT)
     {NS_ABOUTLOOKDIRECTORY_CONTRACTID, &kNS_ABOUTLOOKDIRECTORY_CID},
-    {NS_ABOUTLOOKDIRFACTORY_CONTRACTID, &kNS_ABOUTLOOKDIRFACTORY_CID},
+    {NS_ABOUTLOOKINTERFACE_CONTRACTID, &kNS_ABOUTLOOKINTERFACE_CID},
 #endif
     {NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID,
      &kNS_ABDIRECTORYQUERYARGUMENTS_CID},
     {NS_BOOLEANCONDITIONSTRING_CONTRACTID, &kNS_BOOLEANCONDITIONSTRING_CID},
     {NS_BOOLEANEXPRESSION_CONTRACTID, &kNS_BOOLEANEXPRESSION_CID},
 
 #if defined(MOZ_LDAP_XPCOM)
     {NS_ABLDAPDIRECTORY_CONTRACTID, &kNS_ABLDAPDIRECTORY_CID},