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

NEW
Assigned to

Status

()

Toolkit
WebExtensions: Untriaged
9 months ago
6 months ago

People

(Reporter: sheppy, Assigned: kmag)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [bookmarks]triaged)

(Reporter)

Description

9 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:

chrome.bookmarks.create({
  parentId: chrome.bookmarks.getToolbarFolder(),
  title: "MDN",
  "https://developer.mozilla.org/"
});

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).

Updated

9 months ago
Whiteboard: [bookmarks][design decision needed]
(Assignee)

Updated

9 months ago
Assignee: nobody → kmaglione+bmo
(Reporter)

Comment 1

9 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().
(Assignee)

Comment 2

8 months ago
I was planning to just add constants.

Updated

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

Comment 3

6 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.