var bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(Ci.nsINavBookmarksService);
var history = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
var query = history.getNewQuery();
query.setFolders([ bookmarks.bookmarksMenuFolder ], 1);
query.searchTerms = "developer";
var options = history.getNewQueryOptions();
options.excludeQueries = true;
options.queryType = Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
var result = history.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
for(var i = 0; i < root.childCount; i++) {
log(root.getChild(i).title);
}
root.containerOpen = false;Well actually it did work with FUEL but I'm still trying to figure out how to read the results returned.
var query = Application.bookmarks.menu.newQuery();
query.searchTerms = "developer";
var result = query.execute();
var root = result.root;
for(var i = 0; i < result.length; i++) {
var x = result[i];
log(x);
}Here the log prints out object, which is supposed to be an object of fuelIBookmark but it breaks when I try to log(x.title)

2 comments:
Do you have to cast it to a fuelIBookmark type?
Maybe something like
log(fuelIBookmark(x).title)
No, because execute() returns an array that contains objects of type fuelIBookmark or fuelIBookmarkFolder depending on what is fetched. See the bug, link is on the right, for a patch if you want
Post a Comment