Closed Bug 1351915 Opened 7 years ago Closed 7 years ago

`dedupeSyncBookmark` should fire `onItemChanged` when an item's GUID changes

Categories

(Firefox :: Sync, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: lina, Assigned: eoger)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

`dedupeSyncBookmark` updates the GUID in the database, and calls `invalidateCachedGuidFor`, but doesn't fire `onItemChanged`. This means consumers that cache GUIDs (Web Extensions, for example, via the `chrome.bookmarks` API) might be working with stale ones.
Talking specifically about browser.bookmarks:

Note that the WE API is… optimistic in this regard.

"Each ID is unique within the user's profile and remains unchanged across browser restarts."

and the WE onChanged event is only defined for titles and URLs:

> Fired when there is a change to:
>
> -   the title or URL of a bookmark
> -   the name of a folder.

I'm not sure if this is just our docs or if that restriction is in the spec.
Priority: -- → P2
Assignee: nobody → eoger
Comment on attachment 8858931 [details]
Bug 1351915 - Fire onItemChanged when deduping sync bookmarks.

https://reviewboard.mozilla.org/r/130926/#review133514

Looks great, thanks!

::: toolkit/components/places/PlacesSyncUtils.jsm:1776
(Diff revision 1)
>  
>  var dedupeSyncBookmark = Task.async(function* (db, localGuid, remoteGuid,
>                                                 remoteParentGuid) {
> +  let bookmarkItem = yield PlacesUtils.bookmarks.fetch(localGuid);
>    let rows = yield db.executeCached(`
> -    SELECT b.id, p.guid AS parentGuid, b.syncStatus
> +    SELECT b.id, p.id AS parentId, p.guid AS parentGuid, b.syncStatus

Might as well add `b.type` to the query, too, and remove the `fetch()` call.
Attachment #8858931 - Flags: review?(kit) → review+
Thanks!
Pushed by eoger@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1eceb91e9437
Fire onItemChanged when deduping sync bookmarks. r=kitcambridge
https://hg.mozilla.org/mozilla-central/rev/1eceb91e9437
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: