Closed Bug 1412683 Opened 7 years ago Closed 3 years ago

Bookmark ordering is potentially inconsistent in presence of Sync

Categories

(Firefox for Android Graveyard :: Data Providers, defect, P5)

Firefox 56
defect

Tracking

(firefox57 affected, firefox58 affected, firefox59 affected)

RESOLVED INCOMPLETE
Tracking Status
firefox57 --- affected
firefox58 --- affected
firefox59 --- affected

People

(Reporter: rileyxlesser, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20171024165158

Steps to reproduce:

Added new bookmark using the bookmark buttons.
Using: Firefox version 56.0.
Using: Android 7.1


Actual results:

New entry was added in browser.db with incorrect position value. First new bookmark's value is 0, next new bookmarks position value was -9223372036854775808.


Expected results:

Value should have been current maximum value + 1.
Component: Profile Handling → Data Providers
Yup, that's definitely happening on nightly.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This logic is a bit awkward, and as a result there are some minor UI inconsistencies.

We create bookmarks with a default position of Integer.MIN_VALUE. During a bookmark sync, positions are "normalized" (reset to 0, or to whatever else Sync deems necessary, depending on bookmark reconciliation and other clients).

Without a sync, it doesn't seem to me like we'd reset the position to something other Integer.MIN_VALUE.

Our default sort order for bookmarks is "type ASC, position ASC, _id ASC".

Without sync, for a regular bookmark "type" and "position" will remain constant, so we're really just ordering by "_id ASC".

New bookmarks go to the top of the list, but after all the other "new" bookmarks. Thus for a user that never used sync, they'll see bookmarks appear at the bottom of their bookmarks list.

For a sync user, however, they'll see new bookmarks appear at the top of the bookmarks list, but after any bookmarks that haven't been synced yet.
Summary: New Bookmarks Are Saving As Negative Integers in browser.db → Bookmark ordering is potentially inconsistent in presence of Sync
(In reply to :Grisha Kruglov from comment #2)

> Without a sync, it doesn't seem to me like we'd reset the position to
> something other Integer.MIN_VALUE.

Yes, this was intentional. Even when we added this code (Bug 704490 Comment 39!), Fennec showed bookmarks alphabetically. The position was added for the benefit of Sync (which needs to track folder contents over time), not the frontend.


> For a sync user, however, they'll see new bookmarks appear at the top of the
> bookmarks list, but after any bookmarks that haven't been synced yet.

If you want to change this, the easy option is to ORDER BY … abs(position) ASC …. That will sort all of the new local bookmarks to the end.
Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195

Needinfo :susheel if you think this bug should be re-triaged.
Priority: -- → P5
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: