Closed Bug 753289 Opened 12 years ago Closed 9 years ago

Sync overwrites option added manually to the services.sync.prefs. when adding new sync client

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Iteration:
43.3 - Sep 21
Tracking Status
firefox43 --- fixed

People

(Reporter: jan.dechent, Assigned: tabmix.onemen, Mentored)

References

Details

(Whiteboard: [sync:preferences][sync:rigor][sync:scale][good first bug][lang=js])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0
Build ID: 20120501201020

Steps to reproduce:

Added manually some options to be synced across different firefoxes

Added to about:config on client A:
services.sync.prefs.sync.browser.sessionstore.privacy_level = true
services.sync.prefs.sync.browser.sessionstore.privacy_level_deferred = true
browser.sessionstore.privacy_level = 2
browser.sessionstore.privacy_level_deferred =2
Then added new synclilent on different PC (same ff version)


Actual results:

Firefox sync the option what will be synced, but overwirtes the option itself:

services.sync.prefs.sync.browser.sessionstore.privacy_level = true
services.sync.prefs.sync.browser.sessionstore.privacy_level_deferred = true
browser.sessionstore.privacy_level = default
browser.sessionstore.privacy_level_deferred = default


Expected results:

firefox should sync the options correctly:
browser.sessionstore.privacy_level = 2
browser.sessionstore.privacy_level_deferred = 2
This bug makes it sound like preferences sync is broken. We should probably try to reproduce this...
Component: Untriaged → Firefox Sync: Backend
Keywords: qawanted
Product: Firefox → Mozilla Services
QA Contact: untriaged → sync-backend
Version: 13 Branch → unspecified
I want to re-report this bug since I installed firefox 13 on a mac today and connected my sync account. The same as stated above happens...
Perhaps my user profile is damaged. Can anyone reproduce this error?
Still buggy in 14.0.1
questions: is it necessary to restart after adding and setting new prefs?
If so, was that done before you added client B to the Sync account?
Whiteboard: [sync:preferences]
Blocks: 745408
Whiteboard: [sync:preferences] → [sync:preferences][sync:rigor][sync:scale]
More STR:

https://discourse.mozilla-community.org/t/how-to-sync-preferences-of-a-bootstrapped-extension-via-sync/3024
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86_64 → All
The problem is that the preferences save in the server not sorted
sync.extensions.foo.xxx is saved before services.sync.prefs.sync.extensions.foo.xxx

when the pref engine import the saved record on new device that don't have both sync.extensions.foo.xxx and services.sync.prefs.sync.extensions.foo.xxx, it import sync.extensions.foo.xxx first so PrefStore.prototype._isSynced return false.

The fix for this issue is to sort the imported record with services.sync.prefs.sync. preferences before other preferences.
That seems like a legitimate fix to me.
Mentor: markh, rnewman
Keywords: qawanted
Whiteboard: [sync:preferences][sync:rigor][sync:scale] → [sync:preferences][sync:rigor][sync:scale][good first bug][lang=js]
This patch fix this bug.
Attachment #8654635 - Flags: review?(rnewman)
Comment on attachment 8654635 [details] [diff] [review]
Update 'services.sync.prefs.sync' preferences first

Review of attachment 8654635 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with that change.

::: services/sync/modules/engines/prefs.js
@@ +89,5 @@
>                        .getBranch(WEAVE_SYNC_PREFS)
>                        .getChildList("", {});
>      // Also sync preferences that determine which prefs get synced.
> +    let weavePrefs = syncPrefs.map(function (pref) { return WEAVE_SYNC_PREFS + pref; });
> +    return weavePrefs.concat(syncPrefs);

Remove these changes; it doesn't look like they do anything, and we don't want to reintroduce uses of 'weave'.

@@ +114,5 @@
>      let selectedThemeIDBefore = this._prefs.get(selectedThemeIDPref, null);
>  
> +    // Update 'services.sync.prefs.sync.foo.pref' before 'foo.pref' otherwise
> +    // _isSynced return false when 'foo.pref' doesn't exist in a new device.
> +    let prefs = Object.keys(values).sort(a => -a.indexOf(WEAVE_SYNC_PREFS));

We only want to bother searching at the start of the string, so I think this is what we want:

  .sort(a => !a.startsWith(WEAVE_SYNC_PREFS));
Attachment #8654635 - Flags: review?(rnewman) → review+
Do you need me to land this?
Assignee: nobody → tabmix.onemen
Status: NEW → ASSIGNED
Flags: needinfo?(tabmix.onemen)
Thank you Richard,

Please land this patch, I'm away until September 20.
I applied my nits and some other cleanup; waiting for try to open. Will land. Thanks!
Flags: needinfo?(tabmix.onemen) → needinfo?(rnewman)
url:        https://hg.mozilla.org/integration/fx-team/rev/4378a00214c5b591c4c4dce77e03a87619539f64
changeset:  4378a00214c5b591c4c4dce77e03a87619539f64
user:       Richard Newman <rnewman@mozilla.com>
date:       Thu Sep 10 17:33:50 2015 +0100
description:
Bug 753289 - Pre: rename WEAVE_SYNC_PREFS to PREF_SYNC_PREFS_PREFIX.

url:        https://hg.mozilla.org/integration/fx-team/rev/06f396c07ac9ae10158eec2834faf4d5febbb167
changeset:  06f396c07ac9ae10158eec2834faf4d5febbb167
user:       onemen <tabmix.onemen@gmail.com>
date:       Thu Sep 10 17:33:50 2015 +0100
description:
Bug 753289 - Apply prefs-related prefs before applying other synced prefs. r=rnewman
Flags: needinfo?(rnewman)
Iteration: --- → 43.3 - Sep 21
Flags: firefox-backlog+
blocking-b2g: 2.2? → ---
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: