Firefox Addon bookmarks group (subfolder) search: discriminating between bookmarks and groups

I’m trying to make my first firefox addon.
For this I want to get all the groups directly under the TOOLBAR group.
I started here, but didn’t manage to discriminate between groups and bookmarks.
Here is the relevant part of my code:

var { search, TOOLBAR } = require("sdk/places/bookmarks");
    { group: TOOLBAR, type: "group" },
    { sort: "title" }
).on("end", function (results) {
    var arrayLength = results.length;
    for (var i = 0; i < arrayLength; i++) {
        //Do something

I would be interested in how to do this using the linked API.
If this wouldn’t work for some reason, I would also be interested in workarounds, older methods, more complicated or direct methods. In this case, please direct me to information that is roocky-proof 🙂

Source: bookmarks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.