Services/Sync/WEP/108
Contents
WEP 108 - Preference Sync
- Champions: Anant Narayanan <anant at mozilla dot com>
- Status: Draft
- Created: 05 Sep 2009
- Reference Implementation: None
- WEP Index
Introduction
We already support synchronization of Firefox preferences, but all preferences are synchronized as a single WBO with a fixed GUID. This method doesn't achieve expected results because whenever there is a conflict between even a single local preference value and a remote value, all synchronized preferences are replaced by the current local values (as per the default sync engine's "client wins" conflict resolution policy).
Scope for Improvement
Split preferences into groups of WBOs
We don't store each preference as a single WBO because of the size and performance overhead involved. However, in order to reduce the chances that a conflict will result in a large number of preferences being set to undesirable values, we may split preferences into groups of WBOs instead of storing them in one giant object.
This may be achieved by using Firefox preference branches: all preferences with a given prefix will be stored in a single WBO. The GUID of the object will be equal to the base of the preference branch, i.e. the prefix.
There can be two types of preferences under the extensions.weave.prefs.sync branch: boolean and string.
Any boolean preference under that branch indicates that the entire branch is to be synchronized. For example, setting extensions.weave.prefs.sync.browser to true will result in one WBO with GUID browser containing all values under the browser.* preference branch.
A string preference, on the other hand, indicates that only the specified (comma-separated) subset of values in that preference branch are to be synchronized. For example, setting extensions.weave.prefs.sync.browser to 'download.manager.scanWhenDone,search.openintab,search.selectedEngine' will create a WBO with GUID browser containing only the preference values browser.download.manager.scanWhenDone, browser.search.openintab, and browser.search.selectedEngine.
Intelligently detect default values
Consider the case of somebody setting up Weave for the first time on a new computer with an existing account. As all preferences have default values at this stage, the sync engine detects a conflict and applies local values to the single WBO which then propagates to all other clients.
This problem is especially noticeable while using Personas, as the "default" (currently, Groovy Blue!) persona is selected on all clients whenever a new client is added to a user's account.
This problem is harder to solve because we can never know if the default value is what the user wants / is the latest correct value. One approach is to assume that if the remote WBO contains a non-default value for a preference, but the local value is equal to the default, we apply the remote value locally all the time.