Attempting to access the childCount property of an nsINavHistoryContainerResultNode instance throws NS_ERROR_NOT_AVAILABLE if the object's containerOpen property is false. This may be deliberate, in which case the docs on childCount should be updated to reflect this. Otherwise, some typical error value like -1 might be appropriate? To recreate: var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"] .getService(Components.interfaces.nsINavHistoryService); var options = historyService.getNewQueryOptions(); var query = historyService.getNewQuery(); query.domain = "foo"; var result = historyService.executeQuery(query, options); //result.root.containerOpen = true; alert(result.root.childCount);
Created attachment 261079 [details] [diff] [review] Add @throws line for childCount As discussed - the behaviour is correct as is, it's the documentation that is lacking.
Created attachment 261081 [details] [diff] [review] Whoops - last one was an ugly diff
Comment on attachment 261081 [details] [diff] [review] Whoops - last one was an ugly diff >Index: nsINavHistoryService.idl >=================================================================== >RCS file: /cvsroot/mozilla/toolkit/components/places/public/nsINavHistoryService.idl,v >retrieving revision 1.53 >diff -u -8 -r1.53 nsINavHistoryService.idl >--- nsINavHistoryService.idl 28 Mar 2007 00:28:34 -0000 1.53 >+++ nsINavHistoryService.idl 9 Apr 2007 23:35:55 -0000 >@@ -240,16 +240,18 @@ > * to a tree item. > */ > readonly attribute boolean hasChildren; > > /** > * This gives you the children of the nodes. It is preferrable to use this > * interface over the array one, since it avoids creating an nsIArray object > * and the interface is already the correct type. >+ * >+ * @throws NS_ERROR_NOT_AVAILABLE if containerOpen is false. > */ > readonly attribute PRUint32 childCount; > nsINavHistoryResultNode getChild(in PRUint32 index); > > /** > * Returns false if this node's list of children can be modified > * (adding or removing children, or reordering children), or true if > * the UI should not allow the list of children to be modified.
Oops mozilla/toolkit/components/places/public/nsINavHistoryService.idl 1.54
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv