Bug 672830 - Very slow autocomplete on 7.0a2, os x; r=Standard8
authorMike Conley <mconley@mozilla.com>
Thu, 04 Aug 2011 16:15:53 -0400
changeset 8302 fd30dc96a8caa0acf818a0e7f8e0b1412d25ab2d
parent 8301 513f083fc91f4c5e9b502123a544b9ba2320f9ff
child 8303 34e57d72adab829757defbc502f7337cf1cfab53
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs672830
Bug 672830 - Very slow autocomplete on 7.0a2, os x; r=Standard8
mailnews/addrbook/src/nsAbOSXDirectory.mm
--- a/mailnews/addrbook/src/nsAbOSXDirectory.mm
+++ b/mailnews/addrbook/src/nsAbOSXDirectory.mm
@@ -514,20 +514,20 @@ nsAbOSXDirectory::Init(const char *aUri)
                                                object:nil];
   }
   ++sObserverCount;
 
   NSArray *cards;
   nsCOMPtr<nsIMutableArray> cardList;
   PRBool isRootOSXDirectory = PR_FALSE;
 
-  if (mURINoQuery.Length() <= sizeof(NS_ABOSXDIRECTORY_URI_PREFIX))
+  if (!mIsQueryURI && mURINoQuery.Length() <= sizeof(NS_ABOSXDIRECTORY_URI_PREFIX))
     isRootOSXDirectory = PR_TRUE;
 
-  if (isRootOSXDirectory)
+  if (mIsQueryURI || isRootOSXDirectory)
   {
     m_DirPrefId.AssignLiteral("ldap_2.servers.osx");
 
     cards = [[addressBook people] arrayByAddingObjectsFromArray:[addressBook groups]];
     if (!mCardList)
       mCardList = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     else
       rv = mCardList->Clear();
@@ -582,17 +582,23 @@ nsAbOSXDirectory::Init(const char *aUri)
     else
     {
       // If we're not a Group, that means we're the root nsAbOSXDirectory,
       // which means we have to create the cards from scratch.
       rv = CreateCard([cards objectAtIndex:i], getter_AddRefs(card));
     }
 
     NS_ENSURE_SUCCESS(rv, rv);
-    AssertCard(abManager, card);
+
+    // 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);
+
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAbOSXDirectory::GetURI(nsACString &aURI)
 {