The auto-login at startup no longer unconditionally syncs; if the login fails, the sync is now aborted.
authorAtul Varma <varmaa@toolness.com>
Mon, 30 Jun 2008 17:55:48 -0700
changeset 44847 220fe9d0125e8e7a556618adb9da5906cfc52663
parent 44846 1dffa440e5dde7591d3f833c26daac2eeae52aca
child 44848 160a7147243ae4d363a32265b138c31d4fff00b3
child 44849 d92c8d0e45044bb187792897542296665d47301f
push id14033
push useredward.lee@engineering.uiuc.edu
push dateWed, 23 Jun 2010 22:21:35 +0000
treeherderautoland@227db4ad8cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
The auto-login at startup no longer unconditionally syncs; if the login fails, the sync is now aborted.
services/sync/modules/service.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -205,25 +205,33 @@ WeaveSvc.prototype = {
     if (!this.enabled)
       return 0; // manual/off
     return Utils.prefs.getIntPref("schedule");
   },
 
   onWindowOpened: function Weave__onWindowOpened() {
     if (!this._startupFinished) {
       if (Utils.prefs.getBoolPref("autoconnect") &&
-          this.username && this.username != 'nobody') {
-        // Login, then sync.
-        let self = this;
-        this.login(function() { self.sync(); });
-      }
+          this.username && this.username != 'nobody')
+        this._initialLoginAndSync.async(this);
       this._startupFinished = true;
     }
   },
 
+  _initialLoginAndSync: function Weave__initialLoginAndSync() {
+    let self = yield;
+
+    // Any exceptions thrown by the login process will be propagated
+    // out here, so there's no need to check to see if the login was
+    // successful; if it wasn't, this coroutine will just abort.
+
+    yield this.login(self.cb);
+    yield this.sync(self.cb);
+  },
+
   _setSchedule: function Weave__setSchedule(schedule) {
     switch (this.schedule) {
     case 0:
       this._disableSchedule();
       break;
     case 1:
       this._enableSchedule();
       break;