Skip to content

Instantly share code, notes, and snippets.

@cers
Created October 14, 2009 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cers/210265 to your computer and use it in GitHub Desktop.
Save cers/210265 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
names: ["bmtest"],
preview: function preview(pblock) {
pblock.innerHTML = "";
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();
var bookmarkService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(Components.interfaces.nsINavBookmarksService);
query.setFolders([bookmarkService.toolbarFolder], 1);
var result = historyService.executeQuery(query, options);
var {root} = result;
root.containerOpen = true;
for (var i = 0; i < root.childCount; i ++) {
var node = root.getChild(i);
pblock.innerHTML += node.title + "<br />";
}
root.containerOpen = false;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment