-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use storage.sync API to sync preferences across computers #30
Comments
Following a discussion about privacy it would make sense to add an opt-in preferences to enable synchronization preferences across devices. uBlock Origin is an example of that feature. |
When activating "sync feature" the decision has to be made how to handle the initial sync
Since it's entirely possible that Firefox Sync is not yet activated in Firefox or currently not connected when activating "sync feature", I see no reliable way of making sure that (B) will work because in case of conflict the Server always wins - if Firefox Sync got implemented like chrome (couldn't find other info on that) - and in that case it would overwrite what got written from Another edge-case:
|
The current implementation uses "client wins" on synchronization of everything except for crypto keys. Of course, "server wins" and "client wins" are kind of misnomers, because all changes originate from clients. "Server wins" is really more like "first-to-server wins", and "client wins" is more like "last-to-server wins". Anyhow, we use the second of these. All of the above solutions eventually require losing one device's set of preferences in favor of the others. Maybe it's possible to do slightly better and merge the synced data with the data stored locally. For instance, you might use a variant of B where you only migrate from storage.local to storage.sync once per device, probably by storing a flag in storage.local saying "I've already been migrated". To mitigate the concern of race conditions with preference changes being made on two devices separately, I'd recommend only using storage.sync (as you suggest). If you have a preferences panel where you've generated HTML based on preferences, you can add a listener to storage.onChanged to update the HTML when new preferences come in. |
Good to know, thanks for the explanation!
Yeah, I guess that's why e.g. uBlock really just provides a separate "Import / Export Interface" with enabled cloud-syncing. Nothing happens automatically. Losing preferences without you knowing why is like the worst UX that possibly can happen. So I'm personally also in favour of only providing an additional interface to "Import / Export" preferences to avoid that under any circumstances. That requires more work, of course, but I feel like it's the right thing to do.
Ah, didn't know about this one, that could come in handy for that case, yeah. |
Closing, since making this a good implementation would require a fair amount of work, for imho not enough value in return. A workaround is using the Export/Import introduced in #86. I'd be open for a PR though, if someone wants to tackle it. |
Starting with v1.0beta7 it's possible to export/import to/from Firefox Sync. |
Today I switched computer and Temporary Containers was automatically installed in the new computer (thanks to Sync) but I was a bit puzzle to see that my preferences (Automatic Mode off) was not taken into account.
The text was updated successfully, but these errors were encountered: