fix error expanding folder pane tree rows, r=standard8, bug 658534
authorDavid Bienvenu <bienvenu@nventure.com>
Mon, 25 Jul 2011 14:08:35 -0700
changeset 8177 d5812a6f28b98a7d2ccbb851a31a44acc5476df5
parent 8176 9875fdbfc9db2680007f3305f85e951606725465
child 8178 cf242a5c4d701e39a63b7e9bf1760f3879f46177
push id6288
push userbienvenu@nventure.com
push dateMon, 25 Jul 2011 21:08:35 +0000
treeherdercomm-central@d5812a6f28b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8, bug
bugs658534
fix error expanding folder pane tree rows, r=standard8, bug 658534
mail/base/content/folderPane.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -868,37 +868,37 @@ let gFolderTreeView = {
         this._tree.rowCountChanged(aIndex + 1, (-1) * count);
         this._tree.invalidateRow(aIndex);
       }
     } else {
       // We're opening the container.  Add the children to our map
 
       // Note that these children may have been open when we were last closed,
       // and if they are, we also have to add those grandchildren to the map
-      let tree = this;
       let oldCount = this._rowMap.length;
-      function recursivelyAddToMap(aChild, aNewIndex) {
+      function recursivelyAddToMap(aChild, aNewIndex, tree) {
         // When we add sub-children, we're going to need to increase our index
         // for the next add item at our own level
         let count = 0;
         if (aChild.children.length && aChild.open) {
           for (let [i, child] in Iterator(tree._rowMap[aNewIndex].children)) {
             count++;
             var index = Number(aNewIndex) + Number(i) + 1;
             tree._rowMap.splice(index, 0, child);
 
-            let kidsAdded = recursivelyAddToMap(child, index);
+            let kidsAdded = recursivelyAddToMap(child, index, tree);
             count += kidsAdded;
             // Somehow the aNewIndex turns into a string without this
             aNewIndex = Number(aNewIndex) + kidsAdded;
           }
         }
         return count;
       }
-      recursivelyAddToMap(this._rowMap[aIndex], aIndex);
+      // work around bug 658534 by passing in "this" instead of let tree = this;
+      recursivelyAddToMap(this._rowMap[aIndex], aIndex, this);
 
       // Add this folder to the persist map
       if (!this._persistOpenMap[this.mode])
         this._persistOpenMap[this.mode] = [];
       let id = this._rowMap[aIndex].id;
       if (this._persistOpenMap[this.mode].indexOf(id) == -1)
         this._persistOpenMap[this.mode].push(id);