Bug 1478572 - Turn on ESLint in mail/components/cloudfile; r=aceman
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 03 Oct 2018 21:07:06 +1300
changeset 33291 dd917dc324b68599974ff6db50d115b67d118bbe
parent 33290 b9846bdfa088b43e94d7a801d87622248c79e78d
child 33292 f929f9f1b39c927af3aa30231ca7dde95b330995
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman
bugs1478572
Bug 1478572 - Turn on ESLint in mail/components/cloudfile; r=aceman
.eslintignore
mail/components/cloudfile/cloudFileAccounts.js
mail/components/cloudfile/content/Box/management.js
mail/components/cloudfile/content/Hightail/fileExceedsQuota.js
mail/components/cloudfile/content/Hightail/management.js
mail/components/cloudfile/content/addAccountDialog.js
mail/components/cloudfile/nsBox.js
mail/components/cloudfile/nsHightail.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -46,17 +46,16 @@ mailnews/test/*
 # mailnews/extensions exclusions
 mailnews/extensions/*
 !mailnews/extensions/newsblog
 
 # mail exclusions
 mail/app/**
 mail/base/**
 mail/branding/**
-mail/components/cloudfile/**
 mail/components/newmailaccount/**
 mail/components/search/**
 mail/config/**
 mail/extensions/**
 mail/installer/**
 mail/locales/**
 mail/test/**
 mail/themes/**
--- a/mail/components/cloudfile/cloudFileAccounts.js
+++ b/mail/components/cloudfile/cloudFileAccounts.js
@@ -10,17 +10,17 @@ var ACCOUNT_ROOT = PREF_ROOT + "accounts
 
 // The following constants are used to query and insert entries
 // into the nsILoginManager.
 var PWDMGR_HOST = "chrome://messenger/cloudfile";
 var PWDMGR_REALM = "BigFiles Auth Token";
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
+const { fixIterator } = ChromeUtils.import("resource:///modules/iteratorUtils.jsm", null);
 
 var cloudFileAccounts = {
   get kTokenRealm() {
     return PWDMGR_REALM;
   },
 
   get _accountKeys() {
     let accountKeySet = {};
@@ -30,30 +30,30 @@ var cloudFileAccounts = {
       let subbranch = child.substr(0, child.indexOf("."));
       accountKeySet[subbranch] = 1;
     }
 
     // TODO: sort by ordinal
     return Object.keys(accountKeySet);
   },
 
-  _getInitedProviderForType: function(aAccountKey, aType) {
+  _getInitedProviderForType(aAccountKey, aType) {
     let provider = this.getProviderForType(aType);
     if (provider) {
       try {
         provider.init(aAccountKey);
       } catch (e) {
         Cu.reportError(e);
         provider = null;
       }
     }
     return provider;
   },
 
-  _createUniqueAccountKey: function() {
+  _createUniqueAccountKey() {
     // Pick a unique account key (TODO: this is a dumb way to do it, probably)
     let existingKeys = this._accountKeys;
     for (let n = 1; ; n++) {
 
       if (!existingKeys.includes("account" + n))
         return "account" + n;
     }
   },
@@ -61,58 +61,56 @@ var cloudFileAccounts = {
   /**
    * Ensure that we have the account key for an account. If we already have the
    * key, just return it. If we have the nsIMsgCloudFileProvider, get the key
    * from it.
    *
    * @param aKeyOrAccount the key or the account object
    * @return the account key
    */
-  _ensureKey: function(aKeyOrAccount) {
+  _ensureKey(aKeyOrAccount) {
     if (typeof aKeyOrAccount == "string")
       return aKeyOrAccount;
-    else if ("accountKey" in aKeyOrAccount)
+    if ("accountKey" in aKeyOrAccount)
       return aKeyOrAccount.accountKey;
-    else
-      throw new Error("string or nsIMsgCloudFileProvider expected");
+    throw new Error("string or nsIMsgCloudFileProvider expected");
   },
 
-  getProviderForType: function(aType) {
+  getProviderForType(aType) {
     try {
       let className = categoryManager.getCategoryEntry(CATEGORY, aType);
       let provider = Cc[className].createInstance(Ci.nsIMsgCloudFileProvider);
       return provider;
     } catch (e) {
       if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
         // If a provider is not available we swallow the error message.
         // Otherwise at least notify, so developers can fix things.
         Cu.reportError("Getting provider for type=" + aType + " FAILED; " + e);
       }
     }
     return null;
   },
 
   // aExtraPrefs are prefs specific to an account provider.
-  createAccount: function(aType, aRequestObserver, aExtraPrefs) {
+  createAccount(aType, aRequestObserver, aExtraPrefs) {
     let key = this._createUniqueAccountKey();
 
     try {
       Services.prefs
               .setCharPref(ACCOUNT_ROOT + key + ".type", aType);
 
       if (aExtraPrefs !== undefined)
         this._processExtraPrefs(key, aExtraPrefs);
 
       let provider = this._getInitedProviderForType(key, aType);
       if (provider)
         provider.createExistingAccount(aRequestObserver);
 
       return provider;
-    }
-    catch(e) {
+    } catch (e) {
       Services.prefs.deleteBranch(ACCOUNT_ROOT + key);
       throw e;
     }
   },
 
   // Set provider-specific prefs
   _processExtraPrefs: function CFA__processExtraPrefs(aAccountKey,
                                                       aExtraPrefs) {
@@ -132,35 +130,33 @@ var cloudFileAccounts = {
       }
 
       let func = kFuncMap[type];
       Services.prefs[func](ACCOUNT_ROOT + aAccountKey + "." + prefKey,
                            value);
     }
   },
 
-  enumerateProviders: function*() {
+  * enumerateProviders() {
     for (let entry of fixIterator(categoryManager.enumerateCategory(CATEGORY),
                                   Ci.nsISupportsCString)) {
       let provider = this.getProviderForType(entry.data);
       yield [entry.data, provider];
     }
   },
 
-  getAccount: function(aKey) {
-    let type = Services.prefs.QueryInterface(Ci.nsIPrefBranch)
-                       .getCharPref(ACCOUNT_ROOT + aKey + ".type");
+  getAccount(aKey) {
+    let type = Services.prefs.getCharPref(ACCOUNT_ROOT + aKey + ".type");
     return this._getInitedProviderForType(aKey, type);
   },
 
-  removeAccount: function(aKeyOrAccount) {
+  removeAccount(aKeyOrAccount) {
     let key = this._ensureKey(aKeyOrAccount);
 
-    let type = Services.prefs.QueryInterface(Ci.nsIPrefBranch)
-                       .deleteBranch(ACCOUNT_ROOT + key);
+    Services.prefs.deleteBranch(ACCOUNT_ROOT + key);
 
     // Destroy any secret tokens for this accountKey.
     let logins = Services.logins
                          .findLogins({}, PWDMGR_HOST, null, "");
     for (let login of logins) {
       if (login.username == key)
         Services.logins.removeLogin(login);
     }
@@ -189,44 +185,44 @@ var cloudFileAccounts = {
             .getMostRecentWindow(null)
             .openDialog("chrome://messenger/content/cloudfile/"
                         + "addAccountDialog.xul",
                         "", "chrome, dialog, modal, resizable=yes",
                         params).focus();
     return params.accountKey;
   },
 
-  getDisplayName: function(aKeyOrAccount) {
+  getDisplayName(aKeyOrAccount) {
     try {
       let key = this._ensureKey(aKeyOrAccount);
       return Services.prefs.getCharPref(ACCOUNT_ROOT +
                                         key + ".displayName");
-    } catch(e) {
+    } catch (e) {
       // If no display name has been set, we return the empty string.
       Cu.reportError(e);
       return "";
     }
   },
 
-  setDisplayName: function(aKeyOrAccount, aDisplayName) {
+  setDisplayName(aKeyOrAccount, aDisplayName) {
     let key = this._ensureKey(aKeyOrAccount);
     Services.prefs.setCharPref(ACCOUNT_ROOT + key +
                                ".displayName", aDisplayName);
   },
 
   /**
    * Retrieve a secret value, like an authorization token, for an account.
    *
    * @param aKeyOrAccount an nsIMsgCloudFileProvider, or an accountKey
    *                      for a provider.
    * @param aRealm a human-readable string describing what exactly
    *               was being stored. Should match the realm used when setting
    *               the value.
    */
-  getSecretValue: function(aKeyOrAccount, aRealm) {
+  getSecretValue(aKeyOrAccount, aRealm) {
     let key = this._ensureKey(aKeyOrAccount);
 
     let loginInfo = this._getLoginInfoForKey(key, aRealm);
 
     if (loginInfo)
       return loginInfo.password;
 
     return null;
@@ -240,17 +236,17 @@ var cloudFileAccounts = {
    *                      for a provider.
    * @param aRealm a human-readable string describing what exactly
    *               is being stored here. To reduce magic strings, you can use
    *               cloudFileAccounts.kTokenRealm for simple auth tokens, and
    *               anything else for custom secret values.
    * @param aToken The token to be saved.  If this is set to null or the
    *               empty string, then the entry for this key will be removed.
    */
-  setSecretValue: function(aKeyOrAccount, aRealm, aToken) {
+  setSecretValue(aKeyOrAccount, aRealm, aToken) {
     let key = this._ensureKey(aKeyOrAccount);
     let loginInfo = this._getLoginInfoForKey(key, aRealm);
 
     if (!aToken) {
       if (!loginInfo)
         return;
 
       Services.logins.removeLogin(loginInfo);
@@ -271,17 +267,17 @@ var cloudFileAccounts = {
   /**
    * Searches the nsILoginManager for an nsILoginInfo for BigFiles with
    * the username set to aKey, and the realm set to aRealm.
    *
    * @param aKey a key for an nsIMsgCloudFileProvider that we're searching
    *             for login info for.
    * @param aRealm the realm that the login info was stored under.
    */
-  _getLoginInfoForKey: function(aKey, aRealm) {
+  _getLoginInfoForKey(aKey, aRealm) {
     let logins = Services.logins
                          .findLogins({}, PWDMGR_HOST, null, aRealm);
     for (let login of logins) {
       if (login.username == aKey)
         return login;
     }
     return null;
   },
--- a/mail/components/cloudfile/content/Box/management.js
+++ b/mail/components/cloudfile/content/Box/management.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+// mail/base/content/protovis-r2.6-modded.js
+/* globals pv */
+
 function onLoadProvider(provider) {
   let messenger = Cc["@mozilla.org/messenger;1"]
                     .createInstance(Ci.nsIMessenger);
 
   let fileSpaceUsed = document.getElementById("file-space-used");
   fileSpaceUsed.textContent = messenger.formatFileSize(provider.fileSpaceUsed);
   let fileSpaceUsedSwatch = document.getElementById("file-space-used-swatch");
   fileSpaceUsedSwatch.style.backgroundColor = pv.Colors.category20.values[0];
--- a/mail/components/cloudfile/content/Hightail/fileExceedsQuota.js
+++ b/mail/components/cloudfile/content/Hightail/fileExceedsQuota.js
@@ -4,13 +4,13 @@
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 document.addEventListener("DOMContentLoaded", function() {
   if ("wrappedJSObject" in window.arguments[0]) {
     let storage = parseInt(window.arguments[0].wrappedJSObject.storage);
     storage = (storage / 1024 / 1024 / 1024).toFixed(2);
-    let currentStorage = document.getElementById('currentStorage');
-    currentStorage.textContent = currentStorage.textContent.replace('#XXX', storage);
+    let currentStorage = document.getElementById("currentStorage");
+    currentStorage.textContent = currentStorage.textContent.replace("#XXX", storage);
   }
 });
 
--- a/mail/components/cloudfile/content/Hightail/management.js
+++ b/mail/components/cloudfile/content/Hightail/management.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+// mail/base/content/protovis-r2.6-modded.js
+/* globals pv */
+
 function onLoadProvider(provider) {
   let messenger = Cc["@mozilla.org/messenger;1"]
                     .createInstance(Ci.nsIMessenger);
 
   let fileSpaceUsed = document.getElementById("file-space-used");
   fileSpaceUsed.textContent = messenger.formatFileSize(provider.fileSpaceUsed);
   let fileSpaceUsedSwatch = document.getElementById("file-space-used-swatch");
   fileSpaceUsedSwatch.style.backgroundColor = pv.Colors.category20.values[0];
--- a/mail/components/cloudfile/content/addAccountDialog.js
+++ b/mail/components/cloudfile/content/addAccountDialog.js
@@ -5,47 +5,45 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var kFormId = "provider-form";
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
 
-function createAccountObserver() {};
+function createAccountObserver() {}
 
 createAccountObserver.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIRequestObserver]),
-  onStartRequest: function(aRequest, aContext) {},
-  onStopRequest: function(aRequest, aContext, aStatusCode) {
+  onStartRequest(aRequest, aContext) {},
+  onStopRequest(aRequest, aContext, aStatusCode) {
     if (aStatusCode == Cr.NS_OK
         && aContext instanceof Ci.nsIMsgCloudFileProvider) {
       let accountKey = aContext.accountKey;
 
       // For now, we'll just set the display name to be the name of the service
       cloudFileAccounts.setDisplayName(accountKey, aContext.displayName);
 
       window.arguments[0].accountKey = aContext.accountKey;
       window.close();
-    }
-    else {
+    } else {
       if (aContext instanceof Ci.nsIMsgCloudFileProvider) {
         cloudFileAccounts.removeAccount(aContext.accountKey);
-      }
-      else {
+      } else {
         // Something went seriously wrong here...
         Cu.reportError("Cloud account creation failed, and " +
                        "provider instance missing!");
       }
 
       addAccountDialog._accept.disabled = false;
       addAccountDialog._messages.selectedPanel = addAccountDialog._error;
     }
   },
-}
+};
 
 var addAccountDialog = {
   _settings: null,
   _settingsWrap: null,
   _accountType: null,
   _accept: null,
   _strings: Services.strings
                     .createBundle("chrome://messenger/locale/cloudfile/addAccountDialog.properties"),
@@ -92,26 +90,26 @@ var addAccountDialog = {
     // The default emptySettings.xhtml is already loaded into the IFrame
     // at this point, before we could attach our DOMContentLoaded event
     // listener, so we'll call the function here manually.
     this.onIFrameLoaded(null);
 
     addAccountDialog.fitIFrame();
   },
 
-  onUnInit: function() {
+  onUnInit() {
     // Clean-up the event listeners.
     this._settings.removeEventListener("DOMContentLoaded", this);
     this._settings.removeEventListener("overflow", this);
     this._accountType.removeEventListener("select", this);
 
     return true;
   },
 
-  handleEvent: function(aEvent) {
+  handleEvent(aEvent) {
     switch (aEvent.type) {
       case "DOMContentLoaded": {
         this.onIFrameLoaded();
         break;
       }
       case "overflow": {
         if (this._settings.contentDocument.body)
           this.fitIFrame();
@@ -141,17 +139,17 @@ var addAccountDialog = {
 
     // Focus the first field in the form, if any, that does not have the
     // class "focus-filter".
     let firstField = doc.querySelector("form:not(.filter) input:not(.hidden)");
     if (firstField)
       firstField.focus();
   },
 
-  fitIFrame: function() {
+  fitIFrame() {
     // Determine the height of the accountSettings iframe, and adjust
     // the height of the window appropriately.
 
     // If no account is available, |.body| is undefined. In this case
     // return a minimum height of 16px without calling sizeToContent().
     if (!this._settings.contentDocument.body) {
       Cu.reportError("WARNING: addAccountDialog.js: fitFrame: There is no account and this._settings.contentDocument.body is undefined.");
       this._settings.style.height = this._settings.style.minHeight = "16px";
@@ -196,17 +194,17 @@ var addAccountDialog = {
     // This block should go away when bug 748437 gets fixed, since we'll
     // be able to add an arbitrary number of accounts for each account type.
     if (this._accountType.itemCount == 0) {
       this._createAccountText.hidden = true;
       this._accountType.hidden = true;
       this._accept.disabled = true;
       this._noAccountText.hidden = false;
       this._settings.classList.remove("indent");
-      this._settings.classList.add("small-indent")
+      this._settings.classList.add("small-indent");
       this._cancel.focus();
     }
 
     // If there's only one option, let's choose it for the user to avoid
     // a few clicks.
     if (this._accountType.itemCount == 1)
       this._accountType.selectedIndex = 0;
 
@@ -214,17 +212,17 @@ var addAccountDialog = {
   },
 
   onOK: function AAD_onOK() {
     let accountType = this._accountType.value;
     let obs = new createAccountObserver();
 
     let extras = this.getExtraArgs();
 
-    let provider = cloudFileAccounts.createAccount(accountType, obs, extras);
+    cloudFileAccounts.createAccount(accountType, obs, extras);
     this._accept.disabled = true;
 
     this._messages.selectedPanel = this._authSpinner;
 
     // Uninitialize the dialog before closing.
     this.onUnInit();
     return false;
   },
@@ -265,18 +263,17 @@ var addAccountDialog = {
   },
 
   onInput: function AAD_onInput() {
     // Let's see if we have everything we need to make OK enabled...
     if (this._accountType.selectedIndex == -1) {
       // We have the "Select a service provider" menuitem selected, so we
       // shouldn't be able to click "Set up account"
       this._accept.disabled = true;
-    }
-    else {
+    } else {
       this._accept.disabled = !this.checkValidity();
     }
   },
 
   checkValidity: function AAD_checkValidity() {
     // If there's a form in the iframe, ensure that
     // it's checkValidity function passes.
     let form = this._settings
@@ -285,13 +282,13 @@ var addAccountDialog = {
                    .document
                    .getElementById(kFormId);
 
     if (form)
       return form.checkValidity();
 
     return true;
   },
-}
+};
 
 XPCOMUtils.defineLazyServiceGetter(this, "gProtocolService",
                                    "@mozilla.org/uriloader/external-protocol-service;1",
                                    "nsIExternalProtocolService");
--- a/mail/components/cloudfile/nsBox.js
+++ b/mail/components/cloudfile/nsBox.js
@@ -3,19 +3,21 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This file implements the nsIMsgCloudFileProvider interface.
  *
  * This component handles the Box implementation of the
  * nsIMsgCloudFileProvider interface.
  */
 
+/* globals kClientId, kClientSecret */
+
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
 ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
 ChromeUtils.import("resource:///modules/OAuth2.jsm");
 ChromeUtils.import("resource://gre/modules/Http.jsm");
 
 Cu.importGlobalProperties(["File", "FormData", "XMLHttpRequest"]);
 
 var gServerUrl = "https://api.box.com/2.0/";
 var gUploadUrl = "https://upload.box.com/api/2.0/";
@@ -47,17 +49,17 @@ function nsBox() {
         aVal = "";
 
       cloudFileAccounts.setSecretValue(account.accountKey,
                                        cloudFileAccounts.kTokenRealm,
                                        aVal);
 
       return (this.mRefreshToken = aVal);
     },
-    enumerable: true
+    enumerable: true,
   });
 }
 
 nsBox.prototype = {
   /* nsISupports */
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgCloudFileProvider]),
 
   classID: Components.ID("{c06a8707-7463-416c-8b39-e85044a4ff6e}"),
@@ -74,26 +76,25 @@ nsBox.prototype = {
   completionURI: "http://boxauthcallback.local/",
 
   _accountKey: false,
   _prefBranch: null,
   _folderId: "",
   // If an access token exists, the user is logged in.
   get _loggedIn() { return !!this._oauth.accessToken; },
   _userInfo: null,
-  _file : null,
-  _maxFileSize : -1,
-  _fileSpaceUsed : -1,
-  _totalStorage : -1,
-  _lastErrorStatus : 0,
-  _lastErrorText : "",
-  _uploadingFile : null,
-  _uploader : null,
-  _urlsForFiles : {},
-  _uploadInfo : {},
+  _file: null,
+  _maxFileSize: -1,
+  _fileSpaceUsed: -1,
+  _totalStorage: -1,
+  _lastErrorText: "",
+  _uploadingFile: null,
+  _uploader: null,
+  _urlsForFiles: {},
+  _uploadInfo: {},
   _uploads: [],
   _oauth: null,
 
   /**
    * Used by our testing framework to override the URLs that this component
    * communicates to.
    */
   overrideUrls: function nsBox_overrideUrls(aNumUrls, aUrls) {
@@ -116,20 +117,20 @@ nsBox.prototype = {
   /**
    * Private function for assigning the folder id from a cached version
    * If the folder doesn't exist, check if it exists on the server. If it
    * doesn't, set in motion the creation.
    *
    * @param aCallback called if folder is ready.
    */
   _initFolder: function nsBox__initFolder(aCallback) {
-    this.log.info('_initFolder, cached folder id  = ' + this._cachedFolderId);
+    this.log.info("_initFolder, cached folder id  = " + this._cachedFolderId);
 
     let saveFolderId = (aFolderId) => {
-      this.log.info('saveFolderId : ' + aFolderId);
+      this.log.info("saveFolderId : " + aFolderId);
       this._cachedFolderId = this._folderId = aFolderId;
       if (aCallback)
         aCallback();
     };
 
     let createThunderbirdFolder = () => {
       this._createFolder("Thunderbird", saveFolderId);
     };
@@ -159,23 +160,22 @@ nsBox.prototype = {
     this._uploads.shift();
     if (this._uploads.length > 0) {
       let nextUpload = this._uploads[0];
       this.log.info("chaining upload, file = " + nextUpload.file.leafName);
       this._uploadingFile = nextUpload.file;
       this._uploader = nextUpload;
       try {
         this.uploadFile(nextUpload.file, nextUpload.requestObserver);
-      }
-      catch (ex) {
+      } catch (ex) {
         nextUpload.callback(nextUpload.requestObserver, Cr.NS_ERROR_FAILURE);
       }
+    } else {
+      this._uploader = null;
     }
-    else
-      this._uploader = null;
   },
 
   /**
    * Attempt to upload a file to Box's servers.
    *
    * @param aFile an nsIFile for uploading.
    * @param aCallback an nsIRequestObserver for monitoring the start and
    *                  stop states of the upload procedure.
@@ -208,50 +208,57 @@ nsBox.prototype = {
 
     let onGetUserInfoSuccess = function() {
       this._initFolder(finish);
     }.bind(this);
 
     let onAuthFailure = function() {
       aCallback.onStopRequest(null, null,
                               Ci.nsIMsgCloudFileProvider.authErr);
-    }.bind(this);
+    };
 
     this.log.info("Checking to see if we're logged in");
 
     if (!this._loggedIn) {
       let onLoginSuccess = function() {
         this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
       }.bind(this);
 
-      return this.logon(onLoginSuccess, onAuthFailure, true);
+      this.logon(onLoginSuccess, onAuthFailure, true);
+      return;
     }
 
-    if (!this._userInfo)
-      return this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
+    if (!this._userInfo) {
+      this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
+      return;
+    }
 
     onGetUserInfoSuccess();
   },
 
   /**
    * A private function called when we're almost ready to kick off the upload
    * for a file. First, ensures that the file size is not too large, and that
    * we won't exceed our storage quota, and then kicks off the upload.
    *
    * @param aFile the nsIFile to upload
    * @param aCallback the nsIRequestObserver for monitoring the start and stop
    *                  states of the upload procedure.
    */
   _finishUpload: function nsBox__finishUpload(aFile, aCallback) {
     let exceedsFileLimit = Ci.nsIMsgCloudFileProvider.uploadExceedsFileLimit;
     let exceedsQuota = Ci.nsIMsgCloudFileProvider.uploadWouldExceedQuota;
-    if (aFile.fileSize > this._maxFileSize)
-      return aCallback.onStopRequest(null, null, exceedsFileLimit);
-    if (aFile.fileSize > this.remainingFileSpace)
-      return aCallback.onStopRequest(null, null, exceedsQuota);
+    if (aFile.fileSize > this._maxFileSize) {
+      aCallback.onStopRequest(null, null, exceedsFileLimit);
+      return;
+    }
+    if (aFile.fileSize > this.remainingFileSpace) {
+      aCallback.onStopRequest(null, null, exceedsQuota);
+      return;
+    }
 
     delete this._userInfo; // force us to update userInfo on every upload.
 
     if (!this._uploader) {
       this._uploader = new nsBoxFileUploader(this, aFile,
                                              this._uploaderCallback
                                                  .bind(this),
                                              aCallback);
@@ -265,18 +272,17 @@ nsBox.prototype = {
   /**
    * Cancels an in-progress file upload.
    *
    * @param aFile the nsIFile being uploaded.
    */
   cancelFileUpload: function nsBox_cancelFileUpload(aFile) {
     if (this._uploadingFile.equals(aFile)) {
       this._uploader.cancel();
-    }
-    else {
+    } else {
       for (let i = 0; i < this._uploads.length; i++)
         if (this._uploads[i].file.equals(aFile)) {
           this._uploads[i].requestObserver.onStopRequest(
             null, null, Ci.nsIMsgCloudFileProvider.uploadCanceled);
           this._uploads.splice(i, 1);
           return;
         }
     }
@@ -297,17 +303,17 @@ nsBox.prototype = {
     if (!successCallback)
       successCallback = function() {
         this.requestObserver
             .onStopRequest(null, null,
                            this._loggedIn ? Cr.NS_OK : Ci.nsIMsgCloudFileProvider.authErr);
     }.bind(this);
 
     if (!failureCallback)
-      failureCallback = function () {
+      failureCallback = function() {
         this.requestObserver
             .onStopRequest(null, null, Ci.nsIMsgCloudFileProvider.authErr);
     }.bind(this);
 
     let accountInfoSuccess = function(aResponseText, aRequest) {
       this.log.info("get_account_info request response = " + aResponseText);
 
       try {
@@ -320,38 +326,37 @@ nsBox.prototype = {
 
         this._totalStorage = this._userInfo.space_amount;
         this._fileSpaceUsed = this._userInfo.space_used;
         this._maxFileSize = this._userInfo.max_upload_size;
         this.log.info("storage total = " + this._totalStorage);
         this.log.info("storage used = " + this._fileSpaceUsed);
         this.log.info("max file size = " + this._maxFileSize);
         successCallback();
-      }
-      catch(e) {
+      } catch (e) {
         // most likely bad JSON
         this.log.error("Failed to parse account info response: " + e);
         this.log.error("Account info response: " + aResponseText);
         failureCallback();
       }
     }.bind(this);
     let accountInfoFailure = function(aException, aResponseText, aRequest) {
       this.log.info("Failed to acquire user info:" + aResponseText);
       this.log.error("user info failed, status = " + aRequest.status);
       this.log.error("response text = " + aResponseText);
       this.log.error("exception = " + aException);
       failureCallback();
-    }.bind(this)
+    }.bind(this);
 
     // Request to get user info
     httpRequest(requestUrl, {
                   onLoad: accountInfoSuccess,
                   onError: accountInfoFailure,
                   method: "GET",
-                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]]
+                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]],
                 });
   },
 
   /**
    * A private function that first ensures that the user is logged in, and then
    * retrieves the user's profile information.
    *
    * @param aSuccessCallback the function called on successful information
@@ -359,17 +364,17 @@ nsBox.prototype = {
    * @param aFailureCallback the function called on failed information retrieval
    * @param aWithUI a boolean for whether or not we should display authorization
    *                UI if we don't have a valid token anymore, or just fail out.
    */
   _logonAndGetUserInfo: function nsBox_logonAndGetUserInfo(aSuccessCallback,
                                                                aFailureCallback,
                                                                aWithUI) {
     if (!aFailureCallback)
-      aFailureCallback = function () {
+      aFailureCallback = function() {
         this.requestObserver
             .onStopRequest(null, null, Ci.nsIMsgCloudFileProvider.authErr);
       }.bind(this);
 
     return this.logon(function() {
       this._getUserInfo(aSuccessCallback, aFailureCallback);
     }.bind(this), aFailureCallback, aWithUI);
   },
@@ -441,54 +446,51 @@ nsBox.prototype = {
 
       let folderId = null;
       try {
         let result = JSON.parse(aResponseText);
 
         // Ensure the JSON is somewhat valid.
         if (!result || !result.item_collection) {
           this._lastErrorText = "Get folder failure";
-          this._lastErrorStatus = docStatus;
           return;
         }
 
         // Search the paths for the folder.
         for (let item of result.item_collection.entries) {
           // Found it!
           if (item.type == "folder" && item.name == aName) {
             folderId = item.id;
             break;
           }
         }
-      }
-      catch(e) {
+      } catch (e) {
         // most likely bad JSON
         this.log.error("Failed to get the folder:\n" + e);
       }
 
       // Return outside of the try-catch.
       if (folderId) {
         this.log.info("folder id = " + folderId);
-        aSuccessCallback(folderId)
-      }
-      else {
+        aSuccessCallback(folderId);
+      } else {
         // Didn't find any item.
         aFailureCallback();
       }
     };
     let getFailure = (aException, aResponseText, aRequest) => {
       this.log.error("Failed to get an existing folder: " + aRequest.status);
     };
 
     // Request to create the folder
     httpRequest(requestUrl, {
                   onLoad: getSuccess,
                   onError: getFailure,
                   method: "GET",
-                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]]
+                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]],
                 });
   },
 
   /**
    * Private function for creating folder on the Box website.
    *
    * @param aName name of folder
    * @param aSuccessCallback called when folder is created
@@ -496,54 +498,52 @@ nsBox.prototype = {
   _createFolder: function nsBox__createFolder(aName,
                                               aSuccessCallback) {
     this.log.info("Creating folder: " + aName);
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     let body = {
       parent: {
-        id: "0"
+        id: "0",
       },
-      name: aName
+      name: aName,
     };
     let requestUrl = gServerUrl + "folders";
     this.log.info("create_folder requestUrl = " + requestUrl);
 
     let createSuccess = function(aResponseText, aRequest) {
       this.log.info("create_folder request response = " + aResponseText);
 
       try {
         let result = JSON.parse(aResponseText);
 
         if (!result || !result.id) {
           this._lastErrorText = "Create folder failure";
-          this._lastErrorStatus = docStatus;
           return;
         }
         let folderId = result.id;
         this.log.info("folder id = " + folderId);
         aSuccessCallback(folderId);
-      }
-      catch(e) {
+      } catch (e) {
         // most likely bad JSON
         this.log.error("Failed to create a new folder");
       }
     }.bind(this);
     let createFailure = function(aException, aResponseText, aRequest) {
       this.log.error("Failed to create a new folder: " + aRequest.status);
     }.bind(this);
 
     // Request to create the folder
     httpRequest(requestUrl, {
                   onLoad: createSuccess,
                   onError: createFailure,
                   method: "POST",
                   headers: [["Authorization", "Bearer " + this._oauth.accessToken]],
-                  postData: JSON.stringify(body)
+                  postData: JSON.stringify(body),
                 });
   },
 
   /**
    * If a the user associated with this account key already has an account,
    * allows them to log in.
    *
    * @param aRequestObserver an nsIRequestObserver for monitoring the start and
@@ -625,47 +625,40 @@ nsBox.prototype = {
       aCallback.onStopRequest(null, null, Cr.NS_ERROR_FAILURE);
     }.bind(this);
 
     // Request to delete a file
     httpRequest(requestUrl, {
                   onLoad: deleteSuccess,
                   onError: deleteFailure,
                   method: "DELETE",
-                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]]
+                  headers: [["Authorization", "Bearer " + this._oauth.accessToken]],
                 });
   },
 
   /**
    * Attempt to log on and get the auth token for this Box account.
    *
    * @param successCallback the callback to be fired if logging on is successful
    * @param failureCallback the callback to be fired if loggong on fails
    * @aparam aWithUI a boolean for whether or not we should prompt for a password
    *                 if no auth token is currently stored.
    */
   logon: function nsBox_logon(successCallback, failureCallback, aWithUI) {
     // The token has expired, reauthenticate.
     if (this._oauth.tokenExpires < (new Date()).getTime()) {
       this._oauth.connect(successCallback, failureCallback, aWithUI);
-    }
-    // The token is still valid, success!
-    else {
+    } else {
+      // The token is still valid, success!
       successCallback();
     }
   },
 
   get _cachedFolderId() {
-    let folderId = "";
-    try {
-      folderId = this._prefBranch.getCharPref("folderid");
-    }
-    catch(e) { } // pref does not exist
-
-    return folderId;
+    return this._prefBranch.getCharPref("folderid", "");
   },
 
   set _cachedFolderId(aVal) {
     if (!aVal)
       aVal = "";
 
     this._prefBranch.setCharPref("folderid", aVal);
   },
@@ -677,33 +670,32 @@ function nsBoxFileUploader(aBox, aFile, 
   this.log = this.box.log;
   this.log.info("new nsBoxFileUploader file = " + aFile.leafName);
   this.file = aFile;
   this.callback = aCallback;
   this.requestObserver = aRequestObserver;
 }
 
 nsBoxFileUploader.prototype = {
-  box : null,
-  file : null,
-  callback : null,
-  request : null,
+  box: null,
+  file: null,
+  callback: null,
+  request: null,
 
   /**
    * Do the upload of the file to Box.
    */
   uploadFile: function nsBox_uploadFile() {
     this.requestObserver.onStartRequest(null, null);
     let requestUrl = gUploadUrl + "files/content";
     this.box._uploadInfo[this.file.path] = {};
     this.box._uploadInfo[this.file.path].uploadUrl = requestUrl;
 
     let req = new XMLHttpRequest();
 
-    let curDate = Date.now().toString();
     this.log.info("upload url = " + requestUrl);
     this.request = req;
     req.open("POST", requestUrl, true);
     req.onload = function() {
       if (req.status >= 200 && req.status < 400) {
         try {
           this.log.info("upload response = " + req.responseText);
           let result = JSON.parse(req.responseText);
@@ -735,44 +727,42 @@ nsBoxFileUploader.prototype = {
 
             // Currently only one file is uploaded at a time.
             let fileId = result.entries[0].id;
             this.box._uploadInfo[this.file.path].fileId = fileId;
 
             let requestUrl = gServerUrl + "files/" + fileId;
             let body = {
               shared_link: {
-                access: "open"
-              }
+                access: "open",
+              },
             };
             httpRequest(requestUrl, {
               onLoad: shareSuccess,
               onError: shareFailure,
               method: "PUT",
               headers: [["Authorization", "Bearer " + this.box._oauth.accessToken]],
-              postData: JSON.stringify(body)
+              postData: JSON.stringify(body),
             });
-          }
-          else {
+          } else {
             this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
           }
         } catch (ex) {
           this.log.error(ex);
           this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
         }
-      }
-      else {
+      } else {
         this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
       }
     }.bind(this);
 
-    req.onerror = function () {
+    req.onerror = function() {
       if (this.callback)
         this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
     }.bind(this);
 
     req.setRequestHeader("Authorization", "Bearer " + this.box._oauth.accessToken);
 
     // Encode the form.
@@ -796,31 +786,33 @@ nsBoxFileUploader.prototype = {
       this.log.info("cancelling upload request");
       let req = this.request;
       if (req.channel) {
         this.log.info("cancelling upload channel");
         req.channel.cancel(Cr.NS_BINDING_ABORTED);
       }
       this.request = null;
     }
-  }
+  },
 };
 
 // Before you spend time trying to find out what this means, please note that
 // doing so and using the information WILL cause Box to revoke Thunderbird's
 // privileges,  which means not one Thunderbird user will be able to connect to
 // Box. This will cause unhappy users all around which means that the
 // Thunderbird developers will have to spend more time with user support, which
 // means less time for features, releases and bugfixes. For a paid developer
 // this would actually mean financial harm.
 //
 // Do you really want all of this to be your fault? Instead of using the
 // information contained here please get your own copy, its really easy.
+/* eslint-disable */
 (zqdx=>{zqdx["\x65\x76\x61\x6C"](zqdx["\x41\x72\x72\x61\x79"]["\x70\x72\x6F\x74"+
 "\x6F\x74\x79\x70\x65"]["\x6D\x61\x70"]["\x63\x61\x6C\x6C"]("wbs!lDmjfouJe>#fyt"+
 "9n1bhk2gb6839mywo399zn{12eo{o#<wbs!lDmjfouTfdsfu>#vE33oEp8{Eo{rRw9E7iVJ4ODLw9F"+
 "zLqM#<",__=>zqdx["\x53\x74\x72\x69\x6E\x67"]["\x66\x72\x6F\x6D\x43\x68\x61\x72"+
 "\x43\x6F\x64\x65"](__[""+"\x63\x68\x61\x72\x43\x6F\x64\x65\x41\x74"](0)-1),this)
 ["\x6A\x6F\x69\x6E"](""))})["\x63\x61\x6C\x6C"]((this),Components["\x75\x74\x69"+
 "\x6c\x73"][("\x67\x65\x74\x47\x6c\x6f\x62\x61\x6c\x46\x6f\x72\x4f\x62\x6a\x65")+
 "\x63\x74"](this));
+/* eslint-enable */
 
 var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsBox]);
--- a/mail/components/cloudfile/nsHightail.js
+++ b/mail/components/cloudfile/nsHightail.js
@@ -5,17 +5,17 @@
 /* This file implements the nsIMsgCloudFileProvider interface.
  *
  * This component handles the Hightail implementation of the
  * nsIMsgCloudFileProvider interface.
  */
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
 ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
 
 Cu.importGlobalProperties(["XMLHttpRequest"]);
 
 var gServerUrl = "https://dpi.yousendit.com"; // Production url
 // test url var gServerUrl = "https://test2-api.yousendit.com";
 
 var kApiKey = "7spvjdt7m4kycr7jyhywrdn2";
@@ -47,67 +47,67 @@ nsHightail.prototype = {
   get managementURL() { return "chrome://messenger/content/cloudfile/Hightail/management.xhtml"; },
 
   _accountKey: false,
   _prefBranch: null,
   _userName: "",
   _password: "",
   _loggedIn: false,
   _userInfo: null,
-  _file : null,
+  _file: null,
   _folderId: "",
   _requestDate: null,
   _successCallback: null,
   _request: null,
-  _maxFileSize : -1,
-  _fileSpaceUsed : -1,
-  _availableStorage : -1,
-  _totalStorage : -1,
-  _lastErrorStatus : 0,
-  _lastErrorText : "",
-  _uploadingFile : null,
-  _uploader : null,
-  _urlsForFiles : {},
-  _uploadInfo : {},
+  _maxFileSize: -1,
+  _fileSpaceUsed: -1,
+  _availableStorage: -1,
+  _totalStorage: -1,
+  _lastErrorStatus: 0,
+  _lastErrorText: "",
+  _uploadingFile: null,
+  _uploader: null,
+  _urlsForFiles: {},
+  _uploadInfo: {},
   _uploads: [],
 
   /**
    * Used by our testing framework to override the URLs that this component
    * communicates to.
    */
-  overrideUrls: function(aNumUrls, aUrls) {
+  overrideUrls(aNumUrls, aUrls) {
     gServerUrl = aUrls[0];
   },
 
   /**
    * Initializes an instance of this nsIMsgCloudFileProvider for an account
    * with key aAccountKey.
    *
    * @param aAccountKey the account key to initialize this
    *                    nsIMsgCloudFileProvider with.
    */
-  init: function(aAccountKey) {
+  init(aAccountKey) {
     this._accountKey = aAccountKey;
     this._prefBranch = Services.prefs.getBranch("mail.cloud_files.accounts." +
                                                 aAccountKey + ".");
     this._userName = this._prefBranch.getCharPref("username");
     this._loggedIn = this._cachedAuthToken != "";
   },
 
   /**
    * Private function for retrieving or creating folder
    * on Hightail website for uploading file.
    *
    * @param aCallback called if folder is ready.
    */
-  _initFolder: function(aCallback) {
-    this.log.info('_initFolder');
+  _initFolder(aCallback) {
+    this.log.info("_initFolder");
 
     let saveFolderId = function(aFolderId) {
-      this.log.info('saveFolderId');
+      this.log.info("saveFolderId");
       this._folderId = aFolderId;
       if (aCallback)
         aCallback();
     }.bind(this);
 
     let createThunderbirdFolder = function(aParentFolderId) {
       this._createFolder("Mozilla Thunderbird", aParentFolderId, saveFolderId);
     }.bind(this);
@@ -134,46 +134,45 @@ nsHightail.prototype = {
   /**
    * Private callback function passed to, and called from
    * nsHightailFileUploader.
    *
    * @param aRequestObserver a request observer for monitoring the start and
    *                         stop states of a request.
    * @param aStatus the status of the request.
    */
-  _uploaderCallback: function(aRequestObserver, aStatus) {
+  _uploaderCallback(aRequestObserver, aStatus) {
     aRequestObserver.onStopRequest(null, null, aStatus);
 
     this._uploadingFile = null;
     this._uploads.shift();
     if (this._uploads.length > 0) {
       let nextUpload = this._uploads[0];
       this.log.info("chaining upload, file = " + nextUpload.file.leafName);
       this._uploadingFile = nextUpload.file;
       this._uploader = nextUpload;
       try {
         this.uploadFile(nextUpload.file, nextUpload.requestObserver);
-      }
-      catch (ex) {
+      } catch (ex) {
         // I'd like to pass ex.result, but that doesn't seem to be defined.
         nextUpload.callback(nextUpload.requestObserver, Cr.NS_ERROR_FAILURE);
       }
+    } else {
+      this._uploader = null;
     }
-    else
-      this._uploader = null;
   },
 
   /**
    * Attempt to upload a file to Hightail's servers.
    *
    * @param aFile an nsIFile for uploading.
    * @param aCallback an nsIRequestObserver for monitoring the start and
    *                  stop states of the upload procedure.
    */
-  uploadFile: function(aFile, aCallback) {
+  uploadFile(aFile, aCallback) {
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     this.log.info("Preparing to upload a file");
 
     // if we're uploading a file, queue this request.
     if (this._uploadingFile && this._uploadingFile != aFile) {
       this.log.info("Adding file to queue");
@@ -193,51 +192,59 @@ nsHightail.prototype = {
 
     let onGetUserInfoSuccess = function() {
       this._initFolder(finish);
     }.bind(this);
 
     let onAuthFailure = function() {
       aCallback.onStopRequest(null, null,
                               Ci.nsIMsgCloudFileProvider.authErr);
-    }.bind(this);
+    };
 
     this.log.info("Checking to see if we're logged in");
 
     if (!this._loggedIn) {
       let onLoginSuccess = function() {
         this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
       }.bind(this);
 
-      return this.logon(onLoginSuccess, onAuthFailure, true);
+      this.logon(onLoginSuccess, onAuthFailure, true);
+      return;
     }
 
-    if (!this._userInfo)
-      return this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
+    if (!this._userInfo) {
+      this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
+      return;
+    }
 
     onGetUserInfoSuccess();
   },
 
   /**
    * A private function called when we're almost ready to kick off the upload
    * for a file. First, ensures that the file size is not too large, and that
    * we won't exceed our storage quota, and then kicks off the upload.
    *
    * @param aFile the nsIFile to upload
    * @param aCallback the nsIRequestObserver for monitoring the start and stop
    *                  states of the upload procedure.
    */
-  _finishUpload: function(aFile, aCallback) {
-    if (aFile.fileSize > 2147483648)
-      return this._fileExceedsLimit(aCallback, '2GB', 0);
-    if (aFile.fileSize > this._maxFileSize)
-      return this._fileExceedsLimit(aCallback, 'Limit', 0);
-    if (aFile.fileSize > this._availableStorage)
-      return this._fileExceedsLimit(aCallback, 'Quota',
-                                    aFile.fileSize + this._fileSpaceUsed);
+  _finishUpload(aFile, aCallback) {
+    if (aFile.fileSize > 2147483648) {
+      this._fileExceedsLimit(aCallback, "2GB", 0);
+      return;
+    }
+    if (aFile.fileSize > this._maxFileSize) {
+      this._fileExceedsLimit(aCallback, "Limit", 0);
+      return;
+    }
+    if (aFile.fileSize > this._availableStorage) {
+      this._fileExceedsLimit(aCallback, "Quota", aFile.fileSize + this._fileSpaceUsed);
+      return;
+    }
 
     delete this._userInfo; // force us to update userInfo on every upload.
 
     if (!this._uploader) {
       this._uploader = new nsHightailFileUploader(this, aFile,
                                                    this._uploaderCallback
                                                        .bind(this),
                                                    aCallback);
@@ -249,17 +256,17 @@ nsHightail.prototype = {
   },
 
   /**
    * A private function called when upload exceeds file limit.
    *
    * @param aCallback the nsIRequestObserver for monitoring the start and stop
    *                  states of the upload procedure.
    */
-  _fileExceedsLimit: function(aCallback, aType, aStorageSize) {
+  _fileExceedsLimit(aCallback, aType, aStorageSize) {
     let cancel = Ci.nsIMsgCloudFileProvider.uploadCanceled;
 
     let args = {storage: aStorageSize};
     args.wrappedJSObject = args;
     Services.ww.openWindow(null,
                            "chrome://messenger/content/cloudfile/Hightail/"
                            + "fileExceeds" + aType + ".xul",
                            "Hightail", "chrome,centerscreen,dialog,modal,resizable=yes",
@@ -268,23 +275,22 @@ nsHightail.prototype = {
     return aCallback.onStopRequest(null, null, cancel);
   },
 
   /**
    * Cancels an in-progress file upload.
    *
    * @param aFile the nsIFile being uploaded.
    */
-  cancelFileUpload: function(aFile) {
+  cancelFileUpload(aFile) {
     this.log.info("in cancel upload");
     if (this._uploadingFile != null && this._uploader != null &&
         this._uploadingFile.equals(aFile)) {
       this._uploader.cancel();
-    }
-    else {
+    } else {
       for (let i = 0; i < this._uploads.length; i++)
         if (this._uploads[i].file.equals(aFile)) {
           this._uploads[i].requestObserver.onStopRequest(
             null, null, Ci.nsIMsgCloudFileProvider.uploadCanceled);
           this._uploads.splice(i, 1);
           return;
         }
     }
@@ -292,17 +298,17 @@ nsHightail.prototype = {
 
   /**
    * A private function for dealing with stale tokens.  Attempts to refresh
    * the token without prompting for the password.
    *
    * @param aSuccessCallback called if token refresh is successful.
    * @param aFailureCallback called if token refresh fails.
    */
-  _handleStaleToken: function(aSuccessCallback, aFailureCallback) {
+  _handleStaleToken(aSuccessCallback, aFailureCallback) {
     this.log.info("Handling a stale token.");
     this._loggedIn = false;
     this._cachedAuthToken = "";
     if (this.getPassword(this._userName, true) != "") {
       this.log.info("Attempting to reauth with saved password");
       // We had a stored password - let's try logging in with that now.
       this.logon(aSuccessCallback, aFailureCallback,
                  false);
@@ -315,17 +321,17 @@ nsHightail.prototype = {
   /**
    * A private function for retrieving profile information about a user.
    *
    * @param successCallback a callback fired if retrieving profile information
    *                        is successful.
    * @param failureCallback a callback fired if retrieving profile information
    *                        fails.
    */
-  _getUserInfo: function(successCallback, failureCallback) {
+  _getUserInfo(successCallback, failureCallback) {
     this.log.info("getting user info");
     let args = "?email=" + this._userName + "&";
 
     let req = new XMLHttpRequest();
     req.open("GET", gServerUrl + kUserInfoPath + args + kUrlTail, true);
 
     req.onload = function() {
       if (req.status >= 200 && req.status < 400) {
@@ -353,27 +359,27 @@ nsHightail.prototype = {
           return;
         }
         this._userInfo = docResponse;
         let account = docResponse.account;
         let storage = docResponse.storage;
         if (storage) {
           this._fileSpaceUsed = parseInt(storage.currentUsage);
           this._availableStorage = parseInt(storage.storageQuota) - this._fileSpaceUsed;
+        } else {
+          this._availableStorage = parseInt(account.availableStorage);
         }
-        else
-          this._availableStorage = parseInt(account.availableStorage);
 
         this._maxFileSize = docResponse.type == "BAS" ? 52428800 : (parseInt(account.maxFileSize));
         this.log.info("available storage = " + this._availableStorage + " max file size = " + this._maxFileSize);
 
         successCallback();
+      } else {
+        failureCallback();
       }
-      else
-        failureCallback();
     }.bind(this);
 
     req.onerror = function() {
       this.log.info("getUserInfo failed - status = " + req.status);
       failureCallback();
     }.bind(this);
     // Add a space at the end because http logging looks for two
     // spaces in the X-Auth-Token header to avoid putting passwords
@@ -384,86 +390,84 @@ nsHightail.prototype = {
     req.send();
   },
 
   /**
    * Returns the sharing URL for some uploaded file.
    *
    * @param aFile the nsIFile to get the URL for.
    */
-  urlForFile: function(aFile) {
+  urlForFile(aFile) {
     return this._urlsForFiles[aFile.path];
   },
 
   /**
    * Attempts to refresh cached profile information for the account associated
    * with this instance's account key.
    *
    * @param aWithUI a boolean for whether or not we should prompt the user for
    *                a password if we don't have a proper token.
    * @param aListener an nsIRequestObserver for monitoring the start and stop
    *                  states of fetching profile information.
    */
-  refreshUserInfo: function(aWithUI, aListener) {
+  refreshUserInfo(aWithUI, aListener) {
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     aListener.onStartRequest(null, null);
 
     // Let's define some reusable callback functions...
     let onGetUserInfoSuccess = function() {
       aListener.onStopRequest(null, null, Cr.NS_OK);
-    }
+    };
 
     let onAuthFailure = function() {
       aListener.onStopRequest(null, null,
                               Ci.nsIMsgCloudFileProvider.authErr);
-    }
+    };
 
     // If we're not logged in, attempt to login, and then attempt to
     // get user info if logging in is successful.
     this.log.info("Checking to see if we're logged in");
     if (!this._loggedIn) {
       let onLoginSuccess = function() {
         this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
       }.bind(this);
 
-      return this.logon(onLoginSuccess, onAuthFailure, aWithUI);
+      this.logon(onLoginSuccess, onAuthFailure, aWithUI);
+      return;
     }
 
     // If we're logged in, attempt to get user info.
     if (!this._userInfo)
-      return this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
-
+      this._getUserInfo(onGetUserInfoSuccess, onAuthFailure);
   },
 
   /**
    * Creates an account for a user.  Note that, currently, this function is
    * not being used by the UI.
    */
-  createNewAccount: function(aEmailAddress, aPassword,aFirstName, aLastName,
-                             aRequestObserver) {
+  createNewAccount(aEmailAddress, aPassword, aFirstName, aLastName, aRequestObserver) {
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     let args = "?email=" + aEmailAddress + "&password=" + aPassword + "&firstname="
                + aFirstName + "&lastname=" + aLastName + "&";
 
     let req = new XMLHttpRequest();
 
     req.open("POST", gServerUrl + kUserInfoPath + args + kUrlTail, true);
 
     req.onload = function() {
       if (req.status >= 200 &&
           req.status < 400) {
         this.log.info("request status = " + req + " response = " +
                       req.responseText);
         aRequestObserver.onStopRequest(null, null, Cr.NS_OK);
-      }
-      else {
+      } else {
         let docResponse = JSON.parse(req.responseText);
         this._lastErrorText = docResponse.errorStatus.message;
         this._lastErrorStatus = docResponse.errorStatus.code;
         aRequestObserver.onStopRequest(null, null, Cr.NS_ERROR_FAILURE);
       }
     }.bind(this);
 
     req.onerror = function() {
@@ -482,19 +486,17 @@ nsHightail.prototype = {
   /**
    * Attempt to find folder by name on Hightail website.
    *
    * @param aFolderName name of folder
    * @param aParentFolderId id of folder where we are looking
    * @param aNotFoundCallback called if folder is not found
    * @param aFoundCallback called if folder is found
    */
-  _findFolder: function(aFolderName, aParentFolderId, aNotFoundCallback,
-                        aFoundCallback) {
-
+  _findFolder(aFolderName, aParentFolderId, aNotFoundCallback, aFoundCallback) {
     this.log.info("Find folder: " + aFolderName);
 
     let checkChildFolders = function(folders) {
       this.log.info("Looking for a child folder");
       let folderId = 0;
       let folder = folders.folder;
       for (let i in folder) {
         if (folder[i].name == aFolderName) {
@@ -515,18 +517,18 @@ nsHightail.prototype = {
 
   /**
    * Attempt to find folder by id on Hightail website.
    *
    * @param aFolderId id of folder
    * @param aNotFoundCallback called if folder is not found
    * @param aFoundCallback called if folder is found
    */
-  _checkFolderExist: function(aFolderId, aFoundCallback, aNotFoundCallback) {
-    this.log.info('checkFolderExist');
+  _checkFolderExist(aFolderId, aFoundCallback, aNotFoundCallback) {
+    this.log.info("checkFolderExist");
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     let args = "?includeFiles=false&includeFolders=true&";
 
     let req = new XMLHttpRequest();
 
     req.open("GET",
@@ -536,18 +538,17 @@ nsHightail.prototype = {
     req.onload = function() {
       let docResponse = JSON.parse(req.responseText);
       if (req.status >= 200 && req.status < 400) {
         this.log.info("request status = " + req + " response = " +
                       req.responseText);
 
         if (aFoundCallback && docResponse.folders)
           aFoundCallback(docResponse.folders);
-      }
-      else {
+      } else {
         this._lastErrorText = docResponse.errorStatus.message;
         this._lastErrorStatus = docResponse.errorStatus.code;
         if (this._lastErrorStatus == 400 && this._lastErrorText == "Not Found" && aNotFoundCallback)
           aNotFoundCallback();
       }
     }.bind(this);
 
     req.onerror = function() {
@@ -564,37 +565,36 @@ nsHightail.prototype = {
 
   /**
    * Private function for creating folder on Hightail website.
    *
    * @param aName name of folder
    * @param aParent id of parent folder
    * @param aSuccessCallback called when folder is created
    */
-  _createFolder: function(aName, aParent, aSuccessCallback) {
+  _createFolder(aName, aParent, aSuccessCallback) {
     this.log.info("Create folder: " + aName);
     if (Services.io.offline)
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
 
     let args = "?name=" + aName + "&parentId=" + aParent + "&";
 
     let req = new XMLHttpRequest();
 
-    req.open("POST", gServerUrl + kFolderPath.replace(/\/$/, '') + args + kUrlTail, true);
+    req.open("POST", gServerUrl + kFolderPath.replace(/\/$/, "") + args + kUrlTail, true);
 
     req.onload = function() {
       let docResponse = JSON.parse(req.responseText);
       if (req.status >= 200 && req.status < 400) {
         this.log.info("request status = " + req + " response = " +
                       req.responseText);
 
         if (aSuccessCallback)
-          aSuccessCallback(docResponse.id)
-      }
-      else {
+          aSuccessCallback(docResponse.id);
+      } else {
         this._lastErrorText = docResponse.errorStatus.message;
         this._lastErrorStatus = docResponse.errorStatus.code;
       }
     }.bind(this);
 
     req.onerror = function() {
       this.log.info("createFolder failed - status = " + req.status);
     }.bind(this);
@@ -609,17 +609,17 @@ nsHightail.prototype = {
 
   /**
    * If a the user associated with this account key already has an account,
    * allows them to log in.
    *
    * @param aRequestObserver an nsIRequestObserver for monitoring the start and
    *                         stop states of the login procedure.
    */
-  createExistingAccount: function(aRequestObserver) {
+  createExistingAccount(aRequestObserver) {
      // XXX: replace this with a better function
     let successCb = function(aResponseText, aRequest) {
       aRequestObserver.onStopRequest(null, this, Cr.NS_OK);
     }.bind(this);
 
     let failureCb = function(aResponseText, aRequest) {
       aRequestObserver.onStopRequest(null, this,
                                      Ci.nsIMsgCloudFileProvider.authErr);
@@ -629,17 +629,17 @@ nsHightail.prototype = {
   },
 
   /**
    * Returns an appropriate provider-specific URL for dealing with a particular
    * error type.
    *
    * @param aError an error to get the URL for.
    */
-  providerUrlForError: function(aError) {
+  providerUrlForError(aError) {
     if (aError == Ci.nsIMsgCloudFileProvider.uploadExceedsFileLimit)
       return "http://www.hightail.com";
     return "";
   },
 
   /**
    * If the provider doesn't have an API for creating an account, perhaps
    * there's a url we can load in a content tab that will allow the user
@@ -658,17 +658,17 @@ nsHightail.prototype = {
 
   /**
    * Attempts to delete an uploaded file.
    *
    * @param aFile the nsIFile to delete.
    * @param aCallback an nsIRequestObserver for monitoring the start and stop
    *                  states of the delete procedure.
    */
-  deleteFile: function(aFile, aCallback) {
+  deleteFile(aFile, aCallback) {
     this.log.info("Deleting a file");
 
     if (Services.io.offline) {
       this.log.error("We're offline - we can't delete the file.");
       throw Ci.nsIMsgCloudFileProvider.offlineErr;
     }
 
     let uploadInfo = this._uploadInfo[aFile.path];
@@ -706,26 +706,26 @@ nsHightail.prototype = {
           // Our token has gone stale
           let onTokenRefresh = function() {
             this.deleteFile(aFile, aCallback);
           }.bind(this);
 
           let onTokenRefreshFailure = function() {
             aCallback.onStopRequest(null, null,
                                     Ci.nsIMsgCloudFileProvider.authErr);
-          }
+          };
           this._handleStaleToken(onTokenRefresh, onTokenRefreshFailure);
           return;
         }
 
         this.log.error("Server has returned a failure on our delete request.");
         this.log.error("Error code: " + deleteInfo.errorStatus.code);
         this.log.error("Error message: " + deleteInfo.errorStatus.message);
-        //aCallback.onStopRequest(null, null,
-        //                        Ci.nsIMsgCloudFileProvider.uploadErr);
+        // aCallback.onStopRequest(null, null,
+        //                         Ci.nsIMsgCloudFileProvider.uploadErr);
         return;
       }
 
       this.log.info("Delete was successful!");
       // Success!
       aCallback.onStopRequest(null, null, Cr.NS_OK);
     }.bind(this);
 
@@ -740,17 +740,17 @@ nsHightail.prototype = {
    * Returns the saved password for this account if one exists, or prompts
    * the user for a password. Returns the empty string on failure.
    *
    * @param aUsername the username associated with the account / password.
    * @param aNoPrompt a boolean for whether or not we should suppress
    *                  the password prompt if no password exists.  If so,
    *                  returns the empty string if no password exists.
    */
-  getPassword: function(aUsername, aNoPrompt) {
+  getPassword(aUsername, aNoPrompt) {
     this.log.info("Getting password for user: " + aUsername);
 
     if (aNoPrompt)
       this.log.info("Suppressing password prompt");
 
     let passwordURI = gServerUrl;
     let logins = Services.logins.findLogins({}, passwordURI, null, passwordURI);
     for (let loginInfo of logins) {
@@ -763,17 +763,17 @@ nsHightail.prototype = {
     // OK, let's prompt for it.
     let win = Services.wm.getMostRecentWindow(null);
 
     let authPrompter = Services.ww.getNewAuthPrompter(win);
     let password = { value: "" };
     // Use the service name in the prompt text
     let serverUrl = gServerUrl;
     let userPos = gServerUrl.indexOf("//") + 2;
-    let userNamePart = encodeURIComponent(this._userName) + '@';
+    let userNamePart = encodeURIComponent(this._userName) + "@";
     serverUrl = gServerUrl.substr(0, userPos) + userNamePart + gServerUrl.substr(userPos);
     let messengerBundle = Services.strings.createBundle(
       "chrome://messenger/locale/messenger.properties");
     let promptString = messengerBundle.formatStringFromName("passwordPrompt",
                                                             [this._userName,
                                                              this.displayName],
                                                             2);
 
@@ -783,32 +783,32 @@ nsHightail.prototype = {
       return password.value;
 
     return "";
   },
 
   /**
    * Clears any saved Hightail passwords for this instance's account.
    */
-  clearPassword: function() {
+  clearPassword() {
     let logins = Services.logins.findLogins({}, gServerUrl, null, gServerUrl);
     for (let loginInfo of logins)
       if (loginInfo.username == this._userName)
         Services.logins.removeLogin(loginInfo);
   },
 
   /**
    * Attempt to log on and get the auth token for this Hightail account.
    *
    * @param successCallback the callback to be fired if logging on is successful
    * @param failureCallback the callback to be fired if loggong on fails
    * @aparam aWithUI a boolean for whether or not we should prompt for a password
    *                 if no auth token is currently stored.
    */
-  logon: function(successCallback, failureCallback, aWithUI) {
+  logon(successCallback, failureCallback, aWithUI) {
     this.log.info("Logging in, aWithUI = " + aWithUI);
     if (this._password == undefined || !this._password)
       this._password = this.getPassword(this._userName, !aWithUI);
     let args = "?email=" + this._userName + "&password=" + this._password + "&";
     this.log.info("Sending login information...");
     let req = new XMLHttpRequest();
     let curDate = Date.now().toString();
 
@@ -823,26 +823,24 @@ nsHightail.prototype = {
         this.log.info("auth token response = " + req.responseText);
         let docResponse = JSON.parse(req.responseText);
         this.log.info("login response parsed = " + docResponse);
         this._cachedAuthToken = docResponse.authToken;
         this.log.info("authToken = " + this._cachedAuthToken);
         if (this._cachedAuthToken) {
           this._loggedIn = true;
           successCallback();
-        }
-        else {
+        } else {
           this.clearPassword();
           this._loggedIn = false;
           this._lastErrorText = docResponse.errorStatus.message;
           this._lastErrorStatus = docResponse.errorStatus.code;
           failureCallback();
         }
-      }
-      else {
+      } else {
         this.clearPassword();
         failureCallback();
       }
     }.bind(this);
     req.setRequestHeader("X-Api-Key", kApiKey);
     req.setRequestHeader("Date", curDate);
     req.setRequestHeader("Accept", "application/json");
     req.send();
@@ -874,27 +872,25 @@ function nsHightailFileUploader(aHightai
   this.log = this.hightail.log;
   this.log.info("new nsHightailFileUploader file = " + aFile.leafName);
   this.file = aFile;
   this.callback = aCallback;
   this.requestObserver = aRequestObserver;
 }
 
 nsHightailFileUploader.prototype = {
-  hightail : null,
-  file : null,
-  callback : null,
-  _request : null,
+  hightail: null,
+  file: null,
+  callback: null,
+  _request: null,
 
   /**
    * Kicks off the upload procedure for this uploader.
    */
-  startUpload: function() {
-    let curDate = Date.now().toString();
-
+  startUpload() {
     this.requestObserver.onStartRequest(null, null);
 
     let onSuccess = function() {
       this._uploadFile();
     }.bind(this);
 
     let onFailure = function() {
       this.callback(this.requestObserver, Ci.nsIMsgCloudFileProvider.uploadErr);
@@ -905,34 +901,33 @@ nsHightailFileUploader.prototype = {
 
   /**
    * Communicates with Hightail to get the URL that we will send the upload
    * request to.
    *
    * @param successCallback the callback fired if getting the URL is successful
    * @param failureCallback the callback fired if getting the URL fails
    */
-  _prepareToSend: function(successCallback, failureCallback) {
+  _prepareToSend(successCallback, failureCallback) {
     let req = new XMLHttpRequest();
 
     req.open("POST", gServerUrl + kFolderInitUploadPath + "?" + kUrlTail, true);
 
     req.onerror = failureCallback;
 
     req.onload = function() {
       let response = req.responseText;
       if (req.status >= 200 && req.status < 400) {
         this._urlInfo = JSON.parse(response);
         this.hightail._uploadInfo[this.file.path] = this._urlInfo;
         this.log.info("in prepare to send response = " + response);
         this.log.info("file id = " + this._urlInfo.fileId);
         this.log.info("upload url = " + this._urlInfo.uploadUrl[0]);
         successCallback();
-      }
-      else {
+      } else {
         this.log.error("Preparing to send failed!");
         this.log.error("Response was: " + response);
         this.hightail._lastErrorText = req.responseText;
         this.hightail._lastErrorStatus = req.status;
         failureCallback();
       }
     }.bind(this);
 
@@ -945,48 +940,48 @@ nsHightailFileUploader.prototype = {
     req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     req.send();
   },
 
   /**
    * Once we've got the URL to upload the file to, this function actually does
    * the upload of the file to Hightail.
    */
-  _uploadFile: function() {
+  _uploadFile() {
     let req = new XMLHttpRequest();
 
     let curDate = Date.now().toString();
     this.log.info("upload url = " + this._urlInfo.uploadUrl[0]);
     this.request = req;
     req.open("POST", this._urlInfo.uploadUrl[0] + "?" + kUrlTail, true);
     req.onload = function() {
       this.cleanupTempFile();
       if (req.status >= 200 && req.status < 400) {
         try {
           this.log.info("upload response = " + req.responseText);
           this._commitSend();
         } catch (ex) {
           this.log.error(ex);
         }
-      }
-      else
+      } else {
         this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
+      }
     }.bind(this);
 
-    req.onerror = function () {
+    req.onerror = function() {
       this.cleanupTempFile();
       if (this.callback)
         this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
     }.bind(this);
 
     req.setRequestHeader("Date", curDate);
     let boundary = "------" + curDate;
-    let contentType = "multipart/form-data; boundary="+ boundary;
+    let contentType = "multipart/form-data; boundary=" + boundary;
     req.setRequestHeader("Content-Type", contentType);
 
     let fileContents = "--" + boundary +
       "\r\nContent-Disposition: form-data; name=\"bid\"\r\n\r\n" +
        this._urlInfo.fileId;
 
     let fileName = /^[\040-\176]+$/.test(this.file.leafName)
         ? this.file.leafName
@@ -1049,17 +1044,17 @@ nsHightailFileUploader.prototype = {
       this.log.error(ex);
       throw ex;
     }
   },
 
   /**
    * Cancels the upload request for the file associated with this Uploader.
    */
-  cancel: function() {
+  cancel() {
     this.log.info("in uploader cancel");
     this.callback(this.requestObserver, Ci.nsIMsgCloudFileProvider.uploadCanceled);
     delete this.callback;
     if (this.request) {
       this.log.info("cancelling upload request");
       let req = this.request;
       if (req.channel) {
         this.log.info("cancelling upload channel");
@@ -1067,17 +1062,17 @@ nsHightailFileUploader.prototype = {
       }
       this.request = null;
     }
   },
   /**
    * Once the file is uploaded, if we want to get a sharing URL back, we have
    * to send a "commit" request - which this function does.
    */
-  _commitSend: function() {
+  _commitSend() {
     this.log.info("commit sending file " + this._urlInfo.fileId);
     let req = new XMLHttpRequest();
     let args = "?name=" + this.file.leafName +
                "&fileId=" + this._urlInfo.fileId +
                "&parentId=" + this.hightail._folderId + "&";
 
     req.open("POST", gServerUrl + kFolderCommitUploadPath + args + kUrlTail, true);
 
@@ -1102,60 +1097,59 @@ nsHightailFileUploader.prototype = {
                       ? Ci.nsIMsgCloudFileProvider.uploadExceedsFileNameLimit
                       : Ci.nsIMsgCloudFileProvider.uploadErr);
       }.bind(this);
 
       if (uploadInfo.errorStatus) {
         this.hightail._lastErrorText = uploadInfo.errorStatus.message;
         this.hightail._lastErrorStatus = uploadInfo.errorStatus.code;
         failed();
-      }
-      else if (uploadInfo.clickableDownloadUrl) {
+      } else if (uploadInfo.clickableDownloadUrl) {
         // We need a kludge here because Hightail is returning URLs without the scheme...
         let url = this._ensureScheme(uploadInfo.clickableDownloadUrl);
         this.hightail._urlsForFiles[this.file.path] = url;
         succeed();
+      } else {
+        this._findDownloadUrl(uploadInfo.id, succeed, failed);
       }
-      else
-        this._findDownloadUrl(uploadInfo.id, succeed, failed);
     }.bind(this);
 
     req.setRequestHeader("X-Auth-Token", this.hightail._cachedAuthToken + " ");
     req.setRequestHeader("X-Api-Key", kApiKey);
     req.setRequestHeader("Accept", "application/json");
     req.send();
   },
 
   /**
    * If there's no scheme prefix for a URL, attaches an https:// prefix
    * and returns the new result.
    *
    * @param aURL to ensure a scheme with
    */
-  _ensureScheme: function(aURL) {
+  _ensureScheme(aURL) {
     try {
-      let scheme = Services.io.extractScheme(aURL);
+      Services.io.extractScheme(aURL);
       return aURL;
-    } catch(e) {
+    } catch (e) {
       // If we got NS_ERROR_MALFORMED_URI back, there's no scheme here.
       if (e.result == Cr.NS_ERROR_MALFORMED_URI)
         return "https://" + aURL;
       // Otherwise, we hit something different, and should throw.
       throw e;
     }
   },
 
   /**
    * Attempt to find download url for file.
    *
    * @param aFileId id of file
    * @param aSuccessCallback called if url is found
    * @param aFailureCallback called if url is not found
    */
-  _findDownloadUrl: function(aFileId, aSuccessCallback, aFailureCallback) {
+  _findDownloadUrl(aFileId, aSuccessCallback, aFailureCallback) {
     let req = new XMLHttpRequest();
 
     req.open("GET", gServerUrl + kFolderFilePath + aFileId, true);
 
     req.onerror = function() {
       this.log.info("error in findDownloadUrl");
       aFailureCallback();
     }.bind(this);
@@ -1179,29 +1173,29 @@ nsHightailFileUploader.prototype = {
     req.setRequestHeader("X-Api-Key", kApiKey);
     req.setRequestHeader("Accept", "application/json");
     req.send();
   },
 
   /**
    * Creates and returns a temporary file on the local file system.
    */
-  getTempFile: function(leafName) {
+  getTempFile(leafName) {
     let tempfile = Services.dirsvc.get("TmpD", Ci.nsIFile);
-    tempfile.append(leafName)
+    tempfile.append(leafName);
     tempfile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
     // do whatever you need to the created file
-    return tempfile.clone()
+    return tempfile.clone();
   },
 
   /**
    * Cleans up any temporary files that this nsHightailFileUploader may have
    * created.
    */
-  cleanupTempFile: function() {
+  cleanupTempFile() {
     if (this._bufStream)
       this._bufStream.close();
     if (this._fstream)
       this._fstream.close();
     if (this._tempFile)
       this._tempFile.remove(false);
   },
 };