Bug 1687132 - Remove Outlook Express and WAB address book provider. r=darktrojan
authorit@henk.com.au
Wed, 27 Jan 2021 10:54:24 +0200
changeset 31529 25e615d8cc33faaa92a61a675b13856c02eb6bdb
parent 31528 1517626fcea2a497e10bbe967e617338072a2bba
child 31530 036520a38d2b3d46fb31cf93f89d3545242feac5
push id18396
push usermkmelin@iki.fi
push dateWed, 27 Jan 2021 08:56:42 +0000
treeherdercomm-central@25e615d8cc33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1687132
Bug 1687132 - Remove Outlook Express and WAB address book provider. r=darktrojan
mailnews/addrbook/modules/AddrBookManager.jsm
mailnews/addrbook/src/moz.build
mailnews/addrbook/src/nsAbOutlookDirectory.cpp
mailnews/addrbook/src/nsAbOutlookDirectory.h
mailnews/addrbook/src/nsAbOutlookInterface.cpp
mailnews/addrbook/src/nsAbWinHelper.cpp
mailnews/addrbook/src/nsAbWinHelper.h
mailnews/addrbook/src/nsWabAddressBook.cpp
mailnews/addrbook/src/nsWabAddressBook.h
mailnews/mailnews.js
--- a/mailnews/addrbook/modules/AddrBookManager.jsm
+++ b/mailnews/addrbook/modules/AddrBookManager.jsm
@@ -305,27 +305,17 @@ AddrBookManager.prototype = {
           if (store.has(uri)) {
             throw Components.Exception(
               `Can't create new ab of type=${type} - already exists`,
               Cr.NS_ERROR_UNEXPECTED
             );
           }
           prefName = "ldap_2.servers.osx";
         } else if (AppConstants.platform == "win") {
-          if (
-            ![
-              "moz-aboutlookdirectory://oe/",
-              "moz-aboutlookdirectory://op/",
-            ].includes(uri)
-          ) {
-            throw Components.Exception(
-              `Can't create new ab of type=${type} for uri=${uri}`,
-              Cr.NS_ERROR_UNEXPECTED
-            );
-          }
+          uri = "moz-aboutlookdirectory:///";
           if (store.has(uri)) {
             throw Components.Exception(
               `Can't create new ab of type=${type} - already exists`,
               Cr.NS_ERROR_UNEXPECTED
             );
           }
           prefName = "ldap_2.servers.oe";
         } else {
--- a/mailnews/addrbook/src/moz.build
+++ b/mailnews/addrbook/src/moz.build
@@ -29,17 +29,16 @@ SOURCES += [
 ]
 
 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",
         "nsAbOSXDirectory.mm",
         "nsAbOSXUtils.mm",
     ]
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
@@ -35,18 +35,17 @@ static mozilla::LazyLogModule gAbOutlook
 #  define PRINTF(args) \
     MOZ_LOG(gAbOutlookDirectoryLog, mozilla::LogLevel::Debug, args)
 #endif
 
 nsAbOutlookDirectory::nsAbOutlookDirectory(void)
     : nsAbDirProperty(),
       mDirEntry(nullptr),
       mCurrentQueryId(0),
-      mSearchContext(-1),
-      mAbWinType(nsAbWinType_Unknown) {
+      mSearchContext(-1) {
   mDirEntry = new nsMapiEntry;
 }
 
 nsAbOutlookDirectory::~nsAbOutlookDirectory(void) {
   if (mDirEntry) {
     delete mDirEntry;
   }
 }
@@ -54,53 +53,44 @@ nsAbOutlookDirectory::~nsAbOutlookDirect
 NS_IMPL_ISUPPORTS_INHERITED(nsAbOutlookDirectory, nsAbDirProperty,
                             nsIAbDirectoryQuery, nsIAbDirSearchListener)
 
 NS_IMETHODIMP nsAbOutlookDirectory::Init(const char* aUri) {
   nsresult rv = nsAbDirProperty::Init(aUri);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString entry;
-  nsAutoCString stub;
-
-  mAbWinType = getAbWinType(kOutlookDirectoryScheme, mURI.get(), stub, entry);
-  if (mAbWinType == nsAbWinType_Unknown) {
-    PRINTF(("Huge problem URI=%s.\n", mURI.get()));
-    return NS_ERROR_INVALID_ARG;
-  }
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
-  nsString prefix;
+  makeEntryIdFromURI(kOutlookDirectoryScheme, mURI.get(), entry);
+  nsAbWinHelperGuard mapiAddBook;
   nsAutoString unichars;
   ULONG objectType = 0;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   mDirEntry->Assign(entry);
   if (!mapiAddBook->GetPropertyLong(*mDirEntry, PR_OBJECT_TYPE, objectType)) {
     PRINTF(("Cannot get type.\n"));
     return NS_ERROR_FAILURE;
   }
   if (!mapiAddBook->GetPropertyUString(*mDirEntry, PR_DISPLAY_NAME_W,
                                        unichars)) {
     PRINTF(("Cannot get name.\n"));
     return NS_ERROR_FAILURE;
   }
 
-  if (mAbWinType == nsAbWinType_Outlook)
-    prefix.AssignLiteral("OP ");
-  else
-    prefix.AssignLiteral("OE ");
-  prefix.Append(unichars);
-
   if (objectType == MAPI_DISTLIST) {
     m_IsMailList = true;
     SetDirName(unichars);
   } else {
     m_IsMailList = false;
-    SetDirName(prefix);
+    if (unichars.IsEmpty()) {
+      SetDirName(u"Outlook"_ns);
+    } else {
+      SetDirName(unichars);
+    }
   }
 
   return UpdateAddressList();
 }
 
 // nsIAbDirectory methods
 
 NS_IMETHODIMP nsAbOutlookDirectory::GetDirType(int32_t* aDirType) {
@@ -222,41 +212,39 @@ NS_IMETHODIMP nsAbOutlookDirectory::HasD
 
 nsresult nsAbOutlookDirectory::ExtractCardEntry(nsIAbCard* aCard,
                                                 nsCString& aEntry) {
   aEntry.Truncate();
 
   nsCString uri;
   aCard->GetPropertyAsAUTF8String("OutlookEntryURI", uri);
 
-  // If we don't have a URI, uri will be empty. getAbWinType doesn't set
+  // If we don't have a URI, uri will be empty. makeEntryIdFromURI doesn't set
   // aEntry to anything if uri is empty, so it will be truncated, allowing us
   // to accept cards not initialized by us.
-  nsAutoCString stub;
-  getAbWinType(kOutlookCardScheme, uri.get(), stub, aEntry);
+  makeEntryIdFromURI(kOutlookCardScheme, uri.get(), aEntry);
   return NS_OK;
 }
 
 nsresult nsAbOutlookDirectory::ExtractDirectoryEntry(nsIAbDirectory* aDirectory,
                                                      nsCString& aEntry) {
   aEntry.Truncate();
   nsCString uri;
   nsresult rv = aDirectory->GetURI(uri);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsAutoCString stub;
-  getAbWinType(kOutlookDirectoryScheme, uri.get(), stub, aEntry);
+  makeEntryIdFromURI(kOutlookDirectoryScheme, uri.get(), aEntry);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::DeleteCards(
     const nsTArray<RefPtr<nsIAbCard>>& aCards) {
   nsresult retCode = NS_OK;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
 
   if (!mapiAddBook->IsOK()) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoCString entryString;
   nsMapiEntry cardEntry;
 
@@ -286,17 +274,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Dele
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::DeleteDirectory(
     nsIAbDirectory* aDirectory) {
   if (!aDirectory) {
     return NS_ERROR_NULL_POINTER;
   }
   nsresult retCode = NS_OK;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
   nsAutoCString entryString;
 
   if (!mapiAddBook->IsOK()) {
     return NS_ERROR_FAILURE;
   }
   retCode = ExtractDirectoryEntry(aDirectory, entryString);
   if (NS_SUCCEEDED(retCode) && !entryString.IsEmpty()) {
     nsMapiEntry directoryEntry;
@@ -354,17 +342,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Drop
   return AddCard(aData, getter_AddRefs(addedCard));
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::AddMailList(nsIAbDirectory* aMailList,
                                                 nsIAbDirectory** addedList) {
   NS_ENSURE_ARG_POINTER(aMailList);
   NS_ENSURE_ARG_POINTER(addedList);
   if (m_IsMailList) return NS_OK;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
   nsAutoCString entryString;
   nsMapiEntry newEntry;
   bool didCopy = false;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
   nsresult rv = ExtractDirectoryEntry(aMailList, entryString);
   if (NS_SUCCEEDED(rv) && !entryString.IsEmpty()) {
     nsMapiEntry sourceEntry;
@@ -374,19 +362,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddM
   }
   if (newEntry.mByteCount == 0) {
     if (!mapiAddBook->CreateDistList(*mDirEntry, newEntry))
       return NS_ERROR_FAILURE;
   } else {
     didCopy = true;
   }
   newEntry.ToString(entryString);
-  nsAutoCString uri;
-
-  buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uri);
+  nsAutoCString uri(kOutlookDirectoryScheme);
   uri.Append(entryString);
 
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIAbDirectory> newList;
   rv = abManager->GetDirectory(uri, getter_AddRefs(newList));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -408,17 +394,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddM
 
   return rv;
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::EditMailListToDatabase(
     nsIAbCard* listCard) {
   nsresult rv;
   nsString name;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   rv = GetDirName(name);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mapiAddBook->SetPropertyUString(*mDirEntry, PR_DISPLAY_NAME_W,
                                        name.get()))
@@ -618,75 +604,73 @@ nsresult nsAbOutlookDirectory::ExecuteQu
 
   aListener->OnSearchFinished(NS_OK, nullptr, ""_ns);
   return retCode;
 }
 
 // This function expects the aCards array to already be created.
 nsresult nsAbOutlookDirectory::GetCards(nsIMutableArray* aCards,
                                         SRestriction* aRestriction) {
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   nsMapiEntryArray cardEntries;
   LPSRestriction restriction = (LPSRestriction)aRestriction;
 
   if (!mapiAddBook->GetCards(*mDirEntry, restriction, cardEntries)) {
     PRINTF(("Cannot get cards.\n"));
     return NS_ERROR_FAILURE;
   }
 
   nsAutoCString ourUID;
   GetUID(ourUID);
 
-  nsAutoCString entryId;
-  nsAutoCString uriName;
-  nsCOMPtr<nsIAbCard> childCard;
   nsresult rv = NS_OK;
 
   for (ULONG card = 0; card < cardEntries.mNbEntries; ++card) {
+    nsAutoCString entryId;
+    nsAutoCString uriName(kOutlookCardScheme);
+    nsCOMPtr<nsIAbCard> childCard;
     cardEntries.mEntries[card].ToString(entryId);
-    buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName);
     uriName.Append(entryId);
 
     rv = OutlookCardForURI(uriName, getter_AddRefs(childCard));
     NS_ENSURE_SUCCESS(rv, rv);
     childCard->SetDirectoryUID(ourUID);
 
     aCards->AppendElement(childCard);
   }
   return rv;
 }
 
 nsresult nsAbOutlookDirectory::GetNodes(nsIMutableArray* aNodes) {
   NS_ENSURE_ARG_POINTER(aNodes);
 
   aNodes->Clear();
 
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
   nsMapiEntryArray nodeEntries;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   if (!mapiAddBook->GetNodes(*mDirEntry, nodeEntries)) {
     PRINTF(("Cannot get nodes.\n"));
     return NS_ERROR_FAILURE;
   }
 
-  nsAutoCString entryId;
-  nsAutoCString uriName;
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   for (ULONG node = 0; node < nodeEntries.mNbEntries; ++node) {
+    nsAutoCString entryId;
+    nsAutoCString uriName(kOutlookDirectoryScheme);
     nodeEntries.mEntries[node].ToString(entryId);
-    buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName);
     uriName.Append(entryId);
 
     nsCOMPtr<nsIAbDirectory> directory;
     rv = abManager->GetDirectory(uriName, getter_AddRefs(directory));
     NS_ENSURE_SUCCESS(rv, rv);
 
     aNodes->AppendElement(directory);
   }
@@ -869,17 +853,17 @@ nsresult nsAbOutlookDirectory::UpdateAdd
 
 nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard* aData,
                                           nsIAbCard** aNewCard) {
   if (!aData || !aNewCard) {
     return NS_ERROR_NULL_POINTER;
   }
   *aNewCard = nullptr;
   nsresult retCode = NS_OK;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
   nsMapiEntry newEntry;
   nsAutoCString entryString;
   bool didCopy = false;
 
   if (!mapiAddBook->IsOK()) {
     return NS_ERROR_FAILURE;
   }
   // If we get an nsIAbCard that maps onto an Outlook card uri
@@ -925,19 +909,17 @@ nsresult nsAbOutlookDirectory::CreateCar
     }
     // If we're on a real address book folder, we can directly create an
     // empty card.
     else if (!mapiAddBook->CreateEntry(*mDirEntry, newEntry)) {
       return NS_ERROR_FAILURE;
     }
   }
   newEntry.ToString(entryString);
-  nsAutoCString uri;
-
-  buildAbWinUri(kOutlookCardScheme, mAbWinType, uri);
+  nsAutoCString uri(kOutlookCardScheme);
   uri.Append(entryString);
 
   nsCOMPtr<nsIAbCard> newCard;
   retCode = OutlookCardForURI(uri, getter_AddRefs(newCard));
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   nsAutoCString ourUID;
   GetUID(ourUID);
@@ -983,17 +965,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Modi
 }
 
 nsresult nsAbOutlookDirectory::ModifyCardInternal(nsIAbCard* aModifiedCard,
                                                   bool aIsAddition) {
   NS_ENSURE_ARG_POINTER(aModifiedCard);
 
   nsString* properties = nullptr;
   nsAutoString utility;
-  nsAbWinHelperGuard mapiAddBook(mAbWinType);
+  nsAbWinHelperGuard mapiAddBook;
 
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   nsCString entry;
   nsresult retCode = ExtractCardEntry(aModifiedCard, entry);
   NS_ENSURE_SUCCESS(retCode, retCode);
   // If we don't have the card entry, we can't work.
   if (entry.IsEmpty()) return NS_ERROR_FAILURE;
@@ -1162,25 +1144,19 @@ static void splitString(nsString& aSourc
   }
 }
 
 nsresult nsAbOutlookDirectory::OutlookCardForURI(const nsACString& aUri,
                                                  nsIAbCard** newCard) {
   NS_ENSURE_ARG_POINTER(newCard);
 
   nsAutoCString entry;
-  nsAutoCString stub;
-  uint32_t abWinType = getAbWinType(
-      kOutlookCardScheme, PromiseFlatCString(aUri).get(), stub, entry);
-  if (abWinType == nsAbWinType_Unknown) {
-    PRINTF(("Huge problem URI=%s.\n", PromiseFlatCString(aUri).get()));
-    return NS_ERROR_INVALID_ARG;
-  }
+  makeEntryIdFromURI(kOutlookCardScheme, PromiseFlatCString(aUri).get(), entry);
 
-  nsAbWinHelperGuard mapiAddBook(abWinType);
+  nsAbWinHelperGuard mapiAddBook;
   if (!mapiAddBook->IsOK()) return NS_ERROR_FAILURE;
 
   nsresult rv;
   nsCOMPtr<nsIAbCard> card =
       do_CreateInstance(NS_ABCARDPROPERTY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   card->SetPropertyAsAUTF8String("OutlookEntryURI", aUri);
@@ -1221,18 +1197,17 @@ nsresult nsAbOutlookDirectory::OutlookCa
     SETPROP(kWorkWebPageProperty, index_WorkWebPage);
     SETPROP(kHomeWebPageProperty, index_HomeWebPage);
   }
 
   ULONG cardType = 0;
   if (mapiAddBook->GetPropertyLong(mapiData, PR_OBJECT_TYPE, cardType)) {
     card->SetIsMailList(cardType == MAPI_DISTLIST);
     if (cardType == MAPI_DISTLIST) {
-      nsAutoCString normalChars;
-      buildAbWinUri(kOutlookDirectoryScheme, abWinType, normalChars);
+      nsAutoCString normalChars(kOutlookDirectoryScheme);
       normalChars.Append(entry);
       card->SetMailListURI(normalChars.get());
 
       // In case the display is by "First Last" or "Last, First", give the card
       // a name, otherwise nothing is displayed.
       if (success[index_DisplayName])
         card->SetLastName(unichars[index_DisplayName]);
     }
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.h
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.h
@@ -79,18 +79,16 @@ class nsAbOutlookDirectory : public nsAb
   nsresult OutlookCardForURI(const nsACString& aUri, nsIAbCard** card);
 
   nsMapiEntry* mDirEntry;
   // Keep track of context ID to be passed back from `DoQuery()`.
   int32_t mCurrentQueryId;
   // Data for the search interfaces
   nsInterfaceHashtable<nsISupportsHashKey, nsIAbCard> mCardList;
   int32_t mSearchContext;
-  // Windows AB type
-  uint32_t mAbWinType;
 
  private:
   virtual ~nsAbOutlookDirectory(void);
 };
 
 enum {
   index_DisplayName = 0,
   index_FirstName,
--- a/mailnews/addrbook/src/nsAbOutlookInterface.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookInterface.cpp
@@ -8,44 +8,32 @@
 #include "nsAbBaseCID.h"
 
 NS_IMPL_ISUPPORTS(nsAbOutlookInterface, nsIAbOutlookInterface)
 
 nsAbOutlookInterface::nsAbOutlookInterface(void) {}
 
 nsAbOutlookInterface::~nsAbOutlookInterface(void) {}
 
-extern const char* kOutlookDirectoryScheme;
-
 NS_IMETHODIMP
 nsAbOutlookInterface::GetFolderURIs(const nsACString& aURI,
                                     nsTArray<nsCString>& uris) {
   uris.Clear();
+  nsresult rv = NS_OK;
 
-  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);
+  nsAbWinHelperGuard mapiAddBook;
   nsMapiEntryArray folders;
   NS_ENSURE_SUCCESS(rv, rv);
   if (!mapiAddBook->IsOK() || !mapiAddBook->GetFolders(folders)) {
     return NS_ERROR_FAILURE;
   }
 
   uris.SetCapacity(folders.mNbEntries);
 
-  nsAutoCString entryId;
-  nsAutoCString uri;
-
   for (ULONG i = 0; i < folders.mNbEntries; ++i) {
+    nsAutoCString entryId;
+    nsAutoCString uri(kOutlookDirectoryScheme);
     folders.mEntries[i].ToString(entryId);
-    buildAbWinUri(kOutlookDirectoryScheme, abType, uri);
     uri.Append(entryId);
     uris.AppendElement(uri);
   }
   return NS_OK;
 }
--- a/mailnews/addrbook/src/nsAbWinHelper.cpp
+++ b/mailnews/addrbook/src/nsAbWinHelper.cpp
@@ -8,17 +8,16 @@
 #define USES_IID_IMAPIFolder
 #define USES_IID_IMAPIContainer
 #define USES_IID_IABContainer
 #define USES_IID_IMAPITable
 #define USES_IID_IDistList
 
 #include "nsAbWinHelper.h"
 #include "nsMapiAddressBook.h"
-#include "nsWabAddressBook.h"
 
 #include <mapiguid.h>
 
 #include "mozilla/Logging.h"
 
 #define PRINT_TO_CONSOLE 0
 #if PRINT_TO_CONSOLE
 #  define PRINTF(args) printf args
@@ -927,16 +926,18 @@ BOOL nsAbWinHelper::GetContents(const ns
 
   mLastError =
       mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
                               &IID_IMAPIContainer, 0, &objType, parent);
   if (HR_FAILED(mLastError)) {
     PRINTF(("Cannot open parent %08lx.\n", mLastError));
     return FALSE;
   }
+  // Historic comment: May be relevant in the future.
+  // WAB removed in bug 1687132.
   // Here, flags for WAB and MAPI could be different, so this works
   // only as long as we don't want to use any flag in GetContentsTable
   mLastError = parent->GetContentsTable(0, contents);
   if (HR_FAILED(mLastError)) {
     PRINTF(("Cannot get contents %08lx.\n", mLastError));
     return FALSE;
   }
   if (aRestriction != NULL) {
@@ -1101,66 +1102,24 @@ void nsAbWinHelper::MyFreeProws(LPSRowSe
   ULONG i = 0;
 
   for (i = 0; i < aRowset->cRows; ++i) {
     FreeBuffer(aRowset->aRow[i].lpProps);
   }
   FreeBuffer(aRowset);
 }
 
-nsAbWinHelperGuard::nsAbWinHelperGuard(uint32_t aType) : mHelper(NULL) {
-  switch (aType) {
-    case nsAbWinType_Outlook:
-      mHelper = new nsMapiAddressBook;
-      break;
-    case nsAbWinType_OutlookExp:
-      mHelper = new nsWabAddressBook;
-      break;
-    default:
-      break;
-  }
+nsAbWinHelperGuard::nsAbWinHelperGuard() : mHelper(NULL) {
+  mHelper = new nsMapiAddressBook;
 }
 
 nsAbWinHelperGuard::~nsAbWinHelperGuard(void) { delete mHelper; }
 
-const char* kOutlookDirectoryScheme = "moz-aboutlookdirectory://";
-const int kOutlookDirSchemeLength = 21;
-const char* kOutlookStub = "op/";
-const int kOutlookStubLength = 3;
-const char* kOutlookExpStub = "oe/";
-const int kOutlookExpStubLength = 3;
-const char* kOutlookCardScheme = "moz-aboutlookcard://";
-
-nsAbWinType getAbWinType(const char* aScheme, const char* aUri,
-                         nsCString& aStub, nsCString& aEntry) {
-  aStub.Truncate();
+void makeEntryIdFromURI(const char* aScheme, const char* aUri,
+                        nsCString& aEntry) {
   aEntry.Truncate();
   uint32_t schemeLength = strlen(aScheme);
 
   if (strncmp(aUri, aScheme, schemeLength) == 0) {
-    if (strncmp(aUri + schemeLength, kOutlookStub, kOutlookStubLength) == 0) {
-      aEntry = aUri + schemeLength + kOutlookStubLength;
-      aStub = kOutlookStub;
-      return nsAbWinType_Outlook;
-    }
-    if (strncmp(aUri + schemeLength, kOutlookExpStub, kOutlookExpStubLength) ==
-        0) {
-      aEntry = aUri + schemeLength + kOutlookExpStubLength;
-      aStub = kOutlookExpStub;
-      return nsAbWinType_OutlookExp;
-    }
-  }
-  return nsAbWinType_Unknown;
-}
-
-void buildAbWinUri(const char* aScheme, uint32_t aType, nsCString& aUri) {
-  aUri.Assign(aScheme);
-  switch (aType) {
-    case nsAbWinType_Outlook:
-      aUri.Append(kOutlookStub);
-      break;
-    case nsAbWinType_OutlookExp:
-      aUri.Append(kOutlookExpStub);
-      break;
-    default:
-      aUri.AssignLiteral("");
+    // Assign string from position `schemeLength`.
+    aEntry = aUri + schemeLength;
   }
 }
--- a/mailnews/addrbook/src/nsAbWinHelper.h
+++ b/mailnews/addrbook/src/nsAbWinHelper.h
@@ -6,16 +6,19 @@
 #define nsAbWinHelper_h___
 
 #include <windows.h>
 #include <mapix.h>
 
 #include "nsString.h"
 #include "mozilla/StaticMutex.h"
 
+#define kOutlookDirectoryScheme "moz-aboutlookdirectory:///"
+#define kOutlookCardScheme "moz-aboutlookcard:///"
+
 struct nsMapiEntry {
   ULONG mByteCount;
   LPENTRYID mEntryId;
 
   nsMapiEntry(void);
   ~nsMapiEntry(void);
   nsMapiEntry(ULONG aByteCount, LPENTRYID aEntryId);
 
@@ -129,36 +132,22 @@ class nsAbWinHelper {
   // Allocation of a buffer for transmission to interfaces
   virtual void AllocateBuffer(ULONG aByteCount, LPVOID* aBuffer) = 0;
   // Destruction of a buffer provided by the interfaces
   virtual void FreeBuffer(LPVOID aBuffer) = 0;
 
  private:
 };
 
-enum nsAbWinType {
-  nsAbWinType_Unknown,
-  nsAbWinType_Outlook,
-  nsAbWinType_OutlookExp
-};
-
 class nsAbWinHelperGuard {
  public:
-  explicit nsAbWinHelperGuard(uint32_t aType);
+  explicit nsAbWinHelperGuard();
   ~nsAbWinHelperGuard(void);
 
   nsAbWinHelper* operator->(void) { return mHelper; }
 
  private:
   nsAbWinHelper* mHelper;
 };
 
-extern const char* kOutlookDirectoryScheme;
-extern const int kOutlookDirSchemeLength;
-extern const char* kOutlookStub;
-extern const char* kOutlookExpStub;
-extern const char* kOutlookCardScheme;
-
-nsAbWinType getAbWinType(const char* aScheme, const char* aUri,
-                         nsCString& aStub, nsCString& aEntry);
-void buildAbWinUri(const char* aScheme, uint32_t aType, nsCString& aUri);
-
+void makeEntryIdFromURI(const char* aScheme, const char* aUri,
+                        nsCString& aEntry);
 #endif  // nsAbWinHelper_h___
deleted file mode 100644
--- a/mailnews/addrbook/src/nsWabAddressBook.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- 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 <tchar.h>
-#include "nsWabAddressBook.h"
-#include "mozilla/Logging.h"
-#include "mozilla/DebugOnly.h"
-
-using namespace mozilla;
-
-static LazyLogModule gWabAddressBookLog("WABAddressBook");
-
-#define PRINTF(args) MOZ_LOG(gWabAddressBookLog, mozilla::LogLevel::Debug, args)
-#define WAB_DLL_NAMEW L"" WAB_DLL_NAME
-
-HMODULE nsWabAddressBook::mLibrary = NULL;
-int32_t nsWabAddressBook::mLibUsage = 0;
-LPWABOPEN nsWabAddressBook::mWABOpen = NULL;
-LPWABOBJECT nsWabAddressBook::mRootSession = NULL;
-LPADRBOOK nsWabAddressBook::mRootBook = NULL;
-
-BOOL nsWabAddressBook::LoadWabLibrary(void) {
-  if (mLibrary) {
-    ++mLibUsage;
-    return TRUE;
-  }
-
-  // We try to fetch the location of the WAB DLL from the registry
-  WCHAR wabDLLPath[MAX_PATH];
-  DWORD keyType = 0;
-  ULONG byteCount = sizeof(wabDLLPath);
-  HKEY keyHandle = NULL;
-  wabDLLPath[MAX_PATH - 1] = 0;
-  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"" WAB_DLL_PATH_KEY, 0, KEY_READ,
-                    &keyHandle) == ERROR_SUCCESS) {
-    RegQueryValueExW(keyHandle, L"", NULL, &keyType, (LPBYTE)wabDLLPath,
-                     &byteCount);
-    if (keyType == REG_EXPAND_SZ) {
-      // Expand the environment variables
-      DWORD bufferSize = ExpandEnvironmentStringsW(wabDLLPath, NULL, 0);
-      if (bufferSize && bufferSize < MAX_PATH) {
-        WCHAR tmp[MAX_PATH];
-        ExpandEnvironmentStringsW(wabDLLPath, tmp, bufferSize);
-        wcscpy(wabDLLPath, tmp);
-      } else {
-        return FALSE;
-      }
-    }
-  } else {
-    if (GetSystemDirectoryW(wabDLLPath, MAX_PATH)) {
-      wcsncat(
-          wabDLLPath, WAB_DLL_NAMEW,
-          std::min(wcslen(WAB_DLL_NAMEW), MAX_PATH - wcslen(wabDLLPath) - 1));
-    } else {
-      return FALSE;
-    }
-  }
-  if (keyHandle) {
-    RegCloseKey(keyHandle);
-  }
-  mLibrary = LoadLibraryW((lstrlenW(wabDLLPath)) ? wabDLLPath : WAB_DLL_NAMEW);
-  if (!mLibrary) {
-    return FALSE;
-  }
-  ++mLibUsage;
-  mWABOpen = reinterpret_cast<LPWABOPEN>(GetProcAddress(mLibrary, "WABOpen"));
-  if (!mWABOpen) {
-    return FALSE;
-  }
-  HRESULT retCode = mWABOpen(&mRootBook, &mRootSession, NULL, 0);
-
-  if (HR_FAILED(retCode)) {
-    PRINTF(("Cannot initialize WAB %08x.\n", retCode));
-    return FALSE;
-  }
-  return TRUE;
-}
-
-void nsWabAddressBook::FreeWabLibrary(void) {
-  if (mLibrary) {
-    if (--mLibUsage == 0) {
-      if (mRootBook) {
-        mRootBook->Release();
-      }
-      if (mRootSession) {
-        mRootSession->Release();
-      }
-      FreeLibrary(mLibrary);
-      mLibrary = NULL;
-    }
-  }
-}
-
-nsWabAddressBook::nsWabAddressBook(void) : nsAbWinHelper() {
-  mozilla::DebugOnly<BOOL> result = Initialize();
-
-  NS_ASSERTION(result == TRUE, "Couldn't initialize Wab Helper");
-  MOZ_COUNT_CTOR(nsWabAddressBook);
-}
-
-nsWabAddressBook::~nsWabAddressBook(void) {
-  StaticMutexAutoLock guard(sMutex);
-  FreeWabLibrary();
-  MOZ_COUNT_DTOR(nsWabAddressBook);
-}
-
-BOOL nsWabAddressBook::Initialize(void) {
-  if (mAddressBook) {
-    return TRUE;
-  }
-  StaticMutexAutoLock guard(sMutex);
-
-  if (!LoadWabLibrary()) {
-    PRINTF(("Cannot load library.\n"));
-    return FALSE;
-  }
-  mAddressBook = mRootBook;
-  return TRUE;
-}
-
-void nsWabAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID* aBuffer) {
-  mRootSession->AllocateBuffer(aByteCount, aBuffer);
-}
-
-void nsWabAddressBook::FreeBuffer(LPVOID aBuffer) {
-  mRootSession->FreeBuffer(aBuffer);
-}
deleted file mode 100644
--- a/mailnews/addrbook/src/nsWabAddressBook.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- 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 nsWabAddressBook_h___
-#define nsWabAddressBook_h___
-
-#include "mozilla/Attributes.h"
-#include "nsAbWinHelper.h"
-#include <wab.h>
-
-class nsWabAddressBook : public nsAbWinHelper {
- public:
-  nsWabAddressBook(void);
-  virtual ~nsWabAddressBook(void);
-
- protected:
-  // Session and address book that will be shared by all instances
-  // (see nsMapiAddressBook.h for details)
-  static LPWABOBJECT mRootSession;
-  static LPADRBOOK mRootBook;
-  // Class members to handle library loading/entry points
-  static int32_t mLibUsage;
-  static HMODULE mLibrary;
-  static LPWABOPEN mWABOpen;
-
-  // Load the WAB environment
-  BOOL Initialize(void);
-  // Allocation of a buffer for transmission to interfaces
-  virtual void AllocateBuffer(ULONG aByteCount, LPVOID* aBuffer) override;
-  // Destruction of a buffer provided by the interfaces
-  virtual void FreeBuffer(LPVOID aBuffer) override;
-  // Manage the library
-  static BOOL LoadWabLibrary(void);
-  static void FreeWabLibrary(void);
-
- private:
-};
-
-// Additional definitions for WAB stuff. These properties are
-// only defined with regards to the default character sizes,
-// and not in two _A and _W versions...
-// clang-format off
-#define PR_BUSINESS_ADDRESS_CITY_A                    PR_LOCALITY_A
-#define PR_BUSINESS_ADDRESS_COUNTRY_A                 PR_COUNTRY_A
-#define PR_BUSINESS_ADDRESS_POSTAL_CODE_A             PR_POSTAL_CODE_A
-#define PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A       PR_STATE_OR_PROVINCE_A
-#define PR_BUSINESS_ADDRESS_STREET_A                  PR_STREET_ADDRESS_A
-
-#define PR_BUSINESS_ADDRESS_CITY_W                    PR_LOCALITY_W
-#define PR_BUSINESS_ADDRESS_COUNTRY_W                 PR_COUNTRY_W
-#define PR_BUSINESS_ADDRESS_POSTAL_CODE_W             PR_POSTAL_CODE_W
-#define PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W       PR_STATE_OR_PROVINCE_W
-#define PR_BUSINESS_ADDRESS_STREET_W                  PR_STREET_ADDRESS_W
-// clang-format on
-
-#endif  // nsWABAddressBook_h___
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -980,23 +980,18 @@ pref("mail.password_protect_local_cache"
 
 // import option to skip the first record, recorded so that we can save
 // the users last used preference.
 pref("mailnews.import.text.skipfirstrecord", true);
 
 #ifdef MOZ_SUITE
 // automatically scale attached images that are displayed inline
 pref("mail.enable_automatic_image_resizing", true);
+#endif
 
-#ifdef XP_WIN
-pref("ldap_2.servers.oe.uri", "moz-aboutlookdirectory://oe/");
-pref("ldap_2.servers.oe.description", "chrome://messenger/locale/addressbook/addressBook.properties");
-pref("ldap_2.servers.oe.dirType", 3);
-#endif
-#endif
 #ifdef XP_MACOSX
 pref("ldap_2.servers.osx.uri", "moz-abosxdirectory:///");
 pref("ldap_2.servers.osx.description", "chrome://messenger/locale/addressbook/addressBook.properties");
 pref("ldap_2.servers.osx.dirType", 3);
 pref("mail.notification.sound", "");
 pref("mail.notification.count.inbox_only", true);
 #endif
 pref("mail.notification.loglevel", "Warn");