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
Родитель d398e6a3f7
Коммит 6847f14b74
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;