Bug 1114070 After Bug 783829 PlacesUtils.nodeAncestors is now a generator r=Neil
authorPhilip Chee <philip.chee@gmail.com>
Wed, 24 Dec 2014 02:08:52 +0800
changeset 21529 dd02b8c63aed5d5eff96e7fa7a7043dd3a8e3533
parent 21528 93cf0affd49404c0abd483472424048452e7dbd7
child 21530 ead55271f364337c987117f0d8b34646958fb4f7
push id1305
push usermbanner@mozilla.com
push dateMon, 23 Feb 2015 19:48:12 +0000
treeherdercomm-beta@3ae4f13858fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs1114070, 783829
Bug 1114070 After Bug 783829 PlacesUtils.nodeAncestors is now a generator r=Neil
suite/common/history/treeView.js
suite/common/places/treeView.js
--- a/suite/common/history/treeView.js
+++ b/suite/common/history/treeView.js
@@ -110,17 +110,17 @@ PlacesTreeView.prototype = {
   _getRowForNode:
   function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) {
     if (aNode == this._rootNode)
       throw new Error("The root node is never visible");
 
     // A node is removed form the view either if it has no parent or if its
     // root-ancestor is not the root node (in which case that's the node
     // for which nodeRemoved was called).
-    let ancestors = [x for each (x in PlacesUtils.nodeAncestors(aNode))];
+    let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))];
     if (ancestors.length == 0 ||
         ancestors[ancestors.length - 1] != this._rootNode) {
       throw new Error("Removed node passed to _getRowForNode");
     }
 
     // Ensure that the entire chain is open, otherwise that node is invisible.
     for (let ancestor of ancestors) {
       if (!ancestor.containerOpen)
@@ -350,17 +350,17 @@ PlacesTreeView.prototype = {
   function PTV__getNewRowForRemovedNode(aUpdatedContainer, aOldNode) {
     var parent = aOldNode.parent;
     if (parent) {
       // If the node's parent is still set, the node is not obsolete
       // and we should just find out its new position.
       // However, if any of the node's ancestor is closed, the node is
       // invisible.
       let ancestors = PlacesUtils.nodeAncestors(aOldNode);
-      for (let ancestor in ancestors) {
+      for (let ancestor of ancestors) {
         if (!ancestor.containerOpen)
           return -1;
       }
 
       return this._getRowForNode(aOldNode, true);
     }
 
     // There's a broken edge case here.
--- a/suite/common/places/treeView.js
+++ b/suite/common/places/treeView.js
@@ -129,17 +129,17 @@ PlacesTreeView.prototype = {
   _getRowForNode:
   function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) {
     if (aNode == this._rootNode)
       throw new Error("The root node is never visible");
 
     // A node is removed from the view either if it has no parent or if its
     // root-ancestor is not the root node (in which case that's the node
     // for which nodeRemoved was called).
-    let ancestors = [x for each (x in PlacesUtils.nodeAncestors(aNode))];
+    let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))];
     if (ancestors.length == 0 ||
         ancestors[ancestors.length - 1] != this._rootNode) {
       throw new Error("Removed node passed to _getRowForNode");
     }
 
     // Ensure that the entire chain is open, otherwise that node is invisible.
     for (let ancestor of ancestors) {
       if (!ancestor.containerOpen)
@@ -382,17 +382,17 @@ PlacesTreeView.prototype = {
   function PTV__getNewRowForRemovedNode(aUpdatedContainer, aOldNode) {
     let parent = aOldNode.parent;
     if (parent) {
       // If the node's parent is still set, the node is not obsolete
       // and we should just find out its new position.
       // However, if any of the node's ancestor is closed, the node is
       // invisible.
       let ancestors = PlacesUtils.nodeAncestors(aOldNode);
-      for (let ancestor in ancestors) {
+      for (let ancestor of ancestors) {
         if (!ancestor.containerOpen)
           return -1;
       }
 
       return this._getRowForNode(aOldNode, true);
     }
 
     // There's a broken edge case here.