Bug 1128203 - Reduce indentation from 4 to 2 spaces. rs=dolske, a=NPOTB
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Sat, 31 Jan 2015 21:25:49 +0000
changeset 249669 396eb0f2d14463affb28ff2adb5001d2a7e0f53f
parent 249668 ccb525f5d1d3d86e728b07b58229b8da685accb2
child 249670 cc5e2253319997d3d0aa1bc5c3899efc34dcdc08
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, NPOTB
bugs1128203
milestone37.0a2
Bug 1128203 - Reduce indentation from 4 to 2 spaces. rs=dolske, a=NPOTB
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/LoginManagerParent.jsm
toolkit/components/passwordmgr/crypto-SDR.js
toolkit/components/passwordmgr/nsILoginInfo.idl
toolkit/components/passwordmgr/nsILoginManager.idl
toolkit/components/passwordmgr/nsILoginManagerCrypto.idl
toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
toolkit/components/passwordmgr/nsILoginManagerStorage.idl
toolkit/components/passwordmgr/nsILoginMetaInfo.idl
toolkit/components/passwordmgr/nsLoginInfo.js
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/storage-json.js
toolkit/components/passwordmgr/storage-mozStorage.js
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1,9 +1,9 @@
-/* vim: set ts=4 sts=4 sw=4 et tw=80: */
+/* vim: set ts=2 sts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = [ "LoginManagerContent",
                           "UserAutoCompleteResult" ];
@@ -17,927 +17,927 @@ Cu.import("resource://gre/modules/XPCOMU
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 
 // These mirror signon.* prefs.
 var gEnabled, gDebug, gAutofillForms, gStoreWhenAutocompleteOff;
 
 function log(...pieces) {
-    function generateLogMessage(args) {
-        let strings = ['Login Manager (content):'];
+  function generateLogMessage(args) {
+    let strings = ['Login Manager (content):'];
 
-        args.forEach(function(arg) {
-            if (typeof arg === 'string') {
-                strings.push(arg);
-            } else if (typeof arg === 'undefined') {
-                strings.push('undefined');
-            } else if (arg === null) {
-                strings.push('null');
-            } else {
-                try {
-                  strings.push(JSON.stringify(arg, null, 2));
-                } catch(err) {
-                  strings.push("<<something>>");
-                }
-            }
-        });
-        return strings.join(' ');
-    }
+    args.forEach(function(arg) {
+      if (typeof arg === 'string') {
+        strings.push(arg);
+      } else if (typeof arg === 'undefined') {
+        strings.push('undefined');
+      } else if (arg === null) {
+        strings.push('null');
+      } else {
+        try {
+          strings.push(JSON.stringify(arg, null, 2));
+        } catch(err) {
+          strings.push("<<something>>");
+        }
+      }
+    });
+    return strings.join(' ');
+  }
 
-    if (!gDebug)
-        return;
+  if (!gDebug)
+    return;
 
-    let message = generateLogMessage(pieces);
-    dump(message + "\n");
-    Services.console.logStringMessage(message);
+  let message = generateLogMessage(pieces);
+  dump(message + "\n");
+  Services.console.logStringMessage(message);
 }
 
 
 var observer = {
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
-                                            Ci.nsIFormSubmitObserver,
-                                            Ci.nsISupportsWeakReference]),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
+                                          Ci.nsIFormSubmitObserver,
+                                          Ci.nsISupportsWeakReference]),
 
-    // nsIFormSubmitObserver
-    notify : function (formElement, aWindow, actionURI) {
-        log("observer notified for form submission.");
+  // nsIFormSubmitObserver
+  notify : function (formElement, aWindow, actionURI) {
+    log("observer notified for form submission.");
 
-        // We're invoked before the content's |onsubmit| handlers, so we
-        // can grab form data before it might be modified (see bug 257781).
+    // We're invoked before the content's |onsubmit| handlers, so we
+    // can grab form data before it might be modified (see bug 257781).
 
-        try {
-            LoginManagerContent._onFormSubmit(formElement);
-        } catch (e) {
-            log("Caught error in onFormSubmit(", e.lineNumber, "):", e.message);
-        }
+    try {
+      LoginManagerContent._onFormSubmit(formElement);
+    } catch (e) {
+      log("Caught error in onFormSubmit(", e.lineNumber, "):", e.message);
+    }
 
-        return true; // Always return true, or form submit will be canceled.
-    },
+    return true; // Always return true, or form submit will be canceled.
+  },
 
-    onPrefChange : function() {
-        gDebug = Services.prefs.getBoolPref("signon.debug");
-        gEnabled = Services.prefs.getBoolPref("signon.rememberSignons");
-        gAutofillForms = Services.prefs.getBoolPref("signon.autofillForms");
-        gStoreWhenAutocompleteOff = Services.prefs.getBoolPref("signon.storeWhenAutocompleteOff");
-    },
+  onPrefChange : function() {
+    gDebug = Services.prefs.getBoolPref("signon.debug");
+    gEnabled = Services.prefs.getBoolPref("signon.rememberSignons");
+    gAutofillForms = Services.prefs.getBoolPref("signon.autofillForms");
+    gStoreWhenAutocompleteOff = Services.prefs.getBoolPref("signon.storeWhenAutocompleteOff");
+  },
 };
 
 Services.obs.addObserver(observer, "earlyformsubmit", false);
 var prefBranch = Services.prefs.getBranch("signon.");
 prefBranch.addObserver("", observer.onPrefChange, false);
 
 observer.onPrefChange(); // read initial values
 
 
 function messageManagerFromWindow(win) {
-    return win.QueryInterface(Ci.nsIInterfaceRequestor)
-              .getInterface(Ci.nsIWebNavigation)
-              .QueryInterface(Ci.nsIDocShell)
-              .QueryInterface(Ci.nsIInterfaceRequestor)
-              .getInterface(Ci.nsIContentFrameMessageManager)
+  return win.QueryInterface(Ci.nsIInterfaceRequestor)
+            .getInterface(Ci.nsIWebNavigation)
+            .QueryInterface(Ci.nsIDocShell)
+            .QueryInterface(Ci.nsIInterfaceRequestor)
+            .getInterface(Ci.nsIContentFrameMessageManager)
 }
 
 // This object maps to the "child" process (even in the single-process case).
 var LoginManagerContent = {
 
-    __formFillService : null, // FormFillController, for username autocompleting
-    get _formFillService() {
-        if (!this.__formFillService)
-            this.__formFillService =
-                            Cc["@mozilla.org/satchel/form-fill-controller;1"].
-                            getService(Ci.nsIFormFillController);
-        return this.__formFillService;
-    },
+  __formFillService : null, // FormFillController, for username autocompleting
+  get _formFillService() {
+    if (!this.__formFillService)
+      this.__formFillService =
+                      Cc["@mozilla.org/satchel/form-fill-controller;1"].
+                      getService(Ci.nsIFormFillController);
+    return this.__formFillService;
+  },
 
-    _getRandomId: function() {
-        return Cc["@mozilla.org/uuid-generator;1"]
-                 .getService(Ci.nsIUUIDGenerator).generateUUID().toString();
-    },
+  _getRandomId: function() {
+    return Cc["@mozilla.org/uuid-generator;1"]
+             .getService(Ci.nsIUUIDGenerator).generateUUID().toString();
+  },
 
-    _messages: [ "RemoteLogins:loginsFound",
-                 "RemoteLogins:loginsAutoCompleted" ],
+  _messages: [ "RemoteLogins:loginsFound",
+               "RemoteLogins:loginsAutoCompleted" ],
 
-    // Map from form login requests to information about that request.
-    _requests: new Map(),
+  // Map from form login requests to information about that request.
+  _requests: new Map(),
 
-    // Number of outstanding requests to each manager.
-    _managers: new Map(),
+  // Number of outstanding requests to each manager.
+  _managers: new Map(),
 
-    _takeRequest: function(msg) {
-        let data = msg.data;
-        let request = this._requests.get(data.requestId);
+  _takeRequest: function(msg) {
+    let data = msg.data;
+    let request = this._requests.get(data.requestId);
 
-        this._requests.delete(data.requestId);
+    this._requests.delete(data.requestId);
 
-        let count = this._managers.get(msg.target);
-        if (--count === 0) {
-            this._managers.delete(msg.target);
+    let count = this._managers.get(msg.target);
+    if (--count === 0) {
+      this._managers.delete(msg.target);
 
-            for (let message of this._messages)
-                msg.target.removeMessageListener(message, this);
-        } else {
-            this._managers.set(msg.target, count);
-        }
+      for (let message of this._messages)
+        msg.target.removeMessageListener(message, this);
+    } else {
+      this._managers.set(msg.target, count);
+    }
 
-        return request;
-    },
+    return request;
+  },
 
-    _sendRequest: function(messageManager, requestData,
-                           name, messageData) {
-        let count;
-        if (!(count = this._managers.get(messageManager))) {
-            this._managers.set(messageManager, 1);
+  _sendRequest: function(messageManager, requestData,
+                         name, messageData) {
+    let count;
+    if (!(count = this._managers.get(messageManager))) {
+      this._managers.set(messageManager, 1);
 
-            for (let message of this._messages)
-                messageManager.addMessageListener(message, this);
-        } else {
-            this._managers.set(messageManager, ++count);
-        }
+      for (let message of this._messages)
+        messageManager.addMessageListener(message, this);
+    } else {
+      this._managers.set(messageManager, ++count);
+    }
 
-        let requestId = this._getRandomId();
-        messageData.requestId = requestId;
+    let requestId = this._getRandomId();
+    messageData.requestId = requestId;
 
-        messageManager.sendAsyncMessage(name, messageData);
+    messageManager.sendAsyncMessage(name, messageData);
 
-        let deferred = Promise.defer();
-        requestData.promise = deferred;
-        this._requests.set(requestId, requestData);
-        return deferred.promise;
-    },
+    let deferred = Promise.defer();
+    requestData.promise = deferred;
+    this._requests.set(requestId, requestData);
+    return deferred.promise;
+  },
 
-    receiveMessage: function (msg) {
-        let request = this._takeRequest(msg);
-        switch (msg.name) {
-            case "RemoteLogins:loginsFound": {
-                request.promise.resolve({ form: request.form,
-                                          loginsFound: msg.data.logins });
-                break;
-            }
+  receiveMessage: function (msg) {
+    let request = this._takeRequest(msg);
+    switch (msg.name) {
+      case "RemoteLogins:loginsFound": {
+        request.promise.resolve({ form: request.form,
+                                  loginsFound: msg.data.logins });
+        break;
+      }
 
-            case "RemoteLogins:loginsAutoCompleted": {
-                request.promise.resolve(msg.data.logins);
-                break;
-            }
-        }
-    },
+      case "RemoteLogins:loginsAutoCompleted": {
+        request.promise.resolve(msg.data.logins);
+        break;
+      }
+    }
+  },
 
-    _asyncFindLogins: function(form, options) {
-      let doc = form.ownerDocument;
-      let win = doc.defaultView;
+  _asyncFindLogins: function(form, options) {
+    let doc = form.ownerDocument;
+    let win = doc.defaultView;
 
-      let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
-      let actionOrigin = LoginUtils._getActionOrigin(form);
+    let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
+    let actionOrigin = LoginUtils._getActionOrigin(form);
 
-      let messageManager = messageManagerFromWindow(win);
+    let messageManager = messageManagerFromWindow(win);
 
-      // XXX Weak??
-      let requestData = { form: form };
-      let messageData = { formOrigin: formOrigin,
-                          actionOrigin: actionOrigin,
-                          options: options };
+    // XXX Weak??
+    let requestData = { form: form };
+    let messageData = { formOrigin: formOrigin,
+                        actionOrigin: actionOrigin,
+                        options: options };
 
-      return this._sendRequest(messageManager, requestData,
-                               "RemoteLogins:findLogins",
-                               messageData);
-    },
+    return this._sendRequest(messageManager, requestData,
+                             "RemoteLogins:findLogins",
+                             messageData);
+  },
 
-    _autoCompleteSearchAsync: function(aSearchString, aPreviousResult,
-                                       aElement, aRect) {
-        let doc = aElement.ownerDocument;
-        let form = aElement.form;
-        let win = doc.defaultView;
+  _autoCompleteSearchAsync: function(aSearchString, aPreviousResult,
+                                     aElement, aRect) {
+    let doc = aElement.ownerDocument;
+    let form = aElement.form;
+    let win = doc.defaultView;
 
-        let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
-        let actionOrigin = LoginUtils._getActionOrigin(form);
+    let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
+    let actionOrigin = LoginUtils._getActionOrigin(form);
 
-        let messageManager = messageManagerFromWindow(win);
+    let messageManager = messageManagerFromWindow(win);
 
-        let remote = (Services.appinfo.processType ===
-                      Services.appinfo.PROCESS_TYPE_CONTENT);
+    let remote = (Services.appinfo.processType ===
+                  Services.appinfo.PROCESS_TYPE_CONTENT);
 
-        let requestData = {};
-        let messageData = { formOrigin: formOrigin,
-                            actionOrigin: actionOrigin,
-                            searchString: aSearchString,
-                            previousResult: aPreviousResult,
-                            rect: aRect,
-                            remote: remote };
+    let requestData = {};
+    let messageData = { formOrigin: formOrigin,
+                        actionOrigin: actionOrigin,
+                        searchString: aSearchString,
+                        previousResult: aPreviousResult,
+                        rect: aRect,
+                        remote: remote };
 
-        return this._sendRequest(messageManager, requestData,
-                                 "RemoteLogins:autoCompleteLogins",
-                                 messageData);
-    },
+    return this._sendRequest(messageManager, requestData,
+                             "RemoteLogins:autoCompleteLogins",
+                             messageData);
+  },
 
-    /*
-     * onFormPassword
-     *
-     * Called when an <input type="password"> element is added to the page
-     */
-    onFormPassword: function (event) {
-      if (!event.isTrusted)
-          return;
+  /*
+   * onFormPassword
+   *
+   * Called when an <input type="password"> element is added to the page
+   */
+  onFormPassword: function (event) {
+    if (!event.isTrusted)
+      return;
 
-      if (!gEnabled)
-          return;
+    if (!gEnabled)
+      return;
 
-      let form = event.target;
-      log("onFormPassword for", form.ownerDocument.documentURI);
-      this._asyncFindLogins(form, { showMasterPassword: true })
-          .then(this.loginsFound.bind(this))
-          .then(null, Cu.reportError);
-    },
+    let form = event.target;
+    log("onFormPassword for", form.ownerDocument.documentURI);
+    this._asyncFindLogins(form, { showMasterPassword: true })
+        .then(this.loginsFound.bind(this))
+        .then(null, Cu.reportError);
+  },
 
-    loginsFound: function({ form, loginsFound }) {
-        let doc = form.ownerDocument;
-        let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView);
+  loginsFound: function({ form, loginsFound }) {
+    let doc = form.ownerDocument;
+    let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView);
 
-        this._fillForm(form, autofillForm, false, false, false, loginsFound);
-    },
+    this._fillForm(form, autofillForm, false, false, false, loginsFound);
+  },
 
-    /*
-     * onUsernameInput
-     *
-     * Listens for DOMAutoComplete and blur events on an input field.
-     */
-    onUsernameInput : function(event) {
-        if (!event.isTrusted)
-            return;
+  /*
+   * onUsernameInput
+   *
+   * Listens for DOMAutoComplete and blur events on an input field.
+   */
+  onUsernameInput : function(event) {
+    if (!event.isTrusted)
+      return;
 
-        if (!gEnabled)
-            return;
+    if (!gEnabled)
+      return;
 
-        var acInputField = event.target;
+    var acInputField = event.target;
 
-        // This is probably a bit over-conservatative.
-        if (!(acInputField.ownerDocument instanceof Ci.nsIDOMHTMLDocument))
-            return;
+    // This is probably a bit over-conservatative.
+    if (!(acInputField.ownerDocument instanceof Ci.nsIDOMHTMLDocument))
+      return;
 
-        if (!this._isUsernameFieldType(acInputField))
-            return;
+    if (!this._isUsernameFieldType(acInputField))
+      return;
 
-        var acForm = acInputField.form;
-        if (!acForm)
-            return;
+    var acForm = acInputField.form;
+    if (!acForm)
+      return;
 
-        // If the username is blank, bail out now -- we don't want
-        // fillForm() to try filling in a login without a username
-        // to filter on (bug 471906).
-        if (!acInputField.value)
-            return;
+    // If the username is blank, bail out now -- we don't want
+    // fillForm() to try filling in a login without a username
+    // to filter on (bug 471906).
+    if (!acInputField.value)
+      return;
 
-        log("onUsernameInput from", event.type);
+    log("onUsernameInput from", event.type);
 
-        // Make sure the username field fillForm will use is the
-        // same field as the autocomplete was activated on.
-        var [usernameField, passwordField, ignored] =
-            this._getFormFields(acForm, false);
-        if (usernameField == acInputField && passwordField) {
-            this._asyncFindLogins(acForm, { showMasterPassword: false })
-                .then(({ form, loginsFound }) => {
-                    this._fillForm(form, true, true, true, true, loginsFound);
-                })
-                .then(null, Cu.reportError);
-        } else {
-            // Ignore the event, it's for some input we don't care about.
-        }
-    },
+    // Make sure the username field fillForm will use is the
+    // same field as the autocomplete was activated on.
+    var [usernameField, passwordField, ignored] =
+        this._getFormFields(acForm, false);
+    if (usernameField == acInputField && passwordField) {
+      this._asyncFindLogins(acForm, { showMasterPassword: false })
+          .then(({ form, loginsFound }) => {
+              this._fillForm(form, true, true, true, true, loginsFound);
+          })
+          .then(null, Cu.reportError);
+    } else {
+      // Ignore the event, it's for some input we don't care about.
+    }
+  },
 
 
-    /*
-     * _getPasswordFields
-     *
-     * Returns an array of password field elements for the specified form.
-     * If no pw fields are found, or if more than 3 are found, then null
-     * is returned.
-     *
-     * skipEmptyFields can be set to ignore password fields with no value.
-     */
-    _getPasswordFields : function (form, skipEmptyFields) {
-        // Locate the password fields in the form.
-        var pwFields = [];
-        for (var i = 0; i < form.elements.length; i++) {
-            var element = form.elements[i];
-            if (!(element instanceof Ci.nsIDOMHTMLInputElement) ||
-                element.type != "password")
-                continue;
+  /*
+   * _getPasswordFields
+   *
+   * Returns an array of password field elements for the specified form.
+   * If no pw fields are found, or if more than 3 are found, then null
+   * is returned.
+   *
+   * skipEmptyFields can be set to ignore password fields with no value.
+   */
+  _getPasswordFields : function (form, skipEmptyFields) {
+    // Locate the password fields in the form.
+    var pwFields = [];
+    for (var i = 0; i < form.elements.length; i++) {
+      var element = form.elements[i];
+      if (!(element instanceof Ci.nsIDOMHTMLInputElement) ||
+          element.type != "password")
+        continue;
 
-            if (skipEmptyFields && !element.value)
-                continue;
+      if (skipEmptyFields && !element.value)
+        continue;
 
-            pwFields[pwFields.length] = {
-                                            index   : i,
-                                            element : element
-                                        };
-        }
+      pwFields[pwFields.length] = {
+                                    index   : i,
+                                    element : element
+                                  };
+    }
 
-        // If too few or too many fields, bail out.
-        if (pwFields.length == 0) {
-            log("(form ignored -- no password fields.)");
-            return null;
-        } else if (pwFields.length > 3) {
-            log("(form ignored -- too many password fields. [ got ",
-                        pwFields.length, "])");
-            return null;
-        }
+    // If too few or too many fields, bail out.
+    if (pwFields.length == 0) {
+      log("(form ignored -- no password fields.)");
+      return null;
+    } else if (pwFields.length > 3) {
+      log("(form ignored -- too many password fields. [ got ",
+                  pwFields.length, "])");
+      return null;
+    }
 
-        return pwFields;
-    },
+    return pwFields;
+  },
 
 
-    _isUsernameFieldType: function(element) {
-        if (!(element instanceof Ci.nsIDOMHTMLInputElement))
-            return false;
+  _isUsernameFieldType: function(element) {
+    if (!(element instanceof Ci.nsIDOMHTMLInputElement))
+      return false;
 
-        let fieldType = (element.hasAttribute("type") ?
-                         element.getAttribute("type").toLowerCase() :
-                         element.type);
-        if (fieldType == "text"  ||
-            fieldType == "email" ||
-            fieldType == "url"   ||
-            fieldType == "tel"   ||
-            fieldType == "number") {
-            return true;
-        }
-        return false;
-    },
+    let fieldType = (element.hasAttribute("type") ?
+                     element.getAttribute("type").toLowerCase() :
+                     element.type);
+    if (fieldType == "text"  ||
+        fieldType == "email" ||
+        fieldType == "url"   ||
+        fieldType == "tel"   ||
+        fieldType == "number") {
+      return true;
+    }
+    return false;
+  },
 
 
-    /*
-     * _getFormFields
-     *
-     * Returns the username and password fields found in the form.
-     * Can handle complex forms by trying to figure out what the
-     * relevant fields are.
-     *
-     * Returns: [usernameField, newPasswordField, oldPasswordField]
-     *
-     * usernameField may be null.
-     * newPasswordField will always be non-null.
-     * oldPasswordField may be null. If null, newPasswordField is just
-     * "theLoginField". If not null, the form is apparently a
-     * change-password field, with oldPasswordField containing the password
-     * that is being changed.
-     */
-    _getFormFields : function (form, isSubmission) {
-        var usernameField = null;
+  /*
+   * _getFormFields
+   *
+   * Returns the username and password fields found in the form.
+   * Can handle complex forms by trying to figure out what the
+   * relevant fields are.
+   *
+   * Returns: [usernameField, newPasswordField, oldPasswordField]
+   *
+   * usernameField may be null.
+   * newPasswordField will always be non-null.
+   * oldPasswordField may be null. If null, newPasswordField is just
+   * "theLoginField". If not null, the form is apparently a
+   * change-password field, with oldPasswordField containing the password
+   * that is being changed.
+   */
+  _getFormFields : function (form, isSubmission) {
+    var usernameField = null;
 
-        // Locate the password field(s) in the form. Up to 3 supported.
-        // If there's no password field, there's nothing for us to do.
-        var pwFields = this._getPasswordFields(form, isSubmission);
-        if (!pwFields)
-            return [null, null, null];
+    // Locate the password field(s) in the form. Up to 3 supported.
+    // If there's no password field, there's nothing for us to do.
+    var pwFields = this._getPasswordFields(form, isSubmission);
+    if (!pwFields)
+      return [null, null, null];
 
 
-        // Locate the username field in the form by searching backwards
-        // from the first passwordfield, assume the first text field is the
-        // username. We might not find a username field if the user is
-        // already logged in to the site.
-        for (var i = pwFields[0].index - 1; i >= 0; i--) {
-            var element = form.elements[i];
-            if (this._isUsernameFieldType(element)) {
-                usernameField = element;
-                break;
-            }
-        }
+    // Locate the username field in the form by searching backwards
+    // from the first passwordfield, assume the first text field is the
+    // username. We might not find a username field if the user is
+    // already logged in to the site.
+    for (var i = pwFields[0].index - 1; i >= 0; i--) {
+      var element = form.elements[i];
+      if (this._isUsernameFieldType(element)) {
+        usernameField = element;
+        break;
+      }
+    }
 
-        if (!usernameField)
-            log("(form -- no username field found)");
+    if (!usernameField)
+      log("(form -- no username field found)");
 
 
-        // If we're not submitting a form (it's a page load), there are no
-        // password field values for us to use for identifying fields. So,
-        // just assume the first password field is the one to be filled in.
-        if (!isSubmission || pwFields.length == 1)
-            return [usernameField, pwFields[0].element, null];
+    // If we're not submitting a form (it's a page load), there are no
+    // password field values for us to use for identifying fields. So,
+    // just assume the first password field is the one to be filled in.
+    if (!isSubmission || pwFields.length == 1)
+      return [usernameField, pwFields[0].element, null];
 
 
-        // Try to figure out WTF is in the form based on the password values.
-        var oldPasswordField, newPasswordField;
-        var pw1 = pwFields[0].element.value;
-        var pw2 = pwFields[1].element.value;
-        var pw3 = (pwFields[2] ? pwFields[2].element.value : null);
+    // Try to figure out WTF is in the form based on the password values.
+    var oldPasswordField, newPasswordField;
+    var pw1 = pwFields[0].element.value;
+    var pw2 = pwFields[1].element.value;
+    var pw3 = (pwFields[2] ? pwFields[2].element.value : null);
 
-        if (pwFields.length == 3) {
-            // Look for two identical passwords, that's the new password
+    if (pwFields.length == 3) {
+      // Look for two identical passwords, that's the new password
 
-            if (pw1 == pw2 && pw2 == pw3) {
-                // All 3 passwords the same? Weird! Treat as if 1 pw field.
-                newPasswordField = pwFields[0].element;
-                oldPasswordField = null;
-            } else if (pw1 == pw2) {
-                newPasswordField = pwFields[0].element;
-                oldPasswordField = pwFields[2].element;
-            } else if (pw2 == pw3) {
-                oldPasswordField = pwFields[0].element;
-                newPasswordField = pwFields[2].element;
-            } else  if (pw1 == pw3) {
-                // A bit odd, but could make sense with the right page layout.
-                newPasswordField = pwFields[0].element;
-                oldPasswordField = pwFields[1].element;
-            } else {
-                // We can't tell which of the 3 passwords should be saved.
-                log("(form ignored -- all 3 pw fields differ)");
-                return [null, null, null];
-            }
-        } else { // pwFields.length == 2
-            if (pw1 == pw2) {
-                // Treat as if 1 pw field
-                newPasswordField = pwFields[0].element;
-                oldPasswordField = null;
-            } else {
-                // Just assume that the 2nd password is the new password
-                oldPasswordField = pwFields[0].element;
-                newPasswordField = pwFields[1].element;
-            }
-        }
+      if (pw1 == pw2 && pw2 == pw3) {
+        // All 3 passwords the same? Weird! Treat as if 1 pw field.
+        newPasswordField = pwFields[0].element;
+        oldPasswordField = null;
+      } else if (pw1 == pw2) {
+        newPasswordField = pwFields[0].element;
+        oldPasswordField = pwFields[2].element;
+      } else if (pw2 == pw3) {
+        oldPasswordField = pwFields[0].element;
+        newPasswordField = pwFields[2].element;
+      } else  if (pw1 == pw3) {
+        // A bit odd, but could make sense with the right page layout.
+        newPasswordField = pwFields[0].element;
+        oldPasswordField = pwFields[1].element;
+      } else {
+        // We can't tell which of the 3 passwords should be saved.
+        log("(form ignored -- all 3 pw fields differ)");
+        return [null, null, null];
+      }
+    } else { // pwFields.length == 2
+      if (pw1 == pw2) {
+        // Treat as if 1 pw field
+        newPasswordField = pwFields[0].element;
+        oldPasswordField = null;
+      } else {
+        // Just assume that the 2nd password is the new password
+        oldPasswordField = pwFields[0].element;
+        newPasswordField = pwFields[1].element;
+      }
+    }
 
-        return [usernameField, newPasswordField, oldPasswordField];
-    },
+    return [usernameField, newPasswordField, oldPasswordField];
+  },
 
 
-    /*
-     * _isAutoCompleteDisabled
-     *
-     * Returns true if the page requests autocomplete be disabled for the
-     * specified form input.
-     */
-    _isAutocompleteDisabled :  function (element) {
-        if (element && element.hasAttribute("autocomplete") &&
-            element.getAttribute("autocomplete").toLowerCase() == "off")
-            return true;
-        
-        return false;
-    },
+  /*
+   * _isAutoCompleteDisabled
+   *
+   * Returns true if the page requests autocomplete be disabled for the
+   * specified form input.
+   */
+  _isAutocompleteDisabled :  function (element) {
+    if (element && element.hasAttribute("autocomplete") &&
+        element.getAttribute("autocomplete").toLowerCase() == "off")
+      return true;
+
+    return false;
+  },
 
 
-    /*
-     * _onFormSubmit
-     *
-     * Called by the our observer when notified of a form submission.
-     * [Note that this happens before any DOM onsubmit handlers are invoked.]
-     * Looks for a password change in the submitted form, so we can update
-     * our stored password.
-     */
-    _onFormSubmit : function (form) {
-        var doc = form.ownerDocument;
-        var win = doc.defaultView;
+  /*
+   * _onFormSubmit
+   *
+   * Called by the our observer when notified of a form submission.
+   * [Note that this happens before any DOM onsubmit handlers are invoked.]
+   * Looks for a password change in the submitted form, so we can update
+   * our stored password.
+   */
+  _onFormSubmit : function (form) {
+    var doc = form.ownerDocument;
+    var win = doc.defaultView;
 
-        if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
-            // We won't do anything in private browsing mode anyway,
-            // so there's no need to perform further checks.
-            log("(form submission ignored in private browsing mode)");
-            return;
-        }
+    if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
+      // We won't do anything in private browsing mode anyway,
+      // so there's no need to perform further checks.
+      log("(form submission ignored in private browsing mode)");
+      return;
+    }
 
-        // If password saving is disabled (globally or for host), bail out now.
-        if (!gEnabled)
-            return;
+    // If password saving is disabled (globally or for host), bail out now.
+    if (!gEnabled)
+      return;
 
-        var hostname = LoginUtils._getPasswordOrigin(doc.documentURI);
-        if (!hostname) {
-            log("(form submission ignored -- invalid hostname)");
-            return;
-        }
+    var hostname = LoginUtils._getPasswordOrigin(doc.documentURI);
+    if (!hostname) {
+      log("(form submission ignored -- invalid hostname)");
+      return;
+    }
 
-        // Somewhat gross hack - we don't want to show the "remember password"
-        // notification on about:accounts for Firefox.
-        let topWin = win.top;
-        if (/^about:accounts($|\?)/i.test(topWin.document.documentURI)) {
-            log("(form submission ignored -- about:accounts)");
-            return;
-        }
+    // Somewhat gross hack - we don't want to show the "remember password"
+    // notification on about:accounts for Firefox.
+    let topWin = win.top;
+    if (/^about:accounts($|\?)/i.test(topWin.document.documentURI)) {
+      log("(form submission ignored -- about:accounts)");
+      return;
+    }
 
-        var formSubmitURL = LoginUtils._getActionOrigin(form)
+    var formSubmitURL = LoginUtils._getActionOrigin(form)
 
-        // Get the appropriate fields from the form.
-        var [usernameField, newPasswordField, oldPasswordField] =
-            this._getFormFields(form, true);
+    // Get the appropriate fields from the form.
+    var [usernameField, newPasswordField, oldPasswordField] =
+        this._getFormFields(form, true);
 
-        // Need at least 1 valid password field to do anything.
-        if (newPasswordField == null)
-            return;
+    // Need at least 1 valid password field to do anything.
+    if (newPasswordField == null)
+      return;
 
-        // Check for autocomplete=off attribute. We don't use it to prevent
-        // autofilling (for existing logins), but won't save logins when it's
-        // present and the storeWhenAutocompleteOff pref is false.
-        // XXX spin out a bug that we don't update timeLastUsed in this case?
-        if ((this._isAutocompleteDisabled(form) ||
-             this._isAutocompleteDisabled(usernameField) ||
-             this._isAutocompleteDisabled(newPasswordField) ||
-             this._isAutocompleteDisabled(oldPasswordField)) &&
-            !gStoreWhenAutocompleteOff) {
-                log("(form submission ignored -- autocomplete=off found)");
-                return;
-        }
+    // Check for autocomplete=off attribute. We don't use it to prevent
+    // autofilling (for existing logins), but won't save logins when it's
+    // present and the storeWhenAutocompleteOff pref is false.
+    // XXX spin out a bug that we don't update timeLastUsed in this case?
+    if ((this._isAutocompleteDisabled(form) ||
+         this._isAutocompleteDisabled(usernameField) ||
+         this._isAutocompleteDisabled(newPasswordField) ||
+         this._isAutocompleteDisabled(oldPasswordField)) &&
+        !gStoreWhenAutocompleteOff) {
+      log("(form submission ignored -- autocomplete=off found)");
+      return;
+    }
 
-        // Don't try to send DOM nodes over IPC.
-        let mockUsername = usernameField ?
-                             { name: usernameField.name,
-                               value: usernameField.value } :
-                             null;
-        let mockPassword = { name: newPasswordField.name,
-                             value: newPasswordField.value };
-        let mockOldPassword = oldPasswordField ?
-                                { name: oldPasswordField.name,
-                                  value: oldPasswordField.value } :
-                                null;
+    // Don't try to send DOM nodes over IPC.
+    let mockUsername = usernameField ?
+                         { name: usernameField.name,
+                           value: usernameField.value } :
+                         null;
+    let mockPassword = { name: newPasswordField.name,
+                         value: newPasswordField.value };
+    let mockOldPassword = oldPasswordField ?
+                            { name: oldPasswordField.name,
+                              value: oldPasswordField.value } :
+                            null;
 
-        // Make sure to pass the opener's top in case it was in a frame.
-        let opener = win.opener ? win.opener.top : null;
+    // Make sure to pass the opener's top in case it was in a frame.
+    let opener = win.opener ? win.opener.top : null;
 
-        let messageManager = messageManagerFromWindow(win);
-        messageManager.sendAsyncMessage("RemoteLogins:onFormSubmit",
-                                        { hostname: hostname,
-                                          formSubmitURL: formSubmitURL,
-                                          usernameField: mockUsername,
-                                          newPasswordField: mockPassword,
-                                          oldPasswordField: mockOldPassword },
-                                        { openerWin: opener });
-    },
+    let messageManager = messageManagerFromWindow(win);
+    messageManager.sendAsyncMessage("RemoteLogins:onFormSubmit",
+                                    { hostname: hostname,
+                                      formSubmitURL: formSubmitURL,
+                                      usernameField: mockUsername,
+                                      newPasswordField: mockPassword,
+                                      oldPasswordField: mockOldPassword },
+                                    { openerWin: opener });
+  },
 
-    /*
-     * _fillform
-     *
-     * Fill the form with login information if we can find it. This will find
-     * an array of logins if not given any, otherwise it will use the logins
-     * passed in. The logins are returned so they can be reused for
-     * optimization. Success of action is also returned in format
-     * [success, foundLogins].
-     *
-     * - autofillForm denotes if we should fill the form in automatically
-     * - ignoreAutocomplete denotes if we should ignore autocomplete=off
-     *     attributes
-     * - userTriggered is an indication of whether this filling was triggered by
-     *     the user
-     * - foundLogins is an array of nsILoginInfo for optimization
-     */
-    _fillForm : function (form, autofillForm, ignoreAutocomplete,
-                          clobberPassword, userTriggered, foundLogins) {
-        // Heuristically determine what the user/pass fields are
-        // We do this before checking to see if logins are stored,
-        // so that the user isn't prompted for a master password
-        // without need.
-        var [usernameField, passwordField, ignored] =
-            this._getFormFields(form, false);
+  /*
+   * _fillform
+   *
+   * Fill the form with login information if we can find it. This will find
+   * an array of logins if not given any, otherwise it will use the logins
+   * passed in. The logins are returned so they can be reused for
+   * optimization. Success of action is also returned in format
+   * [success, foundLogins].
+   *
+   * - autofillForm denotes if we should fill the form in automatically
+   * - ignoreAutocomplete denotes if we should ignore autocomplete=off
+   *     attributes
+   * - userTriggered is an indication of whether this filling was triggered by
+   *     the user
+   * - foundLogins is an array of nsILoginInfo for optimization
+   */
+  _fillForm : function (form, autofillForm, ignoreAutocomplete,
+                        clobberPassword, userTriggered, foundLogins) {
+    // Heuristically determine what the user/pass fields are
+    // We do this before checking to see if logins are stored,
+    // so that the user isn't prompted for a master password
+    // without need.
+    var [usernameField, passwordField, ignored] =
+        this._getFormFields(form, false);
 
-        // Need a valid password field to do anything.
-        if (passwordField == null)
-            return [false, foundLogins];
+    // Need a valid password field to do anything.
+    if (passwordField == null)
+      return [false, foundLogins];
 
-        // If the password field is disabled or read-only, there's nothing to do.
-        if (passwordField.disabled || passwordField.readOnly) {
-            log("not filling form, password field disabled or read-only");
-            return [false, foundLogins];
-        }
+    // If the password field is disabled or read-only, there's nothing to do.
+    if (passwordField.disabled || passwordField.readOnly) {
+      log("not filling form, password field disabled or read-only");
+      return [false, foundLogins];
+    }
 
-        // Discard logins which have username/password values that don't
-        // fit into the fields (as specified by the maxlength attribute).
-        // The user couldn't enter these values anyway, and it helps
-        // with sites that have an extra PIN to be entered (bug 391514)
-        var maxUsernameLen = Number.MAX_VALUE;
-        var maxPasswordLen = Number.MAX_VALUE;
+    // Discard logins which have username/password values that don't
+    // fit into the fields (as specified by the maxlength attribute).
+    // The user couldn't enter these values anyway, and it helps
+    // with sites that have an extra PIN to be entered (bug 391514)
+    var maxUsernameLen = Number.MAX_VALUE;
+    var maxPasswordLen = Number.MAX_VALUE;
 
-        // If attribute wasn't set, default is -1.
-        if (usernameField && usernameField.maxLength >= 0)
-            maxUsernameLen = usernameField.maxLength;
-        if (passwordField.maxLength >= 0)
-            maxPasswordLen = passwordField.maxLength;
+    // If attribute wasn't set, default is -1.
+    if (usernameField && usernameField.maxLength >= 0)
+      maxUsernameLen = usernameField.maxLength;
+    if (passwordField.maxLength >= 0)
+      maxPasswordLen = passwordField.maxLength;
 
-        foundLogins = foundLogins.map(login => {
-            var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                            createInstance(Ci.nsILoginInfo);
-            formLogin.init(login.hostname, login.formSubmitURL,
-                           login.httpRealm, login.username,
-                           login.password, login.usernameField,
-                           login.passwordField);
-            return formLogin;
-        });
-        var logins = foundLogins.filter(function (l) {
-                var fit = (l.username.length <= maxUsernameLen &&
-                           l.password.length <= maxPasswordLen);
-                if (!fit)
-                    log("Ignored", l.username, "login: won't fit");
+    foundLogins = foundLogins.map(login => {
+      var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                      createInstance(Ci.nsILoginInfo);
+      formLogin.init(login.hostname, login.formSubmitURL,
+                     login.httpRealm, login.username,
+                     login.password, login.usernameField,
+                     login.passwordField);
+      return formLogin;
+    });
+    var logins = foundLogins.filter(function (l) {
+      var fit = (l.username.length <= maxUsernameLen &&
+                 l.password.length <= maxPasswordLen);
+      if (!fit)
+        log("Ignored", l.username, "login: won't fit");
 
-                return fit;
-            }, this);
+      return fit;
+    }, this);
 
 
-        // Nothing to do if we have no matching logins available.
-        if (logins.length == 0)
-            return [false, foundLogins];
+    // Nothing to do if we have no matching logins available.
+    if (logins.length == 0)
+      return [false, foundLogins];
 
 
-        // The reason we didn't end up filling the form, if any.  We include
-        // this in the formInfo object we send with the passwordmgr-found-logins
-        // notification.  See the _notifyFoundLogins docs for possible values.
-        var didntFillReason = null;
+    // The reason we didn't end up filling the form, if any.  We include
+    // this in the formInfo object we send with the passwordmgr-found-logins
+    // notification.  See the _notifyFoundLogins docs for possible values.
+    var didntFillReason = null;
 
-        // Attach autocomplete stuff to the username field, if we have
-        // one. This is normally used to select from multiple accounts,
-        // but even with one account we should refill if the user edits.
-        if (usernameField)
-            this._formFillService.markAsLoginManagerField(usernameField);
+    // Attach autocomplete stuff to the username field, if we have
+    // one. This is normally used to select from multiple accounts,
+    // but even with one account we should refill if the user edits.
+    if (usernameField)
+      this._formFillService.markAsLoginManagerField(usernameField);
 
-        // Don't clobber an existing password.
-        if (passwordField.value && !clobberPassword) {
-            didntFillReason = "existingPassword";
-            this._notifyFoundLogins(didntFillReason, usernameField,
-                                    passwordField, foundLogins, null);
-            return [false, foundLogins];
-        }
+    // Don't clobber an existing password.
+    if (passwordField.value && !clobberPassword) {
+      didntFillReason = "existingPassword";
+      this._notifyFoundLogins(didntFillReason, usernameField,
+                              passwordField, foundLogins, null);
+      return [false, foundLogins];
+    }
 
-        // If the form has an autocomplete=off attribute in play, don't
-        // fill in the login automatically. We check this after attaching
-        // the autocomplete stuff to the username field, so the user can
-        // still manually select a login to be filled in.
-        var isFormDisabled = false;
-        if (!ignoreAutocomplete &&
-            (this._isAutocompleteDisabled(form) ||
-             this._isAutocompleteDisabled(usernameField) ||
-             this._isAutocompleteDisabled(passwordField))) {
+    // If the form has an autocomplete=off attribute in play, don't
+    // fill in the login automatically. We check this after attaching
+    // the autocomplete stuff to the username field, so the user can
+    // still manually select a login to be filled in.
+    var isFormDisabled = false;
+    if (!ignoreAutocomplete &&
+        (this._isAutocompleteDisabled(form) ||
+         this._isAutocompleteDisabled(usernameField) ||
+         this._isAutocompleteDisabled(passwordField))) {
 
-            isFormDisabled = true;
-            log("form not filled, has autocomplete=off");
-        }
+      isFormDisabled = true;
+      log("form not filled, has autocomplete=off");
+    }
 
-        // Variable such that we reduce code duplication and can be sure we
-        // should be firing notifications if and only if we can fill the form.
-        var selectedLogin = null;
+    // Variable such that we reduce code duplication and can be sure we
+    // should be firing notifications if and only if we can fill the form.
+    var selectedLogin = null;
 
-        if (usernameField && (usernameField.value || usernameField.disabled || usernameField.readOnly)) {
-            // If username was specified in the field, it's disabled or it's readOnly, only fill in the
-            // password if we find a matching login.
-            var username = usernameField.value.toLowerCase();
+    if (usernameField && (usernameField.value || usernameField.disabled || usernameField.readOnly)) {
+      // If username was specified in the field, it's disabled or it's readOnly, only fill in the
+      // password if we find a matching login.
+      var username = usernameField.value.toLowerCase();
 
-            let matchingLogins = logins.filter(function(l)
-                                     l.username.toLowerCase() == username);
-            if (matchingLogins.length) {
-                // If there are multiple, and one matches case, use it
-                for (let l of matchingLogins) {
-                    if (l.username == usernameField.value) {
-                        selectedLogin = l;
-                    }
-                }
-                // Otherwise just use the first
-                if (!selectedLogin) {
-                  selectedLogin = matchingLogins[0];
-                }
-            } else {
-                didntFillReason = "existingUsername";
-                log("Password not filled. None of the stored logins match the username already present.");
-            }
-        } else if (logins.length == 1) {
-            selectedLogin = logins[0];
-        } else {
-            // We have multiple logins. Handle a special case here, for sites
-            // which have a normal user+pass login *and* a password-only login
-            // (eg, a PIN). Prefer the login that matches the type of the form
-            // (user+pass or pass-only) when there's exactly one that matches.
-            let matchingLogins;
-            if (usernameField)
-                matchingLogins = logins.filter(function(l) l.username);
-            else
-                matchingLogins = logins.filter(function(l) !l.username);
-            if (matchingLogins.length == 1) {
-                selectedLogin = matchingLogins[0];
-            } else {
-                didntFillReason = "multipleLogins";
-                log("Multiple logins for form, so not filling any.");
-            }
+      let matchingLogins = logins.filter(function(l)
+                                         l.username.toLowerCase() == username);
+      if (matchingLogins.length) {
+        // If there are multiple, and one matches case, use it
+        for (let l of matchingLogins) {
+          if (l.username == usernameField.value) {
+            selectedLogin = l;
+          }
+        }
+        // Otherwise just use the first
+        if (!selectedLogin) {
+          selectedLogin = matchingLogins[0];
         }
+      } else {
+        didntFillReason = "existingUsername";
+        log("Password not filled. None of the stored logins match the username already present.");
+      }
+    } else if (logins.length == 1) {
+      selectedLogin = logins[0];
+    } else {
+      // We have multiple logins. Handle a special case here, for sites
+      // which have a normal user+pass login *and* a password-only login
+      // (eg, a PIN). Prefer the login that matches the type of the form
+      // (user+pass or pass-only) when there's exactly one that matches.
+      let matchingLogins;
+      if (usernameField)
+        matchingLogins = logins.filter(function(l) l.username);
+      else
+        matchingLogins = logins.filter(function(l) !l.username);
+      if (matchingLogins.length == 1) {
+        selectedLogin = matchingLogins[0];
+      } else {
+        didntFillReason = "multipleLogins";
+        log("Multiple logins for form, so not filling any.");
+      }
+    }
 
-        var didFillForm = false;
-        if (selectedLogin && autofillForm && !isFormDisabled) {
-            // Fill the form
+    var didFillForm = false;
+    if (selectedLogin && autofillForm && !isFormDisabled) {
+      // Fill the form
 
-            if (usernameField) {
-                // Don't modify the username field if it's disabled or readOnly so we preserve its case.
-                let disabledOrReadOnly = usernameField.disabled || usernameField.readOnly;
+      if (usernameField) {
+        // Don't modify the username field if it's disabled or readOnly so we preserve its case.
+        let disabledOrReadOnly = usernameField.disabled || usernameField.readOnly;
 
-                let userNameDiffers = selectedLogin.username != usernameField.value;
-                // Don't replace the username if it differs only in case, and the user triggered
-                // this autocomplete. We assume that if it was user-triggered the entered text
-                // is desired.
-                let userEnteredDifferentCase = userTriggered && userNameDiffers &&
-                       usernameField.value.toLowerCase() == selectedLogin.username.toLowerCase();
+        let userNameDiffers = selectedLogin.username != usernameField.value;
+        // Don't replace the username if it differs only in case, and the user triggered
+        // this autocomplete. We assume that if it was user-triggered the entered text
+        // is desired.
+        let userEnteredDifferentCase = userTriggered && userNameDiffers &&
+               usernameField.value.toLowerCase() == selectedLogin.username.toLowerCase();
 
-                if (!disabledOrReadOnly && !userEnteredDifferentCase && userNameDiffers) {
-                    usernameField.setUserInput(selectedLogin.username);
-                }
-            }
-            if (passwordField.value != selectedLogin.password) {
-                passwordField.setUserInput(selectedLogin.password);
-            }
-            didFillForm = true;
-        } else if (selectedLogin && !autofillForm) {
-            // For when autofillForm is false, but we still have the information
-            // to fill a form, we notify observers.
-            didntFillReason = "noAutofillForms";
-            Services.obs.notifyObservers(form, "passwordmgr-found-form", didntFillReason);
-            log("autofillForms=false but form can be filled; notified observers");
-        } else if (selectedLogin && isFormDisabled) {
-            // For when autocomplete is off, but we still have the information
-            // to fill a form, we notify observers.
-            didntFillReason = "autocompleteOff";
-            Services.obs.notifyObservers(form, "passwordmgr-found-form", didntFillReason);
-            log("autocomplete=off but form can be filled; notified observers");
+        if (!disabledOrReadOnly && !userEnteredDifferentCase && userNameDiffers) {
+          usernameField.setUserInput(selectedLogin.username);
         }
+      }
+      if (passwordField.value != selectedLogin.password) {
+        passwordField.setUserInput(selectedLogin.password);
+      }
+      didFillForm = true;
+    } else if (selectedLogin && !autofillForm) {
+      // For when autofillForm is false, but we still have the information
+      // to fill a form, we notify observers.
+      didntFillReason = "noAutofillForms";
+      Services.obs.notifyObservers(form, "passwordmgr-found-form", didntFillReason);
+      log("autofillForms=false but form can be filled; notified observers");
+    } else if (selectedLogin && isFormDisabled) {
+      // For when autocomplete is off, but we still have the information
+      // to fill a form, we notify observers.
+      didntFillReason = "autocompleteOff";
+      Services.obs.notifyObservers(form, "passwordmgr-found-form", didntFillReason);
+      log("autocomplete=off but form can be filled; notified observers");
+    }
 
-        this._notifyFoundLogins(didntFillReason, usernameField, passwordField,
-                                foundLogins, selectedLogin);
+    this._notifyFoundLogins(didntFillReason, usernameField, passwordField,
+                            foundLogins, selectedLogin);
 
-        return [didFillForm, foundLogins];
-    },
+    return [didFillForm, foundLogins];
+  },
 
 
-    /**
-     * Notify observers about an attempt to fill a form that resulted in some
-     * saved logins being found for the form.
-     *
-     * This does not get called if the login manager attempts to fill a form
-     * but does not find any saved logins.  It does, however, get called when
-     * the login manager does find saved logins whether or not it actually
-     * fills the form with one of them.
-     *
-     * @param didntFillReason {String}
-     *        the reason the login manager didn't fill the form, if any;
-     *        if the value of this parameter is null, then the form was filled;
-     *        otherwise, this parameter will be one of these values:
-     *          existingUsername: the username field already contains a username
-     *                            that doesn't match any stored usernames
-     *          existingPassword: the password field already contains a password
-     *          autocompleteOff:  autocomplete has been disabled for the form
-     *                            or its username or password fields
-     *          multipleLogins:   we have multiple logins for the form
-     *          noAutofillForms:  the autofillForms pref is set to false
-     *
-     * @param usernameField   {HTMLInputElement}
-     *        the username field detected by the login manager, if any;
-     *        otherwise null
-     *
-     * @param passwordField   {HTMLInputElement}
-     *        the password field detected by the login manager
-     *
-     * @param foundLogins     {Array}
-     *        an array of nsILoginInfos that can be used to fill the form
-     *
-     * @param selectedLogin   {nsILoginInfo}
-     *        the nsILoginInfo that was/would be used to fill the form, if any;
-     *        otherwise null; whether or not it was actually used depends on
-     *        the value of the didntFillReason parameter
-     */
-    _notifyFoundLogins : function (didntFillReason, usernameField,
-                                   passwordField, foundLogins, selectedLogin) {
-        // We need .setProperty(), which is a method on the original
-        // nsIWritablePropertyBag. Strangley enough, nsIWritablePropertyBag2
-        // doesn't inherit from that, so the additional QI is needed.
-        let formInfo = Cc["@mozilla.org/hash-property-bag;1"].
-                       createInstance(Ci.nsIWritablePropertyBag2).
-                       QueryInterface(Ci.nsIWritablePropertyBag);
+  /**
+   * Notify observers about an attempt to fill a form that resulted in some
+   * saved logins being found for the form.
+   *
+   * This does not get called if the login manager attempts to fill a form
+   * but does not find any saved logins.  It does, however, get called when
+   * the login manager does find saved logins whether or not it actually
+   * fills the form with one of them.
+   *
+   * @param didntFillReason {String}
+   *        the reason the login manager didn't fill the form, if any;
+   *        if the value of this parameter is null, then the form was filled;
+   *        otherwise, this parameter will be one of these values:
+   *          existingUsername: the username field already contains a username
+   *                            that doesn't match any stored usernames
+   *          existingPassword: the password field already contains a password
+   *          autocompleteOff:  autocomplete has been disabled for the form
+   *                            or its username or password fields
+   *          multipleLogins:   we have multiple logins for the form
+   *          noAutofillForms:  the autofillForms pref is set to false
+   *
+   * @param usernameField   {HTMLInputElement}
+   *        the username field detected by the login manager, if any;
+   *        otherwise null
+   *
+   * @param passwordField   {HTMLInputElement}
+   *        the password field detected by the login manager
+   *
+   * @param foundLogins     {Array}
+   *        an array of nsILoginInfos that can be used to fill the form
+   *
+   * @param selectedLogin   {nsILoginInfo}
+   *        the nsILoginInfo that was/would be used to fill the form, if any;
+   *        otherwise null; whether or not it was actually used depends on
+   *        the value of the didntFillReason parameter
+   */
+  _notifyFoundLogins : function (didntFillReason, usernameField,
+                                 passwordField, foundLogins, selectedLogin) {
+    // We need .setProperty(), which is a method on the original
+    // nsIWritablePropertyBag. Strangley enough, nsIWritablePropertyBag2
+    // doesn't inherit from that, so the additional QI is needed.
+    let formInfo = Cc["@mozilla.org/hash-property-bag;1"].
+                   createInstance(Ci.nsIWritablePropertyBag2).
+                   QueryInterface(Ci.nsIWritablePropertyBag);
 
-        formInfo.setPropertyAsACString("didntFillReason", didntFillReason);
-        formInfo.setPropertyAsInterface("usernameField", usernameField);
-        formInfo.setPropertyAsInterface("passwordField", passwordField);
-        formInfo.setProperty("foundLogins", foundLogins.concat());
-        formInfo.setPropertyAsInterface("selectedLogin", selectedLogin);
+    formInfo.setPropertyAsACString("didntFillReason", didntFillReason);
+    formInfo.setPropertyAsInterface("usernameField", usernameField);
+    formInfo.setPropertyAsInterface("passwordField", passwordField);
+    formInfo.setProperty("foundLogins", foundLogins.concat());
+    formInfo.setPropertyAsInterface("selectedLogin", selectedLogin);
 
-        Services.obs.notifyObservers(formInfo, "passwordmgr-found-logins", null);
-    },
+    Services.obs.notifyObservers(formInfo, "passwordmgr-found-logins", null);
+  },
 
 };
 
 var LoginUtils = {
-    /*
-     * _getPasswordOrigin
-     *
-     * Get the parts of the URL we want for identification.
-     */
-    _getPasswordOrigin : function (uriString, allowJS) {
-        var realm = "";
-        try {
-            var uri = Services.io.newURI(uriString, null, null);
+  /*
+   * _getPasswordOrigin
+   *
+   * Get the parts of the URL we want for identification.
+   */
+  _getPasswordOrigin : function (uriString, allowJS) {
+    var realm = "";
+    try {
+      var uri = Services.io.newURI(uriString, null, null);
 
-            if (allowJS && uri.scheme == "javascript")
-                return "javascript:"
+      if (allowJS && uri.scheme == "javascript")
+        return "javascript:"
 
-            realm = uri.scheme + "://" + uri.host;
+      realm = uri.scheme + "://" + uri.host;
 
-            // If the URI explicitly specified a port, only include it when
-            // it's not the default. (We never want "http://foo.com:80")
-            var port = uri.port;
-            if (port != -1) {
-                var handler = Services.io.getProtocolHandler(uri.scheme);
-                if (port != handler.defaultPort)
-                    realm += ":" + port;
-            }
+      // If the URI explicitly specified a port, only include it when
+      // it's not the default. (We never want "http://foo.com:80")
+      var port = uri.port;
+      if (port != -1) {
+        var handler = Services.io.getProtocolHandler(uri.scheme);
+        if (port != handler.defaultPort)
+          realm += ":" + port;
+      }
 
-        } catch (e) {
-            // bug 159484 - disallow url types that don't support a hostPort.
-            // (although we handle "javascript:..." as a special case above.)
-            log("Couldn't parse origin for", uriString);
-            realm = null;
-        }
+    } catch (e) {
+      // bug 159484 - disallow url types that don't support a hostPort.
+      // (although we handle "javascript:..." as a special case above.)
+      log("Couldn't parse origin for", uriString);
+      realm = null;
+    }
 
-        return realm;
-    },
+    return realm;
+  },
 
-    _getActionOrigin : function (form) {
-        var uriString = form.action;
+  _getActionOrigin : function (form) {
+    var uriString = form.action;
 
-        // A blank or missing action submits to where it came from.
-        if (uriString == "")
-            uriString = form.baseURI; // ala bug 297761
+    // A blank or missing action submits to where it came from.
+    if (uriString == "")
+      uriString = form.baseURI; // ala bug 297761
 
-        return this._getPasswordOrigin(uriString, true);
-    },
+    return this._getPasswordOrigin(uriString, true);
+  },
 
 };
 
 // nsIAutoCompleteResult implementation
 function UserAutoCompleteResult (aSearchString, matchingLogins) {
-    function loginSort(a,b) {
-        var userA = a.username.toLowerCase();
-        var userB = b.username.toLowerCase();
+  function loginSort(a,b) {
+    var userA = a.username.toLowerCase();
+    var userB = b.username.toLowerCase();
 
-        if (userA < userB)
-            return -1;
+    if (userA < userB)
+      return -1;
 
-        if (userB > userA)
-            return  1;
+    if (userB > userA)
+      return  1;
 
-        return 0;
-    };
+    return 0;
+  };
 
-    this.searchString = aSearchString;
-    this.logins = matchingLogins.sort(loginSort);
-    this.matchCount = matchingLogins.length;
+  this.searchString = aSearchString;
+  this.logins = matchingLogins.sort(loginSort);
+  this.matchCount = matchingLogins.length;
 
-    if (this.matchCount > 0) {
-        this.searchResult = Ci.nsIAutoCompleteResult.RESULT_SUCCESS;
-        this.defaultIndex = 0;
-    }
+  if (this.matchCount > 0) {
+    this.searchResult = Ci.nsIAutoCompleteResult.RESULT_SUCCESS;
+    this.defaultIndex = 0;
+  }
 }
 
 UserAutoCompleteResult.prototype = {
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsIAutoCompleteResult,
-                                            Ci.nsISupportsWeakReference]),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsIAutoCompleteResult,
+                                          Ci.nsISupportsWeakReference]),
 
-    // private
-    logins : null,
+  // private
+  logins : null,
 
-    // Allow autoCompleteSearch to get at the JS object so it can
-    // modify some readonly properties for internal use.
-    get wrappedJSObject() {
-        return this;
-    },
+  // Allow autoCompleteSearch to get at the JS object so it can
+  // modify some readonly properties for internal use.
+  get wrappedJSObject() {
+    return this;
+  },
 
-    // Interfaces from idl...
-    searchString : null,
-    searchResult : Ci.nsIAutoCompleteResult.RESULT_NOMATCH,
-    defaultIndex : -1,
-    errorDescription : "",
-    matchCount : 0,
+  // Interfaces from idl...
+  searchString : null,
+  searchResult : Ci.nsIAutoCompleteResult.RESULT_NOMATCH,
+  defaultIndex : -1,
+  errorDescription : "",
+  matchCount : 0,
 
-    getValueAt : function (index) {
-        if (index < 0 || index >= this.logins.length)
-            throw "Index out of range.";
+  getValueAt : function (index) {
+    if (index < 0 || index >= this.logins.length)
+      throw "Index out of range.";
 
-        return this.logins[index].username;
-    },
+    return this.logins[index].username;
+  },
 
-    getLabelAt: function(index) {
-        return this.getValueAt(index);
-    },
+  getLabelAt: function(index) {
+    return this.getValueAt(index);
+  },
 
-    getCommentAt : function (index) {
-        return "";
-    },
+  getCommentAt : function (index) {
+    return "";
+  },
 
-    getStyleAt : function (index) {
-        return "";
-    },
+  getStyleAt : function (index) {
+    return "";
+  },
 
-    getImageAt : function (index) {
-        return "";
-    },
+  getImageAt : function (index) {
+    return "";
+  },
 
-    getFinalCompleteValueAt : function (index) {
-        return this.getValueAt(index);
-    },
+  getFinalCompleteValueAt : function (index) {
+    return this.getValueAt(index);
+  },
 
-    removeValueAt : function (index, removeFromDB) {
-        if (index < 0 || index >= this.logins.length)
-            throw "Index out of range.";
+  removeValueAt : function (index, removeFromDB) {
+    if (index < 0 || index >= this.logins.length)
+        throw "Index out of range.";
 
-        var [removedLogin] = this.logins.splice(index, 1);
+    var [removedLogin] = this.logins.splice(index, 1);
 
-        this.matchCount--;
-        if (this.defaultIndex > this.logins.length)
-            this.defaultIndex--;
+    this.matchCount--;
+    if (this.defaultIndex > this.logins.length)
+      this.defaultIndex--;
 
-        if (removeFromDB) {
-            var pwmgr = Cc["@mozilla.org/login-manager;1"].
-                        getService(Ci.nsILoginManager);
-            pwmgr.removeLogin(removedLogin);
-        }
+    if (removeFromDB) {
+      var pwmgr = Cc["@mozilla.org/login-manager;1"].
+                  getService(Ci.nsILoginManager);
+      pwmgr.removeLogin(removedLogin);
     }
+  }
 };
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -1,9 +1,9 @@
-/* vim: set ts=4 sts=4 sw=4 et tw=80: */
+/* vim: set ts=2 sts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
@@ -17,306 +17,306 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 XPCOMUtils.defineLazyModuleGetter(this, "AutoCompleteE10S",
                                   "resource://gre/modules/AutoCompleteE10S.jsm");
 
 this.EXPORTED_SYMBOLS = [ "LoginManagerParent" ];
 
 var gDebug;
 
 function log(...pieces) {
-    function generateLogMessage(args) {
-        let strings = ['Login Manager (parent):'];
+  function generateLogMessage(args) {
+    let strings = ['Login Manager (parent):'];
 
-        args.forEach(function(arg) {
-            if (typeof arg === 'string') {
-                strings.push(arg);
-            } else if (typeof arg === 'undefined') {
-                strings.push('undefined');
-            } else if (arg === null) {
-                strings.push('null');
-            } else {
-                try {
-                  strings.push(JSON.stringify(arg, null, 2));
-                } catch(err) {
-                  strings.push("<<something>>");
-                }
-            }
-        });
-        return strings.join(' ');
-    }
+    args.forEach(function(arg) {
+      if (typeof arg === 'string') {
+        strings.push(arg);
+      } else if (typeof arg === 'undefined') {
+        strings.push('undefined');
+      } else if (arg === null) {
+        strings.push('null');
+      } else {
+        try {
+          strings.push(JSON.stringify(arg, null, 2));
+        } catch(err) {
+          strings.push("<<something>>");
+        }
+      }
+    });
+    return strings.join(' ');
+  }
 
-    if (!gDebug)
-        return;
+  if (!gDebug)
+    return;
 
-    let message = generateLogMessage(pieces);
-    dump(message + "\n");
-    Services.console.logStringMessage(message);
+  let message = generateLogMessage(pieces);
+  dump(message + "\n");
+  Services.console.logStringMessage(message);
 }
 
 function prefChanged() {
-    gDebug = Services.prefs.getBoolPref("signon.debug");
+  gDebug = Services.prefs.getBoolPref("signon.debug");
 }
 
 Services.prefs.addObserver("signon.debug", prefChanged, false);
 prefChanged();
 
 var LoginManagerParent = {
-    init: function() {
-        let mm = Cc["@mozilla.org/globalmessagemanager;1"]
-                   .getService(Ci.nsIMessageListenerManager);
-        mm.addMessageListener("RemoteLogins:findLogins", this);
-        mm.addMessageListener("RemoteLogins:onFormSubmit", this);
-        mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
-    },
+  init: function() {
+    let mm = Cc["@mozilla.org/globalmessagemanager;1"]
+               .getService(Ci.nsIMessageListenerManager);
+    mm.addMessageListener("RemoteLogins:findLogins", this);
+    mm.addMessageListener("RemoteLogins:onFormSubmit", this);
+    mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
+  },
 
-    receiveMessage: function (msg) {
-        let data = msg.data;
-        switch (msg.name) {
-            case "RemoteLogins:findLogins": {
-                // TODO Verify msg.target's principals against the formOrigin?
-                this.findLogins(data.options.showMasterPassword,
-                                data.formOrigin,
-                                data.actionOrigin,
-                                data.requestId,
-                                msg.target.messageManager);
-                break;
-            }
+  receiveMessage: function (msg) {
+    let data = msg.data;
+    switch (msg.name) {
+      case "RemoteLogins:findLogins": {
+        // TODO Verify msg.target's principals against the formOrigin?
+        this.findLogins(data.options.showMasterPassword,
+                        data.formOrigin,
+                        data.actionOrigin,
+                        data.requestId,
+                        msg.target.messageManager);
+        break;
+      }
+
+      case "RemoteLogins:onFormSubmit": {
+        // TODO Verify msg.target's principals against the formOrigin?
+        this.onFormSubmit(data.hostname,
+                          data.formSubmitURL,
+                          data.usernameField,
+                          data.newPasswordField,
+                          data.oldPasswordField,
+                          msg.objects.openerWin,
+                          msg.target);
+        break;
+      }
 
-            case "RemoteLogins:onFormSubmit": {
-                // TODO Verify msg.target's principals against the formOrigin?
-                this.onFormSubmit(data.hostname,
-                                  data.formSubmitURL,
-                                  data.usernameField,
-                                  data.newPasswordField,
-                                  data.oldPasswordField,
-                                  msg.objects.openerWin,
-                                  msg.target);
-                break;
-            }
+      case "RemoteLogins:autoCompleteLogins": {
+        this.doAutocompleteSearch(data, msg.target);
+        break;
+      }
+    }
+  },
+
+  findLogins: function(showMasterPassword, formOrigin, actionOrigin,
+                       requestId, target) {
+    if (!showMasterPassword && !Services.logins.isLoggedIn) {
+      target.sendAsyncMessage("RemoteLogins:loginsFound",
+                              { requestId: requestId, logins: [] });
+      return;
+    }
 
-            case "RemoteLogins:autoCompleteLogins": {
-                this.doAutocompleteSearch(data, msg.target);
-                break;
-            }
-        }
-    },
+    // If there are no logins for this site, bail out now.
+    if (!Services.logins.countLogins(formOrigin, "", null)) {
+      target.sendAsyncMessage("RemoteLogins:loginsFound",
+                              { requestId: requestId, logins: [] });
+      return;
+    }
 
-    findLogins: function(showMasterPassword, formOrigin, actionOrigin,
-                         requestId, target) {
-        if (!showMasterPassword && !Services.logins.isLoggedIn) {
-            target.sendAsyncMessage("RemoteLogins:loginsFound",
-                                    { requestId: requestId, logins: [] });
-            return;
-        }
+    // If we're currently displaying a master password prompt, defer
+    // processing this form until the user handles the prompt.
+    if (Services.logins.uiBusy) {
+      log("deferring onFormPassword for", formOrigin);
+      let self = this;
+      let observer = {
+        QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+                                               Ci.nsISupportsWeakReference]),
 
-        // If there are no logins for this site, bail out now.
-        if (!Services.logins.countLogins(formOrigin, "", null)) {
+        observe: function (subject, topic, data) {
+          log("Got deferred onFormPassword notification:", topic);
+          // Only run observer once.
+          Services.obs.removeObserver(this, "passwordmgr-crypto-login");
+          Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
+          if (topic == "passwordmgr-crypto-loginCanceled") {
             target.sendAsyncMessage("RemoteLogins:loginsFound",
                                     { requestId: requestId, logins: [] });
             return;
-        }
+          }
 
-        // If we're currently displaying a master password prompt, defer
-        // processing this form until the user handles the prompt.
-        if (Services.logins.uiBusy) {
-            log("deferring onFormPassword for", formOrigin);
-            let self = this;
-            let observer = {
-                QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
-                                                       Ci.nsISupportsWeakReference]),
+          self.findLogins(showMasterPassword, formOrigin, actionOrigin,
+                          requestId, target);
+        },
+      };
 
-                observe: function (subject, topic, data) {
-                    log("Got deferred onFormPassword notification:", topic);
-                    // Only run observer once.
-                    Services.obs.removeObserver(this, "passwordmgr-crypto-login");
-                    Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
-                    if (topic == "passwordmgr-crypto-loginCanceled") {
-                        target.sendAsyncMessage("RemoteLogins:loginsFound",
-                                                { requestId: requestId, logins: [] });
-                        return;
-                    }
+      // Possible leak: it's possible that neither of these notifications
+      // will fire, and if that happens, we'll leak the observer (and
+      // never return). We should guarantee that at least one of these
+      // will fire.
+      // See bug XXX.
+      Services.obs.addObserver(observer, "passwordmgr-crypto-login", false);
+      Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", false);
+      return;
+    }
 
-                    self.findLogins(showMasterPassword, formOrigin, actionOrigin,
-                                    requestId, target);
-                },
-            };
+    var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
+    target.sendAsyncMessage("RemoteLogins:loginsFound",
+                            { requestId: requestId, logins: logins });
+  },
+
+  doAutocompleteSearch: function({ formOrigin, actionOrigin,
+                                   searchString, previousResult,
+                                   rect, requestId, remote }, target) {
+    // Note: previousResult is a regular object, not an
+    // nsIAutoCompleteResult.
+    var result;
 
-            // Possible leak: it's possible that neither of these notifications
-            // will fire, and if that happens, we'll leak the observer (and
-            // never return). We should guarantee that at least one of these
-            // will fire.
-            // See bug XXX.
-            Services.obs.addObserver(observer, "passwordmgr-crypto-login", false);
-            Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", false);
-            return;
-        }
+    let searchStringLower = searchString.toLowerCase();
+    let logins;
+    if (previousResult &&
+        searchStringLower.startsWith(previousResult.searchString.toLowerCase())) {
+      log("Using previous autocomplete result");
 
-        var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
-        target.sendAsyncMessage("RemoteLogins:loginsFound",
-                                { requestId: requestId, logins: logins });
-    },
+      // We have a list of results for a shorter search string, so just
+      // filter them further based on the new search string.
+      logins = previousResult.logins;
+    } else {
+      log("Creating new autocomplete search result.");
 
-    doAutocompleteSearch: function({ formOrigin, actionOrigin,
-                                     searchString, previousResult,
-                                     rect, requestId, remote }, target) {
-        // Note: previousResult is a regular object, not an
-        // nsIAutoCompleteResult.
-        var result;
+      // Grab the logins from the database.
+      logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
+    }
 
-        let searchStringLower = searchString.toLowerCase();
-        let logins;
-        if (previousResult &&
-            searchStringLower.startsWith(previousResult.searchString.toLowerCase())) {
-            log("Using previous autocomplete result");
+    let matchingLogins = logins.filter(function(fullMatch) {
+      let match = fullMatch.username;
 
-            // We have a list of results for a shorter search string, so just
-            // filter them further based on the new search string.
-            logins = previousResult.logins;
-        } else {
-            log("Creating new autocomplete search result.");
+      // Remove results that are too short, or have different prefix.
+      // Also don't offer empty usernames as possible results.
+      return match && match.toLowerCase().startsWith(searchStringLower);
+    });
 
-            // Grab the logins from the database.
-            logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
-        }
-
-        let matchingLogins = logins.filter(function(fullMatch) {
-            let match = fullMatch.username;
-
-            // Remove results that are too short, or have different prefix.
-            // Also don't offer empty usernames as possible results.
-            return match && match.toLowerCase().startsWith(searchStringLower);
-        });
+    // XXX In the E10S case, we're responsible for showing our own
+    // autocomplete popup here because the autocomplete protocol hasn't
+    // been e10s-ized yet. In the non-e10s case, our caller is responsible
+    // for showing the autocomplete popup (via the regular
+    // nsAutoCompleteController).
+    if (remote) {
+      result = new UserAutoCompleteResult(searchString, matchingLogins);
+      AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result);
+    }
 
-        // XXX In the E10S case, we're responsible for showing our own
-        // autocomplete popup here because the autocomplete protocol hasn't
-        // been e10s-ized yet. In the non-e10s case, our caller is responsible
-        // for showing the autocomplete popup (via the regular
-        // nsAutoCompleteController).
-        if (remote) {
-            result = new UserAutoCompleteResult(searchString, matchingLogins);
-            AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result);
-        }
-
-        target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted",
-                                               { requestId: requestId,
-                                                 logins: matchingLogins });
-    },
+    target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted",
+                                           { requestId: requestId,
+                                             logins: matchingLogins });
+  },
 
-    onFormSubmit: function(hostname, formSubmitURL,
-                           usernameField, newPasswordField,
-                           oldPasswordField, opener,
-                           target) {
-        function getPrompter() {
-            var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
-                              createInstance(Ci.nsILoginManagerPrompter);
-            // XXX For E10S, we don't want to use the browser's contentWindow
-            // because it's in another process, so we use our chrome window as
-            // the window parent (the content process is responsible for
-            // making sure that its window is not in private browsing mode).
-            // In the same-process case, we can simply use the content window.
-            prompterSvc.init(target.isRemoteBrowser ?
-                                target.ownerDocument.defaultView :
-                                target.contentWindow);
-            if (target.isRemoteBrowser)
-                prompterSvc.setE10sData(target, opener);
-            return prompterSvc;
-        }
+  onFormSubmit: function(hostname, formSubmitURL,
+                         usernameField, newPasswordField,
+                         oldPasswordField, opener,
+                         target) {
+    function getPrompter() {
+      var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
+                        createInstance(Ci.nsILoginManagerPrompter);
+      // XXX For E10S, we don't want to use the browser's contentWindow
+      // because it's in another process, so we use our chrome window as
+      // the window parent (the content process is responsible for
+      // making sure that its window is not in private browsing mode).
+      // In the same-process case, we can simply use the content window.
+      prompterSvc.init(target.isRemoteBrowser ?
+                          target.ownerDocument.defaultView :
+                          target.contentWindow);
+      if (target.isRemoteBrowser)
+        prompterSvc.setE10sData(target, opener);
+      return prompterSvc;
+    }
+
+    if (!Services.logins.getLoginSavingEnabled(hostname)) {
+      log("(form submission ignored -- saving is disabled for:", hostname, ")");
+      return;
+    }
 
-        if (!Services.logins.getLoginSavingEnabled(hostname)) {
-            log("(form submission ignored -- saving is disabled for:", hostname, ")");
-            return;
-        }
+    var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                    createInstance(Ci.nsILoginInfo);
+    formLogin.init(hostname, formSubmitURL, null,
+                   (usernameField ? usernameField.value : ""),
+                   newPasswordField.value,
+                   (usernameField ? usernameField.name  : ""),
+                   newPasswordField.name);
 
-        var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                        createInstance(Ci.nsILoginInfo);
-        formLogin.init(hostname, formSubmitURL, null,
-                    (usernameField ? usernameField.value : ""),
-                    newPasswordField.value,
-                    (usernameField ? usernameField.name  : ""),
-                    newPasswordField.name);
+    // If we didn't find a username field, but seem to be changing a
+    // password, allow the user to select from a list of applicable
+    // logins to update the password for.
+    if (!usernameField && oldPasswordField) {
 
-        // If we didn't find a username field, but seem to be changing a
-        // password, allow the user to select from a list of applicable
-        // logins to update the password for.
-        if (!usernameField && oldPasswordField) {
-
-            var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
+      var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
 
-            if (logins.length == 0) {
-                // Could prompt to save this as a new password-only login.
-                // This seems uncommon, and might be wrong, so ignore.
-                log("(no logins for this host -- pwchange ignored)");
-                return;
-            }
+      if (logins.length == 0) {
+        // Could prompt to save this as a new password-only login.
+        // This seems uncommon, and might be wrong, so ignore.
+        log("(no logins for this host -- pwchange ignored)");
+        return;
+      }
 
-            var prompter = getPrompter();
+      var prompter = getPrompter();
 
-            if (logins.length == 1) {
-                var oldLogin = logins[0];
-                formLogin.username      = oldLogin.username;
-                formLogin.usernameField = oldLogin.usernameField;
+      if (logins.length == 1) {
+        var oldLogin = logins[0];
+        formLogin.username      = oldLogin.username;
+        formLogin.usernameField = oldLogin.usernameField;
 
-                prompter.promptToChangePassword(oldLogin, formLogin);
-            } else {
-                prompter.promptToChangePasswordWithUsernames(
-                                    logins, logins.length, formLogin);
-            }
+        prompter.promptToChangePassword(oldLogin, formLogin);
+      } else {
+        prompter.promptToChangePasswordWithUsernames(
+                            logins, logins.length, formLogin);
+      }
 
-            return;
-        }
+      return;
+    }
 
 
-        // Look for an existing login that matches the form login.
-        var existingLogin = null;
-        var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
+    // Look for an existing login that matches the form login.
+    var existingLogin = null;
+    var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
 
-        for (var i = 0; i < logins.length; i++) {
-            var same, login = logins[i];
+    for (var i = 0; i < logins.length; i++) {
+      var same, login = logins[i];
 
-            // If one login has a username but the other doesn't, ignore
-            // the username when comparing and only match if they have the
-            // same password. Otherwise, compare the logins and match even
-            // if the passwords differ.
-            if (!login.username && formLogin.username) {
-                var restoreMe = formLogin.username;
-                formLogin.username = "";
-                same = formLogin.matches(login, false);
-                formLogin.username = restoreMe;
-            } else if (!formLogin.username && login.username) {
-                formLogin.username = login.username;
-                same = formLogin.matches(login, false);
-                formLogin.username = ""; // we know it's always blank.
-            } else {
-                same = formLogin.matches(login, true);
-            }
+      // If one login has a username but the other doesn't, ignore
+      // the username when comparing and only match if they have the
+      // same password. Otherwise, compare the logins and match even
+      // if the passwords differ.
+      if (!login.username && formLogin.username) {
+        var restoreMe = formLogin.username;
+        formLogin.username = "";
+        same = formLogin.matches(login, false);
+        formLogin.username = restoreMe;
+      } else if (!formLogin.username && login.username) {
+        formLogin.username = login.username;
+        same = formLogin.matches(login, false);
+        formLogin.username = ""; // we know it's always blank.
+      } else {
+        same = formLogin.matches(login, true);
+      }
 
-            if (same) {
-                existingLogin = login;
-                break;
-            }
-        }
+      if (same) {
+        existingLogin = login;
+        break;
+      }
+    }
 
-        if (existingLogin) {
-            log("Found an existing login matching this form submission");
+    if (existingLogin) {
+      log("Found an existing login matching this form submission");
 
-            // Change password if needed.
-            if (existingLogin.password != formLogin.password) {
-                log("...passwords differ, prompting to change.");
-                prompter = getPrompter();
-                prompter.promptToChangePassword(existingLogin, formLogin);
-            } else {
-                // Update the lastUsed timestamp.
-                var propBag = Cc["@mozilla.org/hash-property-bag;1"].
-                              createInstance(Ci.nsIWritablePropertyBag);
-                propBag.setProperty("timeLastUsed", Date.now());
-                propBag.setProperty("timesUsedIncrement", 1);
-                Services.logins.modifyLogin(existingLogin, propBag);
-            }
+      // Change password if needed.
+      if (existingLogin.password != formLogin.password) {
+        log("...passwords differ, prompting to change.");
+        prompter = getPrompter();
+        prompter.promptToChangePassword(existingLogin, formLogin);
+      } else {
+        // Update the lastUsed timestamp.
+        var propBag = Cc["@mozilla.org/hash-property-bag;1"].
+                      createInstance(Ci.nsIWritablePropertyBag);
+        propBag.setProperty("timeLastUsed", Date.now());
+        propBag.setProperty("timesUsedIncrement", 1);
+        Services.logins.modifyLogin(existingLogin, propBag);
+      }
 
-            return;
-        }
+      return;
+    }
 
 
-        // Prompt user to save login (via dialog or notification bar)
-        prompter = getPrompter();
-        prompter.promptToSavePassword(formLogin);
-    }
+    // Prompt user to save login (via dialog or notification bar)
+    prompter = getPrompter();
+    prompter.promptToSavePassword(formLogin);
+  }
 };
--- a/toolkit/components/passwordmgr/crypto-SDR.js
+++ b/toolkit/components/passwordmgr/crypto-SDR.js
@@ -6,216 +6,216 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 function LoginManagerCrypto_SDR() {
-    this.init();
+  this.init();
 };
 
 LoginManagerCrypto_SDR.prototype = {
 
-    classID : Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerCrypto]),
+  classID : Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerCrypto]),
 
-    __sdrSlot : null, // PKCS#11 slot being used by the SDR.
-    get _sdrSlot() {
-        if (!this.__sdrSlot) {
-            let modules = Cc["@mozilla.org/security/pkcs11moduledb;1"].
-                          getService(Ci.nsIPKCS11ModuleDB);
-            this.__sdrSlot = modules.findSlotByName("");
-        }
-        return this.__sdrSlot;
-    },
+  __sdrSlot : null, // PKCS#11 slot being used by the SDR.
+  get _sdrSlot() {
+    if (!this.__sdrSlot) {
+      let modules = Cc["@mozilla.org/security/pkcs11moduledb;1"].
+                    getService(Ci.nsIPKCS11ModuleDB);
+      this.__sdrSlot = modules.findSlotByName("");
+    }
+    return this.__sdrSlot;
+  },
 
-    __decoderRing : null,  // nsSecretDecoderRing service
-    get _decoderRing() {
-        if (!this.__decoderRing)
-            this.__decoderRing = Cc["@mozilla.org/security/sdr;1"].
-                                 getService(Ci.nsISecretDecoderRing);
-        return this.__decoderRing;
-    },
+  __decoderRing : null,  // nsSecretDecoderRing service
+  get _decoderRing() {
+    if (!this.__decoderRing)
+      this.__decoderRing = Cc["@mozilla.org/security/sdr;1"].
+                           getService(Ci.nsISecretDecoderRing);
+    return this.__decoderRing;
+  },
 
-    __utfConverter : null, // UCS2 <--> UTF8 string conversion
-    get _utfConverter() {
-        if (!this.__utfConverter) {
-            this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
-                                  createInstance(Ci.nsIScriptableUnicodeConverter);
-            this.__utfConverter.charset = "UTF-8";
-        }
-        return this.__utfConverter;
-    },
+  __utfConverter : null, // UCS2 <--> UTF8 string conversion
+  get _utfConverter() {
+    if (!this.__utfConverter) {
+      this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
+                            createInstance(Ci.nsIScriptableUnicodeConverter);
+      this.__utfConverter.charset = "UTF-8";
+    }
+    return this.__utfConverter;
+  },
 
-    _utfConverterReset : function() {
-        this.__utfConverter = null;
-    },
+  _utfConverterReset : function() {
+    this.__utfConverter = null;
+  },
 
-    _debug  : false, // mirrors signon.debug
-    _uiBusy : false,
+  _debug  : false, // mirrors signon.debug
+  _uiBusy : false,
 
 
-    /*
-     * log
-     *
-     * Internal function for logging debug messages to the Error Console.
-     */
-    log : function (message) {
-        if (!this._debug)
-            return;
-        dump("PwMgr cryptoSDR: " + message + "\n");
-        Services.console.logStringMessage("PwMgr cryptoSDR: " + message);
-    },
+  /*
+   * log
+   *
+   * Internal function for logging debug messages to the Error Console.
+   */
+  log : function (message) {
+    if (!this._debug)
+      return;
+    dump("PwMgr cryptoSDR: " + message + "\n");
+    Services.console.logStringMessage("PwMgr cryptoSDR: " + message);
+  },
 
 
-    init : function () {
-        // Connect to the correct preferences branch.
-        this._prefBranch = Services.prefs.getBranch("signon.");
+  init : function () {
+    // Connect to the correct preferences branch.
+    this._prefBranch = Services.prefs.getBranch("signon.");
 
-        this._debug = this._prefBranch.getBoolPref("debug");
+    this._debug = this._prefBranch.getBoolPref("debug");
 
-        // Check to see if the internal PKCS#11 token has been initialized.
-        // If not, set a blank password.
-        let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
-                      getService(Ci.nsIPK11TokenDB);
+    // Check to see if the internal PKCS#11 token has been initialized.
+    // If not, set a blank password.
+    let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
+                  getService(Ci.nsIPK11TokenDB);
 
-        let token = tokenDB.getInternalKeyToken();
-        if (token.needsUserInit) {
-            this.log("Initializing key3.db with default blank password.");
-            token.initPassword("");
-        }
-    },
+    let token = tokenDB.getInternalKeyToken();
+    if (token.needsUserInit) {
+      this.log("Initializing key3.db with default blank password.");
+      token.initPassword("");
+    }
+  },
 
 
-    /*
-     * encrypt
-     *
-     * Encrypts the specified string, using the SecretDecoderRing.
-     *
-     * Returns the encrypted string, or throws an exception if there was a
-     * problem.
-     */
-    encrypt : function (plainText) {
-        let cipherText = null;
+  /*
+   * encrypt
+   *
+   * Encrypts the specified string, using the SecretDecoderRing.
+   *
+   * Returns the encrypted string, or throws an exception if there was a
+   * problem.
+   */
+  encrypt : function (plainText) {
+    let cipherText = null;
 
-        let wasLoggedIn = this.isLoggedIn;
-        let canceledMP = false;
+    let wasLoggedIn = this.isLoggedIn;
+    let canceledMP = false;
 
-        this._uiBusy = true;
-        try {
-            let plainOctet = this._utfConverter.ConvertFromUnicode(plainText);
-            plainOctet += this._utfConverter.Finish();
-            cipherText = this._decoderRing.encryptString(plainOctet);
-        } catch (e) {
-            this.log("Failed to encrypt string. (" + e.name + ")");
-            // If the user clicks Cancel, we get NS_ERROR_FAILURE.
-            // (unlike decrypting, which gets NS_ERROR_NOT_AVAILABLE).
-            if (e.result == Cr.NS_ERROR_FAILURE) {
-                canceledMP = true;
-                throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
-            } else {
-                throw Components.Exception("Couldn't encrypt string", Cr.NS_ERROR_FAILURE);
-            }
-        } finally {
-            this._uiBusy = false;
-            // If we triggered a master password prompt, notify observers.
-            if (!wasLoggedIn && this.isLoggedIn)
-                this._notifyObservers("passwordmgr-crypto-login");
-            else if (canceledMP)
-                this._notifyObservers("passwordmgr-crypto-loginCanceled");
-        }
-        return cipherText;
-    },
+    this._uiBusy = true;
+    try {
+      let plainOctet = this._utfConverter.ConvertFromUnicode(plainText);
+      plainOctet += this._utfConverter.Finish();
+      cipherText = this._decoderRing.encryptString(plainOctet);
+    } catch (e) {
+      this.log("Failed to encrypt string. (" + e.name + ")");
+      // If the user clicks Cancel, we get NS_ERROR_FAILURE.
+      // (unlike decrypting, which gets NS_ERROR_NOT_AVAILABLE).
+      if (e.result == Cr.NS_ERROR_FAILURE) {
+        canceledMP = true;
+        throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
+      } else {
+        throw Components.Exception("Couldn't encrypt string", Cr.NS_ERROR_FAILURE);
+      }
+    } finally {
+      this._uiBusy = false;
+      // If we triggered a master password prompt, notify observers.
+      if (!wasLoggedIn && this.isLoggedIn)
+        this._notifyObservers("passwordmgr-crypto-login");
+      else if (canceledMP)
+        this._notifyObservers("passwordmgr-crypto-loginCanceled");
+    }
+    return cipherText;
+  },
 
 
-    /*
-     * decrypt
-     *
-     * Decrypts the specified string, using the SecretDecoderRing.
-     *
-     * Returns the decrypted string, or throws an exception if there was a
-     * problem.
-     */
-    decrypt : function (cipherText) {
-        let plainText = null;
+  /*
+   * decrypt
+   *
+   * Decrypts the specified string, using the SecretDecoderRing.
+   *
+   * Returns the decrypted string, or throws an exception if there was a
+   * problem.
+   */
+  decrypt : function (cipherText) {
+    let plainText = null;
 
-        let wasLoggedIn = this.isLoggedIn;
-        let canceledMP = false;
+    let wasLoggedIn = this.isLoggedIn;
+    let canceledMP = false;
 
-        this._uiBusy = true;
-        try {
-            let plainOctet;
-            plainOctet = this._decoderRing.decryptString(cipherText);
-            plainText = this._utfConverter.ConvertToUnicode(plainOctet);
-        } catch (e) {
-            this.log("Failed to decrypt string: " + cipherText +
-                " (" + e.name + ")");
+    this._uiBusy = true;
+    try {
+      let plainOctet;
+      plainOctet = this._decoderRing.decryptString(cipherText);
+      plainText = this._utfConverter.ConvertToUnicode(plainOctet);
+    } catch (e) {
+      this.log("Failed to decrypt string: " + cipherText +
+          " (" + e.name + ")");
 
-            // In the unlikely event the converter threw, reset it.
-            this._utfConverterReset();
+      // In the unlikely event the converter threw, reset it.
+      this._utfConverterReset();
 
-            // If the user clicks Cancel, we get NS_ERROR_NOT_AVAILABLE.
-            // If the cipherText is bad / wrong key, we get NS_ERROR_FAILURE
-            // Wrong passwords are handled by the decoderRing reprompting;
-            // we get no notification.
-            if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
-                canceledMP = true;
-                throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
-            } else {
-                throw Components.Exception("Couldn't decrypt string", Cr.NS_ERROR_FAILURE);
-            }
-        } finally {
-            this._uiBusy = false;
-            // If we triggered a master password prompt, notify observers.
-            if (!wasLoggedIn && this.isLoggedIn)
-                this._notifyObservers("passwordmgr-crypto-login");
-            else if (canceledMP)
-                this._notifyObservers("passwordmgr-crypto-loginCanceled");
-        }
+      // If the user clicks Cancel, we get NS_ERROR_NOT_AVAILABLE.
+      // If the cipherText is bad / wrong key, we get NS_ERROR_FAILURE
+      // Wrong passwords are handled by the decoderRing reprompting;
+      // we get no notification.
+      if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
+        canceledMP = true;
+        throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
+      } else {
+        throw Components.Exception("Couldn't decrypt string", Cr.NS_ERROR_FAILURE);
+      }
+    } finally {
+      this._uiBusy = false;
+      // If we triggered a master password prompt, notify observers.
+      if (!wasLoggedIn && this.isLoggedIn)
+        this._notifyObservers("passwordmgr-crypto-login");
+      else if (canceledMP)
+        this._notifyObservers("passwordmgr-crypto-loginCanceled");
+    }
 
-        return plainText;
-    },
+    return plainText;
+  },
 
 
-    /*
-     * uiBusy
-     */
-    get uiBusy() {
-        return this._uiBusy;
-    },
+  /*
+   * uiBusy
+   */
+  get uiBusy() {
+    return this._uiBusy;
+  },
 
 
-    /*
-     * isLoggedIn
-     */
-    get isLoggedIn() {
-        let status = this._sdrSlot.status;
-        this.log("SDR slot status is " + status);
-        if (status == Ci.nsIPKCS11Slot.SLOT_READY ||
-            status == Ci.nsIPKCS11Slot.SLOT_LOGGED_IN)
-            return true;
-        if (status == Ci.nsIPKCS11Slot.SLOT_NOT_LOGGED_IN)
-            return false;
-        throw Components.Exception("unexpected slot status: " + status, Cr.NS_ERROR_FAILURE);
-    },
+  /*
+   * isLoggedIn
+   */
+  get isLoggedIn() {
+    let status = this._sdrSlot.status;
+    this.log("SDR slot status is " + status);
+    if (status == Ci.nsIPKCS11Slot.SLOT_READY ||
+        status == Ci.nsIPKCS11Slot.SLOT_LOGGED_IN)
+      return true;
+    if (status == Ci.nsIPKCS11Slot.SLOT_NOT_LOGGED_IN)
+      return false;
+    throw Components.Exception("unexpected slot status: " + status, Cr.NS_ERROR_FAILURE);
+  },
 
 
-    /*
-     * defaultEncType
-     */
-    get defaultEncType() {
-        return Ci.nsILoginManagerCrypto.ENCTYPE_SDR;
-    },
+  /*
+   * defaultEncType
+   */
+  get defaultEncType() {
+    return Ci.nsILoginManagerCrypto.ENCTYPE_SDR;
+  },
 
 
-    /*
-     * _notifyObservers
-     */
-    _notifyObservers : function(topic) {
-        this.log("Prompted for a master password, notifying for " + topic);
-        Services.obs.notifyObservers(null, topic, null);
-     },
+  /*
+   * _notifyObservers
+   */
+  _notifyObservers : function(topic) {
+    this.log("Prompted for a master password, notifying for " + topic);
+    Services.obs.notifyObservers(null, topic, null);
+  },
 }; // end of nsLoginManagerCrypto_SDR implementation
 
 let component = [LoginManagerCrypto_SDR];
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
--- a/toolkit/components/passwordmgr/nsILoginInfo.idl
+++ b/toolkit/components/passwordmgr/nsILoginInfo.idl
@@ -7,114 +7,114 @@
 
 [scriptable, uuid(c41b7dff-6b9b-42fe-b78d-113051facb05)]
 
 /**
  * An object containing information for a login stored by the
  * password manager.
  */
 interface nsILoginInfo : nsISupports {
-    /**
-     * The hostname the login applies to.
-     *
-     * The hostname should be formatted as an URL. For example,
-     * "https://site.com", "http://site.com:1234", "ftp://ftp.site.com".
-     */
-    attribute AString hostname;
+  /**
+   * The hostname the login applies to.
+   *
+   * The hostname should be formatted as an URL. For example,
+   * "https://site.com", "http://site.com:1234", "ftp://ftp.site.com".
+   */
+  attribute AString hostname;
 
-    /**
-     * The URL a form-based login was submitted to.
-     *
-     * For logins obtained from HTML forms, this field is the |action|
-     * attribute from the |form| element, with the path removed. For
-     * example "http://www.site.com". [Forms with no |action| attribute
-     * default to submitting to their origin URL, so we store that.]
-     *
-     * For logins obtained from a HTTP or FTP protocol authentication,
-     * this field is NULL.
-     */
-    attribute AString formSubmitURL;
+  /**
+   * The URL a form-based login was submitted to.
+   *
+   * For logins obtained from HTML forms, this field is the |action|
+   * attribute from the |form| element, with the path removed. For
+   * example "http://www.site.com". [Forms with no |action| attribute
+   * default to submitting to their origin URL, so we store that.]
+   *
+   * For logins obtained from a HTTP or FTP protocol authentication,
+   * this field is NULL.
+   */
+  attribute AString formSubmitURL;
 
-    /**
-     * The HTTP Realm a login was requested for.
-     *
-     * When an HTTP server sends a 401 result, the WWW-Authenticate
-     * header includes a realm to identify the "protection space." See
-     * RFC2617. If the response sent has a missing or blank realm, the
-     * hostname is used instead.
-     *
-     * For logins obtained from HTML forms, this field is NULL.
-     */
-    attribute AString httpRealm;
+  /**
+   * The HTTP Realm a login was requested for.
+   *
+   * When an HTTP server sends a 401 result, the WWW-Authenticate
+   * header includes a realm to identify the "protection space." See
+   * RFC2617. If the response sent has a missing or blank realm, the
+   * hostname is used instead.
+   *
+   * For logins obtained from HTML forms, this field is NULL.
+   */
+  attribute AString httpRealm;
 
-    /**
-     * The username for the login.
-     */
-    attribute AString username;
+  /**
+   * The username for the login.
+   */
+  attribute AString username;
 
-    /**
-     * The |name| attribute for the username input field.
-     *
-     * For logins obtained from a HTTP or FTP protocol authentication,
-     * this field is an empty string.
-     */
-    attribute AString usernameField;
+  /**
+   * The |name| attribute for the username input field.
+   *
+   * For logins obtained from a HTTP or FTP protocol authentication,
+   * this field is an empty string.
+   */
+  attribute AString usernameField;
 
-    /**
-     * The password for the login.
-     */
-    attribute AString password;
+  /**
+   * The password for the login.
+   */
+  attribute AString password;
 
-    /**
-     * The |name| attribute for the password input field.
-     *
-     * For logins obtained from a HTTP or FTP protocol authentication,
-     * this field is an empty string.
-     */
-    attribute AString passwordField;
+  /**
+   * The |name| attribute for the password input field.
+   *
+   * For logins obtained from a HTTP or FTP protocol authentication,
+   * this field is an empty string.
+   */
+  attribute AString passwordField;
 
-    /**
-     * Initialize a newly created nsLoginInfo object.
-     *
-     * The arguments are the fields for the new object.
-     */
-    void init(in AString aHostname,
-              in AString aFormSubmitURL, in AString aHttpRealm,
-              in AString aUsername,      in AString aPassword,
-              in AString aUsernameField, in AString aPasswordField);
+  /**
+   * Initialize a newly created nsLoginInfo object.
+   *
+   * The arguments are the fields for the new object.
+   */
+  void init(in AString aHostname,
+            in AString aFormSubmitURL, in AString aHttpRealm,
+            in AString aUsername,      in AString aPassword,
+            in AString aUsernameField, in AString aPasswordField);
 
-    /**
-     * Test for strict equality with another nsILoginInfo object.
-     *
-     * @param aLoginInfo
-     *        The other object to test.
-     */
-    boolean equals(in nsILoginInfo aLoginInfo);
+  /**
+   * Test for strict equality with another nsILoginInfo object.
+   *
+   * @param aLoginInfo
+   *        The other object to test.
+   */
+  boolean equals(in nsILoginInfo aLoginInfo);
 
-    /**
-     * Test for loose equivalency with another nsILoginInfo object. The
-     * passwordField and usernameField values are ignored, and the password
-     * values may be optionally ignored. If one login's formSubmitURL is an
-     * empty string (but not null), it will be treated as a wildcard. [The
-     * blank value indicates the login was stored before bug 360493 was fixed.]
-     *
-     * @param aLoginInfo
-     *        The other object to test.
-     * @param ignorePassword
-     *        If true, ignore the password when checking for match.
-     */
-    boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);
+  /**
+   * Test for loose equivalency with another nsILoginInfo object. The
+   * passwordField and usernameField values are ignored, and the password
+   * values may be optionally ignored. If one login's formSubmitURL is an
+   * empty string (but not null), it will be treated as a wildcard. [The
+   * blank value indicates the login was stored before bug 360493 was fixed.]
+   *
+   * @param aLoginInfo
+   *        The other object to test.
+   * @param ignorePassword
+   *        If true, ignore the password when checking for match.
+   */
+  boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);
 
-    /**
-     * Create an identical copy of the login, duplicating all of the login's
-     * nsILoginInfo and nsILoginMetaInfo properties.
-     *
-     * This allows code to be forwards-compatible, when additional properties
-     * are added to nsILoginMetaInfo (or nsILoginInfo) in the future.
-     */
-    nsILoginInfo clone();
+  /**
+   * Create an identical copy of the login, duplicating all of the login's
+   * nsILoginInfo and nsILoginMetaInfo properties.
+   *
+   * This allows code to be forwards-compatible, when additional properties
+   * are added to nsILoginMetaInfo (or nsILoginInfo) in the future.
+   */
+  nsILoginInfo clone();
 };
 
 %{C++
 
 #define NS_LOGININFO_CONTRACTID "@mozilla.org/login-manager/loginInfo;1"
 
 %}
--- a/toolkit/components/passwordmgr/nsILoginManager.idl
+++ b/toolkit/components/passwordmgr/nsILoginManager.idl
@@ -10,257 +10,257 @@ interface nsILoginInfo;
 interface nsIAutoCompleteResult;
 interface nsIFormAutoCompleteObserver;
 interface nsIDOMHTMLInputElement;
 interface nsIDOMHTMLFormElement;
 interface nsIPropertyBag;
 
 [scriptable, uuid(f0c5ca21-db71-4b32-993e-ab63054cc6f5)]
 interface nsILoginManager : nsISupports {
-    /**
-     * This promise is resolved when initialization is complete, and is rejected
-     * in case initialization failed.  This includes the initial loading of the
-     * login data as well as any migration from previous versions.
-     *
-     * Calling any method of nsILoginManager before this promise is resolved
-     * might trigger the synchronous initialization fallback.
-     */
-    readonly attribute jsval initializationPromise;
-
-
-    /**
-     * Store a new login in the login manager.
-     *
-     * @param aLogin
-     *        The login to be added.
-     *
-     * Default values for the login's nsILoginMetaInfo properties will be
-     * created. However, if the caller specifies non-default values, they will
-     * be used instead.
-     */
-    void addLogin(in nsILoginInfo aLogin);
+  /**
+   * This promise is resolved when initialization is complete, and is rejected
+   * in case initialization failed.  This includes the initial loading of the
+   * login data as well as any migration from previous versions.
+   *
+   * Calling any method of nsILoginManager before this promise is resolved
+   * might trigger the synchronous initialization fallback.
+   */
+  readonly attribute jsval initializationPromise;
 
 
-    /**
-     * Remove a login from the login manager.
-     *
-     * @param aLogin
-     *        The login to be removed.
-     *
-     * The specified login must exactly match a stored login. However, the
-     * values of any nsILoginMetaInfo properties are ignored.
-     */
-    void removeLogin(in nsILoginInfo aLogin);
+  /**
+   * Store a new login in the login manager.
+   *
+   * @param aLogin
+   *        The login to be added.
+   *
+   * Default values for the login's nsILoginMetaInfo properties will be
+   * created. However, if the caller specifies non-default values, they will
+   * be used instead.
+   */
+  void addLogin(in nsILoginInfo aLogin);
 
 
-    /**
-     * Modify an existing login in the login manager.
-     *
-     * @param oldLogin
-     *        The login to be modified.
-     * @param newLoginData
-     *        The new login values (either a nsILoginInfo or nsIProperyBag)
-     *
-     * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
-     * properties are changed to the values from newLoginData (but the old
-     * login's nsILoginMetaInfo properties are unmodified).
-     *
-     * If newLoginData is a nsIPropertyBag, only the specified properties
-     * will be changed. The nsILoginMetaInfo properties of oldLogin can be
-     * changed in this manner.
-     *
-     * If the propertybag contains an item named "timesUsedIncrement", the
-     * login's timesUsed property will be incremented by the item's value.
-     */
-    void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
-
-
-    /**
-     * Remove all logins known to login manager.
-     *
-     * The browser sanitization feature allows the user to clear any stored
-     * passwords. This interface allows that to be done without getting each
-     * login first (which might require knowing the master password).
-     *
-     */
-    void removeAllLogins();
+  /**
+   * Remove a login from the login manager.
+   *
+   * @param aLogin
+   *        The login to be removed.
+   *
+   * The specified login must exactly match a stored login. However, the
+   * values of any nsILoginMetaInfo properties are ignored.
+   */
+  void removeLogin(in nsILoginInfo aLogin);
 
 
-    /**
-     * Fetch all logins in the login manager. An array is always returned;
-     * if there are no logins the array is empty.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property and omit this param.
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.getAllLogins();
-     *       (|logins| is an array).
-     */
-    void getAllLogins([optional] out unsigned long count,
-                      [retval, array, size_is(count)] out nsILoginInfo logins);
-
-
-    /**
-     * Obtain a list of all hosts for which password saving is disabled.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property and omit this param.
-     * @param hostnames
-     *        An array of hostname strings, in origin URL format without a
-     *        pathname. For example: "https://www.site.com".
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.getDisabledAllLogins();
-     */
-    void getAllDisabledHosts([optional] out unsigned long count,
-                      [retval, array, size_is(count)] out wstring hostnames);
-
-
-    /**
-     * Check to see if saving logins has been disabled for a host.
-     *
-     * @param aHost
-     *        The hostname to check. This argument should be in the origin
-     *        URL format, without a pathname. For example: "http://foo.com".
-     */
-    boolean getLoginSavingEnabled(in AString aHost);
+  /**
+   * Modify an existing login in the login manager.
+   *
+   * @param oldLogin
+   *        The login to be modified.
+   * @param newLoginData
+   *        The new login values (either a nsILoginInfo or nsIProperyBag)
+   *
+   * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
+   * properties are changed to the values from newLoginData (but the old
+   * login's nsILoginMetaInfo properties are unmodified).
+   *
+   * If newLoginData is a nsIPropertyBag, only the specified properties
+   * will be changed. The nsILoginMetaInfo properties of oldLogin can be
+   * changed in this manner.
+   *
+   * If the propertybag contains an item named "timesUsedIncrement", the
+   * login's timesUsed property will be incremented by the item's value.
+   */
+  void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
 
 
-    /**
-     * Disable (or enable) storing logins for the specified host. When
-     * disabled, the login manager will not prompt to store logins for
-     * that host. Existing logins are not affected.
-     *
-     * @param aHost
-     *        The hostname to set. This argument should be in the origin
-     *        URL format, without a pathname. For example: "http://foo.com".
-     * @param isEnabled
-     *        Specify if saving logins should be enabled (true) or
-     *        disabled (false)
-     */
-    void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
+  /**
+   * Remove all logins known to login manager.
+   *
+   * The browser sanitization feature allows the user to clear any stored
+   * passwords. This interface allows that to be done without getting each
+   * login first (which might require knowing the master password).
+   *
+   */
+  void removeAllLogins();
 
 
-    /**
-     * Search for logins matching the specified criteria. Called when looking
-     * for logins that might be applicable to a form or authentication request.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property, and supply an dummy object for
-     *        this out param. For example: |findLogins({}, hostname, ...)|
-     * @param aHostname
-     *        The hostname to restrict searches to, in URL format. For
-     *        example: "http://www.site.com".
-     *        To find logins for a given nsIURI, you would typically pass in
-     *        its prePath.
-     * @param aActionURL
-     *        For form logins, this argument should be the URL to which the
-     *        form will be submitted. For protocol logins, specify null.
-     *        An empty string ("") will match any value (except null).
-     * @param aHttpRealm
-     *        For protocol logins, this argument should be the HTTP Realm
-     *        for which the login applies. This is obtained from the
-     *        WWW-Authenticate header. See RFC2617. For form logins,
-     *        specify null.
-     *        An empty string ("") will match any value (except null).
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.findLogins({}, hostname, ...);
-     *
-     */
-    void findLogins(out unsigned long count, in AString aHostname,
-                    in AString aActionURL,   in AString aHttpRealm,
+  /**
+   * Fetch all logins in the login manager. An array is always returned;
+   * if there are no logins the array is empty.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property and omit this param.
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.getAllLogins();
+   *       (|logins| is an array).
+   */
+  void getAllLogins([optional] out unsigned long count,
                     [retval, array, size_is(count)] out nsILoginInfo logins);
 
 
-   /**
-    * Search for logins matching the specified criteria, as with
-    * findLogins(). This interface only returns the number of matching
-    * logins (and not the logins themselves), which allows a caller to
-    * check for logins without causing the user to be prompted for a master
-    * password to decrypt the logins.
-    *
-    * @param aHostname
-    *        The hostname to restrict searches to. Specify an empty string
-    *        to match all hosts. A null value will not match any logins, and
-    *        will thus always return a count of 0.
-    * @param aActionURL
-    *        The URL to which a form login will be submitted. To match any
-    *        form login, specify an empty string. To not match any form
-    *        login, specify null.
-    * @param aHttpRealm
-    *        The HTTP Realm for which the login applies. To match logins for
-    *        any realm, specify an empty string. To not match logins for any
-    *        realm, specify null.
-    */
-   unsigned long countLogins(in AString aHostname, in AString aActionURL,
-                             in AString aHttpRealm);
+  /**
+   * Obtain a list of all hosts for which password saving is disabled.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property and omit this param.
+   * @param hostnames
+   *        An array of hostname strings, in origin URL format without a
+   *        pathname. For example: "https://www.site.com".
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.getDisabledAllLogins();
+   */
+  void getAllDisabledHosts([optional] out unsigned long count,
+                    [retval, array, size_is(count)] out wstring hostnames);
+
+
+  /**
+   * Check to see if saving logins has been disabled for a host.
+   *
+   * @param aHost
+   *        The hostname to check. This argument should be in the origin
+   *        URL format, without a pathname. For example: "http://foo.com".
+   */
+  boolean getLoginSavingEnabled(in AString aHost);
+
+
+  /**
+   * Disable (or enable) storing logins for the specified host. When
+   * disabled, the login manager will not prompt to store logins for
+   * that host. Existing logins are not affected.
+   *
+   * @param aHost
+   *        The hostname to set. This argument should be in the origin
+   *        URL format, without a pathname. For example: "http://foo.com".
+   * @param isEnabled
+   *        Specify if saving logins should be enabled (true) or
+   *        disabled (false)
+   */
+  void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
+
+
+  /**
+   * Search for logins matching the specified criteria. Called when looking
+   * for logins that might be applicable to a form or authentication request.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property, and supply an dummy object for
+   *        this out param. For example: |findLogins({}, hostname, ...)|
+   * @param aHostname
+   *        The hostname to restrict searches to, in URL format. For
+   *        example: "http://www.site.com".
+   *        To find logins for a given nsIURI, you would typically pass in
+   *        its prePath.
+   * @param aActionURL
+   *        For form logins, this argument should be the URL to which the
+   *        form will be submitted. For protocol logins, specify null.
+   *        An empty string ("") will match any value (except null).
+   * @param aHttpRealm
+   *        For protocol logins, this argument should be the HTTP Realm
+   *        for which the login applies. This is obtained from the
+   *        WWW-Authenticate header. See RFC2617. For form logins,
+   *        specify null.
+   *        An empty string ("") will match any value (except null).
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.findLogins({}, hostname, ...);
+   *
+   */
+  void findLogins(out unsigned long count, in AString aHostname,
+                  in AString aActionURL,   in AString aHttpRealm,
+                  [retval, array, size_is(count)] out nsILoginInfo logins);
 
 
-    /**
-     * Generate results for a userfield autocomplete menu.
-     *
-     * NOTE: This interface is provided for use only by the FormFillController,
-     *       which calls it directly. This isn't really ideal, it should
-     *       probably be callback registered through the FFC.
-     */
-    void autoCompleteSearchAsync(in AString aSearchString,
-                                 in nsIAutoCompleteResult aPreviousResult,
-                                 in nsIDOMHTMLInputElement aElement,
-                                 in nsIFormAutoCompleteObserver aListener);
+  /**
+   * Search for logins matching the specified criteria, as with
+   * findLogins(). This interface only returns the number of matching
+   * logins (and not the logins themselves), which allows a caller to
+   * check for logins without causing the user to be prompted for a master
+   * password to decrypt the logins.
+   *
+   * @param aHostname
+   *        The hostname to restrict searches to. Specify an empty string
+   *        to match all hosts. A null value will not match any logins, and
+   *        will thus always return a count of 0.
+   * @param aActionURL
+   *        The URL to which a form login will be submitted. To match any
+   *        form login, specify an empty string. To not match any form
+   *        login, specify null.
+   * @param aHttpRealm
+   *        The HTTP Realm for which the login applies. To match logins for
+   *        any realm, specify an empty string. To not match logins for any
+   *        realm, specify null.
+   */
+  unsigned long countLogins(in AString aHostname, in AString aActionURL,
+                            in AString aHttpRealm);
 
-    /**
-     * Fill a form with login information if we have it. This method will fill
-     * aForm regardless of the signon.autofillForms preference.
-     *
-     * @param aForm
-     *        The form to fill
-     * @return Promise that is resolved with whether or not the form was filled.
-     */
-    jsval fillForm(in nsIDOMHTMLFormElement aForm);
+
+  /**
+   * Generate results for a userfield autocomplete menu.
+   *
+   * NOTE: This interface is provided for use only by the FormFillController,
+   *       which calls it directly. This isn't really ideal, it should
+   *       probably be callback registered through the FFC.
+   */
+  void autoCompleteSearchAsync(in AString aSearchString,
+                               in nsIAutoCompleteResult aPreviousResult,
+                               in nsIDOMHTMLInputElement aElement,
+                               in nsIFormAutoCompleteObserver aListener);
 
-    /**
-     * Search for logins in the login manager. An array is always returned;
-     * if there are no logins the array is empty.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property, and supply an dummy object for
-     *        this out param. For example: |searchLogins({}, matchData)|
-     * @param matchData
-     *        The data used to search. This does not follow the same
-     *        requirements as findLogins for those fields. Wildcard matches are
-     *        simply not specified.
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.searchLogins({}, matchData);
-     *       (|logins| is an array).
-     */
-    void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
-                      [retval, array, size_is(count)] out nsILoginInfo logins);
+  /**
+   * Fill a form with login information if we have it. This method will fill
+   * aForm regardless of the signon.autofillForms preference.
+   *
+   * @param aForm
+   *        The form to fill
+   * @return Promise that is resolved with whether or not the form was filled.
+   */
+  jsval fillForm(in nsIDOMHTMLFormElement aForm);
 
-   /**
-    * True when a master password prompt is being displayed.
-    */
-    readonly attribute boolean uiBusy;
+  /**
+   * Search for logins in the login manager. An array is always returned;
+   * if there are no logins the array is empty.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property, and supply an dummy object for
+   *        this out param. For example: |searchLogins({}, matchData)|
+   * @param matchData
+   *        The data used to search. This does not follow the same
+   *        requirements as findLogins for those fields. Wildcard matches are
+   *        simply not specified.
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.searchLogins({}, matchData);
+   *       (|logins| is an array).
+   */
+  void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
+                    [retval, array, size_is(count)] out nsILoginInfo logins);
 
-   /**
-    * True when the master password has already been entered, and so a caller
-    * can ask for decrypted logins without triggering a prompt.
-    */
-    readonly attribute boolean isLoggedIn;
+ /**
+  * True when a master password prompt is being displayed.
+  */
+  readonly attribute boolean uiBusy;
+
+ /**
+  * True when the master password has already been entered, and so a caller
+  * can ask for decrypted logins without triggering a prompt.
+  */
+  readonly attribute boolean isLoggedIn;
 };
 
 %{C++
 
 #define NS_LOGINMANAGER_CONTRACTID "@mozilla.org/login-manager;1"
 
 %}
--- a/toolkit/components/passwordmgr/nsILoginManagerCrypto.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerCrypto.idl
@@ -4,64 +4,64 @@
 
 
 #include "nsISupports.idl"
 
 [scriptable, uuid(2030770e-542e-40cd-8061-cd9d4ad4227f)]
 
 interface nsILoginManagerCrypto : nsISupports {
 
-    const unsigned long ENCTYPE_BASE64 = 0; // obsolete
-    const unsigned long ENCTYPE_SDR = 1;
+  const unsigned long ENCTYPE_BASE64 = 0; // obsolete
+  const unsigned long ENCTYPE_SDR = 1;
 
-    /**
-     * encrypt
-     *
-     * @param plainText
-     *        The string to be encrypted.
-     *
-     * Encrypts the specified string, returning the ciphertext value.
-     *
-     * NOTE: The current implemention of this inferface simply uses NSS/PSM's
-     * "Secret Decoder Ring" service. It is not recommended for general
-     * purpose encryption/decryption.
-     *
-     * Can throw if the user cancels entry of their master password.
-     */
-    AString encrypt(in AString plainText);
+  /**
+   * encrypt
+   *
+   * @param plainText
+   *        The string to be encrypted.
+   *
+   * Encrypts the specified string, returning the ciphertext value.
+   *
+   * NOTE: The current implemention of this inferface simply uses NSS/PSM's
+   * "Secret Decoder Ring" service. It is not recommended for general
+   * purpose encryption/decryption.
+   *
+   * Can throw if the user cancels entry of their master password.
+   */
+  AString encrypt(in AString plainText);
 
-    /**
-     * decrypt
-     *
-     * @param cipherText
-     *        The string to be decrypted.
-     *
-     * Decrypts the specified string, returning the plaintext value.
-     *
-     * Can throw if the user cancels entry of their master password, or if the
-     * cipherText value can not be successfully decrypted (eg, if it was
-     * encrypted with some other key).
-     */
-    AString decrypt(in AString cipherText);
+  /**
+   * decrypt
+   *
+   * @param cipherText
+   *        The string to be decrypted.
+   *
+   * Decrypts the specified string, returning the plaintext value.
+   *
+   * Can throw if the user cancels entry of their master password, or if the
+   * cipherText value can not be successfully decrypted (eg, if it was
+   * encrypted with some other key).
+   */
+  AString decrypt(in AString cipherText);
 
-    /**
-     * uiBusy
-     *
-     * True when a master password prompt is being displayed.
-     */
-    readonly attribute boolean uiBusy;
+  /**
+   * uiBusy
+   *
+   * True when a master password prompt is being displayed.
+   */
+  readonly attribute boolean uiBusy;
 
-    /**
-     * isLoggedIn
-     *
-     * Current login state of the token used for encryption. If the user is
-     * not logged in, performing a crypto operation will result in a master
-     * password prompt.
-     */
-    readonly attribute boolean isLoggedIn;
+  /**
+   * isLoggedIn
+   *
+   * Current login state of the token used for encryption. If the user is
+   * not logged in, performing a crypto operation will result in a master
+   * password prompt.
+   */
+  readonly attribute boolean isLoggedIn;
 
-    /**
-     * defaultEncType
-     *
-     * Default encryption type used by an implementation of this interface.
-     */
-    readonly attribute unsigned long defaultEncType;
+  /**
+   * defaultEncType
+   *
+   * Default encryption type used by an implementation of this interface.
+   */
+  readonly attribute unsigned long defaultEncType;
 };
--- a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
@@ -6,77 +6,77 @@
 #include "nsISupports.idl"
 
 interface nsILoginInfo;
 interface nsIDOMElement;
 interface nsIDOMWindow;
 
 [scriptable, uuid(425f73b9-b2db-4e8a-88c5-9ac2512934ce)]
 interface nsILoginManagerPrompter : nsISupports {
-    /**
-     * Initialize the prompter. Must be called before using other interfaces.
-     *
-     * @param aWindow
-     *        The in which the user is doing some login-related action that's
-     *        resulting in a need to prompt them for something. The prompt
-     *        will be associated with this window (or, if a notification bar
-     *        is being used, topmost opener in some cases).
-     */
-    void init(in nsIDOMWindow aWindow);
+  /**
+   * Initialize the prompter. Must be called before using other interfaces.
+   *
+   * @param aWindow
+   *        The in which the user is doing some login-related action that's
+   *        resulting in a need to prompt them for something. The prompt
+   *        will be associated with this window (or, if a notification bar
+   *        is being used, topmost opener in some cases).
+   */
+  void init(in nsIDOMWindow aWindow);
 
-    /**
-     * If the caller knows which browser this prompter is being created for,
-     * they can call this function to avoid having to calculate it from the
-     * window passed to init.
-     *
-     * @param aBrowser the <browser> to use for this prompter.
-     * @param aOpener the opener to use for this prompter.
-     */
-    void setE10sData(in nsIDOMElement aBrowser, in nsIDOMWindow aOpener);
+  /**
+   * If the caller knows which browser this prompter is being created for,
+   * they can call this function to avoid having to calculate it from the
+   * window passed to init.
+   *
+   * @param aBrowser the <browser> to use for this prompter.
+   * @param aOpener the opener to use for this prompter.
+   */
+  void setE10sData(in nsIDOMElement aBrowser, in nsIDOMWindow aOpener);
 
-    /**
-     * Ask the user if they want to save a login (Yes, Never, Not Now)
-     *
-     * @param aLogin
-     *        The login to be saved.
-     */
-    void promptToSavePassword(in nsILoginInfo aLogin);
+  /**
+   * Ask the user if they want to save a login (Yes, Never, Not Now)
+   *
+   * @param aLogin
+   *        The login to be saved.
+   */
+  void promptToSavePassword(in nsILoginInfo aLogin);
 
-    /**
-     * Ask the user if they want to change a login's password. If the
-     * user consents, modifyLogin() will be called.
-     *
-     * @param aOldLogin
-     *        The existing login (with the old password).
-     * @param aNewLogin
-     *        The new login.
-     */
-    void promptToChangePassword(in nsILoginInfo aOldLogin,
-                                in nsILoginInfo aNewLogin);
+  /**
+   * Ask the user if they want to change a login's password. If the
+   * user consents, modifyLogin() will be called.
+   *
+   * @param aOldLogin
+   *        The existing login (with the old password).
+   * @param aNewLogin
+   *        The new login.
+   */
+  void promptToChangePassword(in nsILoginInfo aOldLogin,
+                              in nsILoginInfo aNewLogin);
 
-    /**
-     * Ask the user if they want to change the password for one of
-     * multiple logins, when the caller can't determine exactly which
-     * login should be changed. If the user consents, modifyLogin() will
-     * be called.
-     *
-     * @param logins
-     *        An array of existing logins.
-     * @param count
-     *        (length of the array)
-     * @param aNewLogin
-     *        The new login.
-     *
-     * Note: Because the caller does not know the username of the login
-     *       to be changed, aNewLogin.username and aNewLogin.usernameField
-     *       will be set (using the user's selection) before modifyLogin()
-     *       is called.
-     */
-    void promptToChangePasswordWithUsernames(
-            [array, size_is(count)] in nsILoginInfo logins,
-            in uint32_t count,
-            in nsILoginInfo aNewLogin);
+  /**
+   * Ask the user if they want to change the password for one of
+   * multiple logins, when the caller can't determine exactly which
+   * login should be changed. If the user consents, modifyLogin() will
+   * be called.
+   *
+   * @param logins
+   *        An array of existing logins.
+   * @param count
+   *        (length of the array)
+   * @param aNewLogin
+   *        The new login.
+   *
+   * Note: Because the caller does not know the username of the login
+   *       to be changed, aNewLogin.username and aNewLogin.usernameField
+   *       will be set (using the user's selection) before modifyLogin()
+   *       is called.
+   */
+  void promptToChangePasswordWithUsernames(
+          [array, size_is(count)] in nsILoginInfo logins,
+          in uint32_t count,
+          in nsILoginInfo aNewLogin);
 };
 %{C++
 
 #define NS_LOGINMANAGERPROMPTER_CONTRACTID "@mozilla.org/login-manager/prompter/;1"
 
 %}
--- a/toolkit/components/passwordmgr/nsILoginManagerStorage.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerStorage.idl
@@ -14,239 +14,239 @@ interface nsIPropertyBag;
 /*
  * NOTE: This interface is intended to be implemented by modules
  *       providing storage mechanisms for the login manager.
  *       Other code should use the login manager's interfaces
  *       (nsILoginManager), and should not call storage modules
  *       directly.
  */
 interface nsILoginManagerStorage : nsISupports {
-    /**
-     * Initialize the component.
-     *
-     * At present, other methods of this interface may be called before the
-     * returned promise is resolved or rejected.
-     *
-     * @return {Promise}
-     * @resolves When initialization is complete.
-     * @rejects JavaScript exception.
-     */
-    jsval initialize();
-
-
-    /**
-     * Ensures that all data has been written to disk and all files are closed.
-     *
-     * At present, this method is called by regression tests only.  Finalization
-     * on shutdown is done by observers within the component.
-     *
-     * @return {Promise}
-     * @resolves When finalization is complete.
-     * @rejects JavaScript exception.
-     */
-    jsval terminate();
-
-
-    /**
-     * Store a new login in the storage module.
-     *
-     * @param aLogin
-     *        The login to be added.
-     *
-     * Default values for the login's nsILoginMetaInfo properties will be
-     * created. However, if the caller specifies non-default values, they will
-     * be used instead.
-     */
-    void addLogin(in nsILoginInfo aLogin);
+  /**
+   * Initialize the component.
+   *
+   * At present, other methods of this interface may be called before the
+   * returned promise is resolved or rejected.
+   *
+   * @return {Promise}
+   * @resolves When initialization is complete.
+   * @rejects JavaScript exception.
+   */
+  jsval initialize();
 
 
-    /**
-     * Remove a login from the storage module.
-     *
-     * @param aLogin
-     *        The login to be removed.
-     *
-     * The specified login must exactly match a stored login. However, the
-     * values of any nsILoginMetaInfo properties are ignored.
-     */
-    void removeLogin(in nsILoginInfo aLogin);
+  /**
+   * Ensures that all data has been written to disk and all files are closed.
+   *
+   * At present, this method is called by regression tests only.  Finalization
+   * on shutdown is done by observers within the component.
+   *
+   * @return {Promise}
+   * @resolves When finalization is complete.
+   * @rejects JavaScript exception.
+   */
+  jsval terminate();
 
 
-    /**
-     * Modify an existing login in the storage module.
-     *
-     * @param oldLogin
-     *        The login to be modified.
-     * @param newLoginData
-     *        The new login values (either a nsILoginInfo or nsIProperyBag)
-     *
-     * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
-     * properties are changed to the values from newLoginData (but the old
-     * login's nsILoginMetaInfo properties are unmodified).
-     *
-     * If newLoginData is a nsIPropertyBag, only the specified properties
-     * will be changed. The nsILoginMetaInfo properties of oldLogin can be
-     * changed in this manner.
-     *
-     * If the propertybag contains an item named "timesUsedIncrement", the
-     * login's timesUsed property will be incremented by the item's value.
-     */
-    void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
-
-
-    /**
-     * Remove all stored logins.
-     *
-     * The browser sanitization feature allows the user to clear any stored
-     * passwords. This interface allows that to be done without getting each
-     * login first (which might require knowing the master password).
-     *
-     */
-    void removeAllLogins();
+  /**
+   * Store a new login in the storage module.
+   *
+   * @param aLogin
+   *        The login to be added.
+   *
+   * Default values for the login's nsILoginMetaInfo properties will be
+   * created. However, if the caller specifies non-default values, they will
+   * be used instead.
+   */
+  void addLogin(in nsILoginInfo aLogin);
 
 
-    /**
-     * Fetch all logins in the login manager. An array is always returned;
-     * if there are no logins the array is empty.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property and omit this param.
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.getAllLogins();
-     *       (|logins| is an array).
-     */
-    void getAllLogins([optional] out unsigned long count,
-                      [retval, array, size_is(count)] out nsILoginInfo logins);
-
-
-    /**
-     * Search for logins in the login manager. An array is always returned;
-     * if there are no logins the array is empty.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property, and supply an dummy object for
-     *        this out param. For example: |searchLogins({}, matchData)|
-     * @param matchData
-     *        The data used to search. This does not follow the same
-     *        requirements as findLogins for those fields. Wildcard matches are
-     *        simply not specified.
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.searchLogins({}, matchData);
-     *       (|logins| is an array).
-     */
-    void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
-                      [retval, array, size_is(count)] out nsILoginInfo logins);
+  /**
+   * Remove a login from the storage module.
+   *
+   * @param aLogin
+   *        The login to be removed.
+   *
+   * The specified login must exactly match a stored login. However, the
+   * values of any nsILoginMetaInfo properties are ignored.
+   */
+  void removeLogin(in nsILoginInfo aLogin);
 
 
-    /**
-     * Obtain a list of all hosts for which password saving is disabled.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property and omit this param.
-     * @param hostnames
-     *        An array of hostname strings, in origin URL format without a
-     *        pathname. For example: "https://www.site.com".
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.getAllDisabledHosts();
-     */
-    void getAllDisabledHosts([optional] out unsigned long count,
-                      [retval, array, size_is(count)] out wstring hostnames);
-
-
-    /**
-     * Check to see if saving logins has been disabled for a host.
-     *
-     * @param aHost
-     *        The hostname to check. This argument should be in the origin
-     *        URL format, without a pathname. For example: "http://foo.com".
-     */
-    boolean getLoginSavingEnabled(in AString aHost);
+  /**
+   * Modify an existing login in the storage module.
+   *
+   * @param oldLogin
+   *        The login to be modified.
+   * @param newLoginData
+   *        The new login values (either a nsILoginInfo or nsIProperyBag)
+   *
+   * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
+   * properties are changed to the values from newLoginData (but the old
+   * login's nsILoginMetaInfo properties are unmodified).
+   *
+   * If newLoginData is a nsIPropertyBag, only the specified properties
+   * will be changed. The nsILoginMetaInfo properties of oldLogin can be
+   * changed in this manner.
+   *
+   * If the propertybag contains an item named "timesUsedIncrement", the
+   * login's timesUsed property will be incremented by the item's value.
+   */
+  void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
 
 
-    /**
-     * Disable (or enable) storing logins for the specified host. When
-     * disabled, the login manager will not prompt to store logins for
-     * that host. Existing logins are not affected.
-     *
-     * @param aHost
-     *        The hostname to set. This argument should be in the origin
-     *        URL format, without a pathname. For example: "http://foo.com".
-     * @param isEnabled
-     *        Specify if saving logins should be enabled (true) or
-     *        disabled (false)
-     */
-    void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
+  /**
+   * Remove all stored logins.
+   *
+   * The browser sanitization feature allows the user to clear any stored
+   * passwords. This interface allows that to be done without getting each
+   * login first (which might require knowing the master password).
+   *
+   */
+  void removeAllLogins();
 
 
-    /**
-     * Search for logins matching the specified criteria. Called when looking
-     * for logins that might be applicable to a form or authentication request.
-     *
-     * @param count
-     *        The number of elements in the array. JS callers can simply use
-     *        the array's .length property, and supply an dummy object for
-     *        this out param. For example: |findLogins({}, hostname, ...)|
-     * @param aHostname
-     *        The hostname to restrict searches to, in URL format. For
-     *        example: "http://www.site.com".
-     * @param aActionURL
-     *        For form logins, this argument should be the URL to which the
-     *        form will be submitted. For protocol logins, specify null.
-     * @param aHttpRealm
-     *        For protocol logins, this argument should be the HTTP Realm
-     *        for which the login applies. This is obtained from the
-     *        WWW-Authenticate header. See RFC2617. For form logins,
-     *        specify null.
-     * @param logins
-     *        An array of nsILoginInfo objects.
-     *
-     * NOTE: This can be called from JS as:
-     *       var logins = pwmgr.findLogins({}, hostname, ...);
-     *
-     */
-    void findLogins(out unsigned long count, in AString aHostname,
-                    in AString aActionURL,   in AString aHttpRealm,
+  /**
+   * Fetch all logins in the login manager. An array is always returned;
+   * if there are no logins the array is empty.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property and omit this param.
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.getAllLogins();
+   *       (|logins| is an array).
+   */
+  void getAllLogins([optional] out unsigned long count,
                     [retval, array, size_is(count)] out nsILoginInfo logins);
 
 
-   /**
-    * Search for logins matching the specified criteria, as with
-    * findLogins(). This interface only returns the number of matching
-    * logins (and not the logins themselves), which allows a caller to
-    * check for logins without causing the user to be prompted for a master
-    * password to decrypt the logins.
-    *
-    * @param aHostname
-    *        The hostname to restrict searches to. Specify an empty string
-    *        to match all hosts. A null value will not match any logins, and
-    *        will thus always return a count of 0.
-    * @param aActionURL
-    *        The URL to which a form login will be submitted. To match any
-    *        form login, specify an empty string. To not match any form
-    *        login, specify null.
-    * @param aHttpRealm
-    *        The HTTP Realm for which the login applies. To match logins for
-    *        any realm, specify an empty string. To not match logins for any
-    *        realm, specify null.
-    */
-   unsigned long countLogins(in AString aHostname, in AString aActionURL,
-                             in AString aHttpRealm);
-   /**
-    * True when a master password prompt is being shown.
-    */
-    readonly attribute boolean uiBusy;
+  /**
+   * Search for logins in the login manager. An array is always returned;
+   * if there are no logins the array is empty.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property, and supply an dummy object for
+   *        this out param. For example: |searchLogins({}, matchData)|
+   * @param matchData
+   *        The data used to search. This does not follow the same
+   *        requirements as findLogins for those fields. Wildcard matches are
+   *        simply not specified.
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.searchLogins({}, matchData);
+   *       (|logins| is an array).
+   */
+  void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
+                    [retval, array, size_is(count)] out nsILoginInfo logins);
+
+
+  /**
+   * Obtain a list of all hosts for which password saving is disabled.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property and omit this param.
+   * @param hostnames
+   *        An array of hostname strings, in origin URL format without a
+   *        pathname. For example: "https://www.site.com".
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.getAllDisabledHosts();
+   */
+  void getAllDisabledHosts([optional] out unsigned long count,
+                    [retval, array, size_is(count)] out wstring hostnames);
+
+
+  /**
+   * Check to see if saving logins has been disabled for a host.
+   *
+   * @param aHost
+   *        The hostname to check. This argument should be in the origin
+   *        URL format, without a pathname. For example: "http://foo.com".
+   */
+  boolean getLoginSavingEnabled(in AString aHost);
+
+
+  /**
+   * Disable (or enable) storing logins for the specified host. When
+   * disabled, the login manager will not prompt to store logins for
+   * that host. Existing logins are not affected.
+   *
+   * @param aHost
+   *        The hostname to set. This argument should be in the origin
+   *        URL format, without a pathname. For example: "http://foo.com".
+   * @param isEnabled
+   *        Specify if saving logins should be enabled (true) or
+   *        disabled (false)
+   */
+  void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
+
 
-   /**
-    * True when the master password has already been entered, and so a caller
-    * can ask for decrypted logins without triggering a prompt.
-    */
-    readonly attribute boolean isLoggedIn;
+  /**
+   * Search for logins matching the specified criteria. Called when looking
+   * for logins that might be applicable to a form or authentication request.
+   *
+   * @param count
+   *        The number of elements in the array. JS callers can simply use
+   *        the array's .length property, and supply an dummy object for
+   *        this out param. For example: |findLogins({}, hostname, ...)|
+   * @param aHostname
+   *        The hostname to restrict searches to, in URL format. For
+   *        example: "http://www.site.com".
+   * @param aActionURL
+   *        For form logins, this argument should be the URL to which the
+   *        form will be submitted. For protocol logins, specify null.
+   * @param aHttpRealm
+   *        For protocol logins, this argument should be the HTTP Realm
+   *        for which the login applies. This is obtained from the
+   *        WWW-Authenticate header. See RFC2617. For form logins,
+   *        specify null.
+   * @param logins
+   *        An array of nsILoginInfo objects.
+   *
+   * NOTE: This can be called from JS as:
+   *       var logins = pwmgr.findLogins({}, hostname, ...);
+   *
+   */
+  void findLogins(out unsigned long count, in AString aHostname,
+                  in AString aActionURL,   in AString aHttpRealm,
+                  [retval, array, size_is(count)] out nsILoginInfo logins);
+
+
+  /**
+   * Search for logins matching the specified criteria, as with
+   * findLogins(). This interface only returns the number of matching
+   * logins (and not the logins themselves), which allows a caller to
+   * check for logins without causing the user to be prompted for a master
+   * password to decrypt the logins.
+   *
+   * @param aHostname
+   *        The hostname to restrict searches to. Specify an empty string
+   *        to match all hosts. A null value will not match any logins, and
+   *        will thus always return a count of 0.
+   * @param aActionURL
+   *        The URL to which a form login will be submitted. To match any
+   *        form login, specify an empty string. To not match any form
+   *        login, specify null.
+   * @param aHttpRealm
+   *        The HTTP Realm for which the login applies. To match logins for
+   *        any realm, specify an empty string. To not match logins for any
+   *        realm, specify null.
+   */
+  unsigned long countLogins(in AString aHostname, in AString aActionURL,
+                            in AString aHttpRealm);
+  /**
+   * True when a master password prompt is being shown.
+   */
+  readonly attribute boolean uiBusy;
+
+  /**
+   * True when the master password has already been entered, and so a caller
+   * can ask for decrypted logins without triggering a prompt.
+   */
+  readonly attribute boolean isLoggedIn;
 };
--- a/toolkit/components/passwordmgr/nsILoginMetaInfo.idl
+++ b/toolkit/components/passwordmgr/nsILoginMetaInfo.idl
@@ -12,42 +12,42 @@
  *
  * Code using login manager can generally ignore this interface. When adding
  * logins, default value will be created. When modifying logins, these
  * properties will be unchanged unless a change is explicitly requested [by
  * using modifyLogin() with a nsIPropertyBag]. When deleting a login or
  * comparing logins, these properties are ignored.
  */
 interface nsILoginMetaInfo : nsISupports {
-    /**
-     * The GUID to uniquely identify the login. This can be any arbitrary
-     * string, but a format as created by nsIUUIDGenerator is recommended.
-     * For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}"
-     *
-     * addLogin will generate a random value unless a value is provided.
-     *
-     * addLogin and modifyLogin will throw if the GUID already exists.
-     */
-    attribute AString guid;
+  /**
+   * The GUID to uniquely identify the login. This can be any arbitrary
+   * string, but a format as created by nsIUUIDGenerator is recommended.
+   * For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}"
+   *
+   * addLogin will generate a random value unless a value is provided.
+   *
+   * addLogin and modifyLogin will throw if the GUID already exists.
+   */
+  attribute AString guid;
 
-    /**
-     * The time, in Unix Epoch milliseconds, when the login was first created.
-     */
-    attribute unsigned long long timeCreated;
+  /**
+   * The time, in Unix Epoch milliseconds, when the login was first created.
+   */
+  attribute unsigned long long timeCreated;
 
-    /**
-     * The time, in Unix Epoch milliseconds, when the login was last submitted
-     * in a form or used to begin an HTTP auth session.
-     */
-    attribute unsigned long long timeLastUsed;
+  /**
+   * The time, in Unix Epoch milliseconds, when the login was last submitted
+   * in a form or used to begin an HTTP auth session.
+   */
+  attribute unsigned long long timeLastUsed;
 
-    /**
-     * The time, in Unix Epoch milliseconds, when the login's password was
-     * last modified.
-     */
-    attribute unsigned long long timePasswordChanged;
+  /**
+   * The time, in Unix Epoch milliseconds, when the login's password was
+   * last modified.
+   */
+  attribute unsigned long long timePasswordChanged;
 
-    /**
-     * The number of times the login was submitted in a form or used to begin
-     * an HTTP auth session.
-     */
-    attribute unsigned long timesUsed;
+  /**
+   * The number of times the login was submitted in a form or used to begin
+   * an HTTP auth session.
+   */
+  attribute unsigned long timesUsed;
 };
--- a/toolkit/components/passwordmgr/nsLoginInfo.js
+++ b/toolkit/components/passwordmgr/nsLoginInfo.js
@@ -7,98 +7,98 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function nsLoginInfo() {}
 
 nsLoginInfo.prototype = {
 
-    classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
+  classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
 
-    //
-    // nsILoginInfo interfaces...
-    //
+  //
+  // nsILoginInfo interfaces...
+  //
 
-    hostname      : null,
-    formSubmitURL : null,
-    httpRealm     : null,
-    username      : null,
-    password      : null,
-    usernameField : null,
-    passwordField : null,
+  hostname      : null,
+  formSubmitURL : null,
+  httpRealm     : null,
+  username      : null,
+  password      : null,
+  usernameField : null,
+  passwordField : null,
 
-    init : function (aHostname, aFormSubmitURL, aHttpRealm,
-                     aUsername,      aPassword,
-                     aUsernameField, aPasswordField) {
-        this.hostname      = aHostname;
-        this.formSubmitURL = aFormSubmitURL;
-        this.httpRealm     = aHttpRealm;
-        this.username      = aUsername;
-        this.password      = aPassword;
-        this.usernameField = aUsernameField;
-        this.passwordField = aPasswordField;
-    },
+  init : function (aHostname, aFormSubmitURL, aHttpRealm,
+                   aUsername,      aPassword,
+                   aUsernameField, aPasswordField) {
+    this.hostname      = aHostname;
+    this.formSubmitURL = aFormSubmitURL;
+    this.httpRealm     = aHttpRealm;
+    this.username      = aUsername;
+    this.password      = aPassword;
+    this.usernameField = aUsernameField;
+    this.passwordField = aPasswordField;
+  },
 
-    matches : function (aLogin, ignorePassword) {
-        if (this.hostname      != aLogin.hostname      ||
-            this.httpRealm     != aLogin.httpRealm     ||
-            this.username      != aLogin.username)
-            return false;
+  matches : function (aLogin, ignorePassword) {
+    if (this.hostname      != aLogin.hostname      ||
+        this.httpRealm     != aLogin.httpRealm     ||
+        this.username      != aLogin.username)
+      return false;
 
-        if (!ignorePassword && this.password != aLogin.password)
-            return false;
+    if (!ignorePassword && this.password != aLogin.password)
+      return false;
 
-        // If either formSubmitURL is blank (but not null), then match.
-        if (this.formSubmitURL != "" && aLogin.formSubmitURL != "" &&
-            this.formSubmitURL != aLogin.formSubmitURL)
-            return false;
+    // If either formSubmitURL is blank (but not null), then match.
+    if (this.formSubmitURL != "" && aLogin.formSubmitURL != "" &&
+        this.formSubmitURL != aLogin.formSubmitURL)
+      return false;
 
-        // The .usernameField and .passwordField values are ignored.
+    // The .usernameField and .passwordField values are ignored.
 
-        return true;
-    },
+    return true;
+  },
 
-    equals : function (aLogin) {
-        if (this.hostname      != aLogin.hostname      ||
-            this.formSubmitURL != aLogin.formSubmitURL ||
-            this.httpRealm     != aLogin.httpRealm     ||
-            this.username      != aLogin.username      ||
-            this.password      != aLogin.password      ||
-            this.usernameField != aLogin.usernameField ||
-            this.passwordField != aLogin.passwordField)
-            return false;
+  equals : function (aLogin) {
+    if (this.hostname      != aLogin.hostname      ||
+        this.formSubmitURL != aLogin.formSubmitURL ||
+        this.httpRealm     != aLogin.httpRealm     ||
+        this.username      != aLogin.username      ||
+        this.password      != aLogin.password      ||
+        this.usernameField != aLogin.usernameField ||
+        this.passwordField != aLogin.passwordField)
+      return false;
 
-        return true;
-    },
+    return true;
+  },
 
-    clone : function() {
-        let clone = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                    createInstance(Ci.nsILoginInfo);
-        clone.init(this.hostname, this.formSubmitURL, this.httpRealm,
-                   this.username, this.password,
-                   this.usernameField, this.passwordField);
+  clone : function() {
+    let clone = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                createInstance(Ci.nsILoginInfo);
+    clone.init(this.hostname, this.formSubmitURL, this.httpRealm,
+               this.username, this.password,
+               this.usernameField, this.passwordField);
 
-        // Copy nsILoginMetaInfo props
-        clone.QueryInterface(Ci.nsILoginMetaInfo);
-        clone.guid = this.guid;
-        clone.timeCreated = this.timeCreated;
-        clone.timeLastUsed = this.timeLastUsed;
-        clone.timePasswordChanged = this.timePasswordChanged;
-        clone.timesUsed = this.timesUsed;
+    // Copy nsILoginMetaInfo props
+    clone.QueryInterface(Ci.nsILoginMetaInfo);
+    clone.guid = this.guid;
+    clone.timeCreated = this.timeCreated;
+    clone.timeLastUsed = this.timeLastUsed;
+    clone.timePasswordChanged = this.timePasswordChanged;
+    clone.timesUsed = this.timesUsed;
 
-        return clone;
-    },
+    return clone;
+  },
 
-    //
-    // nsILoginMetaInfo interfaces...
-    //
+  //
+  // nsILoginMetaInfo interfaces...
+  //
 
-    guid : null,
-    timeCreated : null,
-    timeLastUsed : null,
-    timePasswordChanged : null,
-    timesUsed : null
+  guid : null,
+  timeCreated : null,
+  timeLastUsed : null,
+  timePasswordChanged : null,
+  timesUsed : null
 
 }; // end of nsLoginInfo implementation
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsLoginInfo]);
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -17,539 +17,539 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/Promise.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
                                   "resource://gre/modules/Task.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
                                   "resource://gre/modules/BrowserUtils.jsm");
 
 var debug = false;
 function log(...pieces) {
-    function generateLogMessage(args) {
-        let strings = ['Login Manager:'];
+  function generateLogMessage(args) {
+    let strings = ['Login Manager:'];
 
-        args.forEach(function(arg) {
-            if (typeof arg === 'string') {
-                strings.push(arg);
-            } else if (typeof arg === 'undefined') {
-                strings.push('undefined');
-            } else if (arg === null) {
-                strings.push('null');
-            } else {
-                try {
-                  strings.push(JSON.stringify(arg, null, 2));
-                } catch(err) {
-                  strings.push("<<something>>");
-                }
-            }
-        });
-        return strings.join(' ');
-    }
+    args.forEach(function(arg) {
+      if (typeof arg === 'string') {
+        strings.push(arg);
+      } else if (typeof arg === 'undefined') {
+        strings.push('undefined');
+      } else if (arg === null) {
+        strings.push('null');
+      } else {
+        try {
+          strings.push(JSON.stringify(arg, null, 2));
+        } catch(err) {
+          strings.push("<<something>>");
+        }
+      }
+    });
+    return strings.join(' ');
+  }
 
-    if (!debug)
-        return;
+  if (!debug)
+    return;
 
-    let message = generateLogMessage(pieces);
-    dump(message + "\n");
-    Services.console.logStringMessage(message);
+  let message = generateLogMessage(pieces);
+  dump(message + "\n");
+  Services.console.logStringMessage(message);
 }
 
 function LoginManager() {
-    this.init();
+  this.init();
 }
 
 LoginManager.prototype = {
 
-    classID: Components.ID("{cb9e0de8-3598-4ed7-857b-827f011ad5d8}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManager,
-                                            Ci.nsISupportsWeakReference,
-                                            Ci.nsIInterfaceRequestor]),
-    getInterface : function(aIID) {
-        if (aIID.equals(Ci.mozIStorageConnection) && this._storage) {
-          let ir = this._storage.QueryInterface(Ci.nsIInterfaceRequestor);
-          return ir.getInterface(aIID);
-        }
+  classID: Components.ID("{cb9e0de8-3598-4ed7-857b-827f011ad5d8}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManager,
+                                          Ci.nsISupportsWeakReference,
+                                          Ci.nsIInterfaceRequestor]),
+  getInterface : function(aIID) {
+    if (aIID.equals(Ci.mozIStorageConnection) && this._storage) {
+      let ir = this._storage.QueryInterface(Ci.nsIInterfaceRequestor);
+      return ir.getInterface(aIID);
+    }
 
-        if (aIID.equals(Ci.nsIVariant)) {
-            // Allows unwrapping the JavaScript object for regression tests.
-            return this;
-        }
+    if (aIID.equals(Ci.nsIVariant)) {
+      // Allows unwrapping the JavaScript object for regression tests.
+      return this;
+    }
 
-        throw Cr.NS_ERROR_NO_INTERFACE;
-    },
+    throw Cr.NS_ERROR_NO_INTERFACE;
+  },
 
 
-    /* ---------- private members ---------- */
+  /* ---------- private members ---------- */
 
 
-    __formFillService : null, // FormFillController, for username autocompleting
-    get _formFillService() {
-        if (!this.__formFillService)
-            this.__formFillService =
-                            Cc["@mozilla.org/satchel/form-fill-controller;1"].
-                            getService(Ci.nsIFormFillController);
-        return this.__formFillService;
-    },
+  __formFillService : null, // FormFillController, for username autocompleting
+  get _formFillService() {
+    if (!this.__formFillService)
+      this.__formFillService =
+                      Cc["@mozilla.org/satchel/form-fill-controller;1"].
+                      getService(Ci.nsIFormFillController);
+    return this.__formFillService;
+  },
 
 
-    _storage : null, // Storage component which contains the saved logins
-    _prefBranch  : null, // Preferences service
-    _remember : true,  // mirrors signon.rememberSignons preference
+  _storage : null, // Storage component which contains the saved logins
+  _prefBranch  : null, // Preferences service
+  _remember : true,  // mirrors signon.rememberSignons preference
 
 
-    /*
-     * init
-     *
-     * Initialize the Login Manager. Automatically called when service
-     * is created.
-     *
-     * Note: Service created in /browser/base/content/browser.js,
-     *       delayedStartup()
-     */
-    init : function () {
+  /*
+   * init
+   *
+   * Initialize the Login Manager. Automatically called when service
+   * is created.
+   *
+   * Note: Service created in /browser/base/content/browser.js,
+   *       delayedStartup()
+   */
+  init : function () {
 
-        // Cache references to current |this| in utility objects
-        this._observer._pwmgr            = this;
+    // Cache references to current |this| in utility objects
+    this._observer._pwmgr            = this;
 
-        // Preferences. Add observer so we get notified of changes.
-        this._prefBranch = Services.prefs.getBranch("signon.");
-        this._prefBranch.addObserver("", this._observer, false);
+    // Preferences. Add observer so we get notified of changes.
+    this._prefBranch = Services.prefs.getBranch("signon.");
+    this._prefBranch.addObserver("", this._observer, false);
 
-        // Get current preference values.
-        debug = this._prefBranch.getBoolPref("debug");
+    // Get current preference values.
+    debug = this._prefBranch.getBoolPref("debug");
 
-        this._remember = this._prefBranch.getBoolPref("rememberSignons");
+    this._remember = this._prefBranch.getBoolPref("rememberSignons");
 
-        // Form submit observer checks forms for new logins and pw changes.
-        Services.obs.addObserver(this._observer, "xpcom-shutdown", false);
+    // Form submit observer checks forms for new logins and pw changes.
+    Services.obs.addObserver(this._observer, "xpcom-shutdown", false);
 
-        // TODO: Make this class useful in the child process (in addition to
-        // autoCompleteSearchAsync and fillForm).
-        if (Services.appinfo.processType ===
-            Services.appinfo.PROCESS_TYPE_DEFAULT) {
-            Services.obs.addObserver(this._observer, "passwordmgr-storage-replace",
-                                     false);
+    // TODO: Make this class useful in the child process (in addition to
+    // autoCompleteSearchAsync and fillForm).
+    if (Services.appinfo.processType ===
+        Services.appinfo.PROCESS_TYPE_DEFAULT) {
+      Services.obs.addObserver(this._observer, "passwordmgr-storage-replace",
+                               false);
 
-            // Initialize storage so that asynchronous data loading can start.
-            this._initStorage();
-        }
+      // Initialize storage so that asynchronous data loading can start.
+      this._initStorage();
+    }
 
-        Services.obs.addObserver(this._observer, "gather-telemetry", false);
-    },
+    Services.obs.addObserver(this._observer, "gather-telemetry", false);
+  },
 
 
-    _initStorage : function () {
+  _initStorage : function () {
 #ifdef ANDROID
-        var contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
+    var contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
 #else
-        var contractID = "@mozilla.org/login-manager/storage/json;1";
+    var contractID = "@mozilla.org/login-manager/storage/json;1";
 #endif
-        try {
-            var catMan = Cc["@mozilla.org/categorymanager;1"].
-                         getService(Ci.nsICategoryManager);
-            contractID = catMan.getCategoryEntry("login-manager-storage",
-                                                 "nsILoginManagerStorage");
-            log("Found alternate nsILoginManagerStorage with contract ID:", contractID);
-        } catch (e) {
-            log("No alternate nsILoginManagerStorage registered");
-        }
+    try {
+      var catMan = Cc["@mozilla.org/categorymanager;1"].
+                   getService(Ci.nsICategoryManager);
+      contractID = catMan.getCategoryEntry("login-manager-storage",
+                                           "nsILoginManagerStorage");
+      log("Found alternate nsILoginManagerStorage with contract ID:", contractID);
+    } catch (e) {
+      log("No alternate nsILoginManagerStorage registered");
+    }
 
-        this._storage = Cc[contractID].
-                        createInstance(Ci.nsILoginManagerStorage);
-        this.initializationPromise = this._storage.initialize();
-    },
+    this._storage = Cc[contractID].
+                    createInstance(Ci.nsILoginManagerStorage);
+    this.initializationPromise = this._storage.initialize();
+  },
 
 
-    /* ---------- Utility objects ---------- */
+  /* ---------- Utility objects ---------- */
 
 
-    /*
-     * _observer object
-     *
-     * Internal utility object, implements the nsIObserver interface.
-     * Used to receive notification for: form submission, preference changes.
-     */
-    _observer : {
-        _pwmgr : null,
+  /*
+   * _observer object
+   *
+   * Internal utility object, implements the nsIObserver interface.
+   * Used to receive notification for: form submission, preference changes.
+   */
+  _observer : {
+    _pwmgr : null,
 
-        QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
-                                                Ci.nsISupportsWeakReference]),
+    QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
+                                            Ci.nsISupportsWeakReference]),
 
-        // nsObserver
-        observe : function (subject, topic, data) {
+    // nsObserver
+    observe : function (subject, topic, data) {
 
-            if (topic == "nsPref:changed") {
-                var prefName = data;
-                log("got change to", prefName, "preference");
+      if (topic == "nsPref:changed") {
+        var prefName = data;
+        log("got change to", prefName, "preference");
 
-                if (prefName == "debug") {
-                    debug = this._pwmgr._prefBranch.getBoolPref("debug");
-                } else if (prefName == "rememberSignons") {
-                    this._pwmgr._remember =
-                        this._pwmgr._prefBranch.getBoolPref("rememberSignons");
-                } else {
-                    log("Oops! Pref not handled, change ignored.");
-                }
-            } else if (topic == "xpcom-shutdown") {
-                delete this._pwmgr.__formFillService;
-                delete this._pwmgr._storage;
-                delete this._pwmgr._prefBranch;
-                this._pwmgr = null;
-            } else if (topic == "passwordmgr-storage-replace") {
-                Task.spawn(function () {
-                  yield this._pwmgr._storage.terminate();
-                  this._pwmgr._initStorage();
-                  yield this._pwmgr.initializationPromise;
-                  Services.obs.notifyObservers(null,
-                               "passwordmgr-storage-replace-complete", null);
-                }.bind(this));
-            } else if (topic == "gather-telemetry") {
-                this._pwmgr._gatherTelemetry();
-            } else {
-                log("Oops! Unexpected notification:", topic);
-            }
+        if (prefName == "debug") {
+          debug = this._pwmgr._prefBranch.getBoolPref("debug");
+        } else if (prefName == "rememberSignons") {
+          this._pwmgr._remember =
+              this._pwmgr._prefBranch.getBoolPref("rememberSignons");
+        } else {
+          log("Oops! Pref not handled, change ignored.");
         }
-    },
-
-    _gatherTelemetry : function() {
-      let numPasswordsBlocklist = Services.telemetry.getHistogramById("PWMGR_BLOCKLIST_NUM_SITES");
-      numPasswordsBlocklist.clear();
-      numPasswordsBlocklist.add(this.getAllDisabledHosts({}).length);
-
-      let numPasswordsHist = Services.telemetry.getHistogramById("PWMGR_NUM_SAVED_PASSWORDS");
-      numPasswordsHist.clear();
-      numPasswordsHist.add(this.countLogins("", "", ""));
+      } else if (topic == "xpcom-shutdown") {
+        delete this._pwmgr.__formFillService;
+        delete this._pwmgr._storage;
+        delete this._pwmgr._prefBranch;
+        this._pwmgr = null;
+      } else if (topic == "passwordmgr-storage-replace") {
+        Task.spawn(function () {
+          yield this._pwmgr._storage.terminate();
+          this._pwmgr._initStorage();
+          yield this._pwmgr.initializationPromise;
+          Services.obs.notifyObservers(null,
+                       "passwordmgr-storage-replace-complete", null);
+        }.bind(this));
+      } else if (topic == "gather-telemetry") {
+        this._pwmgr._gatherTelemetry();
+      } else {
+        log("Oops! Unexpected notification:", topic);
+      }
+    }
+  },
 
-      let isPwdSavedEnabledHist = Services.telemetry.getHistogramById("PWMGR_SAVING_ENABLED");
-      isPwdSavedEnabledHist.clear();
-      isPwdSavedEnabledHist.add(this._remember);
+  _gatherTelemetry : function() {
+    let numPasswordsBlocklist = Services.telemetry.getHistogramById("PWMGR_BLOCKLIST_NUM_SITES");
+    numPasswordsBlocklist.clear();
+    numPasswordsBlocklist.add(this.getAllDisabledHosts({}).length);
 
-      // Don't try to get logins if MP is enabled, since we don't want to show a MP prompt.
-      if (this.isLoggedIn) {
-        let logins = this.getAllLogins({});
+    let numPasswordsHist = Services.telemetry.getHistogramById("PWMGR_NUM_SAVED_PASSWORDS");
+    numPasswordsHist.clear();
+    numPasswordsHist.add(this.countLogins("", "", ""));
 
-        let usernameHist = Services.telemetry.getHistogramById("PWMGR_USERNAME_PRESENT");
-        usernameHist.clear();
-        for (let login of logins) {
-          usernameHist.add(!!login.username);
-        }
+    let isPwdSavedEnabledHist = Services.telemetry.getHistogramById("PWMGR_SAVING_ENABLED");
+    isPwdSavedEnabledHist.clear();
+    isPwdSavedEnabledHist.add(this._remember);
+
+    // Don't try to get logins if MP is enabled, since we don't want to show a MP prompt.
+    if (this.isLoggedIn) {
+      let logins = this.getAllLogins({});
+
+      let usernameHist = Services.telemetry.getHistogramById("PWMGR_USERNAME_PRESENT");
+      usernameHist.clear();
+      for (let login of logins) {
+        usernameHist.add(!!login.username);
       }
-    },
+    }
+  },
 
 
 
 
 
-    /* ---------- Primary Public interfaces ---------- */
+  /* ---------- Primary Public interfaces ---------- */
 
 
 
 
-    /*
-     * initializationPromise
-     *
-     * This promise is resolved when initialization is complete, and is rejected
-     * in case the asynchronous part of initialization failed.
-     */
-    initializationPromise : null,
+  /*
+   * initializationPromise
+   *
+   * This promise is resolved when initialization is complete, and is rejected
+   * in case the asynchronous part of initialization failed.
+   */
+  initializationPromise : null,
 
 
-    /*
-     * addLogin
-     *
-     * Add a new login to login storage.
-     */
-    addLogin : function (login) {
-        // Sanity check the login
-        if (login.hostname == null || login.hostname.length == 0)
-            throw "Can't add a login with a null or empty hostname.";
+  /*
+   * addLogin
+   *
+   * Add a new login to login storage.
+   */
+  addLogin : function (login) {
+    // Sanity check the login
+    if (login.hostname == null || login.hostname.length == 0)
+      throw "Can't add a login with a null or empty hostname.";
 
-        // For logins w/o a username, set to "", not null.
-        if (login.username == null)
-            throw "Can't add a login with a null username.";
+    // For logins w/o a username, set to "", not null.
+    if (login.username == null)
+      throw "Can't add a login with a null username.";
 
-        if (login.password == null || login.password.length == 0)
-            throw "Can't add a login with a null or empty password.";
+    if (login.password == null || login.password.length == 0)
+      throw "Can't add a login with a null or empty password.";
 
-        if (login.formSubmitURL || login.formSubmitURL == "") {
-            // We have a form submit URL. Can't have a HTTP realm.
-            if (login.httpRealm != null)
-                throw "Can't add a login with both a httpRealm and formSubmitURL.";
-        } else if (login.httpRealm) {
-            // We have a HTTP realm. Can't have a form submit URL.
-            if (login.formSubmitURL != null)
-                throw "Can't add a login with both a httpRealm and formSubmitURL.";
-        } else {
-            // Need one or the other!
-            throw "Can't add a login without a httpRealm or formSubmitURL.";
-        }
+    if (login.formSubmitURL || login.formSubmitURL == "") {
+      // We have a form submit URL. Can't have a HTTP realm.
+      if (login.httpRealm != null)
+        throw "Can't add a login with both a httpRealm and formSubmitURL.";
+    } else if (login.httpRealm) {
+      // We have a HTTP realm. Can't have a form submit URL.
+      if (login.formSubmitURL != null)
+        throw "Can't add a login with both a httpRealm and formSubmitURL.";
+    } else {
+      // Need one or the other!
+      throw "Can't add a login without a httpRealm or formSubmitURL.";
+    }
 
 
-        // Look for an existing entry.
-        var logins = this.findLogins({}, login.hostname, login.formSubmitURL,
-                                     login.httpRealm);
+    // Look for an existing entry.
+    var logins = this.findLogins({}, login.hostname, login.formSubmitURL,
+                                 login.httpRealm);
 
-        if (logins.some(function(l) login.matches(l, true)))
-            throw "This login already exists.";
+    if (logins.some(function(l) login.matches(l, true)))
+      throw "This login already exists.";
 
-        log("Adding login");
-        return this._storage.addLogin(login);
-    },
+    log("Adding login");
+    return this._storage.addLogin(login);
+  },
 
 
-    /*
-     * removeLogin
-     *
-     * Remove the specified login from the stored logins.
-     */
-    removeLogin : function (login) {
-        log("Removing login");
-        return this._storage.removeLogin(login);
-    },
+  /*
+   * removeLogin
+   *
+   * Remove the specified login from the stored logins.
+   */
+  removeLogin : function (login) {
+    log("Removing login");
+    return this._storage.removeLogin(login);
+  },
 
 
-    /*
-     * modifyLogin
-     *
-     * Change the specified login to match the new login.
-     */
-    modifyLogin : function (oldLogin, newLogin) {
-        log("Modifying login");
-        return this._storage.modifyLogin(oldLogin, newLogin);
-    },
+  /*
+   * modifyLogin
+   *
+   * Change the specified login to match the new login.
+   */
+  modifyLogin : function (oldLogin, newLogin) {
+    log("Modifying login");
+    return this._storage.modifyLogin(oldLogin, newLogin);
+  },
 
 
-    /*
-     * getAllLogins
-     *
-     * Get a dump of all stored logins. Used by the login manager UI.
-     *
-     * |count| is only needed for XPCOM.
-     *
-     * Returns an array of logins. If there are no logins, the array is empty.
-     */
-    getAllLogins : function (count) {
-        log("Getting a list of all logins");
-        return this._storage.getAllLogins(count);
-    },
+  /*
+   * getAllLogins
+   *
+   * Get a dump of all stored logins. Used by the login manager UI.
+   *
+   * |count| is only needed for XPCOM.
+   *
+   * Returns an array of logins. If there are no logins, the array is empty.
+   */
+  getAllLogins : function (count) {
+    log("Getting a list of all logins");
+    return this._storage.getAllLogins(count);
+  },
 
 
-    /*
-     * removeAllLogins
-     *
-     * Remove all stored logins.
-     */
-    removeAllLogins : function () {
-        log("Removing all logins");
-        this._storage.removeAllLogins();
-    },
+  /*
+   * removeAllLogins
+   *
+   * Remove all stored logins.
+   */
+  removeAllLogins : function () {
+    log("Removing all logins");
+    this._storage.removeAllLogins();
+  },
 
-    /*
-     * getAllDisabledHosts
-     *
-     * Get a list of all hosts for which logins are disabled.
-     *
-     * |count| is only needed for XPCOM.
-     *
-     * Returns an array of disabled logins. If there are no disabled logins,
-     * the array is empty.
-     */
-    getAllDisabledHosts : function (count) {
-        log("Getting a list of all disabled hosts");
-        return this._storage.getAllDisabledHosts(count);
-    },
+  /*
+   * getAllDisabledHosts
+   *
+   * Get a list of all hosts for which logins are disabled.
+   *
+   * |count| is only needed for XPCOM.
+   *
+   * Returns an array of disabled logins. If there are no disabled logins,
+   * the array is empty.
+   */
+  getAllDisabledHosts : function (count) {
+    log("Getting a list of all disabled hosts");
+    return this._storage.getAllDisabledHosts(count);
+  },
 
 
-    /*
-     * findLogins
-     *
-     * Search for the known logins for entries matching the specified criteria.
-     */
-    findLogins : function (count, hostname, formSubmitURL, httpRealm) {
-        log("Searching for logins matching host:", hostname,
-            "formSubmitURL:", formSubmitURL, "httpRealm:", httpRealm);
+  /*
+   * findLogins
+   *
+   * Search for the known logins for entries matching the specified criteria.
+   */
+  findLogins : function (count, hostname, formSubmitURL, httpRealm) {
+    log("Searching for logins matching host:", hostname,
+        "formSubmitURL:", formSubmitURL, "httpRealm:", httpRealm);
 
-        return this._storage.findLogins(count, hostname, formSubmitURL,
-                                        httpRealm);
-    },
+    return this._storage.findLogins(count, hostname, formSubmitURL,
+                                    httpRealm);
+  },
 
 
-    /*
-     * searchLogins
-     *
-     * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
-     * JavaScript object and decrypt the results.
-     *
-     * Returns an array of decrypted nsILoginInfo.
-     */
-    searchLogins : function(count, matchData) {
-       log("Searching for logins");
+  /*
+   * searchLogins
+   *
+   * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
+   * JavaScript object and decrypt the results.
+   *
+   * Returns an array of decrypted nsILoginInfo.
+   */
+  searchLogins : function(count, matchData) {
+   log("Searching for logins");
 
-        return this._storage.searchLogins(count, matchData);
-    },
+    return this._storage.searchLogins(count, matchData);
+  },
 
 
-    /*
-     * countLogins
-     *
-     * Search for the known logins for entries matching the specified criteria,
-     * returns only the count.
-     */
-    countLogins : function (hostname, formSubmitURL, httpRealm) {
-        log("Counting logins matching host:", hostname,
-            "formSubmitURL:", formSubmitURL, "httpRealm:", httpRealm);
+  /*
+   * countLogins
+   *
+   * Search for the known logins for entries matching the specified criteria,
+   * returns only the count.
+   */
+  countLogins : function (hostname, formSubmitURL, httpRealm) {
+    log("Counting logins matching host:", hostname,
+        "formSubmitURL:", formSubmitURL, "httpRealm:", httpRealm);
 
-        return this._storage.countLogins(hostname, formSubmitURL, httpRealm);
-    },
+    return this._storage.countLogins(hostname, formSubmitURL, httpRealm);
+  },
 
 
-    /*
-     * uiBusy
-     */
-    get uiBusy() {
-        return this._storage.uiBusy;
-    },
+  /*
+   * uiBusy
+   */
+  get uiBusy() {
+    return this._storage.uiBusy;
+  },
 
 
-    /*
-     * isLoggedIn
-     */
-    get isLoggedIn() {
-        return this._storage.isLoggedIn;
-    },
+  /*
+   * isLoggedIn
+   */
+  get isLoggedIn() {
+    return this._storage.isLoggedIn;
+  },
 
 
-    /*
-     * getLoginSavingEnabled
-     *
-     * Check to see if user has disabled saving logins for the host.
-     */
-    getLoginSavingEnabled : function (host) {
-        log("Checking if logins to", host, "can be saved.");
-        if (!this._remember)
-            return false;
+  /*
+   * getLoginSavingEnabled
+   *
+   * Check to see if user has disabled saving logins for the host.
+   */
+  getLoginSavingEnabled : function (host) {
+    log("Checking if logins to", host, "can be saved.");
+    if (!this._remember)
+      return false;
 
-        return this._storage.getLoginSavingEnabled(host);
-    },
+    return this._storage.getLoginSavingEnabled(host);
+  },
 
 
-    /*
-     * setLoginSavingEnabled
-     *
-     * Enable or disable storing logins for the specified host.
-     */
-    setLoginSavingEnabled : function (hostname, enabled) {
-        // Nulls won't round-trip with getAllDisabledHosts().
-        if (hostname.indexOf("\0") != -1)
-            throw "Invalid hostname";
+  /*
+   * setLoginSavingEnabled
+   *
+   * Enable or disable storing logins for the specified host.
+   */
+  setLoginSavingEnabled : function (hostname, enabled) {
+    // Nulls won't round-trip with getAllDisabledHosts().
+    if (hostname.indexOf("\0") != -1)
+      throw "Invalid hostname";
 
-        log("Login saving for", hostname, "now enabled?", enabled);
-        return this._storage.setLoginSavingEnabled(hostname, enabled);
-    },
+    log("Login saving for", hostname, "now enabled?", enabled);
+    return this._storage.setLoginSavingEnabled(hostname, enabled);
+  },
 
-    /*
-     * autoCompleteSearchAsync
-     *
-     * Yuck. This is called directly by satchel:
-     * nsFormFillController::StartSearch()
-     * [toolkit/components/satchel/nsFormFillController.cpp]
-     *
-     * We really ought to have a simple way for code to register an
-     * auto-complete provider, and not have satchel calling pwmgr directly.
-     */
-    autoCompleteSearchAsync : function (aSearchString, aPreviousResult,
-                                        aElement, aCallback) {
-        // aPreviousResult is an nsIAutoCompleteResult, aElement is
-        // nsIDOMHTMLInputElement
+  /*
+   * autoCompleteSearchAsync
+   *
+   * Yuck. This is called directly by satchel:
+   * nsFormFillController::StartSearch()
+   * [toolkit/components/satchel/nsFormFillController.cpp]
+   *
+   * We really ought to have a simple way for code to register an
+   * auto-complete provider, and not have satchel calling pwmgr directly.
+   */
+  autoCompleteSearchAsync : function (aSearchString, aPreviousResult,
+                                      aElement, aCallback) {
+    // aPreviousResult is an nsIAutoCompleteResult, aElement is
+    // nsIDOMHTMLInputElement
 
-        if (!this._remember) {
-            setTimeout(function() {
-                aCallback.onSearchCompletion(new UserAutoCompleteResult(aSearchString, []));
-            }, 0);
-            return;
-        }
+    if (!this._remember) {
+      setTimeout(function() {
+        aCallback.onSearchCompletion(new UserAutoCompleteResult(aSearchString, []));
+      }, 0);
+      return;
+    }
 
-        log("AutoCompleteSearch invoked. Search is:", aSearchString);
+    log("AutoCompleteSearch invoked. Search is:", aSearchString);
 
-        var previousResult;
-        if (aPreviousResult) {
-            previousResult = { searchString: aPreviousResult.searchString,
-                               logins: aPreviousResult.wrappedJSObject.logins };
-        } else {
-            previousResult = null;
-        }
+    var previousResult;
+    if (aPreviousResult) {
+      previousResult = { searchString: aPreviousResult.searchString,
+                         logins: aPreviousResult.wrappedJSObject.logins };
+    } else {
+      previousResult = null;
+    }
 
-        let rect = BrowserUtils.getElementBoundingScreenRect(aElement);
-        LoginManagerContent._autoCompleteSearchAsync(aSearchString, previousResult,
-                                                     aElement, rect)
-                           .then(function(logins) {
-                               let results =
-                                   new UserAutoCompleteResult(aSearchString, logins);
-                               aCallback.onSearchCompletion(results);
-                           })
-                           .then(null, Cu.reportError);
-    },
+    let rect = BrowserUtils.getElementBoundingScreenRect(aElement);
+    LoginManagerContent._autoCompleteSearchAsync(aSearchString, previousResult,
+                                                 aElement, rect)
+                       .then(function(logins) {
+                         let results =
+                             new UserAutoCompleteResult(aSearchString, logins);
+                         aCallback.onSearchCompletion(results);
+                       })
+                       .then(null, Cu.reportError);
+  },
 
 
-    /* ------- Internal methods / callbacks for document integration ------- */
+  /* ------- Internal methods / callbacks for document integration ------- */
 
 
-    /*
-     * _getPasswordOrigin
-     *
-     * Get the parts of the URL we want for identification.
-     */
-    _getPasswordOrigin : function (uriString, allowJS) {
-        var realm = "";
-        try {
-            var uri = Services.io.newURI(uriString, null, null);
+  /*
+   * _getPasswordOrigin
+   *
+   * Get the parts of the URL we want for identification.
+   */
+  _getPasswordOrigin : function (uriString, allowJS) {
+    var realm = "";
+    try {
+      var uri = Services.io.newURI(uriString, null, null);
 
-            if (allowJS && uri.scheme == "javascript")
-                return "javascript:"
+      if (allowJS && uri.scheme == "javascript")
+        return "javascript:"
 
-            realm = uri.scheme + "://" + uri.host;
+      realm = uri.scheme + "://" + uri.host;
 
-            // If the URI explicitly specified a port, only include it when
-            // it's not the default. (We never want "http://foo.com:80")
-            var port = uri.port;
-            if (port != -1) {
-                var handler = Services.io.getProtocolHandler(uri.scheme);
-                if (port != handler.defaultPort)
-                    realm += ":" + port;
-            }
+      // If the URI explicitly specified a port, only include it when
+      // it's not the default. (We never want "http://foo.com:80")
+      var port = uri.port;
+      if (port != -1) {
+        var handler = Services.io.getProtocolHandler(uri.scheme);
+        if (port != handler.defaultPort)
+          realm += ":" + port;
+      }
 
-        } catch (e) {
-            // bug 159484 - disallow url types that don't support a hostPort.
-            // (although we handle "javascript:..." as a special case above.)
-            log("Couldn't parse origin for", uriString);
-            realm = null;
-        }
+    } catch (e) {
+      // bug 159484 - disallow url types that don't support a hostPort.
+      // (although we handle "javascript:..." as a special case above.)
+      log("Couldn't parse origin for", uriString);
+      realm = null;
+    }
 
-        return realm;
-    },
+    return realm;
+  },
 
-    _getActionOrigin : function (form) {
-        var uriString = form.action;
+  _getActionOrigin : function (form) {
+    var uriString = form.action;
 
-        // A blank or missing action submits to where it came from.
-        if (uriString == "")
-            uriString = form.baseURI; // ala bug 297761
+    // A blank or missing action submits to where it came from.
+    if (uriString == "")
+      uriString = form.baseURI; // ala bug 297761
 
-        return this._getPasswordOrigin(uriString, true);
-    },
+    return this._getPasswordOrigin(uriString, true);
+  },
 
 
-    /*
-     * fillForm
-     *
-     * Fill the form with login information if we can find it.
-     */
-    fillForm : function (form) {
-        log("fillForm processing form[ id:", form.id, "]");
-        return LoginManagerContent._asyncFindLogins(form, { showMasterPassword: true })
-                                  .then(function({ form, loginsFound }) {
-                   return LoginManagerContent._fillForm(form, true, true,
-                                                        false, false, loginsFound)[0];
-               });
-    },
+  /*
+   * fillForm
+   *
+   * Fill the form with login information if we can find it.
+   */
+  fillForm : function (form) {
+    log("fillForm processing form[ id:", form.id, "]");
+    return LoginManagerContent._asyncFindLogins(form, { showMasterPassword: true })
+                              .then(function({ form, loginsFound }) {
+      return LoginManagerContent._fillForm(form, true, true,
+                                           false, false, loginsFound)[0];
+    });
+  },
 
 }; // end of LoginManager implementation
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManager]);
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -1,9 +1,9 @@
-/* vim: set ts=4 sts=4 sw=4 et tw=80: */
+/* vim: set ts=2 sts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
@@ -16,162 +16,162 @@ Components.utils.import("resource://gre/
 /*
  * LoginManagerPromptFactory
  *
  * Implements nsIPromptFactory
  *
  * Invoked by [toolkit/components/prompts/src/nsPrompter.js]
  */
 function LoginManagerPromptFactory() {
-    Services.obs.addObserver(this, "quit-application-granted", true);
-    Services.obs.addObserver(this, "passwordmgr-crypto-login", true);
-    Services.obs.addObserver(this, "passwordmgr-crypto-loginCanceled", true);
+  Services.obs.addObserver(this, "quit-application-granted", true);
+  Services.obs.addObserver(this, "passwordmgr-crypto-login", true);
+  Services.obs.addObserver(this, "passwordmgr-crypto-loginCanceled", true);
 }
 
 LoginManagerPromptFactory.prototype = {
 
-    classID : Components.ID("{749e62f4-60ae-4569-a8a2-de78b649660e}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsIPromptFactory, Ci.nsIObserver, Ci.nsISupportsWeakReference]),
+  classID : Components.ID("{749e62f4-60ae-4569-a8a2-de78b649660e}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsIPromptFactory, Ci.nsIObserver, Ci.nsISupportsWeakReference]),
 
-    _debug : false,
-    _asyncPrompts : {},
-    _asyncPromptInProgress : false,
+  _debug : false,
+  _asyncPrompts : {},
+  _asyncPromptInProgress : false,
 
-    observe : function (subject, topic, data) {
-        this.log("Observed: " + topic);
-        if (topic == "quit-application-granted") {
-            this._cancelPendingPrompts();
-        } else if (topic == "passwordmgr-crypto-login") {
-            // Start processing the deferred prompters.
-            this._doAsyncPrompt();
-        } else if (topic == "passwordmgr-crypto-loginCanceled") {
-            // User canceled a Master Password prompt, so go ahead and cancel
-            // all pending auth prompts to avoid nagging over and over.
-            this._cancelPendingPrompts();
-        }
-    },
+  observe : function (subject, topic, data) {
+    this.log("Observed: " + topic);
+    if (topic == "quit-application-granted") {
+      this._cancelPendingPrompts();
+    } else if (topic == "passwordmgr-crypto-login") {
+      // Start processing the deferred prompters.
+      this._doAsyncPrompt();
+    } else if (topic == "passwordmgr-crypto-loginCanceled") {
+      // User canceled a Master Password prompt, so go ahead and cancel
+      // all pending auth prompts to avoid nagging over and over.
+      this._cancelPendingPrompts();
+    }
+  },
 
-    getPrompt : function (aWindow, aIID) {
-        var prefBranch = Services.prefs.getBranch("signon.");
-        this._debug = prefBranch.getBoolPref("debug");
+  getPrompt : function (aWindow, aIID) {
+    var prefBranch = Services.prefs.getBranch("signon.");
+    this._debug = prefBranch.getBoolPref("debug");
+
+    var prompt = new LoginManagerPrompter().QueryInterface(aIID);
+    prompt.init(aWindow, this);
+    return prompt;
+  },
+
+  _doAsyncPrompt : function() {
+    if (this._asyncPromptInProgress) {
+      this.log("_doAsyncPrompt bypassed, already in progress");
+      return;
+    }
 
-        var prompt = new LoginManagerPrompter().QueryInterface(aIID);
-        prompt.init(aWindow, this);
-        return prompt;
-    },
+    // Find the first prompt key we have in the queue
+    var hashKey = null;
+    for (hashKey in this._asyncPrompts)
+      break;
 
-    _doAsyncPrompt : function() {
-        if (this._asyncPromptInProgress) {
-            this.log("_doAsyncPrompt bypassed, already in progress");
-            return;
-        }
+    if (!hashKey) {
+      this.log("_doAsyncPrompt:run bypassed, no prompts in the queue");
+      return;
+    }
 
-        // Find the first prompt key we have in the queue
-        var hashKey = null;
-        for (hashKey in this._asyncPrompts)
-            break;
+    // If login manger has logins for this host, defer prompting if we're
+    // already waiting on a master password entry.
+    var prompt = this._asyncPrompts[hashKey];
+    var prompter = prompt.prompter;
+    var [hostname, httpRealm] = prompter._getAuthTarget(prompt.channel, prompt.authInfo);
+    var hasLogins = (prompter._pwmgr.countLogins(hostname, null, httpRealm) > 0);
+    if (hasLogins && prompter._pwmgr.uiBusy) {
+      this.log("_doAsyncPrompt:run bypassed, master password UI busy");
+      return;
+    }
 
-        if (!hashKey) {
-            this.log("_doAsyncPrompt:run bypassed, no prompts in the queue");
-            return;
-        }
+    this._asyncPromptInProgress = true;
+    prompt.inProgress = true;
 
-        // If login manger has logins for this host, defer prompting if we're
-        // already waiting on a master password entry.
-        var prompt = this._asyncPrompts[hashKey];
-        var prompter = prompt.prompter;
-        var [hostname, httpRealm] = prompter._getAuthTarget(prompt.channel, prompt.authInfo);
-        var hasLogins = (prompter._pwmgr.countLogins(hostname, null, httpRealm) > 0);
-        if (hasLogins && prompter._pwmgr.uiBusy) {
-            this.log("_doAsyncPrompt:run bypassed, master password UI busy");
-            return;
+    var self = this;
+
+    var runnable = {
+      run : function() {
+        var ok = false;
+        try {
+          self.log("_doAsyncPrompt:run - performing the prompt for '" + hashKey + "'");
+          ok = prompter.promptAuth(prompt.channel,
+                                   prompt.level,
+                                   prompt.authInfo);
+        } catch (e if (e instanceof Components.Exception) &&
+                       e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
+          self.log("_doAsyncPrompt:run bypassed, UI is not available in this context");
+        } catch (e) {
+          Components.utils.reportError("LoginManagerPrompter: " +
+              "_doAsyncPrompt:run: " + e + "\n");
         }
 
-        this._asyncPromptInProgress = true;
-        prompt.inProgress = true;
-
-        var self = this;
+        delete self._asyncPrompts[hashKey];
+        prompt.inProgress = false;
+        self._asyncPromptInProgress = false;
 
-        var runnable = {
-            run : function() {
-                var ok = false;
-                try {
-                    self.log("_doAsyncPrompt:run - performing the prompt for '" + hashKey + "'");
-                    ok = prompter.promptAuth(prompt.channel,
-                                             prompt.level,
-                                             prompt.authInfo);
-                } catch (e if (e instanceof Components.Exception) &&
-                               e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
-                    self.log("_doAsyncPrompt:run bypassed, UI is not available in this context");
-                } catch (e) {
-                    Components.utils.reportError("LoginManagerPrompter: " +
-                        "_doAsyncPrompt:run: " + e + "\n");
-                }
+        for each (var consumer in prompt.consumers) {
+          if (!consumer.callback)
+            // Not having a callback means that consumer didn't provide it
+            // or canceled the notification
+            continue;
 
-                delete self._asyncPrompts[hashKey];
-                prompt.inProgress = false;
-                self._asyncPromptInProgress = false;
-
-                for each (var consumer in prompt.consumers) {
-                    if (!consumer.callback)
-                        // Not having a callback means that consumer didn't provide it
-                        // or canceled the notification
-                        continue;
+          self.log("Calling back to " + consumer.callback + " ok=" + ok);
+          try {
+            if (ok)
+              consumer.callback.onAuthAvailable(consumer.context, prompt.authInfo);
+            else
+              consumer.callback.onAuthCancelled(consumer.context, true);
+          } catch (e) { /* Throw away exceptions caused by callback */ }
+        }
+        self._doAsyncPrompt();
+      }
+    }
 
-                    self.log("Calling back to " + consumer.callback + " ok=" + ok);
-                    try {
-                        if (ok)
-                            consumer.callback.onAuthAvailable(consumer.context, prompt.authInfo);
-                        else
-                            consumer.callback.onAuthCancelled(consumer.context, true);
-                    } catch (e) { /* Throw away exceptions caused by callback */ }
-                }
-                self._doAsyncPrompt();
-            }
-        }
-
-        Services.tm.mainThread.dispatch(runnable, Ci.nsIThread.DISPATCH_NORMAL);
-        this.log("_doAsyncPrompt:run dispatched");
-    },
+    Services.tm.mainThread.dispatch(runnable, Ci.nsIThread.DISPATCH_NORMAL);
+    this.log("_doAsyncPrompt:run dispatched");
+  },
 
 
-    _cancelPendingPrompts : function() {
-        this.log("Canceling all pending prompts...");
-        var asyncPrompts = this._asyncPrompts;
-        this.__proto__._asyncPrompts = {};
+  _cancelPendingPrompts : function() {
+    this.log("Canceling all pending prompts...");
+    var asyncPrompts = this._asyncPrompts;
+    this.__proto__._asyncPrompts = {};
 
-        for each (var prompt in asyncPrompts) {
-            // Watch out! If this prompt is currently prompting, let it handle
-            // notifying the callbacks of success/failure, since it's already
-            // asking the user for input. Reusing a callback can be crashy.
-            if (prompt.inProgress) {
-                this.log("skipping a prompt in progress");
-                continue;
-            }
+    for each (var prompt in asyncPrompts) {
+      // Watch out! If this prompt is currently prompting, let it handle
+      // notifying the callbacks of success/failure, since it's already
+      // asking the user for input. Reusing a callback can be crashy.
+      if (prompt.inProgress) {
+        this.log("skipping a prompt in progress");
+        continue;
+      }
 
-            for each (var consumer in prompt.consumers) {
-                if (!consumer.callback)
-                    continue;
+      for each (var consumer in prompt.consumers) {
+        if (!consumer.callback)
+          continue;
 
-                this.log("Canceling async auth prompt callback " + consumer.callback);
-                try {
-                    consumer.callback.onAuthCancelled(consumer.context, true);
-                } catch (e) { /* Just ignore exceptions from the callback */ }
-            }
-        }
-    },
+        this.log("Canceling async auth prompt callback " + consumer.callback);
+        try {
+          consumer.callback.onAuthCancelled(consumer.context, true);
+        } catch (e) { /* Just ignore exceptions from the callback */ }
+      }
+    }
+  },
 
 
-    log : function (message) {
-        if (!this._debug)
-            return;
+  log : function (message) {
+    if (!this._debug)
+      return;
 
-        dump("Pwmgr PromptFactory: " + message + "\n");
-        Services.console.logStringMessage("Pwmgr PrompFactory: " + message);
-    }
+    dump("Pwmgr PromptFactory: " + message + "\n");
+    Services.console.logStringMessage("Pwmgr PrompFactory: " + message);
+  }
 }; // end of LoginManagerPromptFactory implementation
 
 
 
 
 /* ==================== LoginManagerPrompter ==================== */
 
 
@@ -189,1342 +189,1342 @@ LoginManagerPromptFactory.prototype = {
  *
  * nsILoginManagerPrompter: Used by Login Manager for saving/changing logins
  * found in HTML forms.
  */
 function LoginManagerPrompter() {}
 
 LoginManagerPrompter.prototype = {
 
-    classID : Components.ID("{8aa66d77-1bbb-45a6-991e-b8f47751c291}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsIAuthPrompt,
-                                            Ci.nsIAuthPrompt2,
-                                            Ci.nsILoginManagerPrompter]),
+  classID : Components.ID("{8aa66d77-1bbb-45a6-991e-b8f47751c291}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsIAuthPrompt,
+                                          Ci.nsIAuthPrompt2,
+                                          Ci.nsILoginManagerPrompter]),
 
-    _factory       : null,
-    _window        : null,
-    _browser       : null,
-    _opener        : null,
-    _debug         : false, // mirrors signon.debug
+  _factory       : null,
+  _window        : null,
+  _browser       : null,
+  _opener        : null,
+  _debug         : false, // mirrors signon.debug
 
-    __pwmgr : null, // Password Manager service
-    get _pwmgr() {
-        if (!this.__pwmgr)
-            this.__pwmgr = Cc["@mozilla.org/login-manager;1"].
-                           getService(Ci.nsILoginManager);
-        return this.__pwmgr;
-    },
+  __pwmgr : null, // Password Manager service
+  get _pwmgr() {
+    if (!this.__pwmgr)
+      this.__pwmgr = Cc["@mozilla.org/login-manager;1"].
+                     getService(Ci.nsILoginManager);
+    return this.__pwmgr;
+  },
 
-    __promptService : null, // Prompt service for user interaction
-    get _promptService() {
-        if (!this.__promptService)
-            this.__promptService =
-                Cc["@mozilla.org/embedcomp/prompt-service;1"].
-                getService(Ci.nsIPromptService2);
-        return this.__promptService;
-    },
+  __promptService : null, // Prompt service for user interaction
+  get _promptService() {
+    if (!this.__promptService)
+      this.__promptService =
+          Cc["@mozilla.org/embedcomp/prompt-service;1"].
+          getService(Ci.nsIPromptService2);
+    return this.__promptService;
+  },
 
 
-    __strBundle : null, // String bundle for L10N
-    get _strBundle() {
-        if (!this.__strBundle) {
-            var bunService = Cc["@mozilla.org/intl/stringbundle;1"].
-                             getService(Ci.nsIStringBundleService);
-            this.__strBundle = bunService.createBundle(
-                        "chrome://passwordmgr/locale/passwordmgr.properties");
-            if (!this.__strBundle)
-                throw "String bundle for Login Manager not present!";
-        }
+  __strBundle : null, // String bundle for L10N
+  get _strBundle() {
+    if (!this.__strBundle) {
+      var bunService = Cc["@mozilla.org/intl/stringbundle;1"].
+                       getService(Ci.nsIStringBundleService);
+      this.__strBundle = bunService.createBundle(
+                  "chrome://passwordmgr/locale/passwordmgr.properties");
+      if (!this.__strBundle)
+        throw "String bundle for Login Manager not present!";
+    }
 
-        return this.__strBundle;
-    },
+    return this.__strBundle;
+  },
 
 
-    __ellipsis : null,
-    get _ellipsis() {
-        if (!this.__ellipsis) {
-            this.__ellipsis = "\u2026";
-            try {
-                this.__ellipsis = Services.prefs.getComplexValue(
-                                    "intl.ellipsis", Ci.nsIPrefLocalizedString).data;
-            } catch (e) { }
-        }
-        return this.__ellipsis;
-    },
+  __ellipsis : null,
+  get _ellipsis() {
+    if (!this.__ellipsis) {
+      this.__ellipsis = "\u2026";
+      try {
+        this.__ellipsis = Services.prefs.getComplexValue(
+                            "intl.ellipsis", Ci.nsIPrefLocalizedString).data;
+      } catch (e) { }
+    }
+    return this.__ellipsis;
+  },
 
 
-    // Whether we are in private browsing mode
-    get _inPrivateBrowsing() {
-      if (this._window) {
-        return PrivateBrowsingUtils.isContentWindowPrivate(this._window);
-      } else {
-        // If we don't that we're in private browsing mode if the caller did
-        // not provide a window.  The callers which really care about this
-        // will indeed pass down a window to us, and for those who don't,
-        // we can just assume that we don't want to save the entered login
-        // information.
-        return true;
-      }
-    },
+  // Whether we are in private browsing mode
+  get _inPrivateBrowsing() {
+    if (this._window) {
+      return PrivateBrowsingUtils.isContentWindowPrivate(this._window);
+    } else {
+      // If we don't that we're in private browsing mode if the caller did
+      // not provide a window.  The callers which really care about this
+      // will indeed pass down a window to us, and for those who don't,
+      // we can just assume that we don't want to save the entered login
+      // information.
+      return true;
+    }
+  },
 
 
-    /*
-     * log
-     *
-     * Internal function for logging debug messages to the Error Console window.
-     */
-    log : function (message) {
-        if (!this._debug)
-            return;
+  /*
+   * log
+   *
+   * Internal function for logging debug messages to the Error Console window.
+   */
+  log : function (message) {
+    if (!this._debug)
+      return;
 
-        dump("Pwmgr Prompter: " + message + "\n");
-        Services.console.logStringMessage("Pwmgr Prompter: " + message);
-    },
+    dump("Pwmgr Prompter: " + message + "\n");
+    Services.console.logStringMessage("Pwmgr Prompter: " + message);
+  },
 
 
 
 
-    /* ---------- nsIAuthPrompt prompts ---------- */
+  /* ---------- nsIAuthPrompt prompts ---------- */
 
 
-    /*
-     * prompt
-     *
-     * Wrapper around the prompt service prompt. Saving random fields here
-     * doesn't really make sense and therefore isn't implemented.
-     */
-    prompt : function (aDialogTitle, aText, aPasswordRealm,
-                       aSavePassword, aDefaultText, aResult) {
-        if (aSavePassword != Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER)
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+  /*
+   * prompt
+   *
+   * Wrapper around the prompt service prompt. Saving random fields here
+   * doesn't really make sense and therefore isn't implemented.
+   */
+  prompt : function (aDialogTitle, aText, aPasswordRealm,
+                     aSavePassword, aDefaultText, aResult) {
+    if (aSavePassword != Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER)
+      throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
 
-        this.log("===== prompt() called =====");
+    this.log("===== prompt() called =====");
 
-        if (aDefaultText) {
-            aResult.value = aDefaultText;
-        }
+    if (aDefaultText) {
+      aResult.value = aDefaultText;
+    }
 
-        return this._promptService.prompt(this._window,
-               aDialogTitle, aText, aResult, null, {});
-    },
+    return this._promptService.prompt(this._window,
+           aDialogTitle, aText, aResult, null, {});
+  },
 
 
-    /*
-     * promptUsernameAndPassword
-     *
-     * Looks up a username and password in the database. Will prompt the user
-     * with a dialog, even if a username and password are found.
-     */
-    promptUsernameAndPassword : function (aDialogTitle, aText, aPasswordRealm,
-                                         aSavePassword, aUsername, aPassword) {
-        this.log("===== promptUsernameAndPassword() called =====");
+  /*
+   * promptUsernameAndPassword
+   *
+   * Looks up a username and password in the database. Will prompt the user
+   * with a dialog, even if a username and password are found.
+   */
+  promptUsernameAndPassword : function (aDialogTitle, aText, aPasswordRealm,
+                                       aSavePassword, aUsername, aPassword) {
+    this.log("===== promptUsernameAndPassword() called =====");
 
-        if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
+        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
 
-        var selectedLogin = null;
-        var checkBox = { value : false };
-        var checkBoxLabel = null;
-        var [hostname, realm, unused] = this._getRealmInfo(aPasswordRealm);
+    var selectedLogin = null;
+    var checkBox = { value : false };
+    var checkBoxLabel = null;
+    var [hostname, realm, unused] = this._getRealmInfo(aPasswordRealm);
 
-        // If hostname is null, we can't save this login.
-        if (hostname) {
-            var canRememberLogin;
-            if (this._inPrivateBrowsing)
-                canRememberLogin = false;
-            else
-                canRememberLogin = (aSavePassword ==
-                                    Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
-                                   this._pwmgr.getLoginSavingEnabled(hostname);
+    // If hostname is null, we can't save this login.
+    if (hostname) {
+      var canRememberLogin;
+      if (this._inPrivateBrowsing)
+        canRememberLogin = false;
+      else
+        canRememberLogin = (aSavePassword ==
+                            Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
+                           this._pwmgr.getLoginSavingEnabled(hostname);
 
-            // if checkBoxLabel is null, the checkbox won't be shown at all.
-            if (canRememberLogin)
-                checkBoxLabel = this._getLocalizedString("rememberPassword");
+      // if checkBoxLabel is null, the checkbox won't be shown at all.
+      if (canRememberLogin)
+        checkBoxLabel = this._getLocalizedString("rememberPassword");
 
-            // Look for existing logins.
-            var foundLogins = this._pwmgr.findLogins({}, hostname, null,
-                                                     realm);
+      // Look for existing logins.
+      var foundLogins = this._pwmgr.findLogins({}, hostname, null,
+                                               realm);
 
-            // XXX Like the original code, we can't deal with multiple
-            // account selection. (bug 227632)
-            if (foundLogins.length > 0) {
-                selectedLogin = foundLogins[0];
+      // XXX Like the original code, we can't deal with multiple
+      // account selection. (bug 227632)
+      if (foundLogins.length > 0) {
+        selectedLogin = foundLogins[0];
 
-                // If the caller provided a username, try to use it. If they
-                // provided only a password, this will try to find a password-only
-                // login (or return null if none exists).
-                if (aUsername.value)
-                    selectedLogin = this._repickSelectedLogin(foundLogins,
-                                                              aUsername.value);
+        // If the caller provided a username, try to use it. If they
+        // provided only a password, this will try to find a password-only
+        // login (or return null if none exists).
+        if (aUsername.value)
+          selectedLogin = this._repickSelectedLogin(foundLogins,
+                                                    aUsername.value);
 
-                if (selectedLogin) {
-                    checkBox.value = true;
-                    aUsername.value = selectedLogin.username;
-                    // If the caller provided a password, prefer it.
-                    if (!aPassword.value)
-                        aPassword.value = selectedLogin.password;
-                }
-            }
+        if (selectedLogin) {
+          checkBox.value = true;
+          aUsername.value = selectedLogin.username;
+          // If the caller provided a password, prefer it.
+          if (!aPassword.value)
+            aPassword.value = selectedLogin.password;
         }
+      }
+    }
 
-        var ok = this._promptService.promptUsernameAndPassword(this._window,
-                    aDialogTitle, aText, aUsername, aPassword,
-                    checkBoxLabel, checkBox);
+    var ok = this._promptService.promptUsernameAndPassword(this._window,
+                aDialogTitle, aText, aUsername, aPassword,
+                checkBoxLabel, checkBox);
 
-        if (!ok || !checkBox.value || !hostname)
-            return ok;
+    if (!ok || !checkBox.value || !hostname)
+      return ok;
 
-        if (!aPassword.value) {
-            this.log("No password entered, so won't offer to save.");
-            return ok;
-        }
+    if (!aPassword.value) {
+      this.log("No password entered, so won't offer to save.");
+      return ok;
+    }
 
-        // XXX We can't prompt with multiple logins yet (bug 227632), so
-        // the entered login might correspond to an existing login
-        // other than the one we originally selected.
-        selectedLogin = this._repickSelectedLogin(foundLogins, aUsername.value);
+    // XXX We can't prompt with multiple logins yet (bug 227632), so
+    // the entered login might correspond to an existing login
+    // other than the one we originally selected.
+    selectedLogin = this._repickSelectedLogin(foundLogins, aUsername.value);
 
-        // If we didn't find an existing login, or if the username
-        // changed, save as a new login.
-        if (!selectedLogin) {
-            // add as new
-            this.log("New login seen for " + realm);
-            var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                           createInstance(Ci.nsILoginInfo);
-            newLogin.init(hostname, null, realm,
-                          aUsername.value, aPassword.value, "", "");
-            this._pwmgr.addLogin(newLogin);
-        } else if (aPassword.value != selectedLogin.password) {
-            // update password
-            this.log("Updating password for  " + realm);
-            this._updateLogin(selectedLogin, aPassword.value);
-        } else {
-            this.log("Login unchanged, no further action needed.");
-            this._updateLogin(selectedLogin);
-        }
+    // If we didn't find an existing login, or if the username
+    // changed, save as a new login.
+    if (!selectedLogin) {
+      // add as new
+      this.log("New login seen for " + realm);
+      var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                     createInstance(Ci.nsILoginInfo);
+      newLogin.init(hostname, null, realm,
+                    aUsername.value, aPassword.value, "", "");
+      this._pwmgr.addLogin(newLogin);
+    } else if (aPassword.value != selectedLogin.password) {
+      // update password
+      this.log("Updating password for  " + realm);
+      this._updateLogin(selectedLogin, aPassword.value);
+    } else {
+      this.log("Login unchanged, no further action needed.");
+      this._updateLogin(selectedLogin);
+    }
 
-        return ok;
-    },
+    return ok;
+  },
 
 
-    /*
-     * promptPassword
-     *
-     * If a password is found in the database for the password realm, it is
-     * returned straight away without displaying a dialog.
-     *
-     * If a password is not found in the database, the user will be prompted
-     * with a dialog with a text field and ok/cancel buttons. If the user
-     * allows it, then the password will be saved in the database.
-     */
-    promptPassword : function (aDialogTitle, aText, aPasswordRealm,
-                               aSavePassword, aPassword) {
-        this.log("===== promptPassword called() =====");
+  /*
+   * promptPassword
+   *
+   * If a password is found in the database for the password realm, it is
+   * returned straight away without displaying a dialog.
+   *
+   * If a password is not found in the database, the user will be prompted
+   * with a dialog with a text field and ok/cancel buttons. If the user
+   * allows it, then the password will be saved in the database.
+   */
+  promptPassword : function (aDialogTitle, aText, aPasswordRealm,
+                             aSavePassword, aPassword) {
+    this.log("===== promptPassword called() =====");
 
-        if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
+        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
 
-        var checkBox = { value : false };
-        var checkBoxLabel = null;
-        var [hostname, realm, username] = this._getRealmInfo(aPasswordRealm);
+    var checkBox = { value : false };
+    var checkBoxLabel = null;
+    var [hostname, realm, username] = this._getRealmInfo(aPasswordRealm);
 
-        username = decodeURIComponent(username);
+    username = decodeURIComponent(username);
 
-        // If hostname is null, we can't save this login.
-        if (hostname && !this._inPrivateBrowsing) {
-          var canRememberLogin = (aSavePassword ==
-                                  Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
-                                 this._pwmgr.getLoginSavingEnabled(hostname);
+    // If hostname is null, we can't save this login.
+    if (hostname && !this._inPrivateBrowsing) {
+      var canRememberLogin = (aSavePassword ==
+                              Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
+                             this._pwmgr.getLoginSavingEnabled(hostname);
 
-          // if checkBoxLabel is null, the checkbox won't be shown at all.
-          if (canRememberLogin)
-              checkBoxLabel = this._getLocalizedString("rememberPassword");
+      // if checkBoxLabel is null, the checkbox won't be shown at all.
+      if (canRememberLogin)
+        checkBoxLabel = this._getLocalizedString("rememberPassword");
 
-          if (!aPassword.value) {
-              // Look for existing logins.
-              var foundLogins = this._pwmgr.findLogins({}, hostname, null,
-                                                       realm);
+      if (!aPassword.value) {
+        // Look for existing logins.
+        var foundLogins = this._pwmgr.findLogins({}, hostname, null,
+                                                 realm);
 
-              // XXX Like the original code, we can't deal with multiple
-              // account selection (bug 227632). We can deal with finding the
-              // account based on the supplied username - but in this case we'll
-              // just return the first match.
-              for (var i = 0; i < foundLogins.length; ++i) {
-                  if (foundLogins[i].username == username) {
-                      aPassword.value = foundLogins[i].password;
-                      // wallet returned straight away, so this mimics that code
-                      return true;
-                  }
-              }
+        // XXX Like the original code, we can't deal with multiple
+        // account selection (bug 227632). We can deal with finding the
+        // account based on the supplied username - but in this case we'll
+        // just return the first match.
+        for (var i = 0; i < foundLogins.length; ++i) {
+          if (foundLogins[i].username == username) {
+            aPassword.value = foundLogins[i].password;
+            // wallet returned straight away, so this mimics that code
+            return true;
           }
         }
+      }
+    }
 
-        var ok = this._promptService.promptPassword(this._window, aDialogTitle,
-                                                    aText, aPassword,
-                                                    checkBoxLabel, checkBox);
+    var ok = this._promptService.promptPassword(this._window, aDialogTitle,
+                                                aText, aPassword,
+                                                checkBoxLabel, checkBox);
 
-        if (ok && checkBox.value && hostname && aPassword.value) {
-            var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                           createInstance(Ci.nsILoginInfo);
-            newLogin.init(hostname, null, realm, username,
-                          aPassword.value, "", "");
+    if (ok && checkBox.value && hostname && aPassword.value) {
+      var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                     createInstance(Ci.nsILoginInfo);
+      newLogin.init(hostname, null, realm, username,
+                    aPassword.value, "", "");
 
-            this.log("New login seen for " + realm);
+      this.log("New login seen for " + realm);
 
-            this._pwmgr.addLogin(newLogin);
-        }
+      this._pwmgr.addLogin(newLogin);
+    }
 
-        return ok;
-    },
+    return ok;
+  },
 
-    /* ---------- nsIAuthPrompt helpers ---------- */
+  /* ---------- nsIAuthPrompt helpers ---------- */
 
 
-    /**
-     * Given aRealmString, such as "http://user@example.com/foo", returns an
-     * array of:
-     *   - the formatted hostname
-     *   - the realm (hostname + path)
-     *   - the username, if present
-     *
-     * If aRealmString is in the format produced by NS_GetAuthKey for HTTP[S]
-     * channels, e.g. "example.com:80 (httprealm)", null is returned for all
-     * arguments to let callers know the login can't be saved because we don't
-     * know whether it's http or https.
-     */
-    _getRealmInfo : function (aRealmString) {
-        var httpRealm = /^.+ \(.+\)$/;
-        if (httpRealm.test(aRealmString))
-            return [null, null, null];
+  /**
+   * Given aRealmString, such as "http://user@example.com/foo", returns an
+   * array of:
+   *   - the formatted hostname
+   *   - the realm (hostname + path)
+   *   - the username, if present
+   *
+   * If aRealmString is in the format produced by NS_GetAuthKey for HTTP[S]
+   * channels, e.g. "example.com:80 (httprealm)", null is returned for all
+   * arguments to let callers know the login can't be saved because we don't
+   * know whether it's http or https.
+   */
+  _getRealmInfo : function (aRealmString) {
+    var httpRealm = /^.+ \(.+\)$/;
+    if (httpRealm.test(aRealmString))
+      return [null, null, null];
 
-        var uri = Services.io.newURI(aRealmString, null, null);
-        var pathname = "";
+    var uri = Services.io.newURI(aRealmString, null, null);
+    var pathname = "";
 
-        if (uri.path != "/")
-            pathname = uri.path;
+    if (uri.path != "/")
+      pathname = uri.path;
 
-        var formattedHostname = this._getFormattedHostname(uri);
+    var formattedHostname = this._getFormattedHostname(uri);
 
-        return [formattedHostname, formattedHostname + pathname, uri.username];
-    },
+    return [formattedHostname, formattedHostname + pathname, uri.username];
+  },
 
-    /* ---------- nsIAuthPrompt2 prompts ---------- */
+  /* ---------- nsIAuthPrompt2 prompts ---------- */
 
 
 
 
-    /*
-     * promptAuth
-     *
-     * Implementation of nsIAuthPrompt2.
-     *
-     * nsIChannel aChannel
-     * int        aLevel
-     * nsIAuthInformation aAuthInfo
-     */
-    promptAuth : function (aChannel, aLevel, aAuthInfo) {
-        var selectedLogin = null;
-        var checkbox = { value : false };
-        var checkboxLabel = null;
-        var epicfail = false;
-        var canAutologin = false;
+  /*
+   * promptAuth
+   *
+   * Implementation of nsIAuthPrompt2.
+   *
+   * nsIChannel aChannel
+   * int        aLevel
+   * nsIAuthInformation aAuthInfo
+   */
+  promptAuth : function (aChannel, aLevel, aAuthInfo) {
+    var selectedLogin = null;
+    var checkbox = { value : false };
+    var checkboxLabel = null;
+    var epicfail = false;
+    var canAutologin = false;
 
-        try {
+    try {
 
-            this.log("===== promptAuth called =====");
+      this.log("===== promptAuth called =====");
 
-            // If the user submits a login but it fails, we need to remove the
-            // notification bar that was displayed. Conveniently, the user will
-            // be prompted for authentication again, which brings us here.
-            this._removeLoginNotifications();
+      // If the user submits a login but it fails, we need to remove the
+      // notification bar that was displayed. Conveniently, the user will
+      // be prompted for authentication again, which brings us here.
+      this._removeLoginNotifications();
 
-            var [hostname, httpRealm] = this._getAuthTarget(aChannel, aAuthInfo);
+      var [hostname, httpRealm] = this._getAuthTarget(aChannel, aAuthInfo);
 
 
-            // Looks for existing logins to prefill the prompt with.
-            var foundLogins = this._pwmgr.findLogins({},
-                                        hostname, null, httpRealm);
-            this.log("found " + foundLogins.length + " matching logins.");
-
-            // XXX Can't select from multiple accounts yet. (bug 227632)
-            if (foundLogins.length > 0) {
-                selectedLogin = foundLogins[0];
-                this._SetAuthInfo(aAuthInfo, selectedLogin.username,
-                                             selectedLogin.password);
-
-                // Allow automatic proxy login
-                if (aAuthInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY &&
-                    !(aAuthInfo.flags & Ci.nsIAuthInformation.PREVIOUS_FAILED) &&
-                    Services.prefs.getBoolPref("signon.autologin.proxy") &&
-                    !this._inPrivateBrowsing) {
-
-                    this.log("Autologin enabled, skipping auth prompt.");
-                    canAutologin = true;
-                }
+      // Looks for existing logins to prefill the prompt with.
+      var foundLogins = this._pwmgr.findLogins({},
+                                  hostname, null, httpRealm);
+      this.log("found " + foundLogins.length + " matching logins.");
 
-                checkbox.value = true;
-            }
-
-            var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
-            if (this._inPrivateBrowsing)
-              canRememberLogin = false;
+      // XXX Can't select from multiple accounts yet. (bug 227632)
+      if (foundLogins.length > 0) {
+        selectedLogin = foundLogins[0];
+        this._SetAuthInfo(aAuthInfo, selectedLogin.username,
+                                     selectedLogin.password);
 
-            // if checkboxLabel is null, the checkbox won't be shown at all.
-            var notifyBox = this._getNotifyBox();
-            if (canRememberLogin && !notifyBox)
-                checkboxLabel = this._getLocalizedString("rememberPassword");
-        } catch (e) {
-            // Ignore any errors and display the prompt anyway.
-            epicfail = true;
-            Components.utils.reportError("LoginManagerPrompter: " +
-                "Epic fail in promptAuth: " + e + "\n");
-        }
+        // Allow automatic proxy login
+        if (aAuthInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY &&
+            !(aAuthInfo.flags & Ci.nsIAuthInformation.PREVIOUS_FAILED) &&
+            Services.prefs.getBoolPref("signon.autologin.proxy") &&
+            !this._inPrivateBrowsing) {
 
-        var ok = canAutologin;
-        if (!ok) {
-          if (this._window)
-            PromptUtils.fireDialogEvent(this._window, "DOMWillOpenModalDialog", this._browser);
-          ok = this._promptService.promptAuth(this._window,
-                                              aChannel, aLevel, aAuthInfo,
-                                              checkboxLabel, checkbox);
+          this.log("Autologin enabled, skipping auth prompt.");
+          canAutologin = true;
         }
 
-        // If there's a notification box, use it to allow the user to
-        // determine if the login should be saved. If there isn't a
-        // notification box, only save the login if the user set the
-        // checkbox to do so.
-        var rememberLogin = notifyBox ? canRememberLogin : checkbox.value;
-        if (!ok || !rememberLogin || epicfail)
-            return ok;
+        checkbox.value = true;
+      }
+
+      var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
+      if (this._inPrivateBrowsing)
+        canRememberLogin = false;
 
-        try {
-            var [username, password] = this._GetAuthInfo(aAuthInfo);
+      // if checkboxLabel is null, the checkbox won't be shown at all.
+      var notifyBox = this._getNotifyBox();
+      if (canRememberLogin && !notifyBox)
+        checkboxLabel = this._getLocalizedString("rememberPassword");
+    } catch (e) {
+      // Ignore any errors and display the prompt anyway.
+      epicfail = true;
+      Components.utils.reportError("LoginManagerPrompter: " +
+          "Epic fail in promptAuth: " + e + "\n");
+    }
 
-            if (!password) {
-                this.log("No password entered, so won't offer to save.");
-                return ok;
-            }
-
-            // XXX We can't prompt with multiple logins yet (bug 227632), so
-            // the entered login might correspond to an existing login
-            // other than the one we originally selected.
-            selectedLogin = this._repickSelectedLogin(foundLogins, username);
+    var ok = canAutologin;
+    if (!ok) {
+      if (this._window)
+        PromptUtils.fireDialogEvent(this._window, "DOMWillOpenModalDialog", this._browser);
+      ok = this._promptService.promptAuth(this._window,
+                                          aChannel, aLevel, aAuthInfo,
+                                          checkboxLabel, checkbox);
+    }
 
-            // If we didn't find an existing login, or if the username
-            // changed, save as a new login.
-            if (!selectedLogin) {
-                this.log("New login seen for " + username +
-                         " @ " + hostname + " (" + httpRealm + ")");
+    // If there's a notification box, use it to allow the user to
+    // determine if the login should be saved. If there isn't a
+    // notification box, only save the login if the user set the
+    // checkbox to do so.
+    var rememberLogin = notifyBox ? canRememberLogin : checkbox.value;
+    if (!ok || !rememberLogin || epicfail)
+      return ok;
+
+    try {
+      var [username, password] = this._GetAuthInfo(aAuthInfo);
+
+      if (!password) {
+        this.log("No password entered, so won't offer to save.");
+        return ok;
+      }
 
-                var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                               createInstance(Ci.nsILoginInfo);
-                newLogin.init(hostname, null, httpRealm,
-                              username, password, "", "");
-                var notifyObj = this._getPopupNote() || notifyBox;
-                if (notifyObj)
-                    this._showSaveLoginNotification(notifyObj, newLogin);
-                else
-                    this._pwmgr.addLogin(newLogin);
+      // XXX We can't prompt with multiple logins yet (bug 227632), so
+      // the entered login might correspond to an existing login
+      // other than the one we originally selected.
+      selectedLogin = this._repickSelectedLogin(foundLogins, username);
+
+      // If we didn't find an existing login, or if the username
+      // changed, save as a new login.
+      if (!selectedLogin) {
+        this.log("New login seen for " + username +
+                 " @ " + hostname + " (" + httpRealm + ")");
 
-            } else if (password != selectedLogin.password) {
+        var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                       createInstance(Ci.nsILoginInfo);
+        newLogin.init(hostname, null, httpRealm,
+                      username, password, "", "");
+        var notifyObj = this._getPopupNote() || notifyBox;
+        if (notifyObj)
+          this._showSaveLoginNotification(notifyObj, newLogin);
+        else
+          this._pwmgr.addLogin(newLogin);
 
-                this.log("Updating password for " + username +
-                         " @ " + hostname + " (" + httpRealm + ")");
-                var notifyObj = this._getPopupNote() || notifyBox;
-                if (notifyObj)
-                    this._showChangeLoginNotification(notifyObj,
-                                                      selectedLogin, password);
-                else
-                    this._updateLogin(selectedLogin, password);
+      } else if (password != selectedLogin.password) {
 
-            } else {
-                this.log("Login unchanged, no further action needed.");
-                this._updateLogin(selectedLogin);
-            }
-        } catch (e) {
-            Components.utils.reportError("LoginManagerPrompter: " +
-                "Fail2 in promptAuth: " + e + "\n");
-        }
-
-        return ok;
-    },
+        this.log("Updating password for " + username +
+                 " @ " + hostname + " (" + httpRealm + ")");
+        var notifyObj = this._getPopupNote() || notifyBox;
+        if (notifyObj)
+          this._showChangeLoginNotification(notifyObj,
+                                            selectedLogin, password);
+        else
+          this._updateLogin(selectedLogin, password);
 
-    asyncPromptAuth : function (aChannel, aCallback, aContext, aLevel, aAuthInfo) {
-        var cancelable = null;
+      } else {
+        this.log("Login unchanged, no further action needed.");
+        this._updateLogin(selectedLogin);
+      }
+    } catch (e) {
+      Components.utils.reportError("LoginManagerPrompter: " +
+          "Fail2 in promptAuth: " + e + "\n");
+    }
 
-        try {
-            this.log("===== asyncPromptAuth called =====");
+    return ok;
+  },
 
-            // If the user submits a login but it fails, we need to remove the
-            // notification bar that was displayed. Conveniently, the user will
-            // be prompted for authentication again, which brings us here.
-            this._removeLoginNotifications();
+  asyncPromptAuth : function (aChannel, aCallback, aContext, aLevel, aAuthInfo) {
+    var cancelable = null;
+
+    try {
+      this.log("===== asyncPromptAuth called =====");
 
-            cancelable = this._newAsyncPromptConsumer(aCallback, aContext);
+      // If the user submits a login but it fails, we need to remove the
+      // notification bar that was displayed. Conveniently, the user will
+      // be prompted for authentication again, which brings us here.
+      this._removeLoginNotifications();
 
-            var [hostname, httpRealm] = this._getAuthTarget(aChannel, aAuthInfo);
+      cancelable = this._newAsyncPromptConsumer(aCallback, aContext);
 
-            var hashKey = aLevel + "|" + hostname + "|" + httpRealm;
-            this.log("Async prompt key = " + hashKey);
-            var asyncPrompt = this._factory._asyncPrompts[hashKey];
-            if (asyncPrompt) {
-                this.log("Prompt bound to an existing one in the queue, callback = " + aCallback);
-                asyncPrompt.consumers.push(cancelable);
-                return cancelable;
-            }
+      var [hostname, httpRealm] = this._getAuthTarget(aChannel, aAuthInfo);
+
+      var hashKey = aLevel + "|" + hostname + "|" + httpRealm;
+      this.log("Async prompt key = " + hashKey);
+      var asyncPrompt = this._factory._asyncPrompts[hashKey];
+      if (asyncPrompt) {
+        this.log("Prompt bound to an existing one in the queue, callback = " + aCallback);
+        asyncPrompt.consumers.push(cancelable);
+        return cancelable;
+      }
 
-            this.log("Adding new prompt to the queue, callback = " + aCallback);
-            asyncPrompt = {
-                consumers: [cancelable],
-                channel: aChannel,
-                authInfo: aAuthInfo,
-                level: aLevel,
-                inProgress : false,
-                prompter: this
-            }
+      this.log("Adding new prompt to the queue, callback = " + aCallback);
+      asyncPrompt = {
+        consumers: [cancelable],
+        channel: aChannel,
+        authInfo: aAuthInfo,
+        level: aLevel,
+        inProgress : false,
+        prompter: this
+      }
 
-            this._factory._asyncPrompts[hashKey] = asyncPrompt;
-            this._factory._doAsyncPrompt();
-        }
-        catch (e) {
-            Components.utils.reportError("LoginManagerPrompter: " +
-                "asyncPromptAuth: " + e + "\nFalling back to promptAuth\n");
-            // Fail the prompt operation to let the consumer fall back
-            // to synchronous promptAuth method
-            throw e;
-        }
+      this._factory._asyncPrompts[hashKey] = asyncPrompt;
+      this._factory._doAsyncPrompt();
+    }
+    catch (e) {
+      Components.utils.reportError("LoginManagerPrompter: " +
+          "asyncPromptAuth: " + e + "\nFalling back to promptAuth\n");
+      // Fail the prompt operation to let the consumer fall back
+      // to synchronous promptAuth method
+      throw e;
+    }
 
-        return cancelable;
-    },
+    return cancelable;
+  },
 
 
 
 
-    /* ---------- nsILoginManagerPrompter prompts ---------- */
+  /* ---------- nsILoginManagerPrompter prompts ---------- */
 
 
 
 
-    /*
-     * init
-     *
-     */
-    init : function (aWindow, aFactory) {
-        this._window = aWindow;
-        this._factory = aFactory || null;
-        this._browser = null;
-        this._opener = null;
+  /*
+   * init
+   *
+   */
+  init : function (aWindow, aFactory) {
+    this._window = aWindow;
+    this._factory = aFactory || null;
+    this._browser = null;
+    this._opener = null;
 
-        var prefBranch = Services.prefs.getBranch("signon.");
-        this._debug = prefBranch.getBoolPref("debug");
-        this.log("===== initialized =====");
-    },
+    var prefBranch = Services.prefs.getBranch("signon.");
+    this._debug = prefBranch.getBoolPref("debug");
+    this.log("===== initialized =====");
+  },
 
-    setE10sData : function (aBrowser, aOpener) {
-        if (!(this._window instanceof Ci.nsIDOMChromeWindow))
-            throw new Error("Unexpected call");
-        this._browser = aBrowser;
-        this._opener = aOpener;
-    },
+  setE10sData : function (aBrowser, aOpener) {
+    if (!(this._window instanceof Ci.nsIDOMChromeWindow))
+      throw new Error("Unexpected call");
+    this._browser = aBrowser;
+    this._opener = aOpener;
+  },
 
 
-    /*
-     * promptToSavePassword
-     *
-     */
-    promptToSavePassword : function (aLogin) {
-        var notifyObj = this._getPopupNote() || this._getNotifyBox();
+  /*
+   * promptToSavePassword
+   *
+   */
+  promptToSavePassword : function (aLogin) {
+    var notifyObj = this._getPopupNote() || this._getNotifyBox();
 
-        if (notifyObj)
-            this._showSaveLoginNotification(notifyObj, aLogin);
-        else
-            this._showSaveLoginDialog(aLogin);
-    },
+    if (notifyObj)
+      this._showSaveLoginNotification(notifyObj, aLogin);
+    else
+      this._showSaveLoginDialog(aLogin);
+  },
 
 
-    /*
-     * _showLoginNotification
-     *
-     * Displays a notification bar.
-     *
-     */
-    _showLoginNotification : function (aNotifyBox, aName, aText, aButtons) {
-        var oldBar = aNotifyBox.getNotificationWithValue(aName);
-        const priority = aNotifyBox.PRIORITY_INFO_MEDIUM;
+  /*
+   * _showLoginNotification
+   *
+   * Displays a notification bar.
+   *
+   */
+  _showLoginNotification : function (aNotifyBox, aName, aText, aButtons) {
+    var oldBar = aNotifyBox.getNotificationWithValue(aName);
+    const priority = aNotifyBox.PRIORITY_INFO_MEDIUM;
 
-        this.log("Adding new " + aName + " notification bar");
-        var newBar = aNotifyBox.appendNotification(
-                                aText, aName,
-                                "chrome://mozapps/skin/passwordmgr/key.png",
-                                priority, aButtons);
+    this.log("Adding new " + aName + " notification bar");
+    var newBar = aNotifyBox.appendNotification(
+                            aText, aName,
+                            "chrome://mozapps/skin/passwordmgr/key.png",
+                            priority, aButtons);
 
-        // The page we're going to hasn't loaded yet, so we want to persist
-        // across the first location change.
-        newBar.persistence++;
+    // The page we're going to hasn't loaded yet, so we want to persist
+    // across the first location change.
+    newBar.persistence++;
 
-        // Sites like Gmail perform a funky redirect dance before you end up
-        // at the post-authentication page. I don't see a good way to
-        // heuristically determine when to ignore such location changes, so
-        // we'll try ignoring location changes based on a time interval.
-        newBar.timeout = Date.now() + 20000; // 20 seconds
+    // Sites like Gmail perform a funky redirect dance before you end up
+    // at the post-authentication page. I don't see a good way to
+    // heuristically determine when to ignore such location changes, so
+    // we'll try ignoring location changes based on a time interval.
+    newBar.timeout = Date.now() + 20000; // 20 seconds
 
-        if (oldBar) {
-            this.log("(...and removing old " + aName + " notification bar)");
-            aNotifyBox.removeNotification(oldBar);
-        }
-    },
+    if (oldBar) {
+      this.log("(...and removing old " + aName + " notification bar)");
+      aNotifyBox.removeNotification(oldBar);
+    }
+  },
 
 
-    /*
-     * _showSaveLoginNotification
-     *
-     * Displays a notification bar or a popup notification, to allow the user
-     * to save the specified login. This allows the user to see the results of
-     * their login, and only save a login which they know worked.
-     *
-     * @param aNotifyObj
-     *        A notification box or a popup notification.
-     */
-    _showSaveLoginNotification : function (aNotifyObj, aLogin) {
+  /*
+   * _showSaveLoginNotification
+   *
+   * Displays a notification bar or a popup notification, to allow the user
+   * to save the specified login. This allows the user to see the results of
+   * their login, and only save a login which they know worked.
+   *
+   * @param aNotifyObj
+   *        A notification box or a popup notification.
+   */
+  _showSaveLoginNotification : function (aNotifyObj, aLogin) {
 
-        // Ugh. We can't use the strings from the popup window, because they
-        // have the access key marked in the string (eg "Mo&zilla"), along
-        // with some weird rules for handling access keys that do not occur
-        // in the string, for L10N. See commonDialog.js's setLabelForNode().
-        var neverButtonText =
-              this._getLocalizedString("notifyBarNeverRememberButtonText");
-        var neverButtonAccessKey =
-              this._getLocalizedString("notifyBarNeverRememberButtonAccessKey");
-        var rememberButtonText =
-              this._getLocalizedString("notifyBarRememberPasswordButtonText");
-        var rememberButtonAccessKey =
-              this._getLocalizedString("notifyBarRememberPasswordButtonAccessKey");
+    // Ugh. We can't use the strings from the popup window, because they
+    // have the access key marked in the string (eg "Mo&zilla"), along
+    // with some weird rules for handling access keys that do not occur
+    // in the string, for L10N. See commonDialog.js's setLabelForNode().
+    var neverButtonText =
+          this._getLocalizedString("notifyBarNeverRememberButtonText");
+    var neverButtonAccessKey =
+          this._getLocalizedString("notifyBarNeverRememberButtonAccessKey");
+    var rememberButtonText =
+          this._getLocalizedString("notifyBarRememberPasswordButtonText");
+    var rememberButtonAccessKey =
+          this._getLocalizedString("notifyBarRememberPasswordButtonAccessKey");
 
-        var displayHost = this._getShortDisplayHost(aLogin.hostname);
-        var notificationText;
-        if (aLogin.username) {
-            var displayUser = this._sanitizeUsername(aLogin.username);
-            notificationText  = this._getLocalizedString(
-                                        "rememberPasswordMsg",
-                                        [displayUser, displayHost]);
-        } else {
-            notificationText  = this._getLocalizedString(
-                                        "rememberPasswordMsgNoUsername",
-                                        [displayHost]);
-        }
+    var displayHost = this._getShortDisplayHost(aLogin.hostname);
+    var notificationText;
+    if (aLogin.username) {
+      var displayUser = this._sanitizeUsername(aLogin.username);
+      notificationText  = this._getLocalizedString(
+                                  "rememberPasswordMsg",
+                                  [displayUser, displayHost]);
+    } else {
+      notificationText  = this._getLocalizedString(
+                                  "rememberPasswordMsgNoUsername",
+                                  [displayHost]);
+    }
 
-        // The callbacks in |buttons| have a closure to access the variables
-        // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
-        // without a getService() call.
-        var pwmgr = this._pwmgr;
+    // The callbacks in |buttons| have a closure to access the variables
+    // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
+    // without a getService() call.
+    var pwmgr = this._pwmgr;
 
-        // Notification is a PopupNotification
-        if (aNotifyObj == this._getPopupNote()) {
-            // "Remember" button
-            var mainAction = {
-                label:     rememberButtonText,
-                accessKey: rememberButtonAccessKey,
-                callback: function(aNotifyObj, aButton) {
-                    pwmgr.addLogin(aLogin);
-                    browser.focus();
-                }
-            };
+    // Notification is a PopupNotification
+    if (aNotifyObj == this._getPopupNote()) {
+      // "Remember" button
+      var mainAction = {
+        label:     rememberButtonText,
+        accessKey: rememberButtonAccessKey,
+        callback: function(aNotifyObj, aButton) {
+          pwmgr.addLogin(aLogin);
+          browser.focus();
+        }
+      };
 
-            var secondaryActions = [
-                // "Never for this site" button
-                {
-                    label:     neverButtonText,
-                    accessKey: neverButtonAccessKey,
-                    callback: function(aNotifyObj, aButton) {
-                        pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
-                        browser.focus();
-                    }
-                }
-            ];
+      var secondaryActions = [
+        // "Never for this site" button
+        {
+          label:     neverButtonText,
+          accessKey: neverButtonAccessKey,
+          callback: function(aNotifyObj, aButton) {
+            pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
+            browser.focus();
+          }
+        }
+      ];
 
-            var { browser } = this._getNotifyWindow();
+      var { browser } = this._getNotifyWindow();
 
-            aNotifyObj.show(browser, "password-save", notificationText,
-                            "password-notification-icon", mainAction,
-                            secondaryActions, { timeout: Date.now() + 10000,
-                                                persistWhileVisible: true });
-        } else {
-            var notNowButtonText =
-                  this._getLocalizedString("notifyBarNotNowButtonText");
-            var notNowButtonAccessKey =
-                  this._getLocalizedString("notifyBarNotNowButtonAccessKey");
-            var buttons = [
-                // "Remember" button
-                {
-                    label:     rememberButtonText,
-                    accessKey: rememberButtonAccessKey,
-                    popup:     null,
-                    callback: function(aNotifyObj, aButton) {
-                        pwmgr.addLogin(aLogin);
-                    }
-                },
+      aNotifyObj.show(browser, "password-save", notificationText,
+                      "password-notification-icon", mainAction,
+                      secondaryActions, { timeout: Date.now() + 10000,
+                                          persistWhileVisible: true });
+    } else {
+      var notNowButtonText =
+            this._getLocalizedString("notifyBarNotNowButtonText");
+      var notNowButtonAccessKey =
+            this._getLocalizedString("notifyBarNotNowButtonAccessKey");
+      var buttons = [
+        // "Remember" button
+        {
+          label:     rememberButtonText,
+          accessKey: rememberButtonAccessKey,
+          popup:     null,
+          callback: function(aNotifyObj, aButton) {
+            pwmgr.addLogin(aLogin);
+          }
+        },
 
-                // "Never for this site" button
-                {
-                    label:     neverButtonText,
-                    accessKey: neverButtonAccessKey,
-                    popup:     null,
-                    callback: function(aNotifyObj, aButton) {
-                        pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
-                    }
-                },
+        // "Never for this site" button
+        {
+          label:     neverButtonText,
+          accessKey: neverButtonAccessKey,
+          popup:     null,
+          callback: function(aNotifyObj, aButton) {
+            pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
+          }
+        },
 
-                // "Not now" button
-                {
-                    label:     notNowButtonText,
-                    accessKey: notNowButtonAccessKey,
-                    popup:     null,
-                    callback:  function() { /* NOP */ }
-                }
-            ];
+        // "Not now" button
+        {
+          label:     notNowButtonText,
+          accessKey: notNowButtonAccessKey,
+          popup:     null,
+          callback:  function() { /* NOP */ }
+        }
+      ];
 
-            this._showLoginNotification(aNotifyObj, "password-save",
-                                        notificationText, buttons);
-        }
-    },
+      this._showLoginNotification(aNotifyObj, "password-save",
+                                  notificationText, buttons);
+    }
+  },
 
 
-    /*
-     * _removeLoginNotifications
-     *
-     */
-    _removeLoginNotifications : function () {
-        var popupNote = this._getPopupNote();
-        if (popupNote)
-            popupNote = popupNote.getNotification("password-save");
-        if (popupNote)
-            popupNote.remove();
+  /*
+   * _removeLoginNotifications
+   *
+   */
+  _removeLoginNotifications : function () {
+    var popupNote = this._getPopupNote();
+    if (popupNote)
+      popupNote = popupNote.getNotification("password-save");
+    if (popupNote)
+      popupNote.remove();
 
-        var notifyBox = this._getNotifyBox();
-        if (notifyBox) {
-            var oldBar = notifyBox.getNotificationWithValue("password-save");
-            if (oldBar) {
-                this.log("Removing save-password notification bar.");
-                notifyBox.removeNotification(oldBar);
-            }
+    var notifyBox = this._getNotifyBox();
+    if (notifyBox) {
+      var oldBar = notifyBox.getNotificationWithValue("password-save");
+      if (oldBar) {
+        this.log("Removing save-password notification bar.");
+        notifyBox.removeNotification(oldBar);
+      }
 
-            oldBar = notifyBox.getNotificationWithValue("password-change");
-            if (oldBar) {
-                this.log("Removing change-password notification bar.");
-                notifyBox.removeNotification(oldBar);
-            }
-        }
-    },
+      oldBar = notifyBox.getNotificationWithValue("password-change");
+      if (oldBar) {
+        this.log("Removing change-password notification bar.");
+        notifyBox.removeNotification(oldBar);
+      }
+    }
+  },
 
 
-    /*
-     * _showSaveLoginDialog
-     *
-     * Called when we detect a new login in a form submission,
-     * asks the user what to do.
-     *
-     */
-    _showSaveLoginDialog : function (aLogin) {
-        const buttonFlags = Ci.nsIPrompt.BUTTON_POS_1_DEFAULT +
-            (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
-            (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1) +
-            (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_2);
+  /*
+   * _showSaveLoginDialog
+   *
+   * Called when we detect a new login in a form submission,
+   * asks the user what to do.
+   *
+   */
+  _showSaveLoginDialog : function (aLogin) {
+    const buttonFlags = Ci.nsIPrompt.BUTTON_POS_1_DEFAULT +
+        (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
+        (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1) +
+        (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_2);
 
-        var displayHost = this._getShortDisplayHost(aLogin.hostname);
+    var displayHost = this._getShortDisplayHost(aLogin.hostname);
 
-        var dialogText;
-        if (aLogin.username) {
-            var displayUser = this._sanitizeUsername(aLogin.username);
-            dialogText = this._getLocalizedString(
-                                 "rememberPasswordMsg",
-                                 [displayUser, displayHost]);
-        } else {
-            dialogText = this._getLocalizedString(
-                                 "rememberPasswordMsgNoUsername",
-                                 [displayHost]);
+    var dialogText;
+    if (aLogin.username) {
+      var displayUser = this._sanitizeUsername(aLogin.username);
+      dialogText = this._getLocalizedString(
+                           "rememberPasswordMsg",
+                           [displayUser, displayHost]);
+    } else {
+      dialogText = this._getLocalizedString(
+                           "rememberPasswordMsgNoUsername",
+                           [displayHost]);
 
-        }
-        var dialogTitle        = this._getLocalizedString(
-                                        "savePasswordTitle");
-        var neverButtonText    = this._getLocalizedString(
-                                        "neverForSiteButtonText");
-        var rememberButtonText = this._getLocalizedString(
-                                        "rememberButtonText");
-        var notNowButtonText   = this._getLocalizedString(
-                                        "notNowButtonText");
+    }
+    var dialogTitle        = this._getLocalizedString(
+                                    "savePasswordTitle");
+    var neverButtonText    = this._getLocalizedString(
+                                    "neverForSiteButtonText");
+    var rememberButtonText = this._getLocalizedString(
+                                    "rememberButtonText");
+    var notNowButtonText   = this._getLocalizedString(
+                                    "notNowButtonText");
 
-        this.log("Prompting user to save/ignore login");
-        var userChoice = this._promptService.confirmEx(this._window,
-                                            dialogTitle, dialogText,
-                                            buttonFlags, rememberButtonText,
-                                            notNowButtonText, neverButtonText,
-                                            null, {});
-        //  Returns:
-        //   0 - Save the login
-        //   1 - Ignore the login this time
-        //   2 - Never save logins for this site
-        if (userChoice == 2) {
-            this.log("Disabling " + aLogin.hostname + " logins by request.");
-            this._pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
-        } else if (userChoice == 0) {
-            this.log("Saving login for " + aLogin.hostname);
-            this._pwmgr.addLogin(aLogin);
-        } else {
-            // userChoice == 1 --> just ignore the login.
-            this.log("Ignoring login.");
-        }
-    },
+    this.log("Prompting user to save/ignore login");
+    var userChoice = this._promptService.confirmEx(this._window,
+                                        dialogTitle, dialogText,
+                                        buttonFlags, rememberButtonText,
+                                        notNowButtonText, neverButtonText,
+                                        null, {});
+    //  Returns:
+    //   0 - Save the login
+    //   1 - Ignore the login this time
+    //   2 - Never save logins for this site
+    if (userChoice == 2) {
+      this.log("Disabling " + aLogin.hostname + " logins by request.");
+      this._pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
+    } else if (userChoice == 0) {
+      this.log("Saving login for " + aLogin.hostname);
+      this._pwmgr.addLogin(aLogin);
+    } else {
+      // userChoice == 1 --> just ignore the login.
+      this.log("Ignoring login.");
+    }
+  },
 
 
-    /*
-     * promptToChangePassword
-     *
-     * Called when we think we detect a password change for an existing
-     * login, when the form being submitted contains multiple password
-     * fields.
-     *
-     */
-    promptToChangePassword : function (aOldLogin, aNewLogin) {
-        var notifyObj = this._getPopupNote() || this._getNotifyBox();
+  /*
+   * promptToChangePassword
+   *
+   * Called when we think we detect a password change for an existing
+   * login, when the form being submitted contains multiple password
+   * fields.
+   *
+   */
+  promptToChangePassword : function (aOldLogin, aNewLogin) {
+    var notifyObj = this._getPopupNote() || this._getNotifyBox();
 
-        if (notifyObj)
-            this._showChangeLoginNotification(notifyObj, aOldLogin,
-                                              aNewLogin.password);
-        else
-            this._showChangeLoginDialog(aOldLogin, aNewLogin.password);
-    },
+    if (notifyObj)
+      this._showChangeLoginNotification(notifyObj, aOldLogin,
+                                        aNewLogin.password);
+    else
+      this._showChangeLoginDialog(aOldLogin, aNewLogin.password);
+  },
 
 
-    /*
-     * _showChangeLoginNotification
-     *
-     * Shows the Change Password notification bar or popup notification.
-     *
-     * @param aNotifyObj
-     *        A notification box or a popup notification.
-     */
-    _showChangeLoginNotification : function (aNotifyObj, aOldLogin, aNewPassword) {
-        var notificationText;
-        if (aOldLogin.username) {
-            var displayUser = this._sanitizeUsername(aOldLogin.username);
-            notificationText  = this._getLocalizedString(
-                                          "updatePasswordMsg",
-                                          [displayUser]);
-        } else {
-            notificationText  = this._getLocalizedString(
-                                          "updatePasswordMsgNoUser");
-        }
+  /*
+   * _showChangeLoginNotification
+   *
+   * Shows the Change Password notification bar or popup notification.
+   *
+   * @param aNotifyObj
+   *        A notification box or a popup notification.
+   */
+  _showChangeLoginNotification : function (aNotifyObj, aOldLogin, aNewPassword) {
+    var notificationText;
+    if (aOldLogin.username) {
+      var displayUser = this._sanitizeUsername(aOldLogin.username);
+      notificationText  = this._getLocalizedString(
+                                    "updatePasswordMsg",
+                                    [displayUser]);
+    } else {
+      notificationText  = this._getLocalizedString(
+                                    "updatePasswordMsgNoUser");
+    }
 
-        var changeButtonText =
-              this._getLocalizedString("notifyBarUpdateButtonText");
-        var changeButtonAccessKey =
-              this._getLocalizedString("notifyBarUpdateButtonAccessKey");
+    var changeButtonText =
+          this._getLocalizedString("notifyBarUpdateButtonText");
+    var changeButtonAccessKey =
+          this._getLocalizedString("notifyBarUpdateButtonAccessKey");
 
-        // The callbacks in |buttons| have a closure to access the variables
-        // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
-        // without a getService() call.
-        var self = this;
+    // The callbacks in |buttons| have a closure to access the variables
+    // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
+    // without a getService() call.
+    var self = this;
 
-        // Notification is a PopupNotification
-        if (aNotifyObj == this._getPopupNote()) {
-            // "Yes" button
-            var mainAction = {
-                label:     changeButtonText,
-                accessKey: changeButtonAccessKey,
-                popup:     null,
-                callback:  function(aNotifyObj, aButton) {
-                    self._updateLogin(aOldLogin, aNewPassword);
-                }
-            };
+    // Notification is a PopupNotification
+    if (aNotifyObj == this._getPopupNote()) {
+      // "Yes" button
+      var mainAction = {
+        label:     changeButtonText,
+        accessKey: changeButtonAccessKey,
+        popup:     null,
+        callback:  function(aNotifyObj, aButton) {
+          self._updateLogin(aOldLogin, aNewPassword);
+        }
+      };
 
-            var { browser } = this._getNotifyWindow();
+      var { browser } = this._getNotifyWindow();
 
-            aNotifyObj.show(browser, "password-change", notificationText,
-                            "password-notification-icon", mainAction,
-                            null, { timeout: Date.now() + 10000,
-                                    persistWhileVisible: true });
-        } else {
-            var dontChangeButtonText =
-                  this._getLocalizedString("notifyBarDontChangeButtonText");
-            var dontChangeButtonAccessKey =
-                  this._getLocalizedString("notifyBarDontChangeButtonAccessKey");
-            var buttons = [
-                // "Yes" button
-                {
-                    label:     changeButtonText,
-                    accessKey: changeButtonAccessKey,
-                    popup:     null,
-                    callback:  function(aNotifyObj, aButton) {
-                        self._updateLogin(aOldLogin, aNewPassword);
-                    }
-                },
+      aNotifyObj.show(browser, "password-change", notificationText,
+                      "password-notification-icon", mainAction,
+                      null, { timeout: Date.now() + 10000,
+                              persistWhileVisible: true });
+    } else {
+      var dontChangeButtonText =
+            this._getLocalizedString("notifyBarDontChangeButtonText");
+      var dontChangeButtonAccessKey =
+            this._getLocalizedString("notifyBarDontChangeButtonAccessKey");
+      var buttons = [
+        // "Yes" button
+        {
+          label:     changeButtonText,
+          accessKey: changeButtonAccessKey,
+          popup:     null,
+          callback:  function(aNotifyObj, aButton) {
+            self._updateLogin(aOldLogin, aNewPassword);
+          }
+        },
 
-                // "No" button
-                {
-                    label:     dontChangeButtonText,
-                    accessKey: dontChangeButtonAccessKey,
-                    popup:     null,
-                    callback:  function(aNotifyObj, aButton) {
-                        // do nothing
-                    }
-                }
-            ];
+        // "No" button
+        {
+          label:     dontChangeButtonText,
+          accessKey: dontChangeButtonAccessKey,
+          popup:     null,
+          callback:  function(aNotifyObj, aButton) {
+            // do nothing
+          }
+        }
+      ];
 
-            this._showLoginNotification(aNotifyObj, "password-change",
-                                        notificationText, buttons);
-        }
-    },
+      this._showLoginNotification(aNotifyObj, "password-change",
+                                  notificationText, buttons);
+    }
+  },
 
 
-    /*
-     * _showChangeLoginDialog
-     *
-     * Shows the Change Password dialog.
-     *
-     */
-    _showChangeLoginDialog : function (aOldLogin, aNewPassword) {
-        const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
+  /*
+   * _showChangeLoginDialog
+   *
+   * Shows the Change Password dialog.
+   *
+   */
+  _showChangeLoginDialog : function (aOldLogin, aNewPassword) {
+    const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
 
-        var dialogText;
-        if (aOldLogin.username)
-            dialogText  = this._getLocalizedString(
-                                    "updatePasswordMsg",
-                                    [aOldLogin.username]);
-        else
-            dialogText  = this._getLocalizedString(
-                                    "updatePasswordMsgNoUser");
+    var dialogText;
+    if (aOldLogin.username)
+      dialogText  = this._getLocalizedString(
+                              "updatePasswordMsg",
+                              [aOldLogin.username]);
+    else
+      dialogText  = this._getLocalizedString(
+                              "updatePasswordMsgNoUser");
 
-        var dialogTitle = this._getLocalizedString(
-                                    "passwordChangeTitle");
+    var dialogTitle = this._getLocalizedString(
+                                "passwordChangeTitle");
 
-        // returns 0 for yes, 1 for no.
-        var ok = !this._promptService.confirmEx(this._window,
-                                dialogTitle, dialogText, buttonFlags,
-                                null, null, null,
-                                null, {});
-        if (ok) {
-            this.log("Updating password for user " + aOldLogin.username);
-            this._updateLogin(aOldLogin, aNewPassword);
-        }
-    },
+    // returns 0 for yes, 1 for no.
+    var ok = !this._promptService.confirmEx(this._window,
+                            dialogTitle, dialogText, buttonFlags,
+                            null, null, null,
+                            null, {});
+    if (ok) {
+      this.log("Updating password for user " + aOldLogin.username);
+      this._updateLogin(aOldLogin, aNewPassword);
+    }
+  },
 
 
-    /*
-     * promptToChangePasswordWithUsernames
-     *
-     * Called when we detect a password change in a form submission, but we
-     * don't know which existing login (username) it's for. Asks the user
-     * to select a username and confirm the password change.
-     *
-     * Note: The caller doesn't know the username for aNewLogin, so this
-     *       function fills in .username and .usernameField with the values
-     *       from the login selected by the user.
-     *
-     * Note; XPCOM stupidity: |count| is just |logins.length|.
-     */
-    promptToChangePasswordWithUsernames : function (logins, count, aNewLogin) {
-        const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
+  /*
+   * promptToChangePasswordWithUsernames
+   *
+   * Called when we detect a password change in a form submission, but we
+   * don't know which existing login (username) it's for. Asks the user
+   * to select a username and confirm the password change.
+   *
+   * Note: The caller doesn't know the username for aNewLogin, so this
+   *       function fills in .username and .usernameField with the values
+   *       from the login selected by the user.
+   *
+   * Note; XPCOM stupidity: |count| is just |logins.length|.
+   */
+  promptToChangePasswordWithUsernames : function (logins, count, aNewLogin) {
+    const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
 
-        var usernames = logins.map(function (l) l.username);
-        var dialogText  = this._getLocalizedString("userSelectText");
-        var dialogTitle = this._getLocalizedString("passwordChangeTitle");
-        var selectedIndex = { value: null };
+    var usernames = logins.map(function (l) l.username);
+    var dialogText  = this._getLocalizedString("userSelectText");
+    var dialogTitle = this._getLocalizedString("passwordChangeTitle");
+    var selectedIndex = { value: null };
 
-        // If user selects ok, outparam.value is set to the index
-        // of the selected username.
-        var ok = this._promptService.select(this._window,
-                                dialogTitle, dialogText,
-                                usernames.length, usernames,
-                                selectedIndex);
-        if (ok) {
-            // Now that we know which login to use, modify its password.
-            var selectedLogin = logins[selectedIndex.value];
-            this.log("Updating password for user " + selectedLogin.username);
-            this._updateLogin(selectedLogin, aNewLogin.password);
-        }
-    },
+    // If user selects ok, outparam.value is set to the index
+    // of the selected username.
+    var ok = this._promptService.select(this._window,
+                            dialogTitle, dialogText,
+                            usernames.length, usernames,
+                            selectedIndex);
+    if (ok) {
+      // Now that we know which login to use, modify its password.
+      var selectedLogin = logins[selectedIndex.value];
+      this.log("Updating password for user " + selectedLogin.username);
+      this._updateLogin(selectedLogin, aNewLogin.password);
+    }
+  },
 
 
 
 
-    /* ---------- Internal Methods ---------- */
+  /* ---------- Internal Methods ---------- */
 
 
 
 
-    /*
-     * _updateLogin
-     */
-    _updateLogin : function (login, newPassword) {
-        var now = Date.now();
-        var propBag = Cc["@mozilla.org/hash-property-bag;1"].
-                      createInstance(Ci.nsIWritablePropertyBag);
-        if (newPassword) {
-            propBag.setProperty("password", newPassword);
-            // Explicitly set the password change time here (even though it would
-            // be changed automatically), to ensure that it's exactly the same
-            // value as timeLastUsed.
-            propBag.setProperty("timePasswordChanged", now);
-        }
-        propBag.setProperty("timeLastUsed", now);
-        propBag.setProperty("timesUsedIncrement", 1);
-        this._pwmgr.modifyLogin(login, propBag);
-    },
+  /*
+   * _updateLogin
+   */
+  _updateLogin : function (login, newPassword) {
+    var now = Date.now();
+    var propBag = Cc["@mozilla.org/hash-property-bag;1"].
+                  createInstance(Ci.nsIWritablePropertyBag);
+    if (newPassword) {
+      propBag.setProperty("password", newPassword);
+      // Explicitly set the password change time here (even though it would
+      // be changed automatically), to ensure that it's exactly the same
+      // value as timeLastUsed.
+      propBag.setProperty("timePasswordChanged", now);
+    }
+    propBag.setProperty("timeLastUsed", now);
+    propBag.setProperty("timesUsedIncrement", 1);
+    this._pwmgr.modifyLogin(login, propBag);
+  },
 
 
-    /*
-     * _getChromeWindow
-     *
-     * Given a content DOM window, returns the chrome window it's in.
-     */
-    _getChromeWindow: function (aWindow) {
-        // In e10s, aWindow may already be a chrome window.
-        if (aWindow instanceof Ci.nsIDOMChromeWindow)
-            return aWindow;
-        var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                               .getInterface(Ci.nsIWebNavigation)
-                               .QueryInterface(Ci.nsIDocShell)
-                               .chromeEventHandler.ownerDocument.defaultView;
-        return chromeWin;
-    },
+  /*
+   * _getChromeWindow
+   *
+   * Given a content DOM window, returns the chrome window it's in.
+   */
+  _getChromeWindow: function (aWindow) {
+    // In e10s, aWindow may already be a chrome window.
+    if (aWindow instanceof Ci.nsIDOMChromeWindow)
+      return aWindow;
+    var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+                           .getInterface(Ci.nsIWebNavigation)
+                           .QueryInterface(Ci.nsIDocShell)
+                           .chromeEventHandler.ownerDocument.defaultView;
+    return chromeWin;
+  },
 
 
-    /*
-     * _getNotifyWindow
-     */
-    _getNotifyWindow: function () {
+  /*
+   * _getNotifyWindow
+   */
+  _getNotifyWindow: function () {
 
-        try {
-            // Get topmost window, in case we're in a frame.
-            var notifyWin = this._window.top;
-            var isE10s = (notifyWin instanceof Ci.nsIDOMChromeWindow);
-            var useOpener = false;
+    try {
+      // Get topmost window, in case we're in a frame.
+      var notifyWin = this._window.top;
+      var isE10s = (notifyWin instanceof Ci.nsIDOMChromeWindow);
+      var useOpener = false;
 
-            // Some sites pop up a temporary login window, which disappears
-            // upon submission of credentials. We want to put the notification
-            // bar in the opener window if this seems to be happening.
-            if (notifyWin.opener) {
-                var chromeDoc = this._getChromeWindow(notifyWin).
-                                     document.documentElement;
+      // Some sites pop up a temporary login window, which disappears
+      // upon submission of credentials. We want to put the notification
+      // bar in the opener window if this seems to be happening.
+      if (notifyWin.opener) {
+        var chromeDoc = this._getChromeWindow(notifyWin).
+                             document.documentElement;
 
-                var hasHistory;
-                if (isE10s) {
-                    if (!this._browser)
-                        throw new Error("Expected a browser in e10s");
-                    hasHistory = this._browser.canGoBack;
-                } else {
-                    var webnav = notifyWin.
-                                 QueryInterface(Ci.nsIInterfaceRequestor).
-                                 getInterface(Ci.nsIWebNavigation);
-                    hasHistory = webnav.sessionHistory.count > 1;
-                }
+        var hasHistory;
+        if (isE10s) {
+          if (!this._browser)
+            throw new Error("Expected a browser in e10s");
+          hasHistory = this._browser.canGoBack;
+        } else {
+          var webnav = notifyWin.
+                       QueryInterface(Ci.nsIInterfaceRequestor).
+                       getInterface(Ci.nsIWebNavigation);
+          hasHistory = webnav.sessionHistory.count > 1;
+        }
 
-                // Check to see if the current window was opened with chrome
-                // disabled, and if so use the opener window. But if the window
-                // has been used to visit other pages (ie, has a history),
-                // assume it'll stick around and *don't* use the opener.
-                if (chromeDoc.getAttribute("chromehidden") && !hasHistory) {
-                    this.log("Using opener window for notification bar.");
-                    notifyWin = notifyWin.opener;
-                    useOpener = true;
-                }
-            }
+        // Check to see if the current window was opened with chrome
+        // disabled, and if so use the opener window. But if the window
+        // has been used to visit other pages (ie, has a history),
+        // assume it'll stick around and *don't* use the opener.
+        if (chromeDoc.getAttribute("chromehidden") && !hasHistory) {
+          this.log("Using opener window for notification bar.");
+          notifyWin = notifyWin.opener;
+          useOpener = true;
+        }
+      }
 
-            let browser;
-            if (useOpener && this._opener && isE10s) {
-                // In e10s, we have to reconstruct the opener browser from
-                // the CPOW passed in the message (and then passed to us in
-                // setE10sData).
-                // NB: notifyWin is now the chrome window for the opening
-                // window.
+      let browser;
+      if (useOpener && this._opener && isE10s) {
+        // In e10s, we have to reconstruct the opener browser from
+        // the CPOW passed in the message (and then passed to us in
+        // setE10sData).
+        // NB: notifyWin is now the chrome window for the opening
+        // window.
 
-                browser = notifyWin.gBrowser.getBrowserForContentWindow(this._opener);
-            } else if (isE10s) {
-                browser = this._browser;
-            } else {
-                var chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
-                browser = chromeWin.gBrowser
-                                   .getBrowserForDocument(notifyWin.top.document);
-            }
+        browser = notifyWin.gBrowser.getBrowserForContentWindow(this._opener);
+      } else if (isE10s) {
+        browser = this._browser;
+      } else {
+        var chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
+        browser = chromeWin.gBrowser
+                           .getBrowserForDocument(notifyWin.top.document);
+      }
 
-            return { notifyWin: notifyWin, browser: browser };
+      return { notifyWin: notifyWin, browser: browser };
 
-        } catch (e) {
-            // If any errors happen, just assume no notification box.
-            this.log("Unable to get notify window: " + e.fileName + ":" + e.lineNumber + ": " + e.message);
-            return null;
-        }
-    },
+    } catch (e) {
+      // If any errors happen, just assume no notification box.
+      this.log("Unable to get notify window: " + e.fileName + ":" + e.lineNumber + ": " + e.message);
+      return null;
+    }
+  },
 
 
-    /*
-     * _getPopupNote
-     *
-     * Returns the popup notification to this prompter,
-     * or null if there isn't one available.
-     */
-    _getPopupNote : function () {
-        let popupNote = null;
+  /*
+   * _getPopupNote
+   *
+   * Returns the popup notification to this prompter,
+   * or null if there isn't one available.
+   */
+  _getPopupNote : function () {
+    let popupNote = null;
 
-        try {
-            let { notifyWin } = this._getNotifyWindow();
+    try {
+      let { notifyWin } = this._getNotifyWindow();
 
-            // Get the chrome window for the content window we're using.
-            // .wrappedJSObject needed here -- see bug 422974 comment 5.
-            let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
+      // Get the chrome window for the content window we're using.
+      // .wrappedJSObject needed here -- see bug 422974 comment 5.
+      let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
 
-            popupNote = chromeWin.PopupNotifications;
-        } catch (e) {
-            this.log("Popup notifications not available on window");
-        }
+      popupNote = chromeWin.PopupNotifications;
+    } catch (e) {
+      this.log("Popup notifications not available on window");
+    }
 
-        return popupNote;
-    },
+    return popupNote;
+  },
 
 
-    /*
-     * _getNotifyBox
-     *
-     * Returns the notification box to this prompter, or null if there isn't
-     * a notification box available.
-     */
-    _getNotifyBox : function () {
-        let notifyBox = null;
+  /*
+   * _getNotifyBox
+   *
+   * Returns the notification box to this prompter, or null if there isn't
+   * a notification box available.
+   */
+  _getNotifyBox : function () {
+    let notifyBox = null;
 
-        try {
-            let { notifyWin } = this._getNotifyWindow();
+    try {
+      let { notifyWin } = this._getNotifyWindow();
 
-            // Get the chrome window for the content window we're using.
-            // .wrappedJSObject needed here -- see bug 422974 comment 5.
-            let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
+      // Get the chrome window for the content window we're using.
+      // .wrappedJSObject needed here -- see bug 422974 comment 5.
+      let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
 
-            notifyBox = chromeWin.getNotificationBox(notifyWin);
-        } catch (e) {
-            this.log("Notification bars not available on window");
-        }
+      notifyBox = chromeWin.getNotificationBox(notifyWin);
+    } catch (e) {
+      this.log("Notification bars not available on window");
+    }
 
-        return notifyBox;
-    },
+    return notifyBox;
+  },
 
 
-    /*
-     * _repickSelectedLogin
-     *
-     * The user might enter a login that isn't the one we prefilled, but
-     * is the same as some other existing login. So, pick a login with a
-     * matching username, or return null.
-     */
-    _repickSelectedLogin : function (foundLogins, username) {
-        for (var i = 0; i < foundLogins.length; i++)
-            if (foundLogins[i].username == username)
-                return foundLogins[i];
-        return null;
-    },
+  /*
+   * _repickSelectedLogin
+   *
+   * The user might enter a login that isn't the one we prefilled, but
+   * is the same as some other existing login. So, pick a login with a
+   * matching username, or return null.
+   */
+  _repickSelectedLogin : function (foundLogins, username) {
+    for (var i = 0; i < foundLogins.length; i++)
+      if (foundLogins[i].username == username)
+        return foundLogins[i];
+    return null;
+  },
 
 
-    /*
-     * _getLocalizedString
-     *
-     * Can be called as:
-     *   _getLocalizedString("key1");
-     *   _getLocalizedString("key2", ["arg1"]);
-     *   _getLocalizedString("key3", ["arg1", "arg2"]);
-     *   (etc)
-     *
-     * Returns the localized string for the specified key,
-     * formatted if required.
-     *
-     */
-    _getLocalizedString : function (key, formatArgs) {
-        if (formatArgs)
-            return this._strBundle.formatStringFromName(
-                                        key, formatArgs, formatArgs.length);
-        else
-            return this._strBundle.GetStringFromName(key);
-    },
+  /*
+   * _getLocalizedString
+   *
+   * Can be called as:
+   *   _getLocalizedString("key1");
+   *   _getLocalizedString("key2", ["arg1"]);
+   *   _getLocalizedString("key3", ["arg1", "arg2"]);
+   *   (etc)
+   *
+   * Returns the localized string for the specified key,
+   * formatted if required.
+   *
+   */
+  _getLocalizedString : function (key, formatArgs) {
+    if (formatArgs)
+      return this._strBundle.formatStringFromName(
+                                  key, formatArgs, formatArgs.length);
+    else
+      return this._strBundle.GetStringFromName(key);
+  },
 
 
-    /*
-     * _sanitizeUsername
-     *
-     * Sanitizes the specified username, by stripping quotes and truncating if
-     * it's too long. This helps prevent an evil site from messing with the
-     * "save password?" prompt too much.
-     */
-    _sanitizeUsername : function (username) {
-        if (username.length > 30) {
-            username = username.substring(0, 30);
-            username += this._ellipsis;
-        }
-        return username.replace(/['"]/g, "");
-    },
+  /*
+   * _sanitizeUsername
+   *
+   * Sanitizes the specified username, by stripping quotes and truncating if
+   * it's too long. This helps prevent an evil site from messing with the
+   * "save password?" prompt too much.
+   */
+  _sanitizeUsername : function (username) {
+    if (username.length > 30) {
+      username = username.substring(0, 30);
+      username += this._ellipsis;
+    }
+    return username.replace(/['"]/g, "");
+  },
 
 
-    /*
-     * _getFormattedHostname
-     *
-     * The aURI parameter may either be a string uri, or an nsIURI instance.
-     *
-     * Returns the hostname to use in a nsILoginInfo object (for example,
-     * "http://example.com").
-     */
-    _getFormattedHostname : function (aURI) {
-        var uri;
-        if (aURI instanceof Ci.nsIURI) {
-            uri = aURI;
-        } else {
-            uri = Services.io.newURI(aURI, null, null);
-        }
-        var scheme = uri.scheme;
+  /*
+   * _getFormattedHostname
+   *
+   * The aURI parameter may either be a string uri, or an nsIURI instance.
+   *
+   * Returns the hostname to use in a nsILoginInfo object (for example,
+   * "http://example.com").
+   */
+  _getFormattedHostname : function (aURI) {
+    var uri;
+    if (aURI instanceof Ci.nsIURI) {
+      uri = aURI;
+    } else {
+      uri = Services.io.newURI(aURI, null, null);
+    }
+    var scheme = uri.scheme;
 
-        var hostname = scheme + "://" + uri.host;
+    var hostname = scheme + "://" + uri.host;
 
-        // If the URI explicitly specified a port, only include it when
-        // it's not the default. (We never want "http://foo.com:80")
-        var port = uri.port;
-        if (port != -1) {
-            var handler = Services.io.getProtocolHandler(scheme);
-            if (port != handler.defaultPort)
-                hostname += ":" + port;
-        }
+    // If the URI explicitly specified a port, only include it when
+    // it's not the default. (We never want "http://foo.com:80")
+    var port = uri.port;
+    if (port != -1) {
+      var handler = Services.io.getProtocolHandler(scheme);
+      if (port != handler.defaultPort)
+        hostname += ":" + port;
+    }
 
-        return hostname;
-    },
+    return hostname;
+  },
 
 
-    /*
-     * _getShortDisplayHost
-     *
-     * Converts a login's hostname field (a URL) to a short string for
-     * prompting purposes. Eg, "http://foo.com" --> "foo.com", or
-     * "ftp://www.site.co.uk" --> "site.co.uk".
-     */
-    _getShortDisplayHost: function (aURIString) {
-        var displayHost;
+  /*
+   * _getShortDisplayHost
+   *
+   * Converts a login's hostname field (a URL) to a short string for
+   * prompting purposes. Eg, "http://foo.com" --> "foo.com", or
+   * "ftp://www.site.co.uk" --> "site.co.uk".
+   */
+  _getShortDisplayHost: function (aURIString) {
+    var displayHost;
 
-        var eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"].
-                          getService(Ci.nsIEffectiveTLDService);
-        var idnService = Cc["@mozilla.org/network/idn-service;1"].
-                         getService(Ci.nsIIDNService);
-        try {
-            var uri = Services.io.newURI(aURIString, null, null);
-            var baseDomain = eTLDService.getBaseDomain(uri);
-            displayHost = idnService.convertToDisplayIDN(baseDomain, {});
-        } catch (e) {
-            this.log("_getShortDisplayHost couldn't process " + aURIString);
-        }
+    var eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"].
+                      getService(Ci.nsIEffectiveTLDService);
+    var idnService = Cc["@mozilla.org/network/idn-service;1"].
+                     getService(Ci.nsIIDNService);
+    try {
+      var uri = Services.io.newURI(aURIString, null, null);
+      var baseDomain = eTLDService.getBaseDomain(uri);
+      displayHost = idnService.convertToDisplayIDN(baseDomain, {});
+    } catch (e) {
+      this.log("_getShortDisplayHost couldn't process " + aURIString);
+    }
 
-        if (!displayHost)
-            displayHost = aURIString;
+    if (!displayHost)
+      displayHost = aURIString;
 
-        return displayHost;
-    },
+    return displayHost;
+  },
 
 
-    /*
-     * _getAuthTarget
-     *
-     * Returns the hostname and realm for which authentication is being
-     * requested, in the format expected to be used with nsILoginInfo.
-     */
-    _getAuthTarget : function (aChannel, aAuthInfo) {
-        var hostname, realm;
+  /*
+   * _getAuthTarget
+   *
+   * Returns the hostname and realm for which authentication is being
+   * requested, in the format expected to be used with nsILoginInfo.
+   */
+  _getAuthTarget : function (aChannel, aAuthInfo) {
+    var hostname, realm;
 
-        // If our proxy is demanding authentication, don't use the
-        // channel's actual destination.
-        if (aAuthInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY) {
-            this.log("getAuthTarget is for proxy auth");
-            if (!(aChannel instanceof Ci.nsIProxiedChannel))
-                throw "proxy auth needs nsIProxiedChannel";
+    // If our proxy is demanding authentication, don't use the
+    // channel's actual destination.
+    if (aAuthInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY) {
+      this.log("getAuthTarget is for proxy auth");
+      if (!(aChannel instanceof Ci.nsIProxiedChannel))
+        throw "proxy auth needs nsIProxiedChannel";
 
-            var info = aChannel.proxyInfo;
-            if (!info)
-                throw "proxy auth needs nsIProxyInfo";
+      var info = aChannel.proxyInfo;
+      if (!info)
+        throw "proxy auth needs nsIProxyInfo";
 
-            // Proxies don't have a scheme, but we'll use "moz-proxy://"
-            // so that it's more obvious what the login is for.
-            var idnService = Cc["@mozilla.org/network/idn-service;1"].
-                             getService(Ci.nsIIDNService);
-            hostname = "moz-proxy://" +
-                        idnService.convertUTF8toACE(info.host) +
-                        ":" + info.port;
-            realm = aAuthInfo.realm;
-            if (!realm)
-                realm = hostname;
+      // Proxies don't have a scheme, but we'll use "moz-proxy://"
+      // so that it's more obvious what the login is for.
+      var idnService = Cc["@mozilla.org/network/idn-service;1"].
+                       getService(Ci.nsIIDNService);
+      hostname = "moz-proxy://" +
+                  idnService.convertUTF8toACE(info.host) +
+                  ":" + info.port;
+      realm = aAuthInfo.realm;
+      if (!realm)
+        realm = hostname;
 
-            return [hostname, realm];
-        }
+      return [hostname, realm];
+    }
 
-        hostname = this._getFormattedHostname(aChannel.URI);
+    hostname = this._getFormattedHostname(aChannel.URI);
 
-        // If a HTTP WWW-Authenticate header specified a realm, that value
-        // will be available here. If it wasn't set or wasn't HTTP, we'll use
-        // the formatted hostname instead.
-        realm = aAuthInfo.realm;
-        if (!realm)
-            realm = hostname;
+    // If a HTTP WWW-Authenticate header specified a realm, that value
+    // will be available here. If it wasn't set or wasn't HTTP, we'll use
+    // the formatted hostname instead.
+    realm = aAuthInfo.realm;
+    if (!realm)
+      realm = hostname;
 
-        return [hostname, realm];
-    },
+    return [hostname, realm];
+  },
 
 
-    /**
-     * Returns [username, password] as extracted from aAuthInfo (which
-     * holds this info after having prompted the user).
-     *
-     * If the authentication was for a Windows domain, we'll prepend the
-     * return username with the domain. (eg, "domain\user")
-     */
-    _GetAuthInfo : function (aAuthInfo) {
-        var username, password;
+  /**
+   * Returns [username, password] as extracted from aAuthInfo (which
+   * holds this info after having prompted the user).
+   *
+   * If the authentication was for a Windows domain, we'll prepend the
+   * return username with the domain. (eg, "domain\user")
+   */
+  _GetAuthInfo : function (aAuthInfo) {
+    var username, password;
 
-        var flags = aAuthInfo.flags;
-        if (flags & Ci.nsIAuthInformation.NEED_DOMAIN && aAuthInfo.domain)
-            username = aAuthInfo.domain + "\\" + aAuthInfo.username;
-        else
-            username = aAuthInfo.username;
+    var flags = aAuthInfo.flags;
+    if (flags & Ci.nsIAuthInformation.NEED_DOMAIN && aAuthInfo.domain)
+      username = aAuthInfo.domain + "\\" + aAuthInfo.username;
+    else
+      username = aAuthInfo.username;
 
-        password = aAuthInfo.password;
+    password = aAuthInfo.password;
 
-        return [username, password];
-    },
+    return [username, password];
+  },
 
 
-    /**
-     * Given a username (possibly in DOMAIN\user form) and password, parses the
-     * domain out of the username if necessary and sets domain, username and
-     * password on the auth information object.
-     */
-    _SetAuthInfo : function (aAuthInfo, username, password) {
-        var flags = aAuthInfo.flags;
-        if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
-            // Domain is separated from username by a backslash
-            var idx = username.indexOf("\\");
-            if (idx == -1) {
-                aAuthInfo.username = username;
-            } else {
-                aAuthInfo.domain   =  username.substring(0, idx);
-                aAuthInfo.username =  username.substring(idx+1);
-            }
-        } else {
-            aAuthInfo.username = username;
-        }
-        aAuthInfo.password = password;
-    },
+  /**
+   * Given a username (possibly in DOMAIN\user form) and password, parses the
+   * domain out of the username if necessary and sets domain, username and
+   * password on the auth information object.
+   */
+  _SetAuthInfo : function (aAuthInfo, username, password) {
+    var flags = aAuthInfo.flags;
+    if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
+      // Domain is separated from username by a backslash
+      var idx = username.indexOf("\\");
+      if (idx == -1) {
+        aAuthInfo.username = username;
+      } else {
+        aAuthInfo.domain   =  username.substring(0, idx);
+        aAuthInfo.username =  username.substring(idx+1);
+      }
+    } else {
+      aAuthInfo.username = username;
+    }
+    aAuthInfo.password = password;
+  },
 
-    _newAsyncPromptConsumer : function(aCallback, aContext) {
-        return {
-            QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
-            callback: aCallback,
-            context: aContext,
-            cancel: function() {
-                this.callback.onAuthCancelled(this.context, false);
-                this.callback = null;
-                this.context = null;
-            }
-        }
+  _newAsyncPromptConsumer : function(aCallback, aContext) {
+    return {
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
+      callback: aCallback,
+      context: aContext,
+      cancel: function() {
+        this.callback.onAuthCancelled(this.context, false);
+        this.callback = null;
+        this.context = null;
+      }
     }
+  }
 
 }; // end of LoginManagerPrompter implementation
 
 
 var component = [LoginManagerPromptFactory, LoginManagerPrompter];
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
--- a/toolkit/components/passwordmgr/storage-json.js
+++ b/toolkit/components/passwordmgr/storage-json.js
@@ -1,10 +1,10 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
-/* vim: set sw=4 ts=4 et lcs=trail\:.,tab\:>~ : */
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sw=2 ts=2 et lcs=trail\:.,tab\:>~ : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * nsILoginManagerStorage implementation for the JSON back-end.
  */
 
@@ -33,622 +33,622 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "nsIUUIDGenerator");
 
 ////////////////////////////////////////////////////////////////////////////////
 //// LoginManagerStorage_json
 
 this.LoginManagerStorage_json = function () {}
 
 this.LoginManagerStorage_json.prototype = {
-    classID : Components.ID("{c00c432d-a0c9-46d7-bef6-9c45b4d07341}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage]),
+  classID : Components.ID("{c00c432d-a0c9-46d7-bef6-9c45b4d07341}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage]),
 
-    __crypto : null,  // nsILoginManagerCrypto service
-    get _crypto() {
-        if (!this.__crypto)
-            this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
-                            getService(Ci.nsILoginManagerCrypto);
-        return this.__crypto;
-    },
+  __crypto : null,  // nsILoginManagerCrypto service
+  get _crypto() {
+    if (!this.__crypto)
+      this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
+                      getService(Ci.nsILoginManagerCrypto);
+    return this.__crypto;
+  },
 
-    /*
-     * log
-     *
-     * Internal function for logging debug messages to the Error Console.
-     */
-    log : function (message) {
-        if (!this._debug)
-            return;
-        dump("PwMgr json: " + message + "\n");
-        Services.console.logStringMessage("PwMgr json: " + message);
-    },
-    _debug : false,
+  /*
+   * log
+   *
+   * Internal function for logging debug messages to the Error Console.
+   */
+  log : function (message) {
+    if (!this._debug)
+      return;
+    dump("PwMgr json: " + message + "\n");
+    Services.console.logStringMessage("PwMgr json: " + message);
+  },
+  _debug : false,
 
 
-    /*
-     * initialize
-     *
-     */
-    initialize : function () {
-        this._debug = Services.prefs.getBoolPref("signon.debug");
-
-        try {
-            // Force initialization of the crypto module.
-            // See bug 717490 comment 17.
-            this._crypto;
-
-            // Set the reference to LoginStore synchronously.
-            let jsonPath = OS.Path.join(OS.Constants.Path.profileDir,
-                                        "logins.json");
-            this._store = new LoginStore(jsonPath);
+  /*
+   * initialize
+   *
+   */
+  initialize : function () {
+    this._debug = Services.prefs.getBoolPref("signon.debug");
 
-            return Task.spawn(function () {
-                // Load the data asynchronously.
-                this.log("Opening database at " + this._store.path);
-                yield this._store.load();
+    try {
+      // Force initialization of the crypto module.
+      // See bug 717490 comment 17.
+      this._crypto;
 
-                // The import from previous versions operates the first time
-                // that this built-in storage back-end is used.  This may be
-                // later than expected, in case add-ons have registered an
-                // alternate storage that disabled the default one.
-                try {
-                    if (Services.prefs.getBoolPref("signon.importedFromSqlite")) {
-                        return;
-                    }
-                } catch (ex) {
-                    // If the preference does not exist, we need to import.
-                }
+      // Set the reference to LoginStore synchronously.
+      let jsonPath = OS.Path.join(OS.Constants.Path.profileDir,
+                                  "logins.json");
+      this._store = new LoginStore(jsonPath);
+
+      return Task.spawn(function () {
+        // Load the data asynchronously.
+        this.log("Opening database at " + this._store.path);
+        yield this._store.load();
 
-                // Import only happens asynchronously.
-                let sqlitePath = OS.Path.join(OS.Constants.Path.profileDir,
-                                              "signons.sqlite");
-                if (yield OS.File.exists(sqlitePath)) {
-                    let loginImport = new LoginImport(this._store, sqlitePath);
-                    // Failures during import, for example due to a corrupt
-                    // file or a schema version that is too old, will not
-                    // prevent us from marking the operation as completed.
-                    // At the next startup, we will not try the import again.
-                    yield loginImport.import().catch(Cu.reportError);
-                    this._store.saveSoon();
-                }
-
-                // We won't attempt import again on next startup.
-                Services.prefs.setBoolPref("signon.importedFromSqlite", true);
-            }.bind(this)).catch(Cu.reportError);
-        } catch (e) {
-            this.log("Initialization failed: " + e);
-            throw "Initialization failed";
+        // The import from previous versions operates the first time
+        // that this built-in storage back-end is used.  This may be
+        // later than expected, in case add-ons have registered an
+        // alternate storage that disabled the default one.
+        try {
+          if (Services.prefs.getBoolPref("signon.importedFromSqlite")) {
+            return;
+          }
+        } catch (ex) {
+          // If the preference does not exist, we need to import.
         }
-    },
-
 
-    /*
-     * terminate
-     *
-     * Internal method used by regression tests only.  It is called before
-     * replacing this storage module with a new instance.
-     */
-    terminate : function () {
-        this._store._saver.disarm();
-        return this._store.save();
-    },
-
-
-    /*
-     * addLogin
-     *
-     */
-    addLogin : function (login) {
-        this._store.ensureDataReady();
-
-        // Throws if there are bogus values.
-        LoginHelper.checkLoginValues(login);
-
-        let [encUsername, encPassword, encType] = this._encryptLogin(login);
-
-        // Clone the login, so we don't modify the caller's object.
-        let loginClone = login.clone();
-
-        // Initialize the nsILoginMetaInfo fields, unless the caller gave us values
-        loginClone.QueryInterface(Ci.nsILoginMetaInfo);
-        if (loginClone.guid) {
-            if (!this._isGuidUnique(loginClone.guid))
-                throw "specified GUID already exists";
-        } else {
-            loginClone.guid = gUUIDGenerator.generateUUID().toString();
+        // Import only happens asynchronously.
+        let sqlitePath = OS.Path.join(OS.Constants.Path.profileDir,
+                                      "signons.sqlite");
+        if (yield OS.File.exists(sqlitePath)) {
+          let loginImport = new LoginImport(this._store, sqlitePath);
+          // Failures during import, for example due to a corrupt
+          // file or a schema version that is too old, will not
+          // prevent us from marking the operation as completed.
+          // At the next startup, we will not try the import again.
+          yield loginImport.import().catch(Cu.reportError);
+          this._store.saveSoon();
         }
 
-        // Set timestamps
-        let currentTime = Date.now();
-        if (!loginClone.timeCreated)
-            loginClone.timeCreated = currentTime;
-        if (!loginClone.timeLastUsed)
-            loginClone.timeLastUsed = currentTime;
-        if (!loginClone.timePasswordChanged)
-            loginClone.timePasswordChanged = currentTime;
-        if (!loginClone.timesUsed)
-            loginClone.timesUsed = 1;
+        // We won't attempt import again on next startup.
+        Services.prefs.setBoolPref("signon.importedFromSqlite", true);
+      }.bind(this)).catch(Cu.reportError);
+    } catch (e) {
+      this.log("Initialization failed: " + e);
+      throw "Initialization failed";
+    }
+  },
+
 
-        this._store.data.logins.push({
-            id:                  this._store.data.nextId++,
-            hostname:            loginClone.hostname,
-            httpRealm:           loginClone.httpRealm,
-            formSubmitURL:       loginClone.formSubmitURL,
-            usernameField:       loginClone.usernameField,
-            passwordField:       loginClone.passwordField,
-            encryptedUsername:   encUsername,
-            encryptedPassword:   encPassword,
-            guid:                loginClone.guid,
-            encType:             encType,
-            timeCreated:         loginClone.timeCreated,
-            timeLastUsed:        loginClone.timeLastUsed,
-            timePasswordChanged: loginClone.timePasswordChanged,
-            timesUsed:           loginClone.timesUsed
-        });
-        this._store.saveSoon();
-
-        // Send a notification that a login was added.
-        this._sendNotification("addLogin", loginClone);
-    },
+  /*
+   * terminate
+   *
+   * Internal method used by regression tests only.  It is called before
+   * replacing this storage module with a new instance.
+   */
+  terminate : function () {
+    this._store._saver.disarm();
+    return this._store.save();
+  },
 
 
-    /*
-     * removeLogin
-     *
-     */
-    removeLogin : function (login) {
-        this._store.ensureDataReady();
+  /*
+   * addLogin
+   *
+   */
+  addLogin : function (login) {
+    this._store.ensureDataReady();
+
+    // Throws if there are bogus values.
+    LoginHelper.checkLoginValues(login);
+
+    let [encUsername, encPassword, encType] = this._encryptLogin(login);
+
+    // Clone the login, so we don't modify the caller's object.
+    let loginClone = login.clone();
+
+    // Initialize the nsILoginMetaInfo fields, unless the caller gave us values
+    loginClone.QueryInterface(Ci.nsILoginMetaInfo);
+    if (loginClone.guid) {
+      if (!this._isGuidUnique(loginClone.guid))
+        throw "specified GUID already exists";
+    } else {
+      loginClone.guid = gUUIDGenerator.generateUUID().toString();
+    }
+
+    // Set timestamps
+    let currentTime = Date.now();
+    if (!loginClone.timeCreated)
+      loginClone.timeCreated = currentTime;
+    if (!loginClone.timeLastUsed)
+      loginClone.timeLastUsed = currentTime;
+    if (!loginClone.timePasswordChanged)
+      loginClone.timePasswordChanged = currentTime;
+    if (!loginClone.timesUsed)
+      loginClone.timesUsed = 1;
 
-        let [idToDelete, storedLogin] = this._getIdForLogin(login);
-        if (!idToDelete)
-            throw "No matching logins";
+    this._store.data.logins.push({
+      id:                  this._store.data.nextId++,
+      hostname:            loginClone.hostname,
+      httpRealm:           loginClone.httpRealm,
+      formSubmitURL:       loginClone.formSubmitURL,
+      usernameField:       loginClone.usernameField,
+      passwordField:       loginClone.passwordField,
+      encryptedUsername:   encUsername,
+      encryptedPassword:   encPassword,
+      guid:                loginClone.guid,
+      encType:             encType,
+      timeCreated:         loginClone.timeCreated,
+      timeLastUsed:        loginClone.timeLastUsed,
+      timePasswordChanged: loginClone.timePasswordChanged,
+      timesUsed:           loginClone.timesUsed
+    });
+    this._store.saveSoon();
 
-        let foundIndex = this._store.data.logins.findIndex(l => l.id == idToDelete);
-        if (foundIndex != -1) {
-            this._store.data.logins.splice(foundIndex, 1);
-            this._store.saveSoon();
-        }
+    // Send a notification that a login was added.
+    this._sendNotification("addLogin", loginClone);
+  },
+
+
+  /*
+   * removeLogin
+   *
+   */
+  removeLogin : function (login) {
+    this._store.ensureDataReady();
 
-        this._sendNotification("removeLogin", storedLogin);
-    },
+    let [idToDelete, storedLogin] = this._getIdForLogin(login);
+    if (!idToDelete)
+      throw "No matching logins";
+
+    let foundIndex = this._store.data.logins.findIndex(l => l.id == idToDelete);
+    if (foundIndex != -1) {
+      this._store.data.logins.splice(foundIndex, 1);
+      this._store.saveSoon();
+    }
+
+    this._sendNotification("removeLogin", storedLogin);
+  },
 
 
-    /*
-     * modifyLogin
-     *
-     */
-    modifyLogin : function (oldLogin, newLoginData) {
-        this._store.ensureDataReady();
+  /*
+   * modifyLogin
+   *
+   */
+  modifyLogin : function (oldLogin, newLoginData) {
+    this._store.ensureDataReady();
 
-        let [idToModify, oldStoredLogin] = this._getIdForLogin(oldLogin);
-        if (!idToModify)
-            throw "No matching logins";
+    let [idToModify, oldStoredLogin] = this._getIdForLogin(oldLogin);
+    if (!idToModify)
+      throw "No matching logins";
 
-        let newLogin = LoginHelper.buildModifiedLogin(oldStoredLogin, newLoginData);
+    let newLogin = LoginHelper.buildModifiedLogin(oldStoredLogin, newLoginData);
 
-        // Check if the new GUID is duplicate.
-        if (newLogin.guid != oldStoredLogin.guid &&
-            !this._isGuidUnique(newLogin.guid)) 
-        {
-            throw "specified GUID already exists";
-        }
+    // Check if the new GUID is duplicate.
+    if (newLogin.guid != oldStoredLogin.guid &&
+        !this._isGuidUnique(newLogin.guid))
+    {
+      throw "specified GUID already exists";
+    }
 
-        // Look for an existing entry in case key properties changed.
-        if (!newLogin.matches(oldLogin, true)) {
-            let logins = this.findLogins({}, newLogin.hostname,
-                                         newLogin.formSubmitURL,
-                                         newLogin.httpRealm);
+    // Look for an existing entry in case key properties changed.
+    if (!newLogin.matches(oldLogin, true)) {
+      let logins = this.findLogins({}, newLogin.hostname,
+                                   newLogin.formSubmitURL,
+                                   newLogin.httpRealm);
 
-            if (logins.some(login => newLogin.matches(login, true)))
-                throw "This login already exists.";
-        }
+      if (logins.some(login => newLogin.matches(login, true)))
+        throw "This login already exists.";
+    }
 
-        // Get the encrypted value of the username and password.
-        let [encUsername, encPassword, encType] = this._encryptLogin(newLogin);
+    // Get the encrypted value of the username and password.
+    let [encUsername, encPassword, encType] = this._encryptLogin(newLogin);
 
-        for (let loginItem of this._store.data.logins) {
-            if (loginItem.id == idToModify) {
-                loginItem.hostname = newLogin.hostname;
-                loginItem.httpRealm = newLogin.httpRealm;
-                loginItem.formSubmitURL = newLogin.formSubmitURL;
-                loginItem.usernameField = newLogin.usernameField;
-                loginItem.passwordField = newLogin.passwordField;
-                loginItem.encryptedUsername = encUsername;
-                loginItem.encryptedPassword = encPassword;
-                loginItem.guid = newLogin.guid;
-                loginItem.encType = encType;
-                loginItem.timeCreated = newLogin.timeCreated;
-                loginItem.timeLastUsed = newLogin.timeLastUsed;
-                loginItem.timePasswordChanged = newLogin.timePasswordChanged;
-                loginItem.timesUsed = newLogin.timesUsed;
-                this._store.saveSoon();
-                break;
-            }
-        }
+    for (let loginItem of this._store.data.logins) {
+      if (loginItem.id == idToModify) {
+        loginItem.hostname = newLogin.hostname;
+        loginItem.httpRealm = newLogin.httpRealm;
+        loginItem.formSubmitURL = newLogin.formSubmitURL;
+        loginItem.usernameField = newLogin.usernameField;
+        loginItem.passwordField = newLogin.passwordField;
+        loginItem.encryptedUsername = encUsername;
+        loginItem.encryptedPassword = encPassword;
+        loginItem.guid = newLogin.guid;
+        loginItem.encType = encType;
+        loginItem.timeCreated = newLogin.timeCreated;
+        loginItem.timeLastUsed = newLogin.timeLastUsed;
+        loginItem.timePasswordChanged = newLogin.timePasswordChanged;
+        loginItem.timesUsed = newLogin.timesUsed;
+        this._store.saveSoon();
+        break;
+      }
+    }
 
-        this._sendNotification("modifyLogin", [oldStoredLogin, newLogin]);
-    },
+    this._sendNotification("modifyLogin", [oldStoredLogin, newLogin]);
+  },
 
 
-    /*
-     * getAllLogins
-     *
-     * Returns an array of nsILoginInfo.
-     */
-    getAllLogins : function (count) {
-        let [logins, ids] = this._searchLogins({});
+  /*
+   * getAllLogins
+   *
+   * Returns an array of nsILoginInfo.
+   */
+  getAllLogins : function (count) {
+    let [logins, ids] = this._searchLogins({});
 
-        // decrypt entries for caller.
-        logins = this._decryptLogins(logins);
+    // decrypt entries for caller.
+    logins = this._decryptLogins(logins);
 
-        this.log("_getAllLogins: returning " + logins.length + " logins.");
-        if (count)
-            count.value = logins.length; // needed for XPCOM
-        return logins;
-    },
+    this.log("_getAllLogins: returning " + logins.length + " logins.");
+    if (count)
+      count.value = logins.length; // needed for XPCOM
+    return logins;
+  },
 
 
-    /*
-     * searchLogins
-     *
-     * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
-     * JavaScript object and decrypt the results.
-     *
-     * Returns an array of decrypted nsILoginInfo.
-     */
-    searchLogins : function(count, matchData) {
-        let realMatchData = {};
-        // Convert nsIPropertyBag to normal JS object
-        let propEnum = matchData.enumerator;
-        while (propEnum.hasMoreElements()) {
-            let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
-            realMatchData[prop.name] = prop.value;
-        }
+  /*
+   * searchLogins
+   *
+   * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
+   * JavaScript object and decrypt the results.
+   *
+   * Returns an array of decrypted nsILoginInfo.
+   */
+  searchLogins : function(count, matchData) {
+    let realMatchData = {};
+    // Convert nsIPropertyBag to normal JS object
+    let propEnum = matchData.enumerator;
+    while (propEnum.hasMoreElements()) {
+      let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
+      realMatchData[prop.name] = prop.value;
+    }
 
-        let [logins, ids] = this._searchLogins(realMatchData);
+    let [logins, ids] = this._searchLogins(realMatchData);
 
-        // Decrypt entries found for the caller.
-        logins = this._decryptLogins(logins);
+    // Decrypt entries found for the caller.
+    logins = this._decryptLogins(logins);
 
-        count.value = logins.length; // needed for XPCOM
-        return logins;
-    },
+    count.value = logins.length; // needed for XPCOM
+    return logins;
+  },
 
 
-    /*
-     * _searchLogins
-     *
-     * Private method to perform arbitrary searches on any field. Decryption is
-     * left to the caller.
-     *
-     * Returns [logins, ids] for logins that match the arguments, where logins
-     * is an array of encrypted nsLoginInfo and ids is an array of associated
-     * ids in the database.
-     */
-    _searchLogins : function (matchData) {
-        this._store.ensureDataReady();
+  /*
+   * _searchLogins
+   *
+   * Private method to perform arbitrary searches on any field. Decryption is
+   * left to the caller.
+   *
+   * Returns [logins, ids] for logins that match the arguments, where logins
+   * is an array of encrypted nsLoginInfo and ids is an array of associated
+   * ids in the database.
+   */
+  _searchLogins : function (matchData) {
+    this._store.ensureDataReady();
 
-        let conditions = [];
+    let conditions = [];
 
-        function match(aLogin) {
-            for (let field in matchData) {
-                let value = matchData[field];
-                switch (field) {
-                    // Historical compatibility requires this special case
-                    case "formSubmitURL":
-                        if (value != null) {
-                            if (aLogin.formSubmitURL != "" && aLogin.formSubmitURL != value) {
-                                return false;
-                            }
-                            break;
-                        }
-                    // Normal cases.
-                    case "hostname":
-                    case "httpRealm":
-                    case "id":
-                    case "usernameField":
-                    case "passwordField":
-                    case "encryptedUsername":
-                    case "encryptedPassword":
-                    case "guid":
-                    case "encType":
-                    case "timeCreated":
-                    case "timeLastUsed":
-                    case "timePasswordChanged":
-                    case "timesUsed":
-                        if (value == null && aLogin[field]) {
-                            return false;
-                        } else if (aLogin[field] != value) {
-                            return false;
-                        }
-                        break;
-                    // Fail if caller requests an unknown property.
-                    default:
-                        throw "Unexpected field: " + field;
-                }
+    function match(aLogin) {
+      for (let field in matchData) {
+        let value = matchData[field];
+        switch (field) {
+          // Historical compatibility requires this special case
+          case "formSubmitURL":
+            if (value != null) {
+              if (aLogin.formSubmitURL != "" && aLogin.formSubmitURL != value) {
+                return false;
+              }
+              break;
             }
-            return true;
+          // Normal cases.
+          case "hostname":
+          case "httpRealm":
+          case "id":
+          case "usernameField":
+          case "passwordField":
+          case "encryptedUsername":
+          case "encryptedPassword":
+          case "guid":
+          case "encType":
+          case "timeCreated":
+          case "timeLastUsed":
+          case "timePasswordChanged":
+          case "timesUsed":
+            if (value == null && aLogin[field]) {
+              return false;
+            } else if (aLogin[field] != value) {
+              return false;
+            }
+            break;
+          // Fail if caller requests an unknown property.
+          default:
+            throw "Unexpected field: " + field;
         }
+      }
+      return true;
+    }
 
-        let foundLogins = [], foundIds = [];
-        for (let loginItem of this._store.data.logins) {
-            if (match(loginItem)) {
-                // Create the new nsLoginInfo object, push to array
-                let login = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                            createInstance(Ci.nsILoginInfo);
-                login.init(loginItem.hostname, loginItem.formSubmitURL,
-                           loginItem.httpRealm, loginItem.encryptedUsername,
-                           loginItem.encryptedPassword, loginItem.usernameField,
-                           loginItem.passwordField);
-                // set nsILoginMetaInfo values
-                login.QueryInterface(Ci.nsILoginMetaInfo);
-                login.guid = loginItem.guid;
-                login.timeCreated = loginItem.timeCreated;
-                login.timeLastUsed = loginItem.timeLastUsed;
-                login.timePasswordChanged = loginItem.timePasswordChanged;
-                login.timesUsed = loginItem.timesUsed;
-                foundLogins.push(login);
-                foundIds.push(loginItem.id);
-            }
-        }
+    let foundLogins = [], foundIds = [];
+    for (let loginItem of this._store.data.logins) {
+      if (match(loginItem)) {
+        // Create the new nsLoginInfo object, push to array
+        let login = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                    createInstance(Ci.nsILoginInfo);
+        login.init(loginItem.hostname, loginItem.formSubmitURL,
+                   loginItem.httpRealm, loginItem.encryptedUsername,
+                   loginItem.encryptedPassword, loginItem.usernameField,
+                   loginItem.passwordField);
+        // set nsILoginMetaInfo values
+        login.QueryInterface(Ci.nsILoginMetaInfo);
+        login.guid = loginItem.guid;
+        login.timeCreated = loginItem.timeCreated;
+        login.timeLastUsed = loginItem.timeLastUsed;
+        login.timePasswordChanged = loginItem.timePasswordChanged;
+        login.timesUsed = loginItem.timesUsed;
+        foundLogins.push(login);
+        foundIds.push(loginItem.id);
+      }
+    }
 
-        this.log("_searchLogins: returning " + foundLogins.length + " logins");
-        return [foundLogins, foundIds];
-    },
+    this.log("_searchLogins: returning " + foundLogins.length + " logins");
+    return [foundLogins, foundIds];
+  },
 
-    /*
-     * removeAllLogins
-     *
-     * Removes all logins from storage.
-     *
-     * Disabled hosts are kept, as one presumably doesn't want to erase those.
-     */
-    removeAllLogins : function () {
-        this._store.ensureDataReady();
+  /*
+   * removeAllLogins
+   *
+   * Removes all logins from storage.
+   *
+   * Disabled hosts are kept, as one presumably doesn't want to erase those.
+   */
+  removeAllLogins : function () {
+    this._store.ensureDataReady();
 
-        this.log("Removing all logins");
-        this._store.data.logins = [];
-        this._store.saveSoon();
+    this.log("Removing all logins");
+    this._store.data.logins = [];
+    this._store.saveSoon();
 
-        this._sendNotification("removeAllLogins", null);
-    },
+    this._sendNotification("removeAllLogins", null);
+  },
 
 
-    /*
-     * getAllDisabledHosts
-     *
-     */
-    getAllDisabledHosts : function (count) {
-        this._store.ensureDataReady();
+  /*
+   * getAllDisabledHosts
+   *
+   */
+  getAllDisabledHosts : function (count) {
+    this._store.ensureDataReady();
 
-        let disabledHosts = this._store.data.disabledHosts.slice(0);
+    let disabledHosts = this._store.data.disabledHosts.slice(0);
 
-        this.log("_getAllDisabledHosts: returning " + disabledHosts.length + " disabled hosts.");
-        if (count)
-            count.value = disabledHosts.length; // needed for XPCOM
-        return disabledHosts;
-    },
+    this.log("_getAllDisabledHosts: returning " + disabledHosts.length + " disabled hosts.");
+    if (count)
+      count.value = disabledHosts.length; // needed for XPCOM
+    return disabledHosts;
+  },
 
 
-    /*
-     * getLoginSavingEnabled
-     *
-     */
-    getLoginSavingEnabled : function (hostname) {
-        this._store.ensureDataReady();
+  /*
+   * getLoginSavingEnabled
+   *
+   */
+  getLoginSavingEnabled : function (hostname) {
+    this._store.ensureDataReady();
 
-        this.log("Getting login saving is enabled for " + hostname);
-        return this._store.data.disabledHosts.indexOf(hostname) == -1;
-    },
+    this.log("Getting login saving is enabled for " + hostname);
+    return this._store.data.disabledHosts.indexOf(hostname) == -1;
+  },
 
 
-    /*
-     * setLoginSavingEnabled
-     *
-     */
-    setLoginSavingEnabled : function (hostname, enabled) {
-        this._store.ensureDataReady();
+  /*
+   * setLoginSavingEnabled
+   *
+   */
+  setLoginSavingEnabled : function (hostname, enabled) {
+    this._store.ensureDataReady();
 
-        // Throws if there are bogus values.
-        LoginHelper.checkHostnameValue(hostname);
+    // Throws if there are bogus values.
+    LoginHelper.checkHostnameValue(hostname);
 
-        this.log("Setting login saving enabled for " + hostname + " to " + enabled);
-        let foundIndex = this._store.data.disabledHosts.indexOf(hostname);
-        if (enabled) {
-            if (foundIndex != -1) {
-                this._store.data.disabledHosts.splice(foundIndex, 1);
-                this._store.saveSoon();
-            }
-        } else {
-            if (foundIndex == -1) {
-                this._store.data.disabledHosts.push(hostname);
-                this._store.saveSoon();
-            }
-        }
+    this.log("Setting login saving enabled for " + hostname + " to " + enabled);
+    let foundIndex = this._store.data.disabledHosts.indexOf(hostname);
+    if (enabled) {
+      if (foundIndex != -1) {
+        this._store.data.disabledHosts.splice(foundIndex, 1);
+        this._store.saveSoon();
+      }
+    } else {
+      if (foundIndex == -1) {
+        this._store.data.disabledHosts.push(hostname);
+        this._store.saveSoon();
+      }
+    }
 
-        this._sendNotification(enabled ? "hostSavingEnabled" : "hostSavingDisabled", hostname);
-    },
+    this._sendNotification(enabled ? "hostSavingEnabled" : "hostSavingDisabled", hostname);
+  },
 
 
-    /*
-     * findLogins
-     *
-     */
-    findLogins : function (count, hostname, formSubmitURL, httpRealm) {
-        let loginData = {
-            hostname: hostname,
-            formSubmitURL: formSubmitURL,
-            httpRealm: httpRealm
-        };
-        let matchData = { };
-        for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
-            if (loginData[field] != '')
-                matchData[field] = loginData[field];
-        let [logins, ids] = this._searchLogins(matchData);
+  /*
+   * findLogins
+   *
+   */
+  findLogins : function (count, hostname, formSubmitURL, httpRealm) {
+    let loginData = {
+      hostname: hostname,
+      formSubmitURL: formSubmitURL,
+      httpRealm: httpRealm
+    };
+    let matchData = { };
+    for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
+      if (loginData[field] != '')
+        matchData[field] = loginData[field];
+    let [logins, ids] = this._searchLogins(matchData);
 
-        // Decrypt entries found for the caller.
-        logins = this._decryptLogins(logins);
+    // Decrypt entries found for the caller.
+    logins = this._decryptLogins(logins);
 
-        this.log("_findLogins: returning " + logins.length + " logins");
-        count.value = logins.length; // needed for XPCOM
-        return logins;
-    },
+    this.log("_findLogins: returning " + logins.length + " logins");
+    count.value = logins.length; // needed for XPCOM
+    return logins;
+  },
 
 
-    /*
-     * countLogins
-     *
-     */
-    countLogins : function (hostname, formSubmitURL, httpRealm) {
-        let count = {};
-        let loginData = {
-            hostname: hostname,
-            formSubmitURL: formSubmitURL,
-            httpRealm: httpRealm
-        };
-        let matchData = { };
-        for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
-            if (loginData[field] != '')
-                matchData[field] = loginData[field];
-        let [logins, ids] = this._searchLogins(matchData);
+  /*
+   * countLogins
+   *
+   */
+  countLogins : function (hostname, formSubmitURL, httpRealm) {
+    let count = {};
+    let loginData = {
+      hostname: hostname,
+      formSubmitURL: formSubmitURL,
+      httpRealm: httpRealm
+    };
+    let matchData = { };
+    for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
+      if (loginData[field] != '')
+        matchData[field] = loginData[field];
+    let [logins, ids] = this._searchLogins(matchData);
 
-        this.log("_countLogins: counted logins: " + logins.length);
-        return logins.length;
-    },
+    this.log("_countLogins: counted logins: " + logins.length);
+    return logins.length;
+  },
 
 
-    /*
-     * uiBusy
-     */
-    get uiBusy() {
-        return this._crypto.uiBusy;
-    },
+  /*
+   * uiBusy
+   */
+  get uiBusy() {
+    return this._crypto.uiBusy;
+  },
 
 
-    /*
-     * isLoggedIn
-     */
-    get isLoggedIn() {
-        return this._crypto.isLoggedIn;
-    },
+  /*
+   * isLoggedIn
+   */
+  get isLoggedIn() {
+    return this._crypto.isLoggedIn;
+  },
 
 
-    /*
-     * _sendNotification
-     *
-     * Send a notification when stored data is changed.
-     */
-    _sendNotification : function (changeType, data) {
-        let dataObject = data;
-        // Can't pass a raw JS string or array though notifyObservers(). :-(
-        if (data instanceof Array) {
-            dataObject = Cc["@mozilla.org/array;1"].
-                         createInstance(Ci.nsIMutableArray);
-            for (let i = 0; i < data.length; i++)
-                dataObject.appendElement(data[i], false);
-        } else if (typeof(data) == "string") {
-            dataObject = Cc["@mozilla.org/supports-string;1"].
-                         createInstance(Ci.nsISupportsString);
-            dataObject.data = data;
-        }
-        Services.obs.notifyObservers(dataObject, "passwordmgr-storage-changed", changeType);
-    },
+  /*
+   * _sendNotification
+   *
+   * Send a notification when stored data is changed.
+   */
+  _sendNotification : function (changeType, data) {
+    let dataObject = data;
+    // Can't pass a raw JS string or array though notifyObservers(). :-(
+    if (data instanceof Array) {
+      dataObject = Cc["@mozilla.org/array;1"].
+                   createInstance(Ci.nsIMutableArray);
+      for (let i = 0; i < data.length; i++)
+        dataObject.appendElement(data[i], false);
+    } else if (typeof(data) == "string") {
+      dataObject = Cc["@mozilla.org/supports-string;1"].
+                   createInstance(Ci.nsISupportsString);
+      dataObject.data = data;
+    }
+    Services.obs.notifyObservers(dataObject, "passwordmgr-storage-changed", changeType);
+  },
 
 
-    /*
-     * _getIdForLogin
-     *
-     * Returns an array with two items: [id, login]. If the login was not
-     * found, both items will be null. The returned login contains the actual
-     * stored login (useful for looking at the actual nsILoginMetaInfo values).
-     */
-    _getIdForLogin : function (login) {
-        let matchData = { };
-        for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
-            if (login[field] != '')
-                matchData[field] = login[field];
-        let [logins, ids] = this._searchLogins(matchData);
+  /*
+   * _getIdForLogin
+   *
+   * Returns an array with two items: [id, login]. If the login was not
+   * found, both items will be null. The returned login contains the actual
+   * stored login (useful for looking at the actual nsILoginMetaInfo values).
+   */
+  _getIdForLogin : function (login) {
+    let matchData = { };
+    for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
+      if (login[field] != '')
+        matchData[field] = login[field];
+    let [logins, ids] = this._searchLogins(matchData);
 
-        let id = null;
-        let foundLogin = null;
+    let id = null;
+    let foundLogin = null;
 
-        // The specified login isn't encrypted, so we need to ensure
-        // the logins we're comparing with are decrypted. We decrypt one entry
-        // at a time, lest _decryptLogins return fewer entries and screw up
-        // indices between the two.
-        for (let i = 0; i < logins.length; i++) {
-            let [decryptedLogin] = this._decryptLogins([logins[i]]);
+    // The specified login isn't encrypted, so we need to ensure
+    // the logins we're comparing with are decrypted. We decrypt one entry
+    // at a time, lest _decryptLogins return fewer entries and screw up
+    // indices between the two.
+    for (let i = 0; i < logins.length; i++) {
+      let [decryptedLogin] = this._decryptLogins([logins[i]]);
 
-            if (!decryptedLogin || !decryptedLogin.equals(login))
-                continue;
+      if (!decryptedLogin || !decryptedLogin.equals(login))
+        continue;
 
-            // We've found a match, set id and break
-            foundLogin = decryptedLogin;
-            id = ids[i];
-            break;
-        }
+      // We've found a match, set id and break
+      foundLogin = decryptedLogin;
+      id = ids[i];
+      break;
+    }
 
-        return [id, foundLogin];
-    },
+    return [id, foundLogin];
+  },
 
 
-    /*
-     * _isGuidUnique
-     *
-     * Checks to see if the specified GUID already exists.
-     */
-    _isGuidUnique : function (guid) {
-        this._store.ensureDataReady();
+  /*
+   * _isGuidUnique
+   *
+   * Checks to see if the specified GUID already exists.
+   */
+  _isGuidUnique : function (guid) {
+    this._store.ensureDataReady();
 
-        return this._store.data.logins.every(l => l.guid != guid);
-    },
+    return this._store.data.logins.every(l => l.guid != guid);
+  },
 
 
-    /*
-     * _encryptLogin
-     *
-     * Returns the encrypted username, password, and encrypton type for the specified
-     * login. Can throw if the user cancels a master password entry.
-     */
-    _encryptLogin : function (login) {
-        let encUsername = this._crypto.encrypt(login.username);
-        let encPassword = this._crypto.encrypt(login.password);
-        let encType     = this._crypto.defaultEncType;
+  /*
+   * _encryptLogin
+   *
+   * Returns the encrypted username, password, and encrypton type for the specified
+   * login. Can throw if the user cancels a master password entry.
+   */
+  _encryptLogin : function (login) {
+    let encUsername = this._crypto.encrypt(login.username);
+    let encPassword = this._crypto.encrypt(login.password);
+    let encType     = this._crypto.defaultEncType;
 
-        return [encUsername, encPassword, encType];
-    },
+    return [encUsername, encPassword, encType];
+  },
 
 
-    /*
-     * _decryptLogins
-     *
-     * Decrypts username and password fields in the provided array of
-     * logins.
-     *
-     * The entries specified by the array will be decrypted, if possible.
-     * An array of successfully decrypted logins will be returned. The return
-     * value should be given to external callers (since still-encrypted
-     * entries are useless), whereas internal callers generally don't want
-     * to lose unencrypted entries (eg, because the user clicked Cancel
-     * instead of entering their master password)
-     */
-    _decryptLogins : function (logins) {
-        let result = [];
+  /*
+   * _decryptLogins
+   *
+   * Decrypts username and password fields in the provided array of
+   * logins.
+   *
+   * The entries specified by the array will be decrypted, if possible.
+   * An array of successfully decrypted logins will be returned. The return
+   * value should be given to external callers (since still-encrypted
+   * entries are useless), whereas internal callers generally don't want
+   * to lose unencrypted entries (eg, because the user clicked Cancel
+   * instead of entering their master password)
+   */
+  _decryptLogins : function (logins) {
+    let result = [];
 
-        for each (let login in logins) {
-            try {
-                login.username = this._crypto.decrypt(login.username);
-                login.password = this._crypto.decrypt(login.password);
-            } catch (e) {
-                // If decryption failed (corrupt entry?), just skip it.
-                // Rethrow other errors (like canceling entry of a master pw)
-                if (e.result == Cr.NS_ERROR_FAILURE)
-                    continue;
-                throw e;
-            }
-            result.push(login);
-        }
+    for each (let login in logins) {
+      try {
+        login.username = this._crypto.decrypt(login.username);
+        login.password = this._crypto.decrypt(login.password);
+      } catch (e) {
+        // If decryption failed (corrupt entry?), just skip it.
+        // Rethrow other errors (like canceling entry of a master pw)
+        if (e.result == Cr.NS_ERROR_FAILURE)
+          continue;
+        throw e;
+      }
+      result.push(login);
+    }
 
-        return result;
-    },
+    return result;
+  },
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManagerStorage_json]);
--- a/toolkit/components/passwordmgr/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/storage-mozStorage.js
@@ -1,10 +1,10 @@
-/* -*- tab-width: 4; indent-tabs-mode: nil; js-indent-level: 4 -*- */
-/* vim: set sw=4 ts=4 et lcs=trail\:.,tab\:>~ : */
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sw=2 ts=2 et lcs=trail\:.,tab\:>~ : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
@@ -21,1372 +21,1372 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 /**
  * Object that manages a database transaction properly so consumers don't have
  * to worry about it throwing.
  *
  * @param aDatabase
  *        The mozIStorageConnection to start a transaction on.
  */
 function Transaction(aDatabase) {
-    this._db = aDatabase;
+  this._db = aDatabase;
 
-    this._hasTransaction = false;
-    try {
-        this._db.beginTransaction();
-        this._hasTransaction = true;
-    }
-    catch(e) { /* om nom nom exceptions */ }
+  this._hasTransaction = false;
+  try {
+    this._db.beginTransaction();
+    this._hasTransaction = true;
+  }
+  catch(e) { /* om nom nom exceptions */ }
 }
 
 Transaction.prototype = {
-    commit : function() {
-        if (this._hasTransaction)
-            this._db.commitTransaction();
-    },
+  commit : function() {
+    if (this._hasTransaction)
+      this._db.commitTransaction();
+  },
 
-    rollback : function() {
-        if (this._hasTransaction)
-            this._db.rollbackTransaction();
-    },
+  rollback : function() {
+    if (this._hasTransaction)
+      this._db.rollbackTransaction();
+  },
 };
 
 
 function LoginManagerStorage_mozStorage() { };
 
 LoginManagerStorage_mozStorage.prototype = {
 
-    classID : Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"),
-    QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage,
-                                            Ci.nsIInterfaceRequestor]),
-    getInterface : function(aIID) {
-        if (aIID.equals(Ci.nsIVariant)) {
-            // Allows unwrapping the JavaScript object for regression tests.
-            return this;
-        }
+  classID : Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"),
+  QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage,
+                                          Ci.nsIInterfaceRequestor]),
+  getInterface : function(aIID) {
+    if (aIID.equals(Ci.nsIVariant)) {
+      // Allows unwrapping the JavaScript object for regression tests.
+      return this;
+    }
 
-        if (aIID.equals(Ci.mozIStorageConnection)) {
-            return this._dbConnection;
-        }
+    if (aIID.equals(Ci.mozIStorageConnection)) {
+      return this._dbConnection;
+    }
 
-        throw Cr.NS_ERROR_NO_INTERFACE;
-    },
+    throw Cr.NS_ERROR_NO_INTERFACE;
+  },
 
-    __crypto : null,  // nsILoginManagerCrypto service
-    get _crypto() {
-        if (!this.__crypto)
-            this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
-                            getService(Ci.nsILoginManagerCrypto);
-        return this.__crypto;
-    },
+  __crypto : null,  // nsILoginManagerCrypto service
+  get _crypto() {
+    if (!this.__crypto)
+      this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
+                      getService(Ci.nsILoginManagerCrypto);
+    return this.__crypto;
+  },
 
-    __profileDir: null,  // nsIFile for the user's profile dir
-    get _profileDir() {
-        if (!this.__profileDir)
-            this.__profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
-        return this.__profileDir;
-    },
+  __profileDir: null,  // nsIFile for the user's profile dir
+  get _profileDir() {
+    if (!this.__profileDir)
+      this.__profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    return this.__profileDir;
+  },
 
-    __storageService: null, // Storage service for using mozStorage
-    get _storageService() {
-        if (!this.__storageService)
-            this.__storageService = Cc["@mozilla.org/storage/service;1"].
-                                    getService(Ci.mozIStorageService);
-        return this.__storageService;
-    },
+  __storageService: null, // Storage service for using mozStorage
+  get _storageService() {
+    if (!this.__storageService)
+      this.__storageService = Cc["@mozilla.org/storage/service;1"].
+                              getService(Ci.mozIStorageService);
+    return this.__storageService;
+  },
 
-    __uuidService: null,
-    get _uuidService() {
-        if (!this.__uuidService)
-            this.__uuidService = Cc["@mozilla.org/uuid-generator;1"].
-                                 getService(Ci.nsIUUIDGenerator);
-        return this.__uuidService;
-    },
+  __uuidService: null,
+  get _uuidService() {
+    if (!this.__uuidService)
+      this.__uuidService = Cc["@mozilla.org/uuid-generator;1"].
+                           getService(Ci.nsIUUIDGenerator);
+    return this.__uuidService;
+  },
 
 
-    // The current database schema.
-    _dbSchema: {
-        tables: {
-            moz_logins:         "id                  INTEGER PRIMARY KEY," +
-                                "hostname            TEXT NOT NULL,"       +
-                                "httpRealm           TEXT,"                +
-                                "formSubmitURL       TEXT,"                +
-                                "usernameField       TEXT NOT NULL,"       +
-                                "passwordField       TEXT NOT NULL,"       +
-                                "encryptedUsername   TEXT NOT NULL,"       +
-                                "encryptedPassword   TEXT NOT NULL,"       +
-                                "guid                TEXT,"                +
-                                "encType             INTEGER,"             +
-                                "timeCreated         INTEGER,"             +
-                                "timeLastUsed        INTEGER,"             +
-                                "timePasswordChanged INTEGER,"             +
-                                "timesUsed           INTEGER",
-            // Changes must be reflected in this._dbAreExpectedColumnsPresent(),
-            // this._searchLogins(), and this.modifyLogin().
+  // The current database schema.
+  _dbSchema: {
+    tables: {
+      moz_logins:         "id                  INTEGER PRIMARY KEY," +
+                          "hostname            TEXT NOT NULL,"       +
+                          "httpRealm           TEXT,"                +
+                          "formSubmitURL       TEXT,"                +
+                          "usernameField       TEXT NOT NULL,"       +
+                          "passwordField       TEXT NOT NULL,"       +
+                          "encryptedUsername   TEXT NOT NULL,"       +
+                          "encryptedPassword   TEXT NOT NULL,"       +
+                          "guid                TEXT,"                +
+                          "encType             INTEGER,"             +
+                          "timeCreated         INTEGER,"             +
+                          "timeLastUsed        INTEGER,"             +
+                          "timePasswordChanged INTEGER,"             +
+                          "timesUsed           INTEGER",
+      // Changes must be reflected in this._dbAreExpectedColumnsPresent(),
+      // this._searchLogins(), and this.modifyLogin().
 
-            moz_disabledHosts:  "id                 INTEGER PRIMARY KEY," +
-                                "hostname           TEXT UNIQUE ON CONFLICT REPLACE",
+      moz_disabledHosts:  "id                 INTEGER PRIMARY KEY," +
+                          "hostname           TEXT UNIQUE ON CONFLICT REPLACE",
 
-            moz_deleted_logins: "id                  INTEGER PRIMARY KEY," +
-                                "guid                TEXT,"                +
-                                "timeDeleted         INTEGER",
-        },
-        indices: {
-          moz_logins_hostname_index: {
-            table: "moz_logins",
-            columns: ["hostname"]
-          },
-          moz_logins_hostname_formSubmitURL_index: {
-            table: "moz_logins",
-            columns: ["hostname", "formSubmitURL"]
-          },
-          moz_logins_hostname_httpRealm_index: {
-              table: "moz_logins",
-              columns: ["hostname", "httpRealm"]
-          },
-          moz_logins_guid_index: {
-              table: "moz_logins",
-              columns: ["guid"]
-          },
-          moz_logins_encType_index: {
-              table: "moz_logins",
-              columns: ["encType"]
-          }
-        }
+      moz_deleted_logins: "id                  INTEGER PRIMARY KEY," +
+                          "guid                TEXT,"                +
+                          "timeDeleted         INTEGER",
     },
-    _dbConnection : null,  // The database connection
-    _dbStmts      : null,  // Database statements for memoization
+    indices: {
+      moz_logins_hostname_index: {
+        table: "moz_logins",
+        columns: ["hostname"]
+      },
+      moz_logins_hostname_formSubmitURL_index: {
+        table: "moz_logins",
+        columns: ["hostname", "formSubmitURL"]
+      },
+      moz_logins_hostname_httpRealm_index: {
+          table: "moz_logins",
+          columns: ["hostname", "httpRealm"]
+      },
+      moz_logins_guid_index: {
+          table: "moz_logins",
+          columns: ["guid"]
+      },
+      moz_logins_encType_index: {
+          table: "moz_logins",
+          columns: ["encType"]
+      }
+    }
+  },
+  _dbConnection : null,  // The database connection
+  _dbStmts      : null,  // Database statements for memoization
 
-    _prefBranch   : null,  // Preferences service
-    _signonsFile  : null,  // nsIFile for "signons.sqlite"
-    _debug        : false, // mirrors signon.debug
+  _prefBranch   : null,  // Preferences service
+  _signonsFile  : null,  // nsIFile for "signons.sqlite"
+  _debug        : false, // mirrors signon.debug
 
 
-    /*
-     * log
-     *
-     * Internal function for logging debug messages to the Error Console.
-     */
-    log : function (message) {
-        if (!this._debug)
-            return;
-        dump("PwMgr mozStorage: " + message + "\n");
-        Services.console.logStringMessage("PwMgr mozStorage: " + message);
-    },
+  /*
+   * log
+   *
+   * Internal function for logging debug messages to the Error Console.
+   */
+  log : function (message) {
+    if (!this._debug)
+      return;
+    dump("PwMgr mozStorage: " + message + "\n");
+    Services.console.logStringMessage("PwMgr mozStorage: " + message);
+  },
 
 
-    /*
-     * Internal method used by regression tests only.  It overrides the default
-     * database location.
-     */
-    initWithFile : function(aDBFile) {
-        if (aDBFile)
-            this._signonsFile = aDBFile;
+  /*
+   * Internal method used by regression tests only.  It overrides the default
+   * database location.
+   */
+  initWithFile : function(aDBFile) {
+    if (aDBFile)
+      this._signonsFile = aDBFile;
 
-        this.initialize();
-    },
+    this.initialize();
+  },
 
 
-    /*
-     * initialize
-     *
-     */
-    initialize : function () {
-        this._dbStmts = {};
+  /*
+   * initialize
+   *
+   */
+  initialize : function () {
+    this._dbStmts = {};
 
-        // Connect to the correct preferences branch.
-        this._prefBranch = Services.prefs.getBranch("signon.");
-        this._debug = this._prefBranch.getBoolPref("debug");
+    // Connect to the correct preferences branch.
+    this._prefBranch = Services.prefs.getBranch("signon.");
+    this._debug = this._prefBranch.getBoolPref("debug");
 
-        let isFirstRun;
-        try {
-            // Force initialization of the crypto module.
-            // See bug 717490 comment 17.
-            this._crypto;
+    let isFirstRun;
+    try {
+      // Force initialization of the crypto module.
+      // See bug 717490 comment 17.
+      this._crypto;
 
-            // If initWithFile is calling us, _signonsFile may already be set.
-            if (!this._signonsFile) {
-                // Initialize signons.sqlite
-                this._signonsFile = this._profileDir.clone();
-                this._signonsFile.append("signons.sqlite");
-            }
-            this.log("Opening database at " + this._signonsFile.path);
+      // If initWithFile is calling us, _signonsFile may already be set.
+      if (!this._signonsFile) {
+        // Initialize signons.sqlite
+        this._signonsFile = this._profileDir.clone();
+        this._signonsFile.append("signons.sqlite");
+      }
+      this.log("Opening database at " + this._signonsFile.path);
 
-            // Initialize the database (create, migrate as necessary)
-            isFirstRun = this._dbInit();
+      // Initialize the database (create, migrate as necessary)
+      isFirstRun = this._dbInit();
 
-            this._initialized = true;
+      this._initialized = true;
 
-            return Promise.resolve();
-        } catch (e) {
-            this.log("Initialization failed: " + e);
-            // If the import fails on first run, we want to delete the db
-            if (isFirstRun && e == "Import failed")
-                this._dbCleanup(false);
-            throw "Initialization failed";
-        }
-    },
+      return Promise.resolve();
+    } catch (e) {
+      this.log("Initialization failed: " + e);
+      // If the import fails on first run, we want to delete the db
+      if (isFirstRun && e == "Import failed")
+        this._dbCleanup(false);
+      throw "Initialization failed";
+    }
+  },
 
 
-    /*
-     * terminate
-     *
-     * Internal method used by regression tests only.  It is called before
-     * replacing this storage module with a new instance.
-     */
-    terminate : function () {
-        return Promise.resolve();
-    },
+  /*
+   * terminate
+   *
+   * Internal method used by regression tests only.  It is called before
+   * replacing this storage module with a new instance.
+   */
+  terminate : function () {
+    return Promise.resolve();
+  },
 
 
-    /*
-     * addLogin
-     *
-     */
-    addLogin : function (login) {
-        // Throws if there are bogus values.
-        LoginHelper.checkLoginValues(login);
+  /*
+   * addLogin
+   *
+   */
+  addLogin : function (login) {
+    // Throws if there are bogus values.
+    LoginHelper.checkLoginValues(login);
 
-        let [encUsername, encPassword, encType] = this._encryptLogin(login);
+    let [encUsername, encPassword, encType] = this._encryptLogin(login);
 
-        // Clone the login, so we don't modify the caller's object.
-        let loginClone = login.clone();
+    // Clone the login, so we don't modify the caller's object.
+    let loginClone = login.clone();
 
-        // Initialize the nsILoginMetaInfo fields, unless the caller gave us values
-        loginClone.QueryInterface(Ci.nsILoginMetaInfo);
-        if (loginClone.guid) {
-            if (!this._isGuidUnique(loginClone.guid))
-                throw "specified GUID already exists";
-        } else {
-            loginClone.guid = this._uuidService.generateUUID().toString();
-        }
+    // Initialize the nsILoginMetaInfo fields, unless the caller gave us values
+    loginClone.QueryInterface(Ci.nsILoginMetaInfo);
+    if (loginClone.guid) {
+      if (!this._isGuidUnique(loginClone.guid))
+        throw "specified GUID already exists";
+    } else {
+      loginClone.guid = this._uuidService.generateUUID().toString();
+    }
 
-        // Set timestamps
-        let currentTime = Date.now();
-        if (!loginClone.timeCreated)
-            loginClone.timeCreated = currentTime;
-        if (!loginClone.timeLastUsed)
-            loginClone.timeLastUsed = currentTime;
-        if (!loginClone.timePasswordChanged)
-            loginClone.timePasswordChanged = currentTime;
-        if (!loginClone.timesUsed)
-            loginClone.timesUsed = 1;
+    // Set timestamps