bookmarks.search() doesn't work for main folders
Categories
(WebExtensions :: General, defect, P5)
Tracking
(Not tracked)
People
(Reporter: fx4waldi, Unassigned)
Details
The main folders (Bookmarks Toolbar, Bookmarks Menu, Other Bookmarks) cannot be searched using their name. However, using a name from the database (toolbar, menu, unfiled), returns the correct results. The main folder names are generated using PlacesUtils.bookmarks.getLocalizedTitle, but bookmarks.search() only uses names from places.sqlite.
browser.bookmarks.search({title:"Bookmarks Menu"}).then(b=>{ console.log(b); },er=>{ console.error(er); });
Comment 1•5 years ago
|
||
Thanks for the report. It's not exactly clear what we should do here.
We could theoretically hard-code searching matching on localized strings for these 3 specific items, but that seems less than ideal. Should we be returning the localized title for all nodes? It could get messy, so perhaps the best solution is just to document the existing behavior on MDN, and let extensions handle it.
What's your use case exactly? Do you have a suggestion for an approach here?
Comment 2•5 years ago
|
||
Hello,
As per Comment 1, I am waiting for some steps to reproduce to test the issue.
In my extension, a user himself enters a name of a folder from which he wants to import bookmarks. This is probably the only real scenario in which this problem occurs.
In a database in a profile that I use by default, these names are correct and everything works. Names: (toolbar, menu, unfiled) are only used in new profiles.
I think the information in MDN will be the best solution.
Comment 4•5 years ago
|
||
In my extension, a user himself enters a name of a folder from which he wants to import bookmarks. This is probably the only real scenario in which this problem occurs.
Could the extension either use browser.bookmarks.getTree() to retrieve the tree of bookmark folders to show to the user, and then use the id of the related bookmarks folder entry got from browser.bookmarks.getTree() instead of relay of bookmark.search?
Also, the bookmarks API does return the localized titles and so another option would be to special case these few special folders by retrieving their currently localized titles and then adding them to the results the extension got from browser.bookmarks.search if they match the string the user was looking for.
As a side note: internally browser.bookmarks.search is calling the same PlaceUtils internals that are likely used by the "Manage bookmarks" dialog for its search feature, and this makes me wonder: does searching from "Manage bookmarks" have a behavior similar to calling browser.bookmarks.search?
Updated•3 years ago
|
Comment 5•2 years ago
|
||
A needinfo is requested from the reporter, however, the reporter is inactive on Bugzilla. Given that the bug is still UNCONFIRMED, closing the bug as incomplete.
For more information, please visit BugBot documentation.
Description
•