Problem with 'index' property of bookmarks while creating new bookmarks using Firefox WebExtensions API
Categories
(WebExtensions :: Frontend, defect, P3)
Tracking
(Not tracked)
People
(Reporter: sdjoshi, Unassigned)
Details
Attachments
(1 file)
|
469 bytes,
text/javascript
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
While creating new bookmarks in Firefox using the bookmarks.create() API from Firefox WebExtensions API, the order in which the new, created bookmarks/sub-folders are placed in the parent folder (controlled by the 'index' property of the bookmark) is incorrect.
Actual results:
In case these are no bookmarks/sub-folders in the parent folder, then the 'index' property for all the newly created bookmarks is set to 0 by the API.
In case, there are 5 existing bookmarks in the parent folder, for example, then the 'index' property for the first 5 newly created bookmarks is set correctly - lets say as 0 to 4 as per in the input data. The 'index' property for all subsequent bookmarks after no. 5 is again set as 0.
Expected results:
Ideally, the index property for each bookmark should be set correctly right from the first time this code is run. However, the index property is set incorrectly for the first run-through and then set correctly for the second run-through.
First run-through - Output: 'index' is set incorrectly as 0 for all bookmarks -
calling browser.bookmarks.create popup_v2.js:496:13
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "Jcr-x-lF8PYy", title: "testName", index: 0, dateAdded: 1561620807650, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "8ljfDMuh-o-q", title: "testName", index: 0, dateAdded: 1561620807651, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "gofKPh9HNGBc", title: "testName", index: 0, dateAdded: 1561620807651, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "5DlcwJ2SvhHF", title: "testName", index: 0, dateAdded: 1561620807652, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "AvsjIgR5Gdcs", title: "testName", index: 0, dateAdded: 1561620807653, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Second run-through, immediately after the first set of 5 bookmarks have been created - Output: 'index' is set correctly as 0-4 for the 5 bookmarks -
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "9LBw0vByVxqG", title: "testName", index: 0, dateAdded: 1561620820045, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "G69Ojwtrvdcj", title: "testName", index: 1, dateAdded: 1561620820047, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "4BwXhyQghwYa", title: "testName", index: 2, dateAdded: 1561620820048, type: "bookmark", url: "http://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "z88JWTZXHlZD", title: "testName", index: 3, dateAdded: 1561620820048, type: "bookmark", url: "htt [changed for SO guidelines]p://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Inside testOnCreatedBookmark popup_v2.js:477:11
Object { id: "09NMoLidnLvl", title: "testName", index: 4, dateAdded: 1561620820049, type: "bookmark", url: "htt [changed for SO guidelines] p://testurl/", parentId: "toolbar_____" }
popup_v2.js:478:11
Updated•6 years ago
|
I have logged a similar bug relating to event properties for the onRemoved and onMoved events. As such I noticed this issue and thought to test it in the latest beta (as the onRemoved event issues are resolved in the beta), and I can confirm this is still an issue in v69.0b5 (20190715173502).
Updated•6 years ago
|
Updated•3 years ago
|
Description
•