bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

tags missing from bookmarks retrieved from places/bookmarks

RESOLVED INVALID

Status

Add-on SDK
General
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: mic.grosse, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
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
(Reporter)

Updated

2 years ago
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
(Reporter)

Comment 1

2 years ago
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
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.