Bug 1293007 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in mailnews/ in comm-central. r=aceman
authorAman Dwivedi <dwivedi.aman96@gmail.com>
Thu, 05 Jan 2017 13:43:41 +0530
changeset 20989 5f8d4bef1cb09e0bbe8f704d3839ea94bcbf26c6
parent 20988 d9c51a68b3730c824393c84539025cd9296ca581
child 20990 48fcd36a39e793b2c92a76a0128c936762757b5e
push id12732
push usermozilla@jorgk.com
push dateTue, 10 Jan 2017 18:01:38 +0000
treeherdercomm-central@a5407b27ddc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1293007
Bug 1293007 - Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in mailnews/ in comm-central. r=aceman
mailnews/base/content/jsTreeView.js
mailnews/base/test/unit/test_autoconfigUtils.js
mailnews/base/test/unit/test_iteratorUtils.js
mailnews/base/test/unit/test_nsMsgDBView.js
mailnews/db/gloda/components/glautocomp.js
mailnews/db/gloda/modules/collection.js
mailnews/db/gloda/modules/datamodel.js
mailnews/db/gloda/modules/datastore.js
mailnews/db/gloda/modules/fundattr.js
mailnews/db/gloda/modules/gloda.js
mailnews/db/gloda/test/unit/resources/genericIndexer.js
mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
mailnews/mime/test/unit/test_message_attachment.js
mailnews/test/resources/mailTestUtils.js
mailnews/test/resources/messageGenerator.js
mailnews/test/resources/messageModifier.js
--- a/mailnews/base/content/jsTreeView.js
+++ b/mailnews/base/content/jsTreeView.js
@@ -119,17 +119,17 @@ PROTO_TREE_VIEW.prototype = {
     this._tree = aTree;
   },
 
   recursivelyAddToMap: function jstv_recursivelyAddToMap(aChild, aNewIndex) {
     // When we add sub-children, we're going to need to increase our index
     // for the next add item at our own level.
     let currentCount = this._rowMap.length;
     if (aChild.children.length && aChild.open) {
-      for (let [i, child] in Iterator(this._rowMap[aNewIndex].children)) {
+      for (let [i, child] of this._rowMap[aNewIndex].children.entries()) {
         let index = aNewIndex + i + 1;
         this._rowMap.splice(index, 0, child);
         aNewIndex += this.recursivelyAddToMap(child, index);
       }
     }
     return this._rowMap.length - currentCount;
   },
 
--- a/mailnews/base/test/unit/test_autoconfigUtils.js
+++ b/mailnews/base/test/unit/test_autoconfigUtils.js
@@ -61,17 +61,17 @@ function assert_equal_host_entries(hostE
 };
 
 /**
  * Assert that the list of tryOrders are the same.
  */
 function assert_equal_try_orders(aA, aB)
 {
   assert_equal(aA.length, aB.length, "tryOrders have different length");
-  for (let [i,subA] in Iterator(aA)) {
+  for (let [i,subA] of aA.entries()) {
     let subB = aB[i];
     assert_equal_host_entries(subA, subB);
   }
 };
 
 /**
  * Check that the POP calculations are correct for a given host and
  * protocol.
--- a/mailnews/base/test/unit/test_iteratorUtils.js
+++ b/mailnews/base/test/unit/test_iteratorUtils.js
@@ -127,32 +127,32 @@ function test_toArray_NodeList() {
   // Sanity check -- rootNode should have tag "rootnode"
   do_check_eq(rootNode.tagName, "rootnode");
   // childNodes is a NodeList
   let childNodes = rootNode.childNodes;
   // Make sure we have at least one child node
   do_check_true(childNodes.length > 0);
   let childArray = iteratorUtils.toArray(childNodes);
   do_check_eq(childNodes.length, childArray.length);
-  for (let [i, node] in Iterator(childArray))
+  for (let [i, node] of childArray.entries())
     do_check_eq(node, childArray[i]);
 }
 
 /**
  * Test that toArray works correctly with a built-in iterator generated by an
  * array.
  */
 function test_toArray_builtin_iterator() {
   let arr = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
   let iterator = Iterator(arr);
   // Note that this is going to be an array of [key, value] pairs, as is
   // returned by Iterator for an array
   let iteratorArray = iteratorUtils.toArray(iterator);
   do_check_eq(arr.length, iteratorArray.length);
-  for (let [i, val] in Iterator(arr)) {
+  for (let [i, val] of arr.entries()) {
     do_check_eq(i, iteratorArray[i][0]);
     do_check_eq(val, iteratorArray[i][1]);
   }
 
   // Bug 1126509, test that toArray rejects unknown objects.
   let thrown = false;
   let tryIterate = { item: "An object, that is not supported by toArray." };
   try {
@@ -178,17 +178,17 @@ function test_toArray_custom_iterator() 
       // C-style for loop so that we don't confuse ourselves with yet another
       // iterator
       for (let i = 0; i < arr.length; i++)
         yield arr[i];
     },
   };
   let iteratorArray = iteratorUtils.toArray(iterator);
   do_check_eq(arr.length, iteratorArray.length);
-  for (let [i, val] in Iterator(arr))
+  for (let [i, val] of arr.entries())
     do_check_eq(val, iteratorArray[i]);
 }
 
 var gTests = [
   test_fixIterator,
   test_toArray_NodeList,
   test_toArray_builtin_iterator,
   test_toArray_custom_iterator,
--- a/mailnews/base/test/unit/test_nsMsgDBView.js
+++ b/mailnews/base/test/unit/test_nsMsgDBView.js
@@ -968,32 +968,32 @@ function run_test() {
 }
 
 function* actually_run_test() {
   dump("in actually_run_test\n");
   yield async_run({func: setup_globals});
   dump("Num Messages: " + gTestFolder.msgDatabase.dBFolderInfo.numMessages + "\n");
 
   // for each view type...
-  for (let [, view_type_and_flags] in Iterator(view_types)) {
+  for (let view_type_and_flags of view_types) {
     let [view_type, view_flags] = view_type_and_flags;
     dump("===== Testing View Type: " + view_type + " flags: " + view_flags +
          "\n");
 
     let save_gTestFolder = gTestFolder;
     // ... run each test
     setup_view(view_type, view_flags);
 
-    for (let [, testFunc] in Iterator(tests_for_all_views)) {
+    for (let testFunc of tests_for_all_views) {
       dump("=== Running generic test: " + testFunc.name + "\n");
       yield async_run({func: testFunc});
     }
 
     if (tests_for_specific_views[view_type]) {
-      for (let [, testFunc] in Iterator(tests_for_specific_views[view_type])) {
+      for (let testFunc of tests_for_specific_views[view_type]) {
         dump("=== Running view-specific test: " + testFunc.name + "\n");
         yield async_run({func: testFunc});
       }
     }
     gTestFolder = save_gTestFolder;
   }
   do_test_finished();
 }
--- a/mailnews/db/gloda/components/glautocomp.js
+++ b/mailnews/db/gloda/components/glautocomp.js
@@ -341,17 +341,17 @@ ContactIdentityCompleter.prototype = {
 function ContactTagCompleter() {
   FreeTagNoun.populateKnownFreeTags();
   this._buildSuffixTree();
   FreeTagNoun.addListener(this);
 }
 ContactTagCompleter.prototype = {
   _buildSuffixTree: function() {
     let tagNames = [], tags = [];
-    for (let [tagName, tag] in Iterator(FreeTagNoun.knownFreeTags)) {
+    for (let [tagName, tag] of Object.entries(FreeTagNoun.knownFreeTags)) {
       tagNames.push(tagName.toLowerCase());
       tags.push(tag);
     }
     this._suffixTree = new MultiSuffixTree(tagNames, tags);
     this._suffixTreeDirty = false;
   },
   onFreeTagAdded: function(aTag) {
     this._suffixTreeDirty = true;
--- a/mailnews/db/gloda/modules/collection.js
+++ b/mailnews/db/gloda/modules/collection.js
@@ -268,17 +268,17 @@ var GlodaCollectionManager = {
         unresolvedIndexToItem[iItem] = aItems[iItem];
       }
       numUnresolved = aItems.length;
     }
 
     let needToCache = [];
     // next, let's fall back to our collections
     for (let collection of this.getCollectionsForNounID(aNounID)) {
-      for (let [iItem, item] in Iterator(unresolvedIndexToItem)) {
+      for (let [iItem, item] of Object.entries(unresolvedIndexToItem)) {
         if (item.id in collection._idMap) {
           let realItem = collection._idMap[item.id];
           // update the caller's array to now have the 'real' object
           aItems[iItem] = realItem;
           // flag that we need to cache this guy (we use an inclusive cache)
           needToCache.push(realItem);
           // we no longer need to resolve this item...
           delete unresolvedIndexToItem[iItem];
--- a/mailnews/db/gloda/modules/datamodel.js
+++ b/mailnews/db/gloda/modules/datamodel.js
@@ -149,17 +149,17 @@ var GlodaHasAttributesMixIn = {
       if (this[attrName])
         aDomNode.setAttribute(attr.domExpose, this[attrName]);
     }
   },
 };
 
 function MixIn(aConstructor, aMixIn) {
   let proto = aConstructor.prototype;
-  for (let [name, func] in Iterator(aMixIn)) {
+  for (let [name, func] of Object.entries(aMixIn)) {
     if (name.startsWith("get_"))
       proto.__defineGetter__(name.substring(4), func);
     else
       proto[name] = func;
   }
 }
 
 /**
--- a/mailnews/db/gloda/modules/datastore.js
+++ b/mailnews/db/gloda/modules/datastore.js
@@ -107,17 +107,17 @@ var QueryFromQueryResolver = {
       return;
     }
 
     let referencesByNounID = originColl.masterCollection.referencesByNounID;
     let inverseReferencesByNounID =
       originColl.masterCollection.inverseReferencesByNounID;
 
     if (originColl.pendingItems) {
-      for (let [, item] in Iterator(originColl.pendingItems)) {
+      for (let item of originColl.pendingItems) {
         //QFQ_LOG.debug("QFQR: loading deferred " + item.NOUN_ID + ":" + item.id);
         GlodaDatastore.loadNounDeferredDeps(item, referencesByNounID,
             inverseReferencesByNounID);
       }
 
       // we need to consider the possibility that we are racing a collection very
       //  much like our own.  as such, this means we need to perform cache
       //  unification as our last step.
@@ -209,18 +209,17 @@ QueryFromQueryCallback.prototype = {
       let pendingIdMap = this.collection._pendingIdMap;
       let row;
       let nounDef = this.nounDef;
       let nounID = nounDef.id;
       while ((row = aResultSet.getNextRow())) {
         let item = nounDef.objFromRow.call(nounDef.datastore, row);
         if (this.collection.stashedColumns) {
           let stashed = this.collection.stashedColumns[item.id] = [];
-          for (let [,iCol] in
-               Iterator(this.collection.query.options.stashColumns)) {
+          for (let iCol of this.collection.query.options.stashColumns) {
             stashed.push(GlodaDatastore._getVariant(row, iCol));
           }
         }
         // try and replace the item with one from the cache, if we can
         let cachedItem = GlodaCollectionManager.cacheLookupOne(nounID, item.id,
                                                                false);
 
         // if we already have a copy in the pending id map, skip it
@@ -3488,17 +3487,17 @@ var GlodaDatastore = {
       sqlString = aQuery.options.explicitSQL;
 
     if (aQuery.options.outerWrapColumns)
       sqlString = "SELECT *, " + aQuery.options.outerWrapColumns.join(", ") +
                   " FROM (" + sqlString + ")";
 
     if (aQuery._order.length) {
       let orderClauses = [];
-      for (let [, colName] in Iterator(aQuery._order)) {
+      for (let colName of aQuery._order) {
          if (colName.startsWith("-"))
            orderClauses.push(colName.substring(1) + " DESC");
          else
            orderClauses.push(colName + " ASC");
       }
       sqlString += " ORDER BY " + orderClauses.join(", ");
     }
 
@@ -3526,17 +3525,17 @@ var GlodaDatastore = {
     return this._queryFromSQLString(sqlString, boundArgs, nounDef, aQuery,
         aListener, aListenerData, aExistingCollection, aMasterCollection);
   },
 
   _queryFromSQLString: function gloda_ds__queryFromSQLString(aSqlString,
       aBoundArgs, aNounDef, aQuery, aListener, aListenerData,
       aExistingCollection, aMasterCollection) {
     let statement = this._createAsyncStatement(aSqlString, true);
-    for (let [iBinding, bindingValue] in Iterator(aBoundArgs)) {
+    for (let [iBinding, bindingValue] of aBoundArgs.entries()) {
       this._bindVariant(statement, iBinding, bindingValue);
     }
 
     let collection;
     if (aExistingCollection)
       collection = aExistingCollection;
     else {
       collection = new GlodaCollection(aNounDef, [], aQuery, aListener,
@@ -3727,17 +3726,17 @@ var GlodaDatastore = {
       return;
 
     //this._log.debug("  loading deferred, deps: " +
     //    Log4Moz.enumerateProperties(aItem._deps).join(","));
 
 
     let attribIDToDBDefAndParam = this._attributeIDToDBDefAndParam;
 
-    for (let [attribId, jsonValue] in Iterator(aItem._deps)) {
+    for (let [attribId, jsonValue] of Object.entries(aItem._deps)) {
       let dbAttrib = attribIDToDBDefAndParam[attribId][0];
       let attrib = dbAttrib.attrDef;
 
       let objectNounDef = attrib.objectNounDef;
       let references = aReferencesByNounID[objectNounDef.id];
       if (attrib.special) {
         if (attrib.special === this.kSpecialColumnChildren) {
           let inverseReferences = aInverseReferencesByNounID[objectNounDef.id];
--- a/mailnews/db/gloda/modules/fundattr.js
+++ b/mailnews/db/gloda/modules/fundattr.js
@@ -776,20 +776,20 @@ var GlodaFundAttr = {
     if (authorIdentity.id in Gloda.myIdentities)
       score += this.NOTABILITY_FROM_ME;
     else if (authorIdentity.inAddressBook)
       score += this.NOTABILITY_FROM_IN_ADDR_BOOK;
     if (aMessage.toMe)
       score += this.NOTABILITY_INVOLVING_ME;
 
     let involvedAddrBookCount = 0;
-    for (let [, identity] in Iterator(aMessage.to))
+    for (let identity of aMessage.to)
       if (identity.inAddressBook)
         involvedAddrBookCount++;
-    for (let [, identity] in Iterator(aMessage.cc))
+    for (let identity of aMessage.cc)
       if (identity.inAddressBook)
         involvedAddrBookCount++;
     if (involvedAddrBookCount)
       score += this.NOTABILITY_INVOLVING_ADDR_BOOK_FIRST +
         (involvedAddrBookCount - 1) * this.NOTABILITY_INVOLVING_ADDR_BOOK_ADDL;
     return score;
   },
 
--- a/mailnews/db/gloda/modules/gloda.js
+++ b/mailnews/db/gloda/modules/gloda.js
@@ -2049,17 +2049,17 @@ var Gloda = {
           jsonDict[attrib.id] = objectNounDef.toJSON(value);
         else
           jsonDict[attrib.id] = value;
       }
       else {
         if (objectNounDef.toJSON) {
           let toJSON = objectNounDef.toJSON;
           jsonDict[attrib.id] = [];
-          for (let [, subValue] in Iterator(value)) {
+          for (let subValue of value) {
             jsonDict[attrib.id].push(toJSON(subValue));
           }
         }
         else
           jsonDict[attrib.id] = value;
       }
 
       let oldValue = aOldItem[key];
@@ -2256,17 +2256,17 @@ var Gloda = {
     for (let item of aItems) {
       let score = 0;
       let attrProviders = this._attrProviderOrderByNoun[itemNounDef.id];
       for (let iProvider = 0; iProvider < attrProviders.length; iProvider++) {
         let provider = attrProviders[iProvider];
         if (provider.score)
           score += provider.score(item);
       }
-      for (let [, extraScoreFunc] in Iterator(aExtraScoreFuncs))
+      for (let extraScoreFunc of aExtraScoreFuncs)
         score += extraScoreFunc(item, aContext);
       scores.push(score);
     }
 
     return scores;
   }
 };
 
--- a/mailnews/db/gloda/test/unit/resources/genericIndexer.js
+++ b/mailnews/db/gloda/test/unit/resources/genericIndexer.js
@@ -31,17 +31,17 @@ var GenericIndexer = {
       " generic objects with id: " + aObjects[0].NOUN_ID);
     GlodaIndexer.indexJob(new IndexingJob("generic", null,
                                           aObjects.concat()));
   },
   /* implementation */
   _worker_index_generic: function*(aJob, aCallbackHandle) {
     this._log.debug("Beginning indexing " + aJob.items.length +
                     " generic items");
-    for (let [, item] in Iterator(aJob.items)) {
+    for (let item of aJob.items) {
       this._log.debug("Indexing: " + item);
       yield aCallbackHandle.pushAndGo(
         Gloda.grokNounItem(item, {},
                            item.id === undefined, item.id === undefined,
                            aCallbackHandle,
                            item.NOUN_DEF.cache));
       item._stash();
     }
--- a/mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
+++ b/mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
@@ -168,17 +168,17 @@ function msgSearchExpectCount(aCount, aF
     sql = aSql
     args = aArgs;
   };
   query.getCollection();
   GlodaDatastore._queryFromSQLString = oldFunc;
 
   // Bind the parameters
   let stmt = conn.createStatement(sql);
-  for (let [iBinding, bindingValue] in Iterator(args)) {
+  for (let [iBinding, bindingValue] of args.entries()) {
     GlodaDatastore._bindVariant(stmt, iBinding, bindingValue);
   }
 
   let i = 0;
   stmt.executeAsync({
     handleResult: function(aResultSet) {
       for (let row = aResultSet.getNextRow();
            row;
--- a/mailnews/mime/test/unit/test_message_attachment.js
+++ b/mailnews/mime/test/unit/test_message_attachment.js
@@ -70,17 +70,17 @@ var gStreamListener = {
     this.contents = "";
     this.stream = null;
   },
   onStopRequest: function (aRequest, aContext, aStatusCode) {
     // Check that the attachments' filenames are as expected. Just use a regex
     // here because it's simple.
     let regex = /<legend class="mimeAttachmentHeaderName">(.*?)<\/legend>/gi;
 
-    for (let [,attachment] in Iterator(messages[this.index].attachments)) {
+    for (let attachment of messages[this.index].attachments) {
       let match = regex.exec(this.contents);
       do_check_neq(match, null);
       do_check_eq(match[1], attachment.expectedFilename || attachment.filename);
     }
     do_check_eq(regex.exec(this.contents), null);
 
     this.index++;
     async_driver();
--- a/mailnews/test/resources/mailTestUtils.js
+++ b/mailnews/test/resources/mailTestUtils.js
@@ -471,17 +471,17 @@ var mailTestUtils = {
     if (!aSomeoneElseWillTriggerTheUpdate)
       aFolder.updateFolder(null);
   },
 
   /**
    * For when you want to compare elements non-strictly.
    */
   non_strict_index_of: function(aArray, aElem) {
-    for (let [i, elem] in Iterator(aArray)) {
+    for (let [i, elem] of aArray.entries()) {
       if (elem == aElem)
         return i;
     }
     return -1;
   },
 
   /**
    * Registers a directory provider for UMimTyp for when its needed.
--- a/mailnews/test/resources/messageGenerator.js
+++ b/mailnews/test/resources/messageGenerator.js
@@ -98,17 +98,17 @@ SyntheticPart.prototype = {
     let s = this._contentType;
     if (this._charset)
       s += '; charset=' + this._charset;
     if (this._format)
       s += '; format=' + this._format;
     if (this._filename)
       s += ';\r\n name="' + this._filename +'"';
     if (this._contentTypeExtra) {
-      for (let [key, value] in Iterator(this._contentTypeExtra))
+      for (let [key, value] of Object.entries(this._contentTypeExtra))
         s += ';\r\n ' + key + '="' + value + '"';
     }
     if (this._boundary)
       s += ';\r\n boundary="' + this._boundary + '"';
     return s;
   },
   get hasTransferEncoding() {
     return this._encoding;
@@ -187,17 +187,17 @@ function SyntheticPartMulti(aParts, aPro
   this.BOUNDARY_COUNTER_HOME.BOUNDARY_COUNTER += 1;
   this.parts = (aParts != null) ? aParts : [];
 }
 SyntheticPartMulti.prototype = {
   __proto__: SyntheticPart.prototype,
   BOUNDARY_COUNTER: 0,
   toMessageString: function() {
     let s = "This is a multi-part message in MIME format.\r\n";
-    for (let [,part] in Iterator(this.parts)) {
+    for (let part of this.parts) {
       s += "--" + this._boundary + "\r\n";
       if (part instanceof SyntheticDegeneratePartEmpty)
         continue;
       s += "Content-Type: " + part.contentTypeHeaderValue + '\r\n';
       if (part.hasTransferEncoding)
         s += 'Content-Transfer-Encoding: ' +
              part.contentTransferEncodingHeaderValue + '\r\n';
       if (part.hasDisposition)
@@ -650,17 +650,17 @@ SyntheticMessage.prototype = {
  * Write a list of messages to a folder
  *
  * @param aMessages The list of SyntheticMessages instances to write.
  * @param aFolder The folder to write to.
  */
 function addMessagesToFolder (aMessages, aFolder)
 {
   let localFolder = aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
-  for (let [, message] in Iterator(aMessages))
+  for (let message of aMessages)
     localFolder.addMessage(message.toMboxString());
 }
 
 /**
  * Provides mechanisms for creating vaguely interesting, but at least valid,
  *  SyntheticMessage instances.
  */
 function MessageGenerator() {
@@ -1015,23 +1015,23 @@ MessageGenerator.prototype = {
    */
   makeMessages: function MessageGenerator_makeMessages(aSetDef) {
     let messages = [];
 
     let args = {};
     // zero out all the age_incr fields in age (if present)
     if (aSetDef.age_incr) {
       args.age = {};
-      for (let [unit, delta] in Iterator(aSetDef.age_incr))
+      for (let [unit, delta] of Object.entries(aSetDef.age_incr))
         args.age[unit] = 0;
     }
     // copy over the initial values from age (if present)
     if (aSetDef.age) {
       args.age = args.age || {};
-      for (let [unit, value] in Iterator(aSetDef.age))
+      for (let [unit, value] of Object.entries(aSetDef.age))
         args.age[unit] = value;
     }
     // just copy over any attributes found from MAKE_MESSAGES_PROPAGATE
     for (let propAttrName of this.MAKE_MESSAGES_PROPAGATE) {
       if (aSetDef[propAttrName])
         args[propAttrName] = aSetDef[propAttrName];
     }
 
@@ -1043,17 +1043,17 @@ MessageGenerator.prototype = {
       if (lastMessage && (iMsg % messagsPerThread != 0))
         args.inReplyTo = lastMessage;
       else if (!("inReplyTo" in aSetDef))
         args.inReplyTo = null;
       lastMessage = this.makeMessage(args);
       messages.push(lastMessage);
 
       if (aSetDef.age_incr) {
-        for (let [unit, delta] in Iterator(aSetDef.age_incr))
+        for (let [unit, delta] of Object.entries(aSetDef.age_incr))
           args.age[unit] += delta;
       }
     }
 
     return messages;
   },
 };
 
@@ -1138,17 +1138,17 @@ MessageScenarioFactory.prototype = {
  *  because we are using a getter and 'this' in js always refers to the object
  *  in question (never any part of its prototype chain).  As such, you probably
  *  want to invoke us on your prototype object(s).
  *
  * @param The object on whom we want to perform magic binding.  This should
  *     probably be your prototype object.
  */
 function bindMethods(aObj) {
-  for (let [name, ubfunc] in Iterator(aObj)) {
+  for (let [name, ubfunc] of Object.entries(aObj)) {
     // the variable binding needs to get captured...
     let realFunc = ubfunc;
     delete aObj[name];
     Object.defineProperty(aObj, name, {
       get: function getterFunc() {
 	return realFunc.bind(this);
       }
     });
--- a/mailnews/test/resources/messageModifier.js
+++ b/mailnews/test/resources/messageModifier.js
@@ -122,17 +122,17 @@ SyntheticMessageSet.prototype = {
 
   /**
    * @return a JS iterator of the message headers for all messages inserted into
    *     a folder.
    */
   msgHdrs: function*() {
     // get the databases
     let msgDatabases = this.msgFolders.map(folder => folder.msgDatabase);
-    for (let [iMsg, synMsg] in Iterator(this.synMessages)) {
+    for (let [iMsg, synMsg] of this.synMessages.entries()) {
       let folderIndex = this.folderIndices[iMsg];
       if (folderIndex != null)
         yield msgDatabases[folderIndex].getMsgHdrForMessageID(synMsg.messageId);
     }
   },
   /**
    * @return a JS list of the message headers for all messages inserted into a
    *     folder.
@@ -150,17 +150,17 @@ SyntheticMessageSet.prototype = {
   },
   /**
    * @return a list where each item is a list with two elements; the first is
    *     an nsIMsgFolder, and the second is a list of all of the nsIMsgDBHdrs
    *     for the synthetic messages in the set inserted into that folder.
    */
   get foldersWithMsgHdrs() {
     let results = this.msgFolders.map(folder => [folder, []]);
-    for (let [iMsg, synMsg] in Iterator(this.synMessages)) {
+    for (let [iMsg, synMsg] of this.synMessages.entries()) {
       let folderIndex = this.folderIndices[iMsg];
       if (folderIndex != null) {
         let [folder, msgHdrs] = results[folderIndex];
         msgHdrs.push(folder.msgDatabase.getMsgHdrForMessageID(synMsg.messageId));
       }
     }
     return results;
   },