Bug 732372 - Search fails - a.contact is undefined in gloda.js. Part 3 - don't pass the card as a raw rep; wrap it in an object. r=bienvenu,a=Standard8
authorAndrew Sutherland <bugmail@asutherland.org>
Thu, 08 Mar 2012 16:10:20 +0000
changeset 10251 eca379427454943ed8ca96b943dcf4466c3e9258
parent 10250 45bb8ced6a394a83a6dd9a3d937b5b25891a18ee
child 10257 e2eba41d5d806ed55ea866c2a1f25e48867d5e86
push idunknown
push userunknown
push dateunknown
reviewersbienvenu, Standard8
bugs732372
Bug 732372 - Search fails - a.contact is undefined in gloda.js. Part 3 - don't pass the card as a raw rep; wrap it in an object. r=bienvenu,a=Standard8
mailnews/db/gloda/modules/gloda.js
mailnews/db/gloda/modules/index_ab.js
--- a/mailnews/db/gloda/modules/gloda.js
+++ b/mailnews/db/gloda/modules/gloda.js
@@ -473,17 +473,18 @@ var Gloda = {
       let identity = GlodaDatastore.createIdentity(contact.id, contact,
         "email", address, /* description */ "", /* relay? */ false);
       contact._identities = [identity];
 
       // give the address book indexer a chance if we have a card.
       // (it will fix-up the name based on the card as appropriate)
       if (card)
         yield aCallbackHandle.pushAndGo(
-          Gloda.grokNounItem(contact, card, true, true, aCallbackHandle));
+          Gloda.grokNounItem(contact, {card: card}, true, true,
+                             aCallbackHandle));
       else // grokNounItem will issue the insert for us...
         GlodaDatastore.insertContact(contact);
 
       for (let iResList = 1; iResList < nameAndResultLists.length; iResList++) {
         nameAndResultLists[iResList].push(identity);
       }
     }
 
--- a/mailnews/db/gloda/modules/index_ab.js
+++ b/mailnews/db/gloda/modules/index_ab.js
@@ -97,17 +97,17 @@ var GlodaABIndexer = {
 
       if (identityCollection.items.length) {
         let identity = identityCollection.items[0];
         // force the identity to know it has an associated ab card.
         identity._hasAddressBookCard = true;
 
         this._log.debug("Found identity, processing card.");
         yield aCallbackHandle.pushAndGo(
-            Gloda.grokNounItem(identity.contact, card, false, false,
+            Gloda.grokNounItem(identity.contact, {card: card}, false, false,
                                aCallbackHandle));
         this._log.debug("Done processing card.");
       }
     }
 
     yield GlodaIndexer.kWorkDone;
   },
 
@@ -284,31 +284,32 @@ var GlodaABAttrs = {
     // we need to find any existing bound freetag attributes, and use them to
     //  populate to FreeTagNoun's understanding
     for (let freeTagName in this._attrFreeTag.parameterBindings) {
       this._log.debug("Telling FreeTagNoun about: " + freeTagName);
       FreeTagNoun.getFreeTag(freeTagName);
     }
   },
 
-  process: function(aContact, aCard, aIsNew, aCallbackHandle) {
+  process: function(aContact, aRawReps, aIsNew, aCallbackHandle) {
+    let card = aRawReps.card;
     if (aContact.NOUN_ID != Gloda.NOUN_CONTACT) {
       this._log.warn("Somehow got a non-contact: " + aContact);
       return; // this will produce an exception; we like.
     }
 
     // update the name
-    if (aCard.displayName && aCard.displayName != aContact.name)
-      aContact.name = aCard.displayName;
+    if (card.displayName && card.displayName != aContact.name)
+      aContact.name = card.displayName;
 
     aContact.freeTags = [];
 
     let tags = null;
     try {
-      tags = aCard.getProperty("Categories", null);
+      tags = card.getProperty("Categories", null);
     } catch (ex) {
       this._log.error("Problem accessing property: " + ex);
     }
     if (tags) {
       for each (let [iTagName, tagName] in Iterator(tags.split(","))) {
         tagName = tagName.trim();
         if (tagName) {
           aContact.freeTags.push(FreeTagNoun.getFreeTag(tagName));