Closed Bug 1305285 Opened 8 years ago Closed 8 years ago

tags missing from bookmarks retrieved from places/bookmarks

Categories

(Add-on SDK Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mic.grosse, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160923225245

Steps to reproduce:

1. Add a tag to a bookmark, e.g. the tag 'ff' to the standard bookmark "About Us" (https://www.mozilla.org/en-US/about/)
2. retrieve the bookmarks with places/bookmarks api:
let { search } = require("sdk/places/bookmarks");
search({
  query: "ff"
}).on("end", function (results) {
  console.log(results);
});


Actual results:

Array [{"title":"About Us","url":"https://www.mozilla.org/en-US/about/","tags":{},"id":11,"group":{"title":"Mozilla Firefox","id":7,"group":{"title":"MENU","id":2},"index":2,"updated":1474789260040000},"index":3,"updated":1474789260041000}]


Expected results:

Array [{"title":"About Us","url":"https://www.mozilla.org/en-US/about/","tags":{"ff":{"some":"stuff"}},"id":11,"group":{"title":"Mozilla Firefox","id":7,"group":{"title":"MENU","id":2},"index":2,"updated":1474789260040000},"index":3,"updated":1474789260041000}]

ther should be something in the tag-field of the returned bookmarks
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Turns out this was my mistake. Sorry for the noise.

If anyone finds this and wonders what the solution was:
Firefox returns the tags of the bookmarks as a Set (see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set ). The privileged code understands that, however a sidebar, which is in fact a webpage, doesn't.

So the solution was to expand the tags back into an array:
```javascript
const fixedBookmarks = bookmarks.map(bookmark => {bookmark.tags = [...bookmark.tags]; return bookmark;});
```
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.