Another automated merge. I'm kind of confused at this point, so I hope I'm not breaking anything by mis-merging.
authorAtul Varma <varmaa@toolness.com>
Wed, 25 Jun 2008 04:45:22 -0700
changeset 44741 662d4ae544362ffaa98afd32ca70bf479b0b43f1
parent 44740 28fbf7bce40aa896291642b6cdb859fd6afde4bd (current diff)
parent 44736 50370911ef24d4c2f00751d6375e28a51d7e7103 (diff)
child 44742 2e74a95c7ea521e63a59d6caf57e958bf66c191a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Another automated merge. I'm kind of confused at this point, so I hope I'm not breaking anything by mis-merging.
services/sync/modules/service.js
--- a/services/sync/locales/en-US/wizard.dtd
+++ b/services/sync/locales/en-US/wizard.dtd
@@ -1,87 +1,91 @@
-<!ENTITY serverError1.description         "Server Error:  ">
-<!ENTITY serverError2.description         ",  ">
-
-<!ENTITY wizard.title                     "Weave Setup">
-
-<!ENTITY intro.title                      "Welcome to Weave">
-<!ENTITY intro.description                "[description of Weave]">
-<!ENTITY intro-more.label                 "Learn more">
-<!ENTITY intro-more.link                  "http://labs.mozilla.com">
-
-<!ENTITY welcome.title			  "Installation Type">
-<!ENTITY curUser-title.label              "Sign In">
-<!ENTITY curUser.description              "Sign into your existing account to set up Weave on this computer.">
-<!ENTITY newUser-title.label              "Get Started with Weave">
-<!ENTITY newUser.description              "Create a new account.">
-
-<!ENTITY verify.title                     "Account Verification (Step 1 of 3)">
-<!ENTITY username.label                   "User name:">
-<!ENTITY password.label                   "Password:">
-<!ENTITY passphrase.label                 "Passphrase:">
-<!ENTITY reminder.label                   "Forgot your password? ">
-<!ENTITY unverified.label                 "Unverified">
-<!ENTITY recovery.link                    "https://sm-labs01.mozilla.org:81/client/forgot.php">
-
-<!ENTITY create.title                     "Create Account (Step 1 of 5)">
-<!ENTITY createUsername.label             "Desired login name:">
-<!ENTITY createUsernameHint.label         "Examples: Maria, Maria.Emerson">
-<!ENTITY createPassword.label             "Choose a password:">
-<!ENTITY createPasswordHint.label         "Minimum of 5 characters in length.">
-<!ENTITY createReenterPassword.label      "Re-enter password:">
-<!ENTITY createEmail.label                "Current email address:">
-<!ENTITY createEmailHint.label            "e.g. yourname@domain.com">
-
-<!ENTITY create2.title                    "Create Account (Step 2 of 5)">
-
-<!ENTITY passphrase.description           "You must also now choose an encryption passphrase that is different from your password. This will be used to protect your data on the server."> 
-<!ENTITY passphrase-more.label            "Learn More">
-<!ENTITY passphrase-more.link             "http://labs.mozilla.com">
-
-<!ENTITY reenterPassphrase.label          "Re-enter passphrase:">
-<!ENTITY moreInfo.label                   "More information on choosing a phrase.">
-
-<!ENTITY create3.title                    "Create Account (Step 3 of 5)">
+<!ENTITY serverError1.description         "Server Error:  ">
+<!ENTITY serverError2.description         ",  ">
+
+<!ENTITY wizard.title                     "Weave Setup">
+
+<!ENTITY intro.title                      "Welcome to Weave">
+<!ENTITY intro.description                "[description of Weave]">
+<!ENTITY intro-more.label                 "Learn more">
+<!ENTITY intro-more.link                  "http://labs.mozilla.com">
+
+<!ENTITY welcome.title			  "Installation Type">
+<!ENTITY curUser-title.label              "Sign In">
+<!ENTITY curUser.description              "Sign into your existing account to set up Weave on this computer.">
+<!ENTITY newUser-title.label              "Get Started with Weave">
+<!ENTITY newUser.description              "Create a new account.">
+
+<!ENTITY verify.title                     "Account Verification (Step 1 of 3)">
+<!ENTITY username.label                   "User name:">
+<!ENTITY password.label                   "Password:">
+<!ENTITY passphrase.label                 "Passphrase:">
+<!ENTITY reminder.label                   "Forgot your password? ">
+<!ENTITY unverified.label                 "Unverified">
+<!ENTITY recovery.link                    "https://sm-labs01.mozilla.org:81/client/forgot.php">
+
+<!ENTITY create.title                     "Create Account (Step 1 of 5)">
+<!ENTITY createUsername.label             "Desired login name:">
+<!ENTITY createUsernameHint.label         "Examples: Maria, Maria.Emerson">
+<!ENTITY createPassword.label             "Choose a password:">
+<!ENTITY createPasswordHint.label         "Minimum of 5 characters in length.">
+<!ENTITY createReenterPassword.label      "Re-enter password:">
+<!ENTITY createEmail.label                "Current email address:">
+<!ENTITY createEmailHint.label            "e.g. yourname@domain.com">
+
+<!ENTITY create2.title                    "Create Account (Step 2 of 5)">
+
+<!ENTITY passphrase.description           "You must also now choose an encryption passphrase that is different from your password. This will be used to protect your data on the server."> 
+<!ENTITY passphrase-more.label            "Learn More">
+<!ENTITY passphrase-more.link             "http://labs.mozilla.com">
+
+<!ENTITY reenterPassphrase.label          "Re-enter passphrase:">
+<!ENTITY moreInfo.label                   "More information on choosing a phrase.">
+
+<!ENTITY create3.title                    "Create Account (Step 3 of 5)">
+
+<!ENTITY instanceName.description         "Name this device... explain why... ">
+<!ENTITY instanceName.label               "Device name:">
+<!ENTITY examples.label                   "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;"> 
+
+<!ENTITY data.description                 "Choose the data that you would like Weave to store for you.">
+<!ENTITY bookmarks.label                  "Bookmarks">
+<!ENTITY history.label                    "Browsing History">
+<!ENTITY cookies.label                    "Cookies">
+<!ENTITY passwords.label                  "Saved Passwords">
+<!ENTITY tabs.label                       "Tabs">
+<!ENTITY formdata.label                   "Saved Form Data">
+<!ENTITY data.note                        "Weave will synchronize this data every 30 seconds.">
+<!ENTITY removeBookmarks.label            "Remove default bookmarks on this device before synchronizing with Weave.">
+
+<!ENTITY captcha.label                    "Type the characters you see in the image below:">
+<!ENTITY captchaDirections.label          "">
+<!ENTITY reloadCaptcha.text               "Reload">
+<!ENTITY captchaHint.label                "Letters are not case-sensitive.">
+
+<!ENTITY terms.label                      "Terms of Service">
+<!ENTITY acceptTerms.label                "I have read and accept the Terms of Service.">
+
+<!ENTITY final.description                "Your account will be created with the following preferences [this screen in progress]">
+
+<!ENTITY initialLogin.label               "Signing you in.">
+<!ENTITY initialPrefs.label               "Setting your preferences.">
+<!ENTITY initialReset.label               "Clearing your default bookmarks.">
+<!ENTITY initialSync.label                "Synchronizing your data.">
+<!ENTITY finalStep1Finished.label         "Signed in.">
+<!ENTITY finalStep2.label                 "Synchronizing data...">
+<!ENTITY finalStep3Finished.label         "Data synchronized.">
 
-<!ENTITY instanceName.description         "Name this device... explain why... ">
-<!ENTITY instanceName.label               "Device name:">
-<!ENTITY examples.label                   "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;"> 
-
-<!ENTITY data.description                 "Choose the data that you would like Weave to store for you.">
-<!ENTITY bookmarks.label                  "Bookmarks">
-<!ENTITY history.label                    "Browsing History">
-<!ENTITY cookies.label                    "Cookies">
-<!ENTITY passwords.label                  "Saved Passwords">
-<!ENTITY tabs.label                       "Tabs">
-<!ENTITY formdata.label                   "Saved Form Data">
-<!ENTITY data.note                        "Weave will synchronize this data every 30 seconds.">
-<!ENTITY removeBookmarks.label            "Remove default bookmarks on this device before synchronizing with Weave.">
-
-<!ENTITY captcha.label                    "Type the characters you see in the image below:">
-<!ENTITY captchaDirections.label          "">
-<!ENTITY reloadCaptcha.text               "Reload">
-<!ENTITY captchaHint.label                "Letters are not case-sensitive.">
-
-<!ENTITY terms.label                      "Terms of Service">
-<!ENTITY acceptTerms.label                "I have read and accept the Terms of Service.">
+<!ENTITY thankyou.title                   "Thank you!">
+<!ENTITY thankyou.description             "You successfully installed Weave. etc... ">
 
-<!ENTITY final.description                "Installing Weave...">
-
-<!ENTITY initialLogin.label               "Signing you in.">
-<!ENTITY initialPrefs.label               "Setting your preferences.">
-<!ENTITY initialReset.label               "Clearing your default bookmarks.">
-<!ENTITY initialSync.label                "Synchronizing your data.">
-<!ENTITY finalStep1Finished.label         "Signed in.">
-<!ENTITY finalStep2.label                 "Synchronizing data...">
-<!ENTITY finalStep3Finished.label         "Data synchronized.">
-
-<!ENTITY userCheckFailed1.description     "Our server is having problems and we couldn't check that username. ">
-<!ENTITY userCheckFailed2.description     " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later.">
-
-<!ENTITY finished.description             "Good job. You installed Weave. You can change preferences in the Weave tab...">
-<!ENTITY initialLoginFailed1.description  "Our server is having problems and we couldn't log you in. ">
-<!ENTITY initialLoginFailed2.description  " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later.">
-<!ENTITY initialSyncFailed1.description   "Our server is having problems and we couldn't synchronize your data. ">
-<!ENTITY initialSyncFailed2.description   " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later."> 
-
-<!ENTITY clickHere.text                   "Click here">
-<!ENTITY tryAgain.text                    "Try again">
+<!ENTITY final-pref-title.description     "Preferences">
<!ENTITY final-account-title.description  "Account">
<!ENTITY final-sync-title.description     "Initial Synchronization">
+<!ENTITY userCheckFailed1.description     "Our server is having problems and we couldn't check that username. ">
+<!ENTITY userCheckFailed2.description     " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later.">
+
+<!ENTITY finished.description             "Good job. You installed Weave. You can change preferences in the Weave tab...">
+<!ENTITY initialLoginFailed1.description  "Our server is having problems and we couldn't log you in. ">
+<!ENTITY initialLoginFailed2.description  " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later.">
+<!ENTITY initialSyncFailed1.description   "Our server is having problems and we couldn't synchronize your data. ">
+<!ENTITY initialSyncFailed2.description   " to try again, or click &quot;Done&quot; to exit the setup wizard and try again later."> 
+
+<!ENTITY clickHere.text                   "Click here">
+<!ENTITY tryAgain.text                    "Try again">
--- a/services/sync/locales/en-US/wizard.properties
+++ b/services/sync/locales/en-US/wizard.properties
@@ -1,52 +1,73 @@
-serverError.label               = Server Error
-serverTimeoutError.label        = Server Error
-
-
-createUsername-progress.label   = 
-createUsername-error.label      = %S is already taken. Please choose another.
-createUsername-success.label    = %S is available.
-
-email-progress.label            = 
-email-unavailable.label         = %S is already taken. Please choose another.
-email-invalid.label             = Please re-enter a valid email address.
-email-success.label             = %S is available.
-
-
-passwordsUnmatched.label        = Passwords do not match
-passphrasesUnmatched.label      = Passphrases do not match.
-samePasswordAndPassphrase.label = Your password and passphrase must be different
-
-
+serverError.label               = Server Error
+serverTimeoutError.label        = Server Error
+
+
+createUsername-progress.label   = Checking username
+createUsername-error.label      = %S is already taken. Please choose another.
+createUsername-success.label    = %S is available.
+
+email-progress.label            = Checking email
+email-unavailable.label         = %S is already taken. Please choose another.
+email-invalid.label             = Please re-enter a valid email address.
+email-success.label             = %S is available.
+
+
+passwordsUnmatched.label        = Passwords do not match
+passphrasesUnmatched.label      = Passphrases do not match.
+samePasswordAndPassphrase.label = Your password and passphrase must be different
+
+
+
+missingCaptchaResponse.label    = Please enter the words in the Captcha box.
+incorrectCaptcha.label          = Incorrect Captcha response. Try again.
+
+
+verify-progress.label           = Verifying username and password
+verify-error.label              = Invalid username and password
+verify-success.label            = Username and password verified
+
+create-progress.label           = Creating your account
+create-uid-inuse.label          = Username in use
+create-uid-missing.label        = Username missing
+create-uid-invalid.label        = Username invalid
+create-mail-invalid.label       = Email invalid
+create-mail-inuse.label         = Emali in use
+create-captcha-missing.label    = Captcha response missing
+create-password-missing.label   = Password missing
+create-password-incorrect.label = Password incorrect
 
-missingCaptchaResponse.label    = Please enter the words in the Captcha box.
-incorrectCaptcha.label          = Incorrect Captcha response. Try again.
-
+create-success.label            = Account for %S created.
 
