Closed Bug 1607341 Opened 6 years ago Closed 5 years ago

browser.bookmarks.onChanged event has datedAdded 1000x too high

Categories

(Firefox :: Sync, defect)

71 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: cal, Assigned: lina)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0

Steps to reproduce:

Bookmark a web page on Firefox mobile. Then wait (or force) synchronisation to desktop browser via Firefox Sync.

Actual results:

The "dateAdded" field in the event (supposed to be milliseconds since epoch) is 1000 times too high.

Expected results:

The "dateAdded" field should be in the correct number of milliseconds since epoch.

I think this problem only applies to bookmarks synced from mobile Firefox.

If you then look up the bookmark id using await browser.bookmarks.get(browserId) the dateAdded field is correct.

Summary: browser.bookmarks.onChanged event has datedAdded 1000x too high when the event pertains to a bookmark synced from firefox mobile → browser.bookmarks.onChanged event has datedAdded 1000x too high

No, doesn't seem to be related to mobile firefox - applies when syncing a bookmark from desktop -> desktop too

I wonder if this is a 2020 date bug related issue?

Component: Untriaged → Server: Sync
Product: Firefox → Cloud Services

Moving to Firefox Sync, as I suspect this is more a client side rather than server side. iirc, places stores bookmarks in microseconds, whereas they are generally handled in milliseconds, so I suspect there's a conversion wrong somewhere.

Component: Server: Sync → Sync
Product: Cloud Services → Firefox

I think this is us passing the wrong argument to PlacesBookmarkAddition hereb.dateAdded is in microseconds here, but PlacesBookmarkAddition expects dateAdded to be in milliseconds.

(As part of this bug, I think we should also rename those temp table columns to dateAddedMicroseconds, like we do for itemsToApply, because this isn't the first time we've run into unit confusion 😅)

Assignee: nobody → lina
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

The legacy nsINavBookmarkObserver notifications use microsecond
timestamps that are rounded to the nearest millisecond, while the
new bookmark-added Places event uses milliseconds directly. This
commit fixes that, and also changes the store to use the given
localTimeSeconds as the current time, instead of querying the
current system time. This, in turn, lets tests set deterministic
last modified times, which is useful for comparing lastModified
timestamps.

Pushed by kcambridge@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb57df7ef0c2 Ensure the bookmarks mirror passes millisecond timestamps for `bookmark-added`. r=LougeniaBailey

Oops, sorry about that! 😬 The last-minute "oh, surely this one-line change will be fine" was not, in fact, fine.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=0cbc7f7d88bbbbd3971be5d50e621220eda2960a

Flags: needinfo?(lina)
Pushed by kcambridge@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/81f6e3c67aa8 Ensure the bookmarks mirror passes millisecond timestamps for `bookmark-added`. r=LougeniaBailey
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: