CloudServices/Sync/FxSync/FaviconSync

From MozillaWiki
< CloudServices‎ | Sync‎ | FxSync
Revision as of 22:29, 2 May 2011 by Philikon (talk | contribs)
Jump to navigation Jump to search

Goals

  • Sync favicons for history and bookmarks
  • Don't sync history favicons if only bookmark sync is enabled (viceversa not as problematic)

Proposal

Firefox (places.sqlite)

moz_places
  id
  guid
  url
  favicon_id  -------> foreign key to moz_favicons.id
  ...

moz_historyvisits
  id
  place_id  ------> foreign key to moz_places.id
  visit_date
  ...

moz_bookmarks
  id
  guid
  type
  fk ------> foreign key to moz_places.id
  ...

moz_favicons
  id
  url
  data
  mime_type
  expiration
  guid (NEW)
  lastmodified (NEW?)

Sync

bookmarks
  id (a.k.a. GUID)
  bmkUri
  ...
  faviconGUID (NEW)

history
  id (a.k.a. GUID)
  histUri
  title
  visits
  faviconGUID (NEW)

favicons (NEW)
  id (a.k.a. GUID)
  url
  data
  mime_type
  expiration?

Implementation

  • Implement favicons engine with above data schema.
  • Add faviconGUID property to bookmarks and history engines, it's synced as follows:
  1. Find favicon based on faviconGUID
    a. it exists. Go to 3.
    b. it doesn't exist. Go to 2.
  2. Create empty favicon entry with id and guid.
  3. Refer to favicon id in the moz_places entry.

Questions

  • Is a blank entry in moz_favicons (cf. step 2 above) ok?
  • How should we model the expiration (if at all)?
  • How to access favicon data? Raw SQL r+w? Extend mozIAsyncHistory?
  • How can we be notified when a new favicon is added or an existing one is changed?