CloudServices/Sync/FxSync/FaviconSync: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
= Firefox (places.sqlite) =
= 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) ==
<pre>
<pre>
moz_places
moz_places
   id
   id
   guid
   guid
   url
   url
   favicon_id  -------> foreign key to moz_favicons.id
   favicon_id  -------&gt; foreign key to moz_favicons.id
   ...
   ...


moz_historyvisits
moz_historyvisits
   id
   id
   place_id  ------> foreign key to moz_places.id
   place_id  ------&gt; foreign key to moz_places.id
   visit_date
   visit_date
   ...
   ...
Line 20: Line 25:
   guid
   guid
   type
   type
   fk ------> foreign key to moz_places.id
   fk ------&gt; foreign key to moz_places.id
   ...
   ...


Line 31: Line 36:
   guid (NEW)
   guid (NEW)
   lastmodified (NEW?)
   lastmodified (NEW?)
</pre>


<pre>
== Sync ==
 
= Sync =


<pre>
<pre>
Line 56: Line 60:
   mime_type
   mime_type
   expiration?
   expiration?
</pre>
</pre>  


== Proposal ==
== Implementation ==


*Implement <code>favicons</code> engine with above data schema.  
*Implement <code>favicons</code> engine with above data schema.  
*Add <code>faviconGUID</code> property to bookmarks and history engines, it's synced as follows:
*Add <code>faviconGUID</code> property to bookmarks and history engines, it's synced as follows:


#Find favicon based on <code>faviconGUID</code><br>a. it exists. Go to 3.<br>b. it doesn't exist. Go to 2.
#Find favicon based on <code>faviconGUID</code><br>a. it exists. Go to 3.<br>b. it doesn't exist. Go to 2.  
#Create empty favicon entry with <code>id</code> and <code>guid</code>.
#Create empty favicon entry with <code>id</code> and <code>guid</code>.  
#Refer to favicon id in the <code>moz_places</code> entry.
#Refer to favicon id in the <code>moz_places</code> entry.


= Questions =
== Questions ==


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

Revision as of 22:29, 2 May 2011

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?