Consider adding bookmarks API method to get ID of standard/common folders

Assigned to



WebExtensions: Untriaged
10 months ago
8 months ago


(Reporter: sheppy, Assigned: kmag)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [bookmarks]triaged)



10 months ago
There are certain folders which are fairly common among browsers which would be helpful to be able to quickly get access to. This could be done with properties, such as: bookmarks.unfiledFolder or bookmarks.toolbarFolder, or using a method, like bookmarks.getToolbarFolder() or bookmarks.getStandardFolder(foldername) where foldername is a special identifier like "toolbar", "unfiled", or "recents".

If the identifiers of common folders are standardized in some way, this would allow extensions to find these special folders easily regardless of which browser they're on.

For example, I could then bookmark MDN into the bookmarks toolbar like this:

  parentId: chrome.bookmarks.getToolbarFolder(),
  title: "MDN",

This provides for cleaner, simpler code in the extension than having to query for the folder, especially since you don't necessarily know its name. This code would "just work" (assuming we can convince others to go along with the addition of a feature like this).


10 months ago
Whiteboard: [bookmarks][design decision needed]
Assignee: nobody → kmaglione+bmo

Comment 1

10 months ago
FWIW, as someone who documents a lot of APIs, I feel like the most consistent solution would be a bookmarks.getStandardFolder() method which would then take a simple string ID to determine which folder to retrieve: "root", "toolbar", "menu", "unfiled", "remote", "local", and so forth. This would be the most flexible, probably, too, since it would be relatively quick to add more, and would discourage every browser outfit from adding new methods for all their unusual or special bookmark folders; they could just add them to the ones supported by getStandardFolder().
I was planning to just add constants.


10 months ago
Whiteboard: [bookmarks][design decision needed] → [bookmarks]triaged

Comment 3

8 months ago
This API discussed in this bug is, sadly, absent from Blink.  In my Chrome and Opera extensions, I get these folders from their position in the root tree, which I have reverse-engineered.

A proper API, such as proposed here, would be wonderful.
You need to log in before you can comment on or make changes to this bug.