-verify-progress.label           = Verifying username and password
-verify-error.label              = Invalid username and password
-verify-success.label            = Username and password verified
+final-pref-value.label          = %S    
+final-account-value.label       = Username: %S
+final-sync-value.label          = [Explain that a sync will happen]
+final-success.label             = Weave was successfully installed.
 
-
+default-name.label              = %S's Firefox
+default-name-nouser.label       = Firefox
 
-initialLogin-progress.label     = Signing you in...
-initialLogin-done.label         = Sign-in successful. 
-initialLogin-error.label        = Problem signing in.
+bookmarks.label                 = Bookmarks
+history.label                   = Browsing History
+cookies.label                   = Cookies
+passwords.label                 = Saved Passwords
+tabs.label                      = Tabs
+formdata.label                  = Saved Form Data
+
+initialLogin-progress.label     = Signing you in
+initialLogin-error.label        = Problem signing in.
+
+initialPrefs-progress.label     = Setting your preferences
 
-initialPrefs-progress.label     = Setting your preferences...
-initialPrefs-done.label         = Preferences set. 
-
-initialReset-progress.label     = Clearing your default bookmarks...
-initialReset-done.label         = Default bookmarks cleared. 
-
-initialSync-progress.label      = Synchronizing your data...
-initialSync-done.label          = Sync successful.
+initialSync-progress.label      = Synchronizing your data
 initialSync-error.label         = Problem syncing data. 
 
-
-tryAgain.text                   = Try again now.
-clickHere.text                  = Click here
-
-data-verify.title               = Data (Step 2 of 3)
-data-create.title               = Data (Step 4 of 5)
-final-verify.title              = Finish (Step 3 of 3)
-final-create.title              = Finish (Step 5 of 5)
+installation-complete.label     = Installation complete.
+
+
+tryAgain.text                   = Try again now.
+clickHere.text                  = Click here
+
+data-verify.title               = Data (Step 2 of 3)
+data-create.title               = Data (Step 4 of 5)
+final-verify.title              = Finish (Step 3 of 3)
+final-create.title              = Finish (Step 5 of 5)
--- a/services/sync/modules/dav.js
+++ b/services/sync/modules/dav.js
@@ -296,31 +296,42 @@ DAVCollection.prototype = {
         ret.push(elt.textContent.replace(root, ''));
     } catch (e) {}
 
     self.done(ret);
   },
 
   // Login / Logout
 
-  checkLogin: function DC_checkLogin() {
+  checkLogin: function DC_checkLogin(username, password) {
     let self = yield;
 
-    this._log.debug("Checking login");
+    this._log.debug("checkLogin called for user " + username);
+
+    let headers = {
+                    'Content-type'  : 'text/plain',
+                    'Authorization' : 'Basic ' + btoa(username + ":" + password)
+                  };
+    let lock = DAVLocks['default'];
+    if (lock)
+      headers['If'] = "<" + lock.URL + "> (<" + lock.token + ">)";
 
     // Make a call to make sure it's working
-    this.GET("", self.cb);
+    this._makeRequest.async(this, self.cb, "GET", "", headers);
     let resp = yield;
 
-    if (resp.status < 200 || resp.status >= 300) {
-      self.done(false);
-      return;
-    }
+    this._log.debug("checkLogin got response status " + resp.status);
+    // XXX would be nice if 404 == invalid username, 401 == invalid password.
+    let retmsg = "";
+    if (resp.status == 401)
+      retmsg = "invalid username or password";
+    else if (resp.status < 200 || resp.status >= 300)
+      retmsg = "server error";
 
-    self.done(true);
+    self.done(retmsg);
   },
 
   // Locking
 
   _getActiveLock: function DC__getActiveLock() {
     let self = yield;
     let ret = null;
 
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -191,20 +191,18 @@ WeaveSvc.prototype = {
   get password() { return ID.get('WeaveID').password; },
   set password(value) { ID.get('WeaveID').password = value; },
 
   get passphrase() { return ID.get('WeaveCryptoID').password; },
   set passphrase(value) { ID.get('WeaveCryptoID').password = value; },
 
   get userPath() { return ID.get('WeaveID').username; },
 
-  get currentUser() {
-    if (this._loggedIn)
-      return this.username;
-    return null;
+  get isLoggedIn() {
+    return this._loggedIn;
   },
 
   get enabled() {
     return Utils.prefs.getBoolPref("enabled");
   },
 
   get schedule() {
     if (!this.enabled)
@@ -494,64 +492,55 @@ WeaveSvc.prototype = {
                                "chrome://weave/content/status.xul",
                                "Weave:status",
                                "chrome,centerscreen,modal",
                                null);
   },
 
   // These are global (for all engines)
 
-  login: function WeaveSync_login(onComplete, password, passphrase, verifyonly) {
-    this._localLock(this._notify("login", this._login,
-                                 password, passphrase, verifyonly)).async(this, onComplete);
+  verifyLogin: function WeaveSync_verifyLogin(username, password) {
+    this._localLock(this._notify("verify-login", this._verifyLogin, username, password)).async(this, null);
   },
-  _login: function WeaveSync__login(password, passphrase, verifyonly) {
+
+  _verifyLogin: function WeaveSync__verifyLogin(username, password) {
+    let self = yield;
+    this._log.debug("Verifying login for user " + username);
+
+    DAV.baseURL = Utils.prefs.getCharPref("serverURL");
+    DAV.defaultPrefix = "user/" + username;
+
+    DAV.checkLogin.async(DAV, self.cb, username, password);
+    let resultMsg = yield;
+
+    // If we got an error message, throw it. [need to throw to cause the
+    // _notify() wrapper to generate an error notification for observers].
+    if (resultMsg) {
+      this._log.debug("Login verification: " + resultMsg);
+      throw resultMsg;
+    }
+
+  },
+
+  login: function WeaveSync_login(onComplete) {
+    this._localLock(this._notify("login", this._login)).async(this, onComplete);
+  },
+  _login: function WeaveSync__login() {
     let self = yield;
 
-    // cache password & passphrase
-    // if null, we'll try to get them from the pw manager below
-    ID.get('WeaveID').setTempPassword(password);
-    ID.get('WeaveCryptoID').setTempPassword(passphrase);
-
-    if(verifyonly)
-       this._log.debug("Verifying login");
-    else
-       this._log.debug("Logging in");
+    this._log.debug("Logging in user " + this.username);
 
     if (!this.username)
       throw "No username set, login failed";
     if (!this.password)
       throw "No password given or found in password manager";
 
     DAV.baseURL = Utils.prefs.getCharPref("serverURL");
     DAV.defaultPrefix = "user/" + this.userPath;
 
-    DAV.checkLogin.async(DAV, self.cb, this.username, this.password);
-    let success = yield;
-    if (!success) {
-      try {
-        // FIXME: This code may not be needed any more, due to the way
-        // that the server is expected to create the user dir for us.
-        this._checkUserDir.async(this, self.cb);
-        yield;
-      } catch (e) { /* FIXME: tmp workaround for services.m.c */ }
-      DAV.checkLogin.async(DAV, self.cb, this.username, this.password);
-      let success = yield;
-      if (!success)
-        throw "Login failed";
-    }
-
-    // If being called from the Wizard to verify credentials, stop here.
-    if (verifyonly) {
-      this._log.debug("Login verified");
-      self.done(true);
-      return;
-    }
-    // Otherwise, setup the user session.
-
     this._log.info("Using server URL: " + DAV.baseURL + DAV.defaultPrefix);
 
     this._versionCheck.async(this, self.cb);
     yield;
     this._getKeypair.async(this, self.cb);
     yield;
 
     this._loggedIn = true;
--- a/services/sync/modules/xmpp/transportLayer.js
+++ b/services/sync/modules/xmpp/transportLayer.js
@@ -172,21 +172,21 @@ HTTPPollingTransport.prototype = {
     this._callbackObject = null;
     this._useKeys = useKeys;
     this._interval = interval;
     this._outgoingRetryBuffer = "";
     this._retryCount = 0;
     this._retryCap = 0;
   },
 
-  __request: null,
   get _request() {
-    if (!this.__request)
-      this.__request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( Ci.nsIXMLHttpRequest );
-    return this.__request;
+    let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( Ci.nsIXMLHttpRequest );
+    request.mozBackgroundRequest = true;
+    this.__defineGetter__("_request", function() request);
+    return this._request;
   },
 
   __hasher: null,
   get _hasher() {
     if (!this.__hasher)
       this.__hasher = Cc["@mozilla.org/security/hash;1"].createInstance( Ci.nsICryptoHash );
     return this.__hasher;
   },
@@ -251,17 +251,16 @@ HTTPPollingTransport.prototype = {
     if ( this._callbackObject != null ) {
       this._callbackObject.onTransportError( errorText );
     }
     this.disconnect();
   },
 
   _doPost: function( requestXml ) {
     var request = this._request;
-    request.mozBackgroundRequest = true;
     var callbackObj = this._callbackObject;
     var self = this;
     var contents = "";
 
     if ( this._useKey ) {
       this._advanceKey();
       contents = this._connectionId + ";" + this._key + "," + requestXml;
     } else {