bug 551572 - 100% CPU when sitting on merge-choice screen, r=Mardak

--HG--
extra : rebase_source : 1b2d36ff6d6d80b81cdadaad4fb53592f851e903
This commit is contained in:
Mike Connor 2010-04-05 23:53:31 -04:00
parent ea7a2f7ba7
commit db5f17224a
2 changed files with 21 additions and 19 deletions

View File

@ -124,6 +124,7 @@ kSyncNotLoggedIn: "User is not logged in",
kSyncNetworkOffline: "Network is offline",
kSyncInPrivateBrowsing: "Private browsing is enabled",
kSyncBackoffNotMet: "Trying to sync before the server said it's okay",
kFirstSyncChoiceNotMade: "User has not selected an action for first sync",
// Application IDs
FIREFOX_ID: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",

View File

@ -968,6 +968,8 @@ WeaveSvc.prototype = {
else if (Svc.Private && Svc.Private.privateBrowsingEnabled)
// Svc.Private doesn't exist on Fennec -- don't assume it's there.
reason = kSyncInPrivateBrowsing;
else if (Svc.Prefs.get("firstSync") == "notReady")
reason = kFirstSyncChoiceNotMade;
else if (Status.minimumNextSync > Date.now())
reason = kSyncBackoffNotMet;
@ -1144,26 +1146,8 @@ WeaveSvc.prototype = {
*/
sync: function sync()
this._catch(this._lock(this._notify("sync", "", function() {
Status.resetSync();
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;
default:
this._scheduleNextSync();
return;
}
}
// if we don't have a node, get one. if that fails, retry in 10 minutes
if (this.clusterURL == "" && !this._setCluster()) {
this._scheduleNextSync(10 * 60 * 1000);
return;
}
Status.resetSync();
// Make sure we should sync or record why we shouldn't
let reason = this._checkSync();
@ -1174,6 +1158,23 @@ WeaveSvc.prototype = {
throw reason;
}
// if we don't have a node, get one. if that fails, retry in 10 minutes
if (this.clusterURL == "" && !this._setCluster()) {
this._scheduleNextSync(10 * 60 * 1000);
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;