Bug 783829 - Make PlacesUtils.nodeAncestors a new generator. r=mak

This commit is contained in:
Tom Schuster 2014-12-17 00:28:39 +01:00
parent aff58df807
commit f175058069
2 changed files with 3 additions and 3 deletions

View File

@ -152,7 +152,7 @@ PlacesTreeView.prototype = {
// 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");
@ -417,7 +417,7 @@ PlacesTreeView.prototype = {
// 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;
}

View File

@ -200,7 +200,7 @@ this.PlacesUtils = {
* @param aNode
* A result node
*/
nodeAncestors: function PU_nodeAncestors(aNode) {
nodeAncestors: function* PU_nodeAncestors(aNode) {
let node = aNode.parent;
while (node) {
yield node;