Bug 1615468 - revert iterator change in AbAutoCompleteSearch to restore autocomplete when macOS address book integration is enabled, r=darktrojan DONTBUILD
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 03 Mar 2020 10:10:08 +0000
changeset 37468 ab91e4acbf0cbf17891a88b477a11fccd425e3e3
parent 37467 8b72e9a9d5c3f74030e7e361ff418dbace77d949
child 37469 4fdcb0fd8f42f07374ac5fdd7f013d19eff7102e
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)
reviewersdarktrojan
bugs1615468
Bug 1615468 - revert iterator change in AbAutoCompleteSearch to restore autocomplete when macOS address book integration is enabled, r=darktrojan DONTBUILD
mailnews/addrbook/src/AbAutoCompleteSearch.jsm
--- a/mailnews/addrbook/src/AbAutoCompleteSearch.jsm
+++ b/mailnews/addrbook/src/AbAutoCompleteSearch.jsm
@@ -208,42 +208,45 @@ AbAutoCompleteSearch.prototype = {
       );
       return;
     }
 
     // Cache this values to save going through xpconnect each time
     var commentColumn = this._commentColumn == 1 ? directory.dirName : "";
 
     // Now iterate through all the cards.
-    for (let card of childCards) {
-      if (card.isMailList) {
-        this._addToResult(commentColumn, directory, card, "", true, result);
-      } else {
-        let email = card.primaryEmail;
-        if (email) {
-          this._addToResult(
-            commentColumn,
-            directory,
-            card,
-            email,
-            true,
-            result
-          );
-        }
+    while (childCards.hasMoreElements()) {
+      var card = childCards.getNext();
+      if (card instanceof Ci.nsIAbCard) {
+        if (card.isMailList) {
+          this._addToResult(commentColumn, directory, card, "", true, result);
+        } else {
+          let email = card.primaryEmail;
+          if (email) {
+            this._addToResult(
+              commentColumn,
+              directory,
+              card,
+              email,
+              true,
+              result
+            );
+          }
 
-        email = card.getProperty("SecondEmail", "");
-        if (email) {
-          this._addToResult(
-            commentColumn,
-            directory,
-            card,
-            email,
-            false,
-            result
-          );
+          email = card.getProperty("SecondEmail", "");
+          if (email) {
+            this._addToResult(
+              commentColumn,
+              directory,
+              card,
+              email,
+              false,
+              result
+            );
+          }
         }
       }
     }
   },
 
   /**
    * Checks the parent card and email address of an autocomplete results entry
    * from a previous result against the search parameters to see if that entry