Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate Firefox Sync?

Firefox 4 comes soon (ok, next year ;)) and there is a Firefox plugin to sync your bookmarks etc. with Firefox 3.whatever .

I would like to know if anyone has a comprehensive, up-to-date tutorial to integrate Firefox Sync into your own plugin? Or any idea regarding this?

I mainly followed this official "tutorial" and also this blog post, but the information seems to be slightly outdated.
For example, the object is not called Weave anymore but Engines and the weave.engines. preference became services.sync.engines.. I played a little with all the mentioned options, but it does not seems to work (and my plugin does not show up in list where you can select what to sync).

I assume that the Tracker and Store classes are fine, the main problem is to register the engine...

like image 780
Felix Kling Avatar asked Nov 14 '10 12:11

Felix Kling


1 Answers

The ClientAPI tutorial you mention is definitely the way to go. I updated it recently so if something's not working, please let us know so I can fix it in the docs. Wladimir's blogpost is definitely quite old and contains some outdated information. We will also make changes to some parts of the API in the upcoming beta releases, so be prepared for some flux...

The Weave namespace is still the canonical way to access Sync related APIs from UI code. It exposes components such as Weave.Service and Weave.Engines. You can import it via Components.utils.import("resource://services-sync/main.js"). If you want to implement your own engine, you'll have to import the actual underlying modules, though (all listed in the ClientAPI tutorial). The tutorial also describes how to register your custom engine implementation. Once it's registered, it won't automatically show up in the preferences UI, though. I suggest building your own UI that flips the services.sync.engine.YOURENGINE pref in your add-on's preferences.

Out of curiosity, what kind of data are you trying to sync?

like image 110
Philipp von Weitershausen Avatar answered Sep 28 '22 08:09

Philipp von Weitershausen