Closed Bug 1380215 Opened 7 years ago Closed 7 years ago

Remote device disconnection doesn't fully reset sync if sync is yet to initialize

Categories

(Firefox :: Sync, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: markh, Assigned: markh)

Details

Attachments

(1 file)

tl;dr - disconnecting a desktop device via "device manager" should behave the same as if the user clicked "Disconnect" on that device. STR: * From one profile, disconnect some other desktop profile. * Start the disconnected profile. Notice there is a notification shown telling you the device has been disconnected, and about:prefs and the hamburger menu all correctly reflect the reset. * However, visit about:config and look for services.sync preferences. Expected: * All preferences should be at their default values, just like when you manually click the "disconnect" button. Actual: * All prefs have the old values, including the old GUIDs, the timestamps from the last sync etc. In theory, this should be as simple as having sync listen for ON_DEVICE_DISCONNECTED_NOTIFICATION, but in practice it seems likely that sync isn't going to have setup the listeners in time for this.
Does startOver() reset those prefs? Here's one of the listeners of ONLOGOUT_NOTIFICATION (which is fired by FxAccounts#signOut): http://searchfox.org/mozilla-central/source/services/sync/modules/browserid_identity.js#295
(In reply to Edouard Oger [:eoger] from comment #1) > Does startOver() reset those prefs? Yep - that's the call we need to make. > Here's one of the listeners of ONLOGOUT_NOTIFICATION (which is fired by > FxAccounts#signOut): > http://searchfox.org/mozilla-central/source/services/sync/modules/ > browserid_identity.js#295 Hrm, right, thanks - so I suspect the problem is simply that browserid_identity hasn't been loaded when this push comes in. IOW, I suspect things will work correctly if the profile is already running when it is disconnected, but doesn't when the push comes in those first 10 seconds of the profile starting.
Priority: -- → P3
FWIW, I believe the same problem exists here if we detect account deletion at startup - either via push, or a 401 attempting to fetch the profile, after which we check if the account exists - if sync hasn't been initialized the wrong thing happens.
Priority: P3 → P2
Priority: P2 → P3
Summary: Remote device disconnection doesn't fully reset sync → Remote device disconnection doesn't fully reset sync if sync is yet to initialize
Assignee: nobody → markh
Comment on attachment 8934372 [details] Bug 1380215 - FxA now ensures Sync is loaded before sending observer notifications. https://reviewboard.mozilla.org/r/205296/#review211082 Thanks! ::: services/fxaccounts/FxAccounts.jsm:88 (Diff revision 1) > > +// A poor-man's "registry" of promise-returning functions to call before we > +// send observer notifications. Primarily used so parts of Firefox which are > +// yet to load for performance reasons can be force-loaded and thus not miss > +// the notification. > +const OBSERVER_PRELOADS = [ As we discussed on IRC, I'm not sure we will add anything else to that array for some time, but I don't care that much if you prefer to keep this.
Attachment #8934372 - Flags: review?(eoger) → review+
Pushed by mhammond@skippinet.com.au: https://hg.mozilla.org/integration/autoland/rev/1400ddefec6c FxA now ensures Sync is loaded before sending observer notifications. r=eoger
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: