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
Родитель a7190024ff
Коммит f59aa320bc
4 изменённых файлов: 12 добавлений и 11 удалений

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

@ -139,7 +139,7 @@ PlacesController.prototype = {
return false;
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) {
var child = contents.getChild(i);
if (PlacesUtils.nodeIsURI(child))
@ -894,7 +894,7 @@ PlacesController.prototype = {
// Open each uri in the folder in a tab.
var index = firstIndex;
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) {
var child = contents.getChild(i);
if (PlacesUtils.nodeIsURI(child))
@ -1874,7 +1874,7 @@ PlacesRemoveFolderTransaction.prototype = {
*/
_saveFolderContents: function PRFT__saveFolderContents() {
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"].
getService(Ci.nsIIOService);
for (var i = 0; i < contents.childCount; ++i) {
@ -2235,7 +2235,7 @@ PlacesSortFolderByNameTransaction.prototype = {
doTransaction: function PSSFBN_doTransaction() {
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;
// sort between separators

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

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

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

@ -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
* The folder to open
* @param [optional] excludeItems
@ -719,8 +719,8 @@ var PlacesUtils = {
* 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
* be true.
* @returns A HistoryContainerResultNode containing the contents of the
* folder. This container is guaranteed to be open.
* @returns A nsINavHistoryResult containing the contents of the
* folder. The result.root is guaranteed to be open.
*/
getFolderContents:
function PU_getFolderContents(aFolderId, aExcludeItems, aExpandQueries) {
@ -733,7 +733,8 @@ var PlacesUtils = {
var result = this.history.executeQuery(query, options);
result.root.containerOpen = true;
return asContainer(result.root);
asContainer(result.root);
return result;
},
/**

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

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