code cleanup for bug #387203: getFolderContents() returns the root result node instead of the result itself.

r=mano
This commit is contained in:
sspitzer@mozilla.org 2007-07-11 18:18:20 -07:00
parent a7190024ff
commit f59aa320bc
4 changed files with 12 additions and 11 deletions

View File

@ -139,7 +139,7 @@ PlacesController.prototype = {
return false; return false;
if (this._view.hasSingleSelection && PlacesUtils.nodeIsFolder(node)) { if (this._view.hasSingleSelection && PlacesUtils.nodeIsFolder(node)) {
var contents = PlacesUtils.getFolderContents(node.itemId, false, false); var contents = PlacesUtils.getFolderContents(node.itemId, false, false).root;
for (var i = 0; i < contents.childCount; ++i) { for (var i = 0; i < contents.childCount; ++i) {
var child = contents.getChild(i); var child = contents.getChild(i);
if (PlacesUtils.nodeIsURI(child)) if (PlacesUtils.nodeIsURI(child))
@ -894,7 +894,7 @@ PlacesController.prototype = {
// Open each uri in the folder in a tab. // Open each uri in the folder in a tab.
var index = firstIndex; var index = firstIndex;
var urlsToOpen = []; var urlsToOpen = [];
var contents = PlacesUtils.getFolderContents(node.itemId, false, false); var contents = PlacesUtils.getFolderContents(node.itemId, false, false).root;
for (var i = 0; i < contents.childCount; ++i) { for (var i = 0; i < contents.childCount; ++i) {
var child = contents.getChild(i); var child = contents.getChild(i);
if (PlacesUtils.nodeIsURI(child)) if (PlacesUtils.nodeIsURI(child))
@ -1874,7 +1874,7 @@ PlacesRemoveFolderTransaction.prototype = {
*/ */
_saveFolderContents: function PRFT__saveFolderContents() { _saveFolderContents: function PRFT__saveFolderContents() {
this._transactions = []; this._transactions = [];
var contents = this.utils.getFolderContents(this._id, false, false); var contents = this.utils.getFolderContents(this._id, false, false).root;
var ios = Cc["@mozilla.org/network/io-service;1"]. var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService); getService(Ci.nsIIOService);
for (var i = 0; i < contents.childCount; ++i) { for (var i = 0; i < contents.childCount; ++i) {
@ -2235,7 +2235,7 @@ PlacesSortFolderByNameTransaction.prototype = {
doTransaction: function PSSFBN_doTransaction() { doTransaction: function PSSFBN_doTransaction() {
this._oldOrder = []; this._oldOrder = [];
var contents = this.utils.getFolderContents(this._folderId, false, false); var contents = this.utils.getFolderContents(this._folderId, false, false).root;
var count = contents.childCount; var count = contents.childCount;
// sort between separators // sort between separators

View File

@ -319,7 +319,7 @@ var PlacesOrganizer = {
if (selectedNode) { if (selectedNode) {
if (PlacesUtils.nodeIsFolder(selectedNode)) { if (PlacesUtils.nodeIsFolder(selectedNode)) {
var childsCount = var childsCount =
PlacesUtils.getFolderContents(selectedNode.itemId).childCount; PlacesUtils.getFolderContents(selectedNode.itemId).root.childCount;
statusText = PlacesUtils.getFormattedString("status_foldercount", statusText = PlacesUtils.getFormattedString("status_foldercount",
[childsCount]); [childsCount]);
} }

View File

@ -709,7 +709,7 @@ var PlacesUtils = {
}, },
/** /**
* Generates a HistoryResultNode for the contents of a folder. * Generates a nsINavHistoryResult for the contents of a folder.
* @param folderId * @param folderId
* The folder to open * The folder to open
* @param [optional] excludeItems * @param [optional] excludeItems
@ -719,8 +719,8 @@ var PlacesUtils = {
* True to make query items expand as new containers. For managing, * True to make query items expand as new containers. For managing,
* you want this to be false, for menus and such, you want this to * you want this to be false, for menus and such, you want this to
* be true. * be true.
* @returns A HistoryContainerResultNode containing the contents of the * @returns A nsINavHistoryResult containing the contents of the
* folder. This container is guaranteed to be open. * folder. The result.root is guaranteed to be open.
*/ */
getFolderContents: getFolderContents:
function PU_getFolderContents(aFolderId, aExcludeItems, aExpandQueries) { function PU_getFolderContents(aFolderId, aExcludeItems, aExpandQueries) {
@ -733,7 +733,8 @@ var PlacesUtils = {
var result = this.history.executeQuery(query, options); var result = this.history.executeQuery(query, options);
result.root.containerOpen = true; result.root.containerOpen = true;
return asContainer(result.root); asContainer(result.root);
return result;
}, },
/** /**

View File

@ -91,7 +91,7 @@ var SelectBookmarkDialog = {
var names = []; var names = [];
var selectedNode = bookmarks.selectedNode; var selectedNode = bookmarks.selectedNode;
if (PlacesUtils.nodeIsFolder(selectedNode)) { if (PlacesUtils.nodeIsFolder(selectedNode)) {
var contents = PlacesUtils.getFolderContents(selectedNode.itemId); var contents = PlacesUtils.getFolderContents(selectedNode.itemId).root;
var cc = contents.childCount; var cc = contents.childCount;
for (var i = 0; i < cc; ++i) { for (var i = 0; i < cc; ++i) {
var node = contents.getChild(i); var node = contents.getChild(i);