From 6c55a1679c9794ce9e15ed27831d99866ca1069c Mon Sep 17 00:00:00 2001 From: "mozilla.mano%sent.com" Date: Sun, 13 Jan 2008 04:03:22 +0000 Subject: [PATCH] Bug 411803 - Middle-clicking a folder doesn't work, unless the bookmark items have been shown. r=dietrich. --- browser/components/places/content/utils.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/browser/components/places/content/utils.js b/browser/components/places/content/utils.js index 7653688db0c..0e2dddeb45b 100644 --- a/browser/components/places/content/utils.js +++ b/browser/components/places/content/utils.js @@ -1604,26 +1604,35 @@ var PlacesUtils = { } } else { - let result, oldViewer; + let result, oldViewer, wasOpen; try { let wasOpen = aNode.containerOpen; + result = aNode.parentResult; + oldViewer = result.viewer; if (!wasOpen) { - result = aNode.parentResult; - oldViewer = result.viewer; result.viewer = null; aNode.containerOpen = true; } for (let i = 0; i < aNode.childCount; ++i) { // Include visible url nodes only let child = aNode.getChild(i); - if (child.viewIndex != -1 && this.nodeIsURI(child)) - urls.push({uri: child.uri, isBookmark: this.nodeIsBookmark(child)}); + if (this.nodeIsURI(child)) { + // If the node contents is visible, add the uri only if its node is + // visible. Otherwise follow viewer's collapseDuplicates property, + // default to true + if ((wasOpen && oldViewer && child.viewIndex != -1) || + (oldViewer && !oldViewer.collapseDuplicates) || + urls.indexOf(child.uri) == -1) { + urls.push({ uri: child.uri, + isBookmark: this.nodeIsBookmark(child) }); + } + } } if (!wasOpen) aNode.containerOpen = false; } finally { - if (oldViewer) + if (!wasOpen) result.viewer = oldViewer; } }