Bug 534218 - Changing sync direction from outdated clients loses client/server data [r=mconnor]

Check remoteSetup first to determine if we're okay to sync before wiping client/remote. Additionally only wipe enabled engines instead of everything.
This commit is contained in:
Edward Lee 2010-04-14 15:00:29 -07:00
parent a0b39324a1
commit 74ee9ca0f3

View File

@ -1146,17 +1146,6 @@ WeaveSvc.prototype = {
return;
}
if (Svc.Prefs.isSet("firstSync")) {
switch(Svc.Prefs.get("firstSync")) {
case "wipeClient":
this.wipeClient();
break;
case "wipeRemote":
this.wipeRemote(Engines.getAll().map(function(e) e.name));
break;
}
}
// Clear out any potentially pending syncs now that we're syncing
this._clearSyncTriggers();
this.nextSync = 0;
@ -1170,6 +1159,16 @@ WeaveSvc.prototype = {
if (!(this._remoteSetup()))
throw "aborting sync, remote setup failed";
// Wipe data in the desired direction if necessary
switch (Svc.Prefs.get("firstSync")) {
case "wipeClient":
this.wipeClient(Engines.getEnabled().map(function(e) e.name));
break;
case "wipeRemote":
this.wipeRemote(Engines.getEnabled().map(function(e) e.name));
break;
}
// Ping the server with a special info request once a day
let infoURL = this.infoURL;
let now = Math.floor(Date.now() / 1000);