Bug 1115364 - Downloads Panel code style refresh. r=jaws
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 29 Dec 2014 12:35:27 +0000
changeset 221553 bb24f0be1bcbc8cb04aa0bd4cabd003445a46e13
parent 221460 6bf93610034bb88c0ac64dc56948e557f26f005d
child 221554 4e494ede6c2d84e10b8b6d7c05dde0ca22f038a5
push id53375
push userkwierso@gmail.com
push dateTue, 30 Dec 2014 01:33:28 +0000
treeherdermozilla-inbound@dc98810c5b0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1115364
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1115364 - Downloads Panel code style refresh. r=jaws
browser/components/downloads/DownloadsCommon.jsm
browser/components/downloads/DownloadsLogger.jsm
browser/components/downloads/DownloadsTaskbar.jsm
browser/components/downloads/content/allDownloadsViewOverlay.js
browser/components/downloads/content/contentAreaDownloadsView.js
browser/components/downloads/content/downloads.js
browser/components/downloads/content/indicator.js
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -99,31 +99,32 @@ XPCOMUtils.defineLazyGetter(this, "Downl
 
 const kPartialDownloadSuffix = ".part";
 
 const kPrefBranch = Services.prefs.getBranch("browser.download.");
 
 let PrefObserver = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
-  getPref: function PO_getPref(name) {
+  getPref(name) {
     try {
       switch (typeof this.prefs[name]) {
         case "boolean":
           return kPrefBranch.getBoolPref(name);
       }
     } catch (ex) { }
     return this.prefs[name];
   },
-  observe: function PO_observe(aSubject, aTopic, aData) {
+  observe(aSubject, aTopic, aData) {
     if (this.prefs.hasOwnProperty(aData)) {
+      delete this[aData];
       return this[aData] = this.getPref(aData);
     }
   },
-  register: function PO_register(prefs) {
+  register(prefs) {
     this.prefs = prefs;
     kPrefBranch.addObserver("", this, true);
     for (let key in prefs) {
       let name = key;
       XPCOMUtils.defineLazyGetter(this, name, function () {
         return PrefObserver.getPref(name);
       });
     }
@@ -147,44 +148,36 @@ PrefObserver.register({
 this.DownloadsCommon = {
   /**
    * Constants with the different types of unblock messages.
    */
   BLOCK_VERDICT_MALWARE: "Malware",
   BLOCK_VERDICT_POTENTIALLY_UNWANTED: "PotentiallyUnwanted",
   BLOCK_VERDICT_UNCOMMON: "Uncommon",
 
-  log: function DC_log(...aMessageArgs) {
-    delete this.log;
-    this.log = function DC_log(...aMessageArgs) {
-      if (!PrefObserver.debug) {
-        return;
-      }
-      DownloadsLogger.log.apply(DownloadsLogger, aMessageArgs);
+  log(...aMessageArgs) {
+    if (!PrefObserver.debug) {
+      return;
     }
-    this.log.apply(this, aMessageArgs);
+    DownloadsLogger.log(...aMessageArgs);
   },
 
-  error: function DC_error(...aMessageArgs) {
-    delete this.error;
-    this.error = function DC_error(...aMessageArgs) {
-      if (!PrefObserver.debug) {
-        return;
-      }
-      DownloadsLogger.reportError.apply(DownloadsLogger, aMessageArgs);
+  error(...aMessageArgs) {
+    if (!PrefObserver.debug) {
+      return;
     }
-    this.error.apply(this, aMessageArgs);
+    DownloadsLogger.reportError(...aMessageArgs);
   },
+
   /**
    * Returns an object whose keys are the string names from the downloads string
    * bundle, and whose values are either the translated strings or functions
    * returning formatted strings.
    */
-  get strings()
-  {
+  get strings() {
     let strings = {};
     let sb = Services.strings.createBundle(kDownloadsStringBundleUrl);
     let enumerator = sb.getSimpleEnumeration();
     while (enumerator.hasMoreElements()) {
       let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
       let stringName = string.key;
       if (stringName in kDownloadsStringsRequiringFormatting) {
         strings[stringName] = function () {
@@ -214,18 +207,17 @@ this.DownloadsCommon = {
    *
    * @param aSeconds
    *        Value to be formatted.  It represents the number of seconds, it must
    *        be positive but does not need to be an integer.
    *
    * @return Formatted string, for example "30s" or "2h".  The returned value is
    *         maximum three characters long, at least in English.
    */
-  formatTimeLeft: function DC_formatTimeLeft(aSeconds)
-  {
+  formatTimeLeft(aSeconds) {
     // Decide what text to show for the time
     let seconds = Math.round(aSeconds);
     if (!seconds) {
       return "";
     } else if (seconds <= 30) {
       return DownloadsCommon.strings["shortTimeLeftSeconds"](seconds);
     }
     let minutes = Math.round(aSeconds / 60);
@@ -239,51 +231,50 @@ this.DownloadsCommon = {
     let days = Math.round(hours / 24);
     return DownloadsCommon.strings["shortTimeLeftDays"](Math.min(days, 99));
   },
 
   /**
    * Indicates whether we should show visual notification on the indicator
    * when a download event is triggered.
    */
-  get animateNotifications()
-  {
+  get animateNotifications() {
     return PrefObserver.animateNotifications;
   },
 
   /**
    * Get access to one of the DownloadsData or PrivateDownloadsData objects,
    * depending on the privacy status of the window in question.
    *
    * @param aWindow
    *        The browser window which owns the download button.
    */
-  getData: function DC_getData(aWindow) {
+  getData(aWindow) {
     if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
       return PrivateDownloadsData;
     } else {
       return DownloadsData;
     }
   },
 
   /**
    * Initializes the Downloads back-end and starts receiving events for both the
    * private and non-private downloads data objects.
    */
-  initializeAllDataLinks: function () {
+  initializeAllDataLinks() {
     DownloadsData.initializeDataLink();
     PrivateDownloadsData.initializeDataLink();
   },
 
   /**
    * Get access to one of the DownloadsIndicatorData or
    * PrivateDownloadsIndicatorData objects, depending on the privacy status of
    * the window in question.
    */
-  getIndicatorData: function DC_getIndicatorData(aWindow) {
+  getIndicatorData(aWindow) {
     if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
       return PrivateDownloadsIndicatorData;
     } else {
       return DownloadsIndicatorData;
     }
   },
 
   /**
@@ -291,18 +282,17 @@ this.DownloadsCommon = {
    * in the process if one hasn't been instantiated yet.
    *
    * @param aWindow
    *        The browser window which owns the download button.
    * @param aNumToExclude
    *        The number of items on the top of the downloads list to exclude
    *        from the summary.
    */
-  getSummary: function DC_getSummary(aWindow, aNumToExclude)
-  {
+  getSummary(aWindow, aNumToExclude) {
     if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
       if (this._privateSummary) {
         return this._privateSummary;
       }
       return this._privateSummary = new DownloadsSummaryData(true, aNumToExclude);
     } else {
       if (this._summary) {
         return this._summary;
@@ -329,18 +319,17 @@ this.DownloadsCommon = {
    *         totalSize       : The total size of all downloads once completed.
    *         totalTransferred: The total amount of transferred data for these
    *                           downloads.
    *         slowestSpeed    : The slowest download rate.
    *         rawTimeLeft     : The estimated time left for the downloads to
    *                           complete.
    *         percentComplete : The percentage of bytes successfully downloaded.
    */
-  summarizeDownloads: function DC_summarizeDownloads(aDataItems)
-  {
+  summarizeDownloads(aDataItems) {
     let summary = {
       numActive: 0,
       numPaused: 0,
       numScanning: 0,
       numDownloading: 0,
       totalSize: 0,
       totalTransferred: 0,
       // slowestSpeed is Infinity so that we can use Math.min to
@@ -398,18 +387,17 @@ this.DownloadsCommon = {
    * If necessary, smooths the estimated number of seconds remaining for one
    * or more downloads to complete.
    *
    * @param aSeconds
    *        Current raw estimate on number of seconds left for one or more
    *        downloads. This is a floating point value to help get sub-second
    *        accuracy for current and future estimates.
    */
-  smoothSeconds: function DC_smoothSeconds(aSeconds, aLastSeconds)
-  {
+  smoothSeconds(aSeconds, aLastSeconds) {
     // We apply an algorithm similar to the DownloadUtils.getTimeLeft function,
     // though tailored to a single time estimation for all downloads.  We never
     // apply something if the new value is less than half the previous value.
     let shouldApplySmoothing = aLastSeconds >= 0 &&
                                aSeconds > aLastSeconds / 2;
     if (shouldApplySmoothing) {
       // Apply hysteresis to favor downward over upward swings.  Trust only 30%
       // of the new value if lower, and 10% if higher (exponential smoothing).
@@ -436,23 +424,26 @@ this.DownloadsCommon = {
    * If you've a dataItem, you should call dataItem.openLocalFile.
    * @param aFile
    *        the downloaded file to be opened.
    * @param aMimeInfo
    *        the mime type info object.  May be null.
    * @param aOwnerWindow
    *        the window with which this action is associated.
    */
-  openDownloadedFile: function DC_openDownloadedFile(aFile, aMimeInfo, aOwnerWindow) {
-    if (!(aFile instanceof Ci.nsIFile))
+  openDownloadedFile(aFile, aMimeInfo, aOwnerWindow) {
+    if (!(aFile instanceof Ci.nsIFile)) {
       throw new Error("aFile must be a nsIFile object");
-    if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo))
+    }
+    if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo)) {
       throw new Error("Invalid value passed for aMimeInfo");
-    if (!(aOwnerWindow instanceof Ci.nsIDOMWindow))
+    }
+    if (!(aOwnerWindow instanceof Ci.nsIDOMWindow)) {
       throw new Error("aOwnerWindow must be a dom-window object");
+    }
 
     let promiseShouldLaunch;
     if (aFile.isExecutable()) {
       // We get a prompter for the provided window here, even though anchoring
       // to the most recently active window should work as well.
       promiseShouldLaunch =
         DownloadUIHelper.getPrompter(aOwnerWindow)
                         .confirmLaunchExecutable(aFile.path);
@@ -466,44 +457,43 @@ this.DownloadsCommon = {
       }
   
       // Actually open the file.
       try {
         if (aMimeInfo && aMimeInfo.preferredAction == aMimeInfo.useHelperApp) {
           aMimeInfo.launchWithFile(aFile);
           return;
         }
-      }
-      catch(ex) { }
+      } catch (ex) { }
   
       // If either we don't have the mime info, or the preferred action failed,
       // attempt to launch the file directly.
       try {
         aFile.launch();
-      }
-      catch(ex) {
+      } catch (ex) {
         // If launch fails, try sending it through the system's external "file:"
         // URL handler.
         Cc["@mozilla.org/uriloader/external-protocol-service;1"]
           .getService(Ci.nsIExternalProtocolService)
           .loadUrl(NetUtil.newURI(aFile));
       }
     }).then(null, Cu.reportError);
   },
 
   /**
    * Show a downloaded file in the system file manager.
    * If you have a dataItem, use dataItem.showLocalFile.
    *
    * @param aFile
    *        a downloaded file.
    */
-  showDownloadedFile: function DC_showDownloadedFile(aFile) {
-    if (!(aFile instanceof Ci.nsIFile))
+  showDownloadedFile(aFile) {
+    if (!(aFile instanceof Ci.nsIFile)) {
       throw new Error("aFile must be a nsIFile object");
+    }
     try {
       // Show the directory containing the file and select the file.
       aFile.reveal();
     } catch (ex) {
       // If reveal fails for some reason (e.g., it's not implemented on unix
       // or the file doesn't exist), try using the parent if we have it.
       let parent = aFile.parent;
       if (parent) {
@@ -528,17 +518,17 @@ this.DownloadsCommon = {
    * @param aType
    *        The type of malware the downloaded file contains.
    * @param aOwnerWindow
    *        The window with which this action is associated.
    *
    * @return True to unblock the file, false to keep the user safe and
    *         cancel the operation.
    */
-  confirmUnblockDownload: Task.async(function* DP_confirmUnblockDownload(aType, aOwnerWindow) {
+  confirmUnblockDownload: Task.async(function* (aType, aOwnerWindow) {
     let s = DownloadsCommon.strings;
     let title = s.unblockHeader;
     let buttonFlags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
                       (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
     let type = "";
     let message = s.unblockTip;
     let okButton = s.unblockButtonContinue;
     let cancelButton = s.unblockButtonCancel;
@@ -635,98 +625,91 @@ function DownloadsDataCtor(aPrivate) {
   // Maps Download objects to DownloadDataItem objects.
   this._downloadToDataItemMap = new Map();
 }
 
 DownloadsDataCtor.prototype = {
   /**
    * Starts receiving events for current downloads.
    */
-  initializeDataLink: function ()
-  {
+  initializeDataLink() {
     if (!this._dataLinkInitialized) {
       let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE
                                                           : Downloads.PUBLIC);
       promiseList.then(list => list.addView(this)).then(null, Cu.reportError);
       this._dataLinkInitialized = true;
     }
   },
   _dataLinkInitialized: false,
 
   /**
    * True if there are finished downloads that can be removed from the list.
    */
-  get canRemoveFinished()
-  {
+  get canRemoveFinished() {
     for (let [, dataItem] of Iterator(this.dataItems)) {
       if (dataItem && !dataItem.inProgress) {
         return true;
       }
     }
     return false;
   },
 
   /**
    * Asks the back-end to remove finished downloads from the list.
    */
-  removeFinished: function DD_removeFinished()
-  {
+  removeFinished() {
     let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE
                                                         : Downloads.PUBLIC);
     promiseList.then(list => list.removeFinished())
                .then(null, Cu.reportError);
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Integration with the asynchronous Downloads back-end
 
-  onDownloadAdded: function (aDownload)
-  {
+  onDownloadAdded(aDownload) {
     let dataItem = new DownloadsDataItem(aDownload);
     this._downloadToDataItemMap.set(aDownload, dataItem);
     this.dataItems[dataItem.downloadGuid] = dataItem;
 
     for (let view of this._views) {
       view.onDataItemAdded(dataItem, true);
     }
 
     this._updateDataItemState(dataItem);
   },
 
-  onDownloadChanged: function (aDownload)
-  {
+  onDownloadChanged(aDownload) {
     let dataItem = this._downloadToDataItemMap.get(aDownload);
     if (!dataItem) {
       Cu.reportError("Download doesn't exist.");
       return;
     }
 
     this._updateDataItemState(dataItem);
   },
 
-  onDownloadRemoved: function (aDownload)
-  {
+  onDownloadRemoved(aDownload) {
     let dataItem = this._downloadToDataItemMap.get(aDownload);
     if (!dataItem) {
       Cu.reportError("Download doesn't exist.");
       return;
     }
 
     this._downloadToDataItemMap.delete(aDownload);
     this.dataItems[dataItem.downloadGuid] = null;
     for (let view of this._views) {
       view.onDataItemRemoved(dataItem);
     }
   },
 
   /**
    * Updates the given data item and sends related notifications.
    */
-  _updateDataItemState: function (aDataItem)
-  {
+  _updateDataItemState(aDataItem) {
     let oldState = aDataItem.state;
     let wasInProgress = aDataItem.inProgress;
     let wasDone = aDataItem.done;
 
     aDataItem.updateFromDownload();
 
     if (wasInProgress && !aDataItem.inProgress) {
       aDataItem.endTime = Date.now();
@@ -783,56 +766,51 @@ DownloadsDataCtor.prototype = {
   /**
    * Adds an object to be notified when the available download data changes.
    * The specified object is initialized with the currently available downloads.
    *
    * @param aView
    *        DownloadsView object to be added.  This reference must be passed to
    *        removeView before termination.
    */
-  addView: function DD_addView(aView)
-  {
+  addView(aView) {
     this._views.push(aView);
     this._updateView(aView);
   },
 
   /**
    * Removes an object previously added using addView.
    *
    * @param aView
    *        DownloadsView object to be removed.
    */
-  removeView: function DD_removeView(aView)
-  {
+  removeView(aView) {
     let index = this._views.indexOf(aView);
     if (index != -1) {
       this._views.splice(index, 1);
     }
   },
 
   /**
    * Ensures that the currently loaded data is added to the specified view.
    *
    * @param aView
    *        DownloadsView object to be initialized.
    */
-  _updateView: function DD_updateView(aView)
-  {
+  _updateView(aView) {
     // Indicate to the view that a batch loading operation is in progress.
     aView.onDataLoadStarting();
 
     // Sort backwards by start time, ensuring that the most recent
     // downloads are added first regardless of their state.
     let loadedItemsArray = [dataItem
                             for each (dataItem in this.dataItems)
                             if (dataItem)];
-    loadedItemsArray.sort(function(a, b) b.startTime - a.startTime);
-    loadedItemsArray.forEach(
-      function (dataItem) aView.onDataItemAdded(dataItem, false)
-    );
+    loadedItemsArray.sort((a, b) => b.startTime - a.startTime);
+    loadedItemsArray.forEach(dataItem => aView.onDataItemAdded(dataItem, false));
 
     // Notify the view that all data is available.
     aView.onDataLoadCompleted();
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Notifications sent to the most recent browser window only
 
@@ -854,18 +832,17 @@ DownloadsDataCtor.prototype = {
 
   /**
    * Displays a new or finished download notification in the most recent browser
    * window, if one is currently available with the required privacy type.
    *
    * @param aType
    *        Set to "start" for new downloads, "finish" for completed downloads.
    */
-  _notifyDownloadEvent: function DD_notifyDownloadEvent(aType)
-  {
+  _notifyDownloadEvent(aType) {
     DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
 
     // Show the panel in the most recent browser window, if present.
     let browserWin = RecentWindow.getMostRecentBrowserWindow({ private: this._isPrivate });
     if (!browserWin) {
       return;
     }
 
@@ -896,18 +873,17 @@ XPCOMUtils.defineLazyGetter(this, "Downl
 /**
  * Represents a single item in the list of downloads.
  *
  * The endTime property is initialized to the current date and time.
  *
  * @param aDownload
  *        The Download object with the current state.
  */
-function DownloadsDataItem(aDownload)
-{
+function DownloadsDataItem(aDownload) {
   this._download = aDownload;
 
   this.downloadGuid = "id:" + this._autoIncrementId;
   this.file = aDownload.target.path;
   this.target = OS.Path.basename(aDownload.target.path);
   this.uri = aDownload.source.url;
   this.endTime = Date.now();
 
@@ -920,18 +896,17 @@ DownloadsDataItem.prototype = {
    * are generated sequentially for the corresponding DownloadDataItem.
    */
   get _autoIncrementId() ++DownloadsDataItem.prototype.__lastId,
   __lastId: 0,
 
   /**
    * Updates this object from the underlying Download object.
    */
-  updateFromDownload: function ()
-  {
+  updateFromDownload() {
     // Collapse state using the correct priority.
     if (this._download.succeeded) {
       this.state = nsIDM.DOWNLOAD_FINISHED;
     } else if (this._download.error &&
                this._download.error.becauseBlockedByParentalControls) {
       this.state = nsIDM.DOWNLOAD_BLOCKED_PARENTAL;
     } else if (this._download.error &&
                this._download.error.becauseBlockedByReputationCheck) {
@@ -973,115 +948,106 @@ DownloadsDataItem.prototype = {
     }
   },
 
   /**
    * Indicates whether the download is proceeding normally, and not finished
    * yet.  This includes paused downloads.  When this property is true, the
    * "progress" property represents the current progress of the download.
    */
-  get inProgress()
-  {
+  get inProgress() {
     return [
       nsIDM.DOWNLOAD_NOTSTARTED,
       nsIDM.DOWNLOAD_QUEUED,
       nsIDM.DOWNLOAD_DOWNLOADING,
       nsIDM.DOWNLOAD_PAUSED,
       nsIDM.DOWNLOAD_SCANNING,
     ].indexOf(this.state) != -1;
   },
 
   /**
    * This is true during the initial phases of a download, before the actual
    * download of data bytes starts.
    */
-  get starting()
-  {
+  get starting() {
     return this.state == nsIDM.DOWNLOAD_NOTSTARTED ||
            this.state == nsIDM.DOWNLOAD_QUEUED;
   },
 
   /**
    * Indicates whether the download is paused.
    */
-  get paused()
-  {
+  get paused() {
     return this.state == nsIDM.DOWNLOAD_PAUSED;
   },
 
   /**
    * Indicates whether the download is in a final state, either because it
    * completed successfully or because it was blocked.
    */
-  get done()
-  {
+  get done() {
     return [
       nsIDM.DOWNLOAD_FINISHED,
       nsIDM.DOWNLOAD_BLOCKED_PARENTAL,
       nsIDM.DOWNLOAD_BLOCKED_POLICY,
       nsIDM.DOWNLOAD_DIRTY,
     ].indexOf(this.state) != -1;
   },
 
   /**
    * Indicates whether the download is finished and can be opened.
    */
-  get openable()
-  {
+  get openable() {
     return this.state == nsIDM.DOWNLOAD_FINISHED;
   },
 
   /**
    * Indicates whether the download stopped because of an error, and can be
    * resumed manually.
    */
-  get canRetry()
-  {
+  get canRetry() {
     return this.state == nsIDM.DOWNLOAD_CANCELED ||
            this.state == nsIDM.DOWNLOAD_FAILED;
   },
 
   /**
    * Returns the nsILocalFile for the download target.
    *
    * @throws if the native path is not valid.  This can happen if the same
    *         profile is used on different platforms, for example if a native
    *         Windows path is stored and then the item is accessed on a Mac.
    */
-  get localFile()
-  {
+  get localFile() {
     return this._getFile(this.file);
   },
 
   /**
    * Returns the nsILocalFile for the partially downloaded target.
    *
    * @throws if the native path is not valid.  This can happen if the same
    *         profile is used on different platforms, for example if a native
    *         Windows path is stored and then the item is accessed on a Mac.
    */
-  get partFile()
-  {
+  get partFile() {
     return this._getFile(this.file + kPartialDownloadSuffix);
   },
 
   /**
    * Returns an nsILocalFile for aFilename. aFilename might be a file URL or
    * a native path.
    *
    * @param aFilename the filename of the file to retrieve.
    * @return an nsILocalFile for the file.
    * @throws if the native path is not valid.  This can happen if the same
    *         profile is used on different platforms, for example if a native
    *         Windows path is stored and then the item is accessed on a Mac.
    * @note This function makes no guarantees about the file's existence -
    *       callers should check that the returned file exists.
    */
-  _getFile: function DDI__getFile(aFilename)
-  {
+  _getFile(aFilename) {
     // The download database may contain targets stored as file URLs or native
     // paths.  This can still be true for previously stored items, even if new
     // items are stored using their file URL.  See also bug 239948 comment 12.
     if (aFilename.startsWith("file:")) {
       // Assume the file URL we obtained from the downloads database or from the
       // "spec" property of the target has the UTF-8 charset.
       let fileUrl = NetUtil.newURI(aFilename).QueryInterface(Ci.nsIFileURL);
       return fileUrl.file.clone().QueryInterface(Ci.nsILocalFile);
@@ -1090,64 +1056,64 @@ DownloadsDataItem.prototype = {
       // file, though this may throw an exception if the path is invalid.
       return new DownloadsLocalFileCtor(aFilename);
     }
   },
 
   /**
    * Open the target file for this download.
    */
-  openLocalFile: function () {
+  openLocalFile() {
     this._download.launch().then(null, Cu.reportError);
   },
 
   /**
    * Show the downloaded file in the system file manager.
    */
-  showLocalFile: function DDI_showLocalFile() {
+  showLocalFile() {
     DownloadsCommon.showDownloadedFile(this.localFile);
   },
 
   /**
    * Resumes the download if paused, pauses it if active.
    * @throws if the download is not resumable or if has already done.
    */
-  togglePauseResume: function DDI_togglePauseResume() {
+  togglePauseResume() {
     if (this._download.stopped) {
       this._download.start();
     } else {
       this._download.cancel();
     }
   },
 
   /**
    * Attempts to retry the download.
    * @throws if we cannot.
    */
-  retry: function DDI_retry() {
+  retry() {
     this._download.start();
   },
 
   /**
    * Cancels the download.
    */
-  cancel: function() {
+  cancel() {
     this._download.cancel();
     this._download.removePartialData().then(null, Cu.reportError);
   },
 
   /**
    * Remove the download.
    */
-  remove: function DDI_remove() {
+  remove() {
     Downloads.getList(Downloads.ALL)
              .then(list => list.remove(this._download))
              .then(() => this._download.finalize(true))
              .then(null, Cu.reportError);
-  }
+  },
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsViewPrototype
 
 /**
  * A prototype for an object that registers itself with DownloadsData as soon
  * as a view is registered with it.
@@ -1175,18 +1141,17 @@ const DownloadsViewPrototype = {
   /**
    * Adds an object to be notified when the available status data changes.
    * The specified object is initialized with the currently available status.
    *
    * @param aView
    *        View object to be added.  This reference must be
    *        passed to removeView before termination.
    */
-  addView: function DVP_addView(aView)
-  {
+  addView(aView) {
     // Start receiving events when the first of our views is registered.
     if (this._views.length == 0) {
       if (this._isPrivate) {
         PrivateDownloadsData.addView(this);
       } else {
         DownloadsData.addView(this);
       }
     }
@@ -1196,32 +1161,30 @@ const DownloadsViewPrototype = {
   },
 
   /**
    * Updates the properties of an object previously added using addView.
    *
    * @param aView
    *        View object to be updated.
    */
-  refreshView: function DVP_refreshView(aView)
-  {
+  refreshView(aView) {
     // Update immediately even if we are still loading data asynchronously.
     // Subclasses must provide these two functions!
     this._refreshProperties();
     this._updateView(aView);
   },
 
   /**
    * Removes an object previously added using addView.
    *
    * @param aView
    *        View object to be removed.
    */
-  removeView: function DVP_removeView(aView)
-  {
+  removeView(aView) {
     let index = this._views.indexOf(aView);
     if (index != -1) {
       this._views.splice(index, 1);
     }
 
     // Stop receiving events when the last of our views is unregistered.
     if (this._views.length == 0) {
       if (this._isPrivate) {
@@ -1238,26 +1201,24 @@ const DownloadsViewPrototype = {
   /**
    * Indicates whether we are still loading downloads data asynchronously.
    */
   _loading: false,
 
   /**
    * Called before multiple downloads are about to be loaded.
    */
-  onDataLoadStarting: function DVP_onDataLoadStarting()
-  {
+  onDataLoadStarting() {
     this._loading = true;
   },
 
   /**
    * Called after data loading finished.
    */
-  onDataLoadCompleted: function DVP_onDataLoadCompleted()
-  {
+  onDataLoadCompleted() {
     this._loading = false;
   },
 
   /**
    * Called when a new download data item is available, either during the
    * asynchronous data load or when a new download is started.
    *
    * @param aDataItem
@@ -1266,70 +1227,65 @@ const DownloadsViewPrototype = {
    *        When true, indicates that this item is the most recent and should be
    *        added in the topmost position.  This happens when a new download is
    *        started.  When false, indicates that the item is the least recent
    *        with regard to the items that have been already added. The latter
    *        generally happens during the asynchronous data load.
    *
    * @note Subclasses should override this.
    */
-  onDataItemAdded: function DVP_onDataItemAdded(aDataItem, aNewest)
-  {
+  onDataItemAdded(aDataItem, aNewest) {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   /**
    * Called when a data item is removed, ensures that the widget associated with
    * the view item is removed from the user interface.
    *
    * @param aDataItem
    *        DownloadsDataItem object that is being removed.
    *
    * @note Subclasses should override this.
    */
-  onDataItemRemoved: function DVP_onDataItemRemoved(aDataItem)
-  {
+  onDataItemRemoved(aDataItem) {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   /**
    * Returns the view item associated with the provided data item for this view.
    *
    * @param aDataItem
    *        DownloadsDataItem object for which the view item is requested.
    *
    * @return Object that can be used to notify item status events.
    *
    * @note Subclasses should override this.
    */
-  getViewItem: function DID_getViewItem(aDataItem)
-  {
+  getViewItem(aDataItem) {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   /**
    * Private function used to refresh the internal properties being sent to
    * each registered view.
    *
    * @note Subclasses should override this.
    */
-  _refreshProperties: function DID_refreshProperties()
-  {
+  _refreshProperties() {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   /**
    * Private function used to refresh an individual view.
    *
    * @note Subclasses should override this.
    */
-  _updateView: function DID_updateView()
-  {
+  _updateView() {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-  }
+  },
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsIndicatorData
 
 /**
  * This object registers itself with DownloadsData as a view, and transforms the
  * notifications it receives into overall status data, that is then broadcast to
@@ -1348,33 +1304,31 @@ DownloadsIndicatorDataCtor.prototype = {
   __proto__: DownloadsViewPrototype,
 
   /**
    * Removes an object previously added using addView.
    *
    * @param aView
    *        DownloadsIndicatorView object to be removed.
    */
-  removeView: function DID_removeView(aView)
-  {
+  removeView(aView) {
     DownloadsViewPrototype.removeView.call(this, aView);
 
     if (this._views.length == 0) {
       this._itemCount = 0;
     }
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsData
 
   /**
    * Called after data loading finished.
    */
-  onDataLoadCompleted: function DID_onDataLoadCompleted()
-  {
+  onDataLoadCompleted() {
     DownloadsViewPrototype.onDataLoadCompleted.call(this);
     this._updateViews();
   },
 
   /**
    * Called when a new download data item is available, either during the
    * asynchronous data load or when a new download is started.
    *
@@ -1382,63 +1336,58 @@ DownloadsIndicatorDataCtor.prototype = {
    *        DownloadsDataItem object that was just added.
    * @param aNewest
    *        When true, indicates that this item is the most recent and should be
    *        added in the topmost position.  This happens when a new download is
    *        started.  When false, indicates that the item is the least recent
    *        with regard to the items that have been already added. The latter
    *        generally happens during the asynchronous data load.
    */
-  onDataItemAdded: function DID_onDataItemAdded(aDataItem, aNewest)
-  {
+  onDataItemAdded(aDataItem, aNewest) {
     this._itemCount++;
     this._updateViews();
   },
 
   /**
    * Called when a data item is removed, ensures that the widget associated with
    * the view item is removed from the user interface.
    *
    * @param aDataItem
    *        DownloadsDataItem object that is being removed.
    */
-  onDataItemRemoved: function DID_onDataItemRemoved(aDataItem)
-  {
+  onDataItemRemoved(aDataItem) {
     this._itemCount--;
     this._updateViews();
   },
 
   /**
    * Returns the view item associated with the provided data item for this view.
    *
    * @param aDataItem
    *        DownloadsDataItem object for which the view item is requested.
    *
    * @return Object that can be used to notify item status events.
    */
-  getViewItem: function DID_getViewItem(aDataItem)
-  {
+  getViewItem(aDataItem) {
     let data = this._isPrivate ? PrivateDownloadsIndicatorData
                                : DownloadsIndicatorData;
     return Object.freeze({
-      onStateChange: function DIVI_onStateChange(aOldState)
-      {
+      onStateChange(aOldState) {
         if (aDataItem.state == nsIDM.DOWNLOAD_FINISHED ||
             aDataItem.state == nsIDM.DOWNLOAD_FAILED) {
           data.attention = true;
         }
 
         // Since the state of a download changed, reset the estimated time left.
         data._lastRawTimeLeft = -1;
         data._lastTimeLeft = -1;
 
         data._updateViews();
       },
-      onProgressChange: function DIVI_onProgressChange()
-      {
+      onProgressChange() {
         data._updateViews();
       }
     });
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Propagation of properties to our views
 
@@ -1447,59 +1396,55 @@ DownloadsIndicatorDataCtor.prototype = {
   _hasDownloads: false,
   _counter: "",
   _percentComplete: -1,
   _paused: false,
 
   /**
    * Indicates whether the download indicators should be highlighted.
    */
-  set attention(aValue)
-  {
+  set attention(aValue) {
     this._attention = aValue;
     this._updateViews();
     return aValue;
   },
   _attention: false,
 
   /**
    * Indicates whether the user is interacting with downloads, thus the
    * attention indication should not be shown even if requested.
    */
-  set attentionSuppressed(aValue)
-  {
+  set attentionSuppressed(aValue) {
     this._attentionSuppressed = aValue;
     this._attention = false;
     this._updateViews();
     return aValue;
   },
   _attentionSuppressed: false,
 
   /**
    * Computes aggregate values and propagates the changes to our views.
    */
-  _updateViews: function DID_updateViews()
-  {
+  _updateViews() {
     // Do not update the status indicators during batch loads of download items.
     if (this._loading) {
       return;
     }
 
     this._refreshProperties();
     this._views.forEach(this._updateView, this);
   },
 
   /**
    * Updates the specified view with the current aggregate values.
    *
    * @param aView
    *        DownloadsIndicatorView object to be updated.
    */
-  _updateView: function DID_updateView(aView)
-  {
+  _updateView(aView) {
     aView.hasDownloads = this._hasDownloads;
     aView.counter = this._counter;
     aView.percentComplete = this._percentComplete;
     aView.paused = this._paused;
     aView.attention = this._attention && !this._attentionSuppressed;
   },
 
   //////////////////////////////////////////////////////////////////////////////
@@ -1527,32 +1472,30 @@ DownloadsIndicatorDataCtor.prototype = {
   _lastTimeLeft: -1,
 
   /**
    * A generator function for the dataItems that this summary is currently
    * interested in. This generator is passed off to summarizeDownloads in order
    * to generate statistics about the dataItems we care about - in this case,
    * it's all dataItems for active downloads.
    */
-  _activeDataItems: function DID_activeDataItems()
-  {
+  _activeDataItems() {
     let dataItems = this._isPrivate ? PrivateDownloadsData.dataItems
                                     : DownloadsData.dataItems;
     for each (let dataItem in dataItems) {
       if (dataItem && dataItem.inProgress) {
         yield dataItem;
       }
     }
   },
 
   /**
    * Computes aggregate values based on the current state of downloads.
    */
-  _refreshProperties: function DID_refreshProperties()
-  {
+  _refreshProperties() {
     let summary =
       DownloadsCommon.summarizeDownloads(this._activeDataItems());
 
     // Determine if the indicator should be shown or get attention.
     this._hasDownloads = (this._itemCount > 0);
 
     // If all downloads are paused, show the progress indicator as paused.
     this._paused = summary.numActive > 0 &&
@@ -1640,129 +1583,118 @@ DownloadsSummaryData.prototype = {
   __proto__: DownloadsViewPrototype,
 
   /**
    * Removes an object previously added using addView.
    *
    * @param aView
    *        DownloadsSummary view to be removed.
    */
-  removeView: function DSD_removeView(aView)
-  {
+  removeView(aView) {
     DownloadsViewPrototype.removeView.call(this, aView);
 
     if (this._views.length == 0) {
       // Clear out our collection of DownloadDataItems. If we ever have
       // another view registered with us, this will get re-populated.
       this._dataItems = [];
     }
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsData - see the documentation in
   //// DownloadsViewPrototype for more information on what these functions
   //// are used for.
 
-  onDataLoadCompleted: function DSD_onDataLoadCompleted()
-  {
+  onDataLoadCompleted() {
     DownloadsViewPrototype.onDataLoadCompleted.call(this);
     this._updateViews();
   },
 
-  onDataItemAdded: function DSD_onDataItemAdded(aDataItem, aNewest)
-  {
+  onDataItemAdded(aDataItem, aNewest) {
     if (aNewest) {
       this._dataItems.unshift(aDataItem);
     } else {
       this._dataItems.push(aDataItem);
     }
 
     this._updateViews();
   },
 
-  onDataItemRemoved: function DSD_onDataItemRemoved(aDataItem)
-  {
+  onDataItemRemoved(aDataItem) {
     let itemIndex = this._dataItems.indexOf(aDataItem);
     this._dataItems.splice(itemIndex, 1);
     this._updateViews();
   },
 
-  getViewItem: function DSD_getViewItem(aDataItem)
-  {
+  getViewItem(aDataItem) {
     let self = this;
     return Object.freeze({
-      onStateChange: function DIVI_onStateChange(aOldState)
-      {
+      onStateChange(aOldState) {
         // Since the state of a download changed, reset the estimated time left.
         self._lastRawTimeLeft = -1;
         self._lastTimeLeft = -1;
         self._updateViews();
       },
-      onProgressChange: function DIVI_onProgressChange()
-      {
+      onProgressChange() {
         self._updateViews();
       }
     });
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Propagation of properties to our views
 
   /**
    * Computes aggregate values and propagates the changes to our views.
    */
-  _updateViews: function DSD_updateViews()
-  {
+  _updateViews() {
     // Do not update the status indicators during batch loads of download items.
     if (this._loading) {
       return;
     }
 
     this._refreshProperties();
     this._views.forEach(this._updateView, this);
   },
 
   /**
    * Updates the specified view with the current aggregate values.
    *
    * @param aView
    *        DownloadsIndicatorView object to be updated.
    */
-  _updateView: function DSD_updateView(aView)
-  {
+  _updateView(aView) {
     aView.showingProgress = this._showingProgress;
     aView.percentComplete = this._percentComplete;
     aView.description = this._description;
     aView.details = this._details;
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Property updating based on current download status
 
   /**
    * A generator function for the dataItems that this summary is currently
    * interested in. This generator is passed off to summarizeDownloads in order
    * to generate statistics about the dataItems we care about - in this case,
    * it's the dataItems in this._dataItems after the first few to exclude,
    * which was set when constructing this DownloadsSummaryData instance.
    */
-  _dataItemsForSummary: function DSD_dataItemsForSummary()
-  {
+  _dataItemsForSummary() {
     if (this._dataItems.length > 0) {
       for (let i = this._numToExclude; i < this._dataItems.length; ++i) {
         yield this._dataItems[i];
       }
     }
   },
 
   /**
    * Computes aggregate values based on the current state of downloads.
    */
-  _refreshProperties: function DSD_refreshProperties()
-  {
+  _refreshProperties() {
     // Pre-load summary with default values.
     let summary =
       DownloadsCommon.summarizeDownloads(this._dataItemsForSummary());
 
     this._description = DownloadsCommon.strings
                                        .otherDownloads2(summary.numActive);
     this._percentComplete = summary.percentComplete;
 
@@ -1782,10 +1714,10 @@ DownloadsSummaryData.prototype = {
         this._lastRawTimeLeft = summary.rawTimeLeft;
         this._lastTimeLeft = DownloadsCommon.smoothSeconds(summary.rawTimeLeft,
                                                            this._lastTimeLeft);
       }
       [this._details] = DownloadUtils.getDownloadStatusNoRate(
         summary.totalTransferred, summary.totalSize, summary.slowestSpeed,
         this._lastTimeLeft);
     }
-  }
+  },
 }
--- a/browser/components/downloads/DownloadsLogger.jsm
+++ b/browser/components/downloads/DownloadsLogger.jsm
@@ -19,17 +19,17 @@ const Cu = Components.utils;
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 this.DownloadsLogger = {
-  _generateLogMessage: function _generateLogMessage(args) {
+  _generateLogMessage(args) {
     // create a string representation of a list of arbitrary things
     let strings = [];
 
     for (let arg of args) {
       if (typeof arg === 'string') {
         strings.push(arg);
       } else if (arg === undefined) {
         strings.push('undefined');
@@ -46,31 +46,30 @@ this.DownloadsLogger = {
     return 'Downloads: ' + strings.join(' ');
   },
 
   /**
    * log() - utility function to print a list of arbitrary things
    *
    * Enable with about:config pref browser.download.debug
    */
-  log: function DL_log(...args) {
+  log(...args) {
     let output = this._generateLogMessage(args);
     dump(output + "\n");
 
     // Additionally, make the output visible in the Error Console
     Services.console.logStringMessage(output);
   },
 
   /**
    * reportError() - report an error through component utils as well as
    * our log function
    */
-  reportError: function DL_reportError(...aArgs) {
+  reportError(...aArgs) {
     // Report the error in the browser
     let output = this._generateLogMessage(aArgs);
     Cu.reportError(output);
     dump("ERROR:" + output + "\n");
     for (let frame = Components.stack.caller; frame; frame = frame.caller) {
       dump("\t" + frame + "\n");
     }
-  }
-
+  },
 };
--- a/browser/components/downloads/DownloadsTaskbar.jsm
+++ b/browser/components/downloads/DownloadsTaskbar.jsm
@@ -77,18 +77,17 @@ this.DownloadsTaskbar = {
    *
    * On Mac OS X, the indicator is initialized globally when this method is
    * called for the first time.  Subsequent calls have no effect.
    *
    * @param aBrowserWindow
    *        nsIDOMWindow object of the newly opened browser window to which the
    *        indicator may be attached.
    */
-  registerIndicator: function (aBrowserWindow)
-  {
+  registerIndicator(aBrowserWindow) {
     if (!this._taskbarProgress) {
       if (gMacTaskbarProgress) {
         // On Mac OS X, we have to register the global indicator only once.
         this._taskbarProgress = gMacTaskbarProgress;
         // Free the XPCOM reference on shutdown, to prevent detecting a leak.
         Services.obs.addObserver(() => {
           this._taskbarProgress = null;
           gMacTaskbarProgress = null;
@@ -115,18 +114,17 @@ this.DownloadsTaskbar = {
         return this._summary.addView(this);
       }).then(null, Cu.reportError);
     }
   },
 
   /**
    * On Windows, attaches the taskbar indicator to the specified browser window.
    */
-  _attachIndicator: function (aWindow)
-  {
+  _attachIndicator(aWindow) {
     // Activate the indicator on the specified window.
     let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIWebNavigation)
                           .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
                           .QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIXULWindow).docShell;
     this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell);
 
@@ -150,18 +148,17 @@ this.DownloadsTaskbar = {
         this._taskbarProgress = null;
       }
     }, false);
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// DownloadSummary view
 
-  onSummaryChanged: function ()
-  {
+  onSummaryChanged() {
     // If the last browser window has been closed, we have no indicator any more.
     if (!this._taskbarProgress) {
       return;
     }
 
     if (this._summary.allHaveStopped || this._summary.progressTotalBytes == 0) {
       this._taskbarProgress.setProgressState(
                                Ci.nsITaskbarProgress.STATE_NO_PROGRESS, 0, 0);
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -71,152 +71,167 @@ const NOT_AVAILABLE = Number.MAX_VALUE;
  */
 function DownloadElementShell(aDataItem, aPlacesNode, aAnnotations) {
   this._element = document.createElement("richlistitem");
   this._element._shell = this;
 
   this._element.classList.add("download");
   this._element.classList.add("download-state");
 
-  if (aAnnotations)
+  if (aAnnotations) {
     this._annotations = aAnnotations;
-  if (aDataItem)
+  }
+  if (aDataItem) {
     this.dataItem = aDataItem;
-  if (aPlacesNode)
+  }
+  if (aPlacesNode) {
     this.placesNode = aPlacesNode;
+  }
 }
 
 DownloadElementShell.prototype = {
   // The richlistitem for the download
   get element() this._element,
 
   /**
    * Manages the "active" state of the shell.  By default all the shells
    * without a dataItem are inactive, thus their UI is not updated.  They must
    * be activated when entering the visible area.  Session downloads are
    * always active since they always have a dataItem.
    */
-  ensureActive: function DES_ensureActive() {
+  ensureActive() {
     if (!this._active) {
       this._active = true;
       this._element.setAttribute("active", true);
       this._updateUI();
     }
   },
   get active() !!this._active,
 
   // The data item for the download
   _dataItem: null,
   get dataItem() this._dataItem,
 
   set dataItem(aValue) {
     if (this._dataItem != aValue) {
-      if (!aValue && !this._placesNode)
+      if (!aValue && !this._placesNode) {
         throw new Error("Should always have either a dataItem or a placesNode");
+      }
 
       this._dataItem = aValue;
-      if (!this.active)
+      if (!this.active) {
         this.ensureActive();
-      else
+      } else {
         this._updateUI();
+      }
     }
     return aValue;
   },
 
   _placesNode: null,
   get placesNode() this._placesNode,
   set placesNode(aValue) {
     if (this._placesNode != aValue) {
-      if (!aValue && !this._dataItem)
+      if (!aValue && !this._dataItem) {
         throw new Error("Should always have either a dataItem or a placesNode");
+      }
 
       // Preserve the annotations map if this is the first loading and we got
       // cached values.
       if (this._placesNode || !this._annotations) {
         this._annotations = new Map();
       }
 
       this._placesNode = aValue;
 
       // We don't need to update the UI if we had a data item, because
       // the places information isn't used in this case.
-      if (!this._dataItem && this.active)
+      if (!this._dataItem && this.active) {
         this._updateUI();
+      }
     }
     return aValue;
   },
 
   // The download uri (as a string)
   get downloadURI() {
-    if (this._dataItem)
-     return this._dataItem.uri;
-    if (this._placesNode)
+    if (this._dataItem) {
+      return this._dataItem.uri;
+    }
+    if (this._placesNode) {
       return this._placesNode.uri;
+    }
     throw new Error("Unexpected download element state");
   },
 
   get _downloadURIObj() {
-    if (!("__downloadURIObj" in this))
+    if (!("__downloadURIObj" in this)) {
       this.__downloadURIObj = NetUtil.newURI(this.downloadURI);
+    }
     return this.__downloadURIObj;
   },
 
-  _getIcon: function DES__getIcon() {
+  _getIcon() {
     let metaData = this.getDownloadMetaData();
-    if ("filePath" in metaData)
+    if ("filePath" in metaData) {
       return "moz-icon://" + metaData.filePath + "?size=32";
+    }
 
     if (this._placesNode) {
       // Try to extract an extension from the uri.
       let ext = this._downloadURIObj.QueryInterface(Ci.nsIURL).fileExtension;
-      if (ext)
+      if (ext) {
         return "moz-icon://." + ext + "?size=32";
+      }
       return this._placesNode.icon || "moz-icon://.unknown?size=32";
     }
-    if (this._dataItem)
+    if (this._dataItem) {
       throw new Error("Session-download items should always have a target file uri");
+    }
 
     throw new Error("Unexpected download element state");
   },
 
   // Helper for getting a places annotation set for the download.
-  _getAnnotation: function DES__getAnnotation(aAnnotation, aDefaultValue) {
+  _getAnnotation(aAnnotation, aDefaultValue) {
     let value;
-    if (this._annotations.has(aAnnotation))
+    if (this._annotations.has(aAnnotation)) {
       value = this._annotations.get(aAnnotation);
+    }
 
     // If the value is cached, or we know it doesn't exist, avoid a database
     // lookup.
     if (value === undefined) {
       try {
         value = PlacesUtils.annotations.getPageAnnotation(
           this._downloadURIObj, aAnnotation);
-      }
-      catch(ex) {
+      } catch (ex) {
         value = NOT_AVAILABLE;
       }
     }
 
     if (value === NOT_AVAILABLE) {
       if (aDefaultValue === undefined) {
         throw new Error("Could not get required annotation '" + aAnnotation +
                         "' for download with url '" + this.downloadURI + "'");
       }
       value = aDefaultValue;
     }
 
     this._annotations.set(aAnnotation, value);
     return value;
   },
 
-  _fetchTargetFileInfo: function DES__fetchTargetFileInfo(aUpdateMetaDataAndStatusUI = false) {
-    if (this._targetFileInfoFetched)
+  _fetchTargetFileInfo(aUpdateMetaDataAndStatusUI = false) {
+    if (this._targetFileInfoFetched) {
       throw new Error("_fetchTargetFileInfo should not be called if the information was already fetched");
-    if (!this.active)
+    }
+    if (!this.active) {
       throw new Error("Trying to _fetchTargetFileInfo on an inactive download shell");
+    }
 
     let path = this.getDownloadMetaData().filePath;
 
     // In previous version, the target file annotations were not set,
     // so we cannot tell where is the file.
     if (path === undefined) {
       this._targetFileInfoFetched = true;
       this._targetFileExists = false;
@@ -225,54 +240,55 @@ DownloadElementShell.prototype = {
         this._updateDownloadStatusUI();
       }
       // Here we don't need to update the download commands,
       // as the state is unknown as it was.
       return;
     }
 
     OS.File.stat(path).then(
-      function onSuccess(fileInfo) {
+      fileInfo => {
         this._targetFileInfoFetched = true;
         this._targetFileExists = true;
         this._targetFileSize = fileInfo.size;
         if (aUpdateMetaDataAndStatusUI) {
           this._metaData = null;
           this._updateDownloadStatusUI();
         }
-        if (this._element.selected)
+        if (this._element.selected) {
           goUpdateDownloadCommands();
-      }.bind(this),
+        }
+      },
 
-      function onFailure(aReason) {
+      aReason => {
         if (aReason instanceof OS.File.Error && aReason.becauseNoSuchFile) {
           this._targetFileInfoFetched = true;
           this._targetFileExists = false;
-        }
-        else {
+        } else {
           Cu.reportError("Could not fetch info for target file (reason: " +
                          aReason + ")");
         }
 
         if (aUpdateMetaDataAndStatusUI) {
           this._metaData = null;
           this._updateDownloadStatusUI();
         }
 
-        if (this._element.selected)
+        if (this._element.selected) {
           goUpdateDownloadCommands();
-      }.bind(this)
+        }
+      }
     );
   },
 
-  _getAnnotatedMetaData: function DES__getAnnotatedMetaData()
-    JSON.parse(this._getAnnotation(DOWNLOAD_META_DATA_ANNO)),
+  _getAnnotatedMetaData() {
+    return JSON.parse(this._getAnnotation(DOWNLOAD_META_DATA_ANNO));
+  },
 
-  _extractFilePathAndNameFromFileURI:
-  function DES__extractFilePathAndNameFromFileURI(aFileURI) {
+  _extractFilePathAndNameFromFileURI(aFileURI) {
     let file = Cc["@mozilla.org/network/protocol;1?name=file"]
                 .getService(Ci.nsIFileProtocolHandler)
                 .getFileFromURLSpec(aFileURI);
     return [file.path, file.leafName];
   },
 
   /**
    * Retrieve the meta data object for the download.  The following fields
@@ -291,62 +307,60 @@ DownloadElementShell.prototype = {
    *   set.  If available, it's set to the downloaded file name.  If not,
    *   the places title for the download uri is used it's set.  As a last
    *   resort, we fallback to the download uri.
    * - fileSize (only set for downloads which completed successfully):
    *   the downloaded file size.  For downloads done after the landing of
    *   bug 826991, this value is "static" - that is, it does not necessarily
    *   mean that the file is in place and has this size.
    */
-  getDownloadMetaData: function DES_getDownloadMetaData() {
+  getDownloadMetaData() {
     if (!this._metaData) {
       if (this._dataItem) {
         this._metaData = {
           state:       this._dataItem.state,
           endTime:     this._dataItem.endTime,
           fileName:    this._dataItem.target,
           displayName: this._dataItem.target
         };
-        if (this._dataItem.done)
+        if (this._dataItem.done) {
           this._metaData.fileSize = this._dataItem.maxBytes;
-        if (this._dataItem.localFile)
+        }
+        if (this._dataItem.localFile) {
           this._metaData.filePath = this._dataItem.localFile.path;
-      }
-      else {
+        }
+      } else {
         try {
           this._metaData = this._getAnnotatedMetaData();
-        }
-        catch(ex) {
-          this._metaData = { };
+        } catch (ex) {
+          this._metaData = {};
           if (this._targetFileInfoFetched && this._targetFileExists) {
             this._metaData.state = this._targetFileSize > 0 ?
               nsIDM.DOWNLOAD_FINISHED : nsIDM.DOWNLOAD_FAILED;
             this._metaData.fileSize = this._targetFileSize;
           }
 
           // This is actually the start-time, but it's the best we can get.
           this._metaData.endTime = this._placesNode.time / 1000;
         }
 
         try {
           let targetFileURI = this._getAnnotation(DESTINATION_FILE_URI_ANNO);
           [this._metaData.filePath, this._metaData.fileName] =
             this._extractFilePathAndNameFromFileURI(targetFileURI);
           this._metaData.displayName = this._metaData.fileName;
-        }
-        catch(ex) {
+        } catch (ex) {
           this._metaData.displayName = this._placesNode.title || this.downloadURI;
         }
       }
     }
     return this._metaData;
   },
 
-  // The status text for the download
-  _getStatusText: function DES__getStatusText() {
+  _getStatusText() {
     let s = DownloadsCommon.strings;
     if (this._dataItem && this._dataItem.inProgress) {
       if (this._dataItem.paused) {
         let transfer =
           DownloadUtils.getTransferTotal(this._dataItem.currBytes,
                                          this._dataItem.maxBytes);
 
          // We use the same XUL label to display both the state and the amount
@@ -428,115 +442,121 @@ DownloadElementShell.prototype = {
                                                 "progressmeter");
     }
     return this.__progressElement;
   },
 
   // Updates the download state attribute (and by that hide/unhide the
   // appropriate buttons and context menu items), the status text label,
   // and the progress meter.
-  _updateDownloadStatusUI: function  DES__updateDownloadStatusUI() {
-    if (!this.active)
+  _updateDownloadStatusUI() {
+    if (!this.active) {
       throw new Error("_updateDownloadStatusUI called for an inactive item.");
+    }
 
     let state = this.getDownloadMetaData().state;
-    if (state !== undefined)
+    if (state !== undefined) {
       this._element.setAttribute("state", state);
+    }
 
     this._element.setAttribute("status", this._getStatusText());
 
     // For past-downloads, we're done. For session-downloads, we may also need
     // to update the progress-meter.
-    if (!this._dataItem)
+    if (!this._dataItem) {
       return;
+    }
 
     // Copied from updateProgress in downloads.js.
     if (this._dataItem.starting) {
       // Before the download starts, the progress meter has its initial value.
       this._element.setAttribute("progressmode", "normal");
       this._element.setAttribute("progress", "0");
-    }
-    else if (this._dataItem.state == nsIDM.DOWNLOAD_SCANNING ||
-             this._dataItem.percentComplete == -1) {
+    } else if (this._dataItem.state == nsIDM.DOWNLOAD_SCANNING ||
+               this._dataItem.percentComplete == -1) {
       // We might not know the progress of a running download, and we don't know
       // the remaining time during the malware scanning phase.
       this._element.setAttribute("progressmode", "undetermined");
-    }
-    else {
+    } else {
       // This is a running download of which we know the progress.
       this._element.setAttribute("progressmode", "normal");
       this._element.setAttribute("progress", this._dataItem.percentComplete);
     }
 
     // Dispatch the ValueChange event for accessibility, if possible.
     if (this._progressElement) {
       let event = document.createEvent("Events");
       event.initEvent("ValueChange", true, true);
       this._progressElement.dispatchEvent(event);
     }
   },
 
-  _updateDisplayNameAndIcon: function DES__updateDisplayNameAndIcon() {
+  _updateDisplayNameAndIcon() {
     let metaData = this.getDownloadMetaData();
     this._element.setAttribute("displayName", metaData.displayName);
     this._element.setAttribute("image", this._getIcon());
   },
 
-  _updateUI: function DES__updateUI() {
-    if (!this.active)
+  _updateUI() {
+    if (!this.active) {
       throw new Error("Trying to _updateUI on an inactive download shell");
+    }
 
     this._metaData = null;
     this._targetFileInfoFetched = false;
 
     this._updateDisplayNameAndIcon();
 
     // For history downloads done in past releases, the downloads/metaData
     // annotation is not set, and therefore we cannot tell the download
     // state without the target file information.
-    if (this._dataItem || this.getDownloadMetaData().state !== undefined)
+    if (this._dataItem || this.getDownloadMetaData().state !== undefined) {
       this._updateDownloadStatusUI();
-    else
+    } else {
       this._fetchTargetFileInfo(true);
+    }
   },
 
-  placesNodeIconChanged: function DES_placesNodeIconChanged() {
-    if (!this._dataItem)
+  placesNodeIconChanged() {
+    if (!this._dataItem) {
       this._element.setAttribute("image", this._getIcon());
+    }
   },
 
-  placesNodeTitleChanged: function DES_placesNodeTitleChanged() {
+  placesNodeTitleChanged() {
     // If there's a file path, we use the leaf name for the title.
-    if (!this._dataItem && this.active && !this.getDownloadMetaData().filePath) {
+    if (!this._dataItem && this.active &&
+        !this.getDownloadMetaData().filePath) {
       this._metaData = null;
       this._updateDisplayNameAndIcon();
     }
   },
 
-  placesNodeAnnotationChanged: function DES_placesNodeAnnotationChanged(aAnnoName) {
+  placesNodeAnnotationChanged(aAnnoName) {
     this._annotations.delete(aAnnoName);
     if (!this._dataItem && this.active) {
       if (aAnnoName == DOWNLOAD_META_DATA_ANNO) {
         let metaData = this.getDownloadMetaData();
         let annotatedMetaData = this._getAnnotatedMetaData();
         metaData.endTime = annotatedMetaData.endTime;
-        if ("fileSize" in annotatedMetaData)
+        if ("fileSize" in annotatedMetaData) {
           metaData.fileSize = annotatedMetaData.fileSize;
-        else
+        } else {
           delete metaData.fileSize;
+        }
 
         if (metaData.state != annotatedMetaData.state) {
           metaData.state = annotatedMetaData.state;
-          if (this._element.selected)
+          if (this._element.selected) {
             goUpdateDownloadCommands();
+          }
         }
 
         this._updateDownloadStatusUI();
-      }
-      else if (aAnnoName == DESTINATION_FILE_URI_ANNO) {
+      } else if (aAnnoName == DESTINATION_FILE_URI_ANNO) {
         let metaData = this.getDownloadMetaData();
         let targetFileURI = this._getAnnotation(DESTINATION_FILE_URI_ANNO);
         [metaData.filePath, metaData.fileName] =
             this._extractFilePathAndNameFromFileURI(targetFileURI);
         metaData.displayName = metaData.fileName;
         this._updateDisplayNameAndIcon();
 
         if (this._targetFileInfoFetched) {
@@ -544,166 +564,175 @@ DownloadElementShell.prototype = {
           this._targetFileInfoFetched = false;
           this._fetchTargetFileInfo();
         }
       }
     }
   },
 
   /* DownloadView */
-  onStateChange: function DES_onStateChange(aOldState) {
+  onStateChange(aOldState) {
     let metaData = this.getDownloadMetaData();
     metaData.state = this.dataItem.state;
     if (aOldState != nsIDM.DOWNLOAD_FINISHED && aOldState != metaData.state) {
       // See comment in DVI_onStateChange in downloads.js (the panel-view)
       this._element.setAttribute("image", this._getIcon() + "&state=normal");
       metaData.fileSize = this._dataItem.maxBytes;
       if (this._targetFileInfoFetched) {
         this._targetFileInfoFetched = false;
         this._fetchTargetFileInfo();
       }
     }
 
     this._updateDownloadStatusUI();
-    if (this._element.selected)
+    if (this._element.selected) {
       goUpdateDownloadCommands();
-    else
+    } else {
       goUpdateCommand("downloadsCmd_clearDownloads");
+    }
   },
 
   /* DownloadView */
-  onProgressChange: function DES_onProgressChange() {
+  onProgressChange() {
     this._updateDownloadStatusUI();
   },
 
   /* nsIController */
-  isCommandEnabled: function DES_isCommandEnabled(aCommand) {
+  isCommandEnabled(aCommand) {
     // The only valid command for inactive elements is cmd_delete.
-    if (!this.active && aCommand != "cmd_delete")
+    if (!this.active && aCommand != "cmd_delete") {
       return false;
+    }
     switch (aCommand) {
-      case "downloadsCmd_open": {
+      case "downloadsCmd_open":
         // We cannot open a session download file unless it's done ("openable").
         // If it's finished, we need to make sure the file was not removed,
         // as we do for past downloads.
-        if (this._dataItem && !this._dataItem.openable)
+        if (this._dataItem && !this._dataItem.openable) {
           return false;
+        }
 
-        if (this._targetFileInfoFetched)
+        if (this._targetFileInfoFetched) {
           return this._targetFileExists;
+        }
 
         // If the target file information is not yet fetched,
         // temporarily assume that the file is in place.
         return this.getDownloadMetaData().state == nsIDM.DOWNLOAD_FINISHED;
-      }
-      case "downloadsCmd_show": {
+      case "downloadsCmd_show":
         // TODO: Bug 827010 - Handle part-file asynchronously.
         if (this._dataItem &&
-            this._dataItem.partFile && this._dataItem.partFile.exists())
+            this._dataItem.partFile && this._dataItem.partFile.exists()) {
           return true;
+        }
 
-        if (this._targetFileInfoFetched)
+        if (this._targetFileInfoFetched) {
           return this._targetFileExists;
+        }
 
         // If the target file information is not yet fetched,
         // temporarily assume that the file is in place.
         return this.getDownloadMetaData().state == nsIDM.DOWNLOAD_FINISHED;
-      }
       case "downloadsCmd_pauseResume":
-        return this._dataItem && this._dataItem.inProgress && this._dataItem.resumable;
+        return this._dataItem && this._dataItem.inProgress &&
+               this._dataItem.resumable;
       case "downloadsCmd_retry":
         // An history download can always be retried.
         return !this._dataItem || this._dataItem.canRetry;
       case "downloadsCmd_openReferrer":
         return this._dataItem && !!this._dataItem.referrer;
       case "cmd_delete":
         // The behavior in this case is somewhat unexpected, so we disallow that.
-        if (this._placesNode && this._dataItem && this._dataItem.inProgress)
+        if (this._placesNode && this._dataItem && this._dataItem.inProgress) {
           return false;
+        }
         return true;
       case "downloadsCmd_cancel":
         return this._dataItem != null;
     }
     return false;
   },
 
-  _retryAsHistoryDownload: function DES__retryAsHistoryDownload() {
+  _retryAsHistoryDownload() {
     // In future we may try to download into the same original target uri, when
     // we have it.  Though that requires verifying the path is still valid and
     // may surprise the user if he wants to be requested every time.
     let browserWin = RecentWindow.getMostRecentBrowserWindow();
     let initiatingDoc = browserWin ? browserWin.document : document;
     DownloadURL(this.downloadURI, this.getDownloadMetaData().fileName,
                 initiatingDoc);
   },
 
   /* nsIController */
-  doCommand: function DES_doCommand(aCommand) {
+  doCommand(aCommand) {
     switch (aCommand) {
       case "downloadsCmd_open": {
         let file = this._dataItem ?
           this.dataItem.localFile :
           new FileUtils.File(this.getDownloadMetaData().filePath);
 
         DownloadsCommon.openDownloadedFile(file, null, window);
         break;
       }
       case "downloadsCmd_show": {
         if (this._dataItem) {
           this._dataItem.showLocalFile();
-        }
-        else {
+        } else {
           let file = new FileUtils.File(this.getDownloadMetaData().filePath);
           DownloadsCommon.showDownloadedFile(file);
         }
         break;
       }
       case "downloadsCmd_openReferrer": {
         openURL(this._dataItem.referrer);
         break;
       }
       case "downloadsCmd_cancel": {
         this._dataItem.cancel();
         break;
       }
       case "cmd_delete": {
-        if (this._dataItem)
+        if (this._dataItem) {
           this._dataItem.remove();
-        if (this._placesNode)
+        }
+        if (this._placesNode) {
           PlacesUtils.bhistory.removePage(this._downloadURIObj);
+        }
         break;
-       }
+      }
       case "downloadsCmd_retry": {
-        if (this._dataItem)
+        if (this._dataItem) {
           this._dataItem.retry();
-        else
+        } else {
           this._retryAsHistoryDownload();
+        }
         break;
       }
       case "downloadsCmd_pauseResume": {
         this._dataItem.togglePauseResume();
         break;
       }
     }
   },
 
   // Returns whether or not the download handled by this shell should
   // show up in the search results for the given term.  Both the display
   // name for the download and the url are searched.
-  matchesSearchTerm: function DES_matchesSearchTerm(aTerm) {
-    if (!aTerm)
+  matchesSearchTerm(aTerm) {
+    if (!aTerm) {
       return true;
+    }
     aTerm = aTerm.toLowerCase();
     return this.getDownloadMetaData().displayName.toLowerCase().contains(aTerm) ||
            this.downloadURI.toLowerCase().contains(aTerm);
   },
 
   // Handles return keypress on the element (the keypress listener is
   // set in the DownloadsPlacesView object).
-  doDefaultCommand: function DES_doDefaultCommand() {
+  doDefaultCommand() {
     function getDefaultCommandForState(aState) {
       switch (aState) {
         case nsIDM.DOWNLOAD_FINISHED:
           return "downloadsCmd_open";
         case nsIDM.DOWNLOAD_PAUSED:
           return "downloadsCmd_pauseResume";
         case nsIDM.DOWNLOAD_NOTSTARTED:
         case nsIDM.DOWNLOAD_QUEUED:
@@ -716,33 +745,36 @@ DownloadElementShell.prototype = {
         case nsIDM.DOWNLOAD_BLOCKED_PARENTAL:
         case nsIDM.DOWNLOAD_DIRTY:
         case nsIDM.DOWNLOAD_BLOCKED_POLICY:
           return "downloadsCmd_openReferrer";
       }
       return "";
     }
     let command = getDefaultCommandForState(this.getDownloadMetaData().state);
-    if (command && this.isCommandEnabled(command))
+    if (command && this.isCommandEnabled(command)) {
       this.doCommand(command);
+    }
   },
 
   /**
    * At the first time an item is selected, we don't yet have
    * the target file information.  Thus the call to goUpdateDownloadCommands
    * in DPV_onSelect would result in best-guess enabled/disabled result.
    * That way we let the user perform command immediately. However, once
    * we have the target file information, we can update the commands
    * appropriately (_fetchTargetFileInfo() calls goUpdateDownloadCommands).
    */
-  onSelect: function DES_onSelect() {
-    if (!this.active)
+  onSelect() {
+    if (!this.active) {
       return;
-    if (!this._targetFileInfoFetched)
+    }
+    if (!this._targetFileInfoFetched) {
       this._fetchTargetFileInfo();
+    }
   }
 };
 
 /**
  * A Downloads Places View is a places view designed to show a places query
  * for history downloads alongside the current "session"-downloads.
  *
  * As we don't use the places controller, some methods implemented by other
@@ -778,58 +810,58 @@ function DownloadsPlacesView(aRichListBo
   this._downloadsData = DownloadsCommon.getData(window.opener || window);
   this._downloadsData.addView(this);
 
   // Get the Download button out of the attention state since we're about to
   // view all downloads.
   DownloadsCommon.getIndicatorData(window).attention = false;
 
   // Make sure to unregister the view if the window is closed.
-  window.addEventListener("unload", function() {
+  window.addEventListener("unload", () => {
     window.controllers.removeController(this);
     this._downloadsData.removeView(this);
     this.result = null;
-  }.bind(this), true);
+  }, true);
   // Resizing the window may change items visibility.
-  window.addEventListener("resize", function() {
+  window.addEventListener("resize", () => {
     this._ensureVisibleElementsAreActive();
-  }.bind(this), true);
+  }, true);
 }
 
 DownloadsPlacesView.prototype = {
   get associatedElement() this._richlistbox,
 
   get active() this._active,
   set active(val) {
     this._active = val;
     if (this._active)
       this._ensureVisibleElementsAreActive();
     return this._active;
   },
 
-  _forEachDownloadElementShellForURI:
-  function DPV__forEachDownloadElementShellForURI(aURI, aCallback) {
+  _forEachDownloadElementShellForURI(aURI, aCallback) {
     if (this._downloadElementsShellsForURI.has(aURI)) {
       let downloadElementShells = this._downloadElementsShellsForURI.get(aURI);
       for (let des of downloadElementShells) {
         aCallback(des);
       }
     }
   },
 
-  _getAnnotationsFor: function DPV_getAnnotationsFor(aURI) {
+  _getAnnotationsFor(aURI) {
     if (!this._cachedAnnotations) {
       this._cachedAnnotations = new Map();
       for (let name of [ DESTINATION_FILE_URI_ANNO,
                          DOWNLOAD_META_DATA_ANNO ]) {
         let results = PlacesUtils.annotations.getAnnotationsWithName(name);
         for (let result of results) {
           let url = result.uri.spec;
-          if (!this._cachedAnnotations.has(url))
+          if (!this._cachedAnnotations.has(url)) {
             this._cachedAnnotations.set(url, new Map());
+          }
           let m = this._cachedAnnotations.get(url);
           m.set(result.annotationName, result.annotationValue);
         }
       }
     }
 
     let annotations = this._cachedAnnotations.get(aURI);
     if (!annotations) {
@@ -867,19 +899,18 @@ DownloadsPlacesView.prototype = {
    *        @see onDataItemAdded. Ignored for history downloads.
    * @param [optional] aDocumentFragment
    *        To speed up the appending of multiple elements to the end of the
    *        list which are coming in a single batch (i.e. invalidateContainer),
    *        a document fragment may be passed to which the new elements would
    *        be appended. It's the caller's job to ensure the fragment is merged
    *        to the richlistbox at the end.
    */
-  _addDownloadData:
-  function DPV_addDownloadData(aDataItem, aPlacesNode, aNewest = false,
-                               aDocumentFragment = null) {
+  _addDownloadData(aDataItem, aPlacesNode, aNewest = false,
+                   aDocumentFragment = null) {
     let downloadURI = aPlacesNode ? aPlacesNode.uri : aDataItem.uri;
     let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI);
     if (!shellsForURI) {
       shellsForURI = new Set();
       this._downloadElementsShellsForURI.set(downloadURI, shellsForURI);
     }
 
     let newOrUpdatedShell = null;
@@ -925,45 +956,44 @@ DownloadsPlacesView.prototype = {
       // annotation changes. 
       // Otherwise we may cache NOT_AVILABLE values first for a given session
       // download, and later use these NOT_AVILABLE values when a history
       // download for the same URL is added.
       let cachedAnnotations = aPlacesNode ? this._getAnnotationsFor(downloadURI) : null;
       let shell = new DownloadElementShell(aDataItem, aPlacesNode, cachedAnnotations);
       newOrUpdatedShell = shell;
       shellsForURI.add(shell);
-      if (aDataItem)
+      if (aDataItem) {
         this._viewItemsForDataItems.set(aDataItem, shell);
-    }
-    else if (aPlacesNode) {
+      }
+    } else if (aPlacesNode) {
       for (let shell of shellsForURI) {
-        if (shell.placesNode != aPlacesNode)
+        if (shell.placesNode != aPlacesNode) {
           shell.placesNode = aPlacesNode;
+        }
       }
     }
 
     if (newOrUpdatedShell) {
       if (aNewest) {
         this._richlistbox.insertBefore(newOrUpdatedShell.element,
                                        this._richlistbox.firstChild);
         if (!this._lastSessionDownloadElement) {
           this._lastSessionDownloadElement = newOrUpdatedShell.element;
         }
         // Some operations like retrying an history download move an element to
         // the top of the richlistbox, along with other session downloads.
         // More generally, if a new download is added, should be made visible.
         this._richlistbox.ensureElementIsVisible(newOrUpdatedShell.element);
-      }
-      else if (aDataItem) {
+      } else if (aDataItem) {
         let before = this._lastSessionDownloadElement ?
           this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild;
         this._richlistbox.insertBefore(newOrUpdatedShell.element, before);
         this._lastSessionDownloadElement = newOrUpdatedShell.element;
-      }
-      else {
+      } else {
         let appendTo = aDocumentFragment || this._richlistbox;
         appendTo.appendChild(newOrUpdatedShell.element);
       }
 
       if (this.searchTerm) {
         newOrUpdatedShell.element.hidden =
           !newOrUpdatedShell.element._shell.matchesSearchTerm(this.searchTerm);
       }
@@ -972,98 +1002,99 @@ DownloadsPlacesView.prototype = {
     // If aDocumentFragment is defined this is a batch change, so it's up to
     // the caller to append the fragment and activate the visible shells.
     if (!aDocumentFragment) {
       this._ensureVisibleElementsAreActive();
       goUpdateCommand("downloadsCmd_clearDownloads");
     }
   },
 
-  _removeElement: function DPV__removeElement(aElement) {
+  _removeElement(aElement) {
     // If the element was selected exclusively, select its next
     // sibling first, if not, try for previous sibling, if any.
     if ((aElement.nextSibling || aElement.previousSibling) &&
         this._richlistbox.selectedItems &&
         this._richlistbox.selectedItems.length == 1 &&
         this._richlistbox.selectedItems[0] == aElement) {
       this._richlistbox.selectItem(aElement.nextSibling ||
                                    aElement.previousSibling);
     }
 
-    if (this._lastSessionDownloadElement == aElement)
+    if (this._lastSessionDownloadElement == aElement) {
       this._lastSessionDownloadElement = aElement.previousSibling;
+    }
 
     this._richlistbox.removeItemFromSelection(aElement);
     this._richlistbox.removeChild(aElement);
     this._ensureVisibleElementsAreActive();
     goUpdateCommand("downloadsCmd_clearDownloads");
   },
 
-  _removeHistoryDownloadFromView:
-  function DPV__removeHistoryDownloadFromView(aPlacesNode) {
+  _removeHistoryDownloadFromView(aPlacesNode) {
     let downloadURI = aPlacesNode.uri;
     let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI);
     if (shellsForURI) {
       for (let shell of shellsForURI) {
         if (shell.dataItem) {
           shell.placesNode = null;
-        }
-        else {
+        } else {
           this._removeElement(shell.element);
           shellsForURI.delete(shell);
           if (shellsForURI.size == 0)
             this._downloadElementsShellsForURI.delete(downloadURI);
         }
       }
     }
   },
 
-  _removeSessionDownloadFromView:
-  function DPV__removeSessionDownloadFromView(aDataItem) {
+  _removeSessionDownloadFromView(aDataItem) {
     let shells = this._downloadElementsShellsForURI.get(aDataItem.uri);
-    if (shells.size == 0)
+    if (shells.size == 0) {
       throw new Error("Should have had at leaat one shell for this uri");
+    }
 
     let shell = this.getViewItem(aDataItem);
-    if (!shells.has(shell))
+    if (!shells.has(shell)) {
       throw new Error("Missing download element shell in shells list for url");
+    }
 
     // If there's more than one item for this download uri, we can let the
     // view item for this this particular data item go away.
     // If there's only one item for this download uri, we should only
     // keep it if it is associated with a history download.
     if (shells.size > 1 || !shell.placesNode) {
       this._removeElement(shell.element);
       shells.delete(shell);
-      if (shells.size == 0)
+      if (shells.size == 0) {
         this._downloadElementsShellsForURI.delete(aDataItem.uri);
-    }
-    else {
+      }
+    } else {
       shell.dataItem = null;
       // Move it below the session-download items;
       if (this._lastSessionDownloadElement == shell.element) {
         this._lastSessionDownloadElement = shell.element.previousSibling;
-      }
-      else {
+      } else {
         let before = this._lastSessionDownloadElement ?
           this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild;
         this._richlistbox.insertBefore(shell.element, before);
       }
     }
   },
 
-  _ensureVisibleElementsAreActive:
-  function DPV__ensureVisibleElementsAreActive() {
-    if (!this.active || this._ensureVisibleTimer || !this._richlistbox.firstChild)
+  _ensureVisibleElementsAreActive() {
+    if (!this.active || this._ensureVisibleTimer ||
+        !this._richlistbox.firstChild) {
       return;
+    }
 
-    this._ensureVisibleTimer = setTimeout(function() {
+    this._ensureVisibleTimer = setTimeout(() => {
       delete this._ensureVisibleTimer;
-      if (!this._richlistbox.firstChild)
+      if (!this._richlistbox.firstChild) {
         return;
+      }
 
       let rlbRect = this._richlistbox.getBoundingClientRect();
       let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
       let nodes = winUtils.nodesFromRect(rlbRect.left, rlbRect.top,
                                          0, rlbRect.width, rlbRect.height, 0,
                                          true, false);
       // nodesFromRect returns nodes in z-index order, and for the same z-index
@@ -1071,33 +1102,36 @@ DownloadsPlacesView.prototype = {
       // be on top.
       let firstVisibleNode, lastVisibleNode;
       for (let node of nodes) {
         if (node.localName === "richlistitem" && node._shell) {
           node._shell.ensureActive();
           // The first visible node is the last match.
           firstVisibleNode = node;
           // While the last visible node is the first match.
-          if (!lastVisibleNode)
+          if (!lastVisibleNode) {
             lastVisibleNode = node;
+          }
         }
       }
 
       // Also activate the first invisible nodes in both boundaries (that is,
       // above and below the visible area) to ensure proper keyboard navigation
       // in both directions.
       let nodeBelowVisibleArea = lastVisibleNode && lastVisibleNode.nextSibling;
-      if (nodeBelowVisibleArea && nodeBelowVisibleArea._shell)
+      if (nodeBelowVisibleArea && nodeBelowVisibleArea._shell) {
         nodeBelowVisibleArea._shell.ensureActive();
+      }
 
-      let nodeABoveVisibleArea =
-        firstVisibleNode && firstVisibleNode.previousSibling;
-      if (nodeABoveVisibleArea && nodeABoveVisibleArea._shell)
-        nodeABoveVisibleArea._shell.ensureActive();
-    }.bind(this), 10);
+      let nodeAboveVisibleArea = firstVisibleNode &&
+                                 firstVisibleNode.previousSibling;
+      if (nodeAboveVisibleArea && nodeAboveVisibleArea._shell) {
+        nodeAboveVisibleArea._shell.ensureActive();
+      }
+    }, 10);
   },
 
   _place: "",
   get place() this._place,
   set place(val) {
     // Don't reload everything if we don't have to.
     if (this._place == val) {
       // XXXmano: places.js relies on this behavior (see Bug 822203).
@@ -1105,119 +1139,120 @@ DownloadsPlacesView.prototype = {
       return val;
     }
 
     this._place = val;
 
     let history = PlacesUtils.history;
     let queries = { }, options = { };
     history.queryStringToQueries(val, queries, { }, options);
-    if (!queries.value.length)
+    if (!queries.value.length) {
       queries.value = [history.getNewQuery()];
+    }
 
     let result = history.executeQueries(queries.value, queries.value.length,
                                         options.value);
     result.addObserver(this, false);
     return val;
   },
 
   _result: null,
   get result() this._result,
   set result(val) {
-    if (this._result == val)
+    if (this._result == val) {
       return val;
+    }
 
     if (this._result) {
       this._result.removeObserver(this);
       this._resultNode.containerOpen = false;
     }
 
     if (val) {
       this._result = val;
       this._resultNode = val.root;
       this._resultNode.containerOpen = true;
       this._ensureInitialSelection();
-    }
-    else {
+    } else {
       delete this._resultNode;
       delete this._result;
     }
 
     return val;
   },
 
   get selectedNodes() {
     let placesNodes = [];
     let selectedElements = this._richlistbox.selectedItems;
     for (let elt of selectedElements) {
-      if (elt._shell.placesNode)
+      if (elt._shell.placesNode) {
         placesNodes.push(elt._shell.placesNode);
+      }
     }
     return placesNodes;
   },
 
   get selectedNode() {
     let selectedNodes = this.selectedNodes;
     return selectedNodes.length == 1 ? selectedNodes[0] : null;
   },
 
   get hasSelection() this.selectedNodes.length > 0,
 
-  containerStateChanged:
-  function DPV_containerStateChanged(aNode, aOldState, aNewState) {
+  containerStateChanged(aNode, aOldState, aNewState) {
     this.invalidateContainer(aNode)
   },
 
-  invalidateContainer:
-  function DPV_invalidateContainer(aContainer) {
-    if (aContainer != this._resultNode)
+  invalidateContainer(aContainer) {
+    if (aContainer != this._resultNode) {
       throw new Error("Unexpected container node");
-    if (!aContainer.containerOpen)
+    }
+    if (!aContainer.containerOpen) {
       throw new Error("Root container for the downloads query cannot be closed");
+    }
 
     let suppressOnSelect = this._richlistbox.suppressOnSelect;
     this._richlistbox.suppressOnSelect = true;
     try {
       // Remove the invalidated history downloads from the list and unset the
       // places node for data downloads.
       // Loop backwards since _removeHistoryDownloadFromView may removeChild().
       for (let i = this._richlistbox.childNodes.length - 1; i >= 0; --i) {
         let element = this._richlistbox.childNodes[i];
-        if (element._shell.placesNode)
+        if (element._shell.placesNode) {
           this._removeHistoryDownloadFromView(element._shell.placesNode);
+        }
       }
-    }
-    finally {
+    } finally {
       this._richlistbox.suppressOnSelect = suppressOnSelect;
     }
 
     if (aContainer.childCount > 0) {
       let elementsToAppendFragment = document.createDocumentFragment();
       for (let i = 0; i < aContainer.childCount; i++) {
         try {
           this._addDownloadData(null, aContainer.getChild(i), false,
                                 elementsToAppendFragment);
-        }
-        catch(ex) {
+        } catch (ex) {
           Cu.reportError(ex);
         }
       }
 
       // _addDownloadData may not add new elements if there were already
       // data items in place.
       if (elementsToAppendFragment.firstChild) {
         this._appendDownloadsFragment(elementsToAppendFragment);
         this._ensureVisibleElementsAreActive();
       }
     }
 
     goUpdateDownloadCommands();
   },
 
-  _appendDownloadsFragment: function DPV__appendDownloadsFragment(aDOMFragment) {
+  _appendDownloadsFragment(aDOMFragment) {
     // Workaround multiple reflows hang by removing the richlistbox
     // and adding it back when we're done.
 
     // Hack for bug 836283: reset xbl fields to their old values after the
     // binding is reattached to avoid breaking the selection state
     let xblFields = new Map();
     for (let [key, value] in Iterator(this._richlistbox)) {
       xblFields.set(key, value);
@@ -1229,51 +1264,48 @@ DownloadsPlacesView.prototype = {
     this._richlistbox.appendChild(aDOMFragment);
     parentNode.insertBefore(this._richlistbox, nextSibling);
 
     for (let [key, value] of xblFields) {
       this._richlistbox[key] = value;
     }
   },
 
-  nodeInserted: function DPV_nodeInserted(aParent, aPlacesNode) {
+  nodeInserted(aParent, aPlacesNode) {
     this._addDownloadData(null, aPlacesNode);
   },
 
-  nodeRemoved: function DPV_nodeRemoved(aParent, aPlacesNode, aOldIndex) {
+  nodeRemoved(aParent, aPlacesNode, aOldIndex) {
     this._removeHistoryDownloadFromView(aPlacesNode);
   },
 
-  nodeIconChanged: function DPV_nodeIconChanged(aNode) {
-    this._forEachDownloadElementShellForURI(aNode.uri, function(aDownloadElementShell) {
-      aDownloadElementShell.placesNodeIconChanged();
-    });
+  nodeIconChanged(aNode) {
+    this._forEachDownloadElementShellForURI(aNode.uri,
+                                            des => des.placesNodeIconChanged());
   },
 
-  nodeAnnotationChanged: function DPV_nodeAnnotationChanged(aNode, aAnnoName) {
-    this._forEachDownloadElementShellForURI(aNode.uri, function(aDownloadElementShell) {
-      aDownloadElementShell.placesNodeAnnotationChanged(aAnnoName);
-    });
+  nodeAnnotationChanged(aNode, aAnnoName) {
+    this._forEachDownloadElementShellForURI(aNode.uri,
+                                            des => des.placesNodeAnnotationChanged(aAnnoName));
   },
 
-  nodeTitleChanged: function DPV_nodeTitleChanged(aNode, aNewTitle) {
-    this._forEachDownloadElementShellForURI(aNode.uri, function(aDownloadElementShell) {
-      aDownloadElementShell.placesNodeTitleChanged();
-    });
+  nodeTitleChanged(aNode, aNewTitle) {
+    this._forEachDownloadElementShellForURI(aNode.uri,
+                                            des => des.placesNodeTitleChanged());
   },
 
-  nodeKeywordChanged: function() {},
-  nodeDateAddedChanged: function() {},
-  nodeLastModifiedChanged: function() {},
-  nodeHistoryDetailsChanged: function() {},
-  nodeTagsChanged: function() {},
-  sortingChanged: function() {},
-  nodeMoved: function() {},
-  nodeURIChanged: function() {},
-  batching: function() {},
+  nodeKeywordChanged() {},
+  nodeDateAddedChanged() {},
+  nodeLastModifiedChanged() {},
+  nodeHistoryDetailsChanged() {},
+  nodeTagsChanged() {},
+  sortingChanged() {},
+  nodeMoved() {},
+  nodeURIChanged() {},
+  batching() {},
 
   get controller() this._richlistbox.controller,
 
   get searchTerm() this._searchTerm,
   set searchTerm(aValue) {
     if (this._searchTerm != aValue) {
       for (let element of this._richlistbox.childNodes) {
         element.hidden = !element._shell.matchesSearchTerm(aValue);
@@ -1293,52 +1325,53 @@ DownloadsPlacesView.prototype = {
    * To make things even more complicated, in other cases, the places data
    * may be loaded after the session downloads data.  Thus we cannot rely on
    * the order in which the data comes in.
    * We work around this by attempting to select the first element twice,
    * once after the places data is loaded and once when the session downloads
    * data is done loading.  However, if the selection has changed in-between,
    * we assume the user has already started using the view and give up.
    */
-  _ensureInitialSelection: function DPV__ensureInitialSelection() {
+  _ensureInitialSelection() {
     // Either they're both null, or the selection has not changed in between.
     if (this._richlistbox.selectedItem == this._initiallySelectedElement) {
       let firstDownloadElement = this._richlistbox.firstChild;
       if (firstDownloadElement != this._initiallySelectedElement) {
         // We may be called before _ensureVisibleElementsAreActive,
         // or before the download binding is attached. Therefore, ensure the
         // first item is activated, and pass the item to the richlistbox
         // setters only at a point we know for sure the binding is attached.
         firstDownloadElement._shell.ensureActive();
-        Services.tm.mainThread.dispatch(function() {
+        Services.tm.mainThread.dispatch(() => {
           this._richlistbox.selectedItem = firstDownloadElement;
           this._richlistbox.currentItem = firstDownloadElement;
           this._initiallySelectedElement = firstDownloadElement;
-        }.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
+        }, Ci.nsIThread.DISPATCH_NORMAL);
       }
     }
   },
 
-  onDataLoadStarting: function() { },
-  onDataLoadCompleted: function DPV_onDataLoadCompleted() {
+  onDataLoadStarting() {},
+  onDataLoadCompleted() {
     this._ensureInitialSelection();
   },
 
-  onDataItemAdded: function DPV_onDataItemAdded(aDataItem, aNewest) {
+  onDataItemAdded(aDataItem, aNewest) {
     this._addDownloadData(aDataItem, null, aNewest);
   },
 
-  onDataItemRemoved: function DPV_onDataItemRemoved(aDataItem) {
+  onDataItemRemoved(aDataItem) {
     this._removeSessionDownloadFromView(aDataItem);
   },
 
-  getViewItem: function(aDataItem)
-    this._viewItemsForDataItems.get(aDataItem, null),
+  getViewItem(aDataItem) {
+    return this._viewItemsForDataItems.get(aDataItem, null);
+  },
 
-  supportsCommand: function DPV_supportsCommand(aCommand) {
+  supportsCommand(aCommand) {
     if (DOWNLOAD_VIEW_SUPPORTED_COMMANDS.indexOf(aCommand) != -1) {
       // The clear-downloads command may be performed by the toolbar-button,
       // which can be focused on OS X.  Thus enable this command even if the
       // richlistbox is not focused.
       // For other commands, be prudent and disable them unless the richlistview
       // is focused. It's important to make the decision here rather than in
       // isCommandEnabled.  Otherwise our controller may "steal" commands from
       // other controls in the window (see goUpdateCommand &
@@ -1346,91 +1379,90 @@ DownloadsPlacesView.prototype = {
       if (document.activeElement == this._richlistbox ||
           aCommand == "downloadsCmd_clearDownloads") {
         return true;
       }
     }
     return false;
   },
 
-  isCommandEnabled: function DPV_isCommandEnabled(aCommand) {
+  isCommandEnabled(aCommand) {
     switch (aCommand) {
       case "cmd_copy":
         return this._richlistbox.selectedItems.length > 0;
       case "cmd_selectAll":
         return true;
       case "cmd_paste":
         return this._canDownloadClipboardURL();
       case "downloadsCmd_clearDownloads":
         return this._canClearDownloads();
       default:
-        return Array.every(this._richlistbox.selectedItems, function(element) {
-          return element._shell.isCommandEnabled(aCommand);
-        });
+        return Array.every(this._richlistbox.selectedItems,
+                           element => element._shell.isCommandEnabled(aCommand));
     }
   },
 
-  _canClearDownloads: function DPV__canClearDownloads() {
+  _canClearDownloads() {
     // Downloads can be cleared if there's at least one removable download in
     // the list (either a history download or a completed session download).
     // Because history downloads are always removable and are listed after the
     // session downloads, check from bottom to top.
     for (let elt = this._richlistbox.lastChild; elt; elt = elt.previousSibling) {
-      if (elt._shell.placesNode || !elt._shell.dataItem.inProgress)
+      if (elt._shell.placesNode || !elt._shell.dataItem.inProgress) {
         return true;
+      }
     }
     return false;
   },
 
-  _copySelectedDownloadsToClipboard:
-  function DPV__copySelectedDownloadsToClipboard() {
+  _copySelectedDownloadsToClipboard() {
     let selectedElements = this._richlistbox.selectedItems;
     let urls = [e._shell.downloadURI for each (e in selectedElements)];
 
     Cc["@mozilla.org/widget/clipboardhelper;1"].
     getService(Ci.nsIClipboardHelper).copyString(urls.join("\n"), document);
   },
 
-  _getURLFromClipboardData: function DPV__getURLFromClipboardData() {
+  _getURLFromClipboardData() {
     let trans = Cc["@mozilla.org/widget/transferable;1"].
                 createInstance(Ci.nsITransferable);
     trans.init(null);
 
     let flavors = ["text/x-moz-url", "text/unicode"];
     flavors.forEach(trans.addDataFlavor);
 
     Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);
 
     // Getting the data or creating the nsIURI might fail.
     try {
       let data = {};
       trans.getAnyTransferData({}, data, {});
       let [url, name] = data.value.QueryInterface(Ci.nsISupportsString)
                             .data.split("\n");
-      if (url)
+      if (url) {
         return [NetUtil.newURI(url, null, null).spec, name];
-    }
-    catch(ex) { }
+      }
+    } catch (ex) {}
 
     return ["", ""];
   },
 
-  _canDownloadClipboardURL: function DPV__canDownloadClipboardURL() {
+  _canDownloadClipboardURL() {
     let [url, name] = this._getURLFromClipboardData();
     return url != "";
   },
 
-  _downloadURLFromClipboard: function DPV__downloadURLFromClipboard() {
+  _downloadURLFromClipboard() {
     let [url, name] = this._getURLFromClipboardData();
     let browserWin = RecentWindow.getMostRecentBrowserWindow();
     let initiatingDoc = browserWin ? browserWin.document : document;
     DownloadURL(url, name, initiatingDoc);
   },
 
-  doCommand: function DPV_doCommand(aCommand) {
+  doCommand(aCommand) {
     switch (aCommand) {
       case "cmd_copy":
         this._copySelectedDownloadsToClipboard();
         break;
       case "cmd_selectAll":
         this._richlistbox.selectAll();
         break;
       case "cmd_paste":
@@ -1455,140 +1487,152 @@ DownloadsPlacesView.prototype = {
         let selectedElements = this._richlistbox.selectedItems.slice();
         for (let element of selectedElements) {
           element._shell.doCommand(aCommand);
         }
       }
     }
   },
 
-  onEvent: function() { },
+  onEvent() {},
 
-  onContextMenu: function DPV_onContextMenu(aEvent)
-  {
+  onContextMenu(aEvent) {
     let element = this._richlistbox.selectedItem;
-    if (!element || !element._shell)
+    if (!element || !element._shell) {
       return false;
+    }
 
     // Set the state attribute so that only the appropriate items are displayed.
     let contextMenu = document.getElementById("downloadsContextMenu");
     let state = element._shell.getDownloadMetaData().state;
-    if (state !== undefined)
+    if (state !== undefined) {
       contextMenu.setAttribute("state", state);
-    else
+    } else {
       contextMenu.removeAttribute("state");
+    }
 
     if (state == nsIDM.DOWNLOAD_DOWNLOADING) {
       // The resumable property of a download may change at any time, so
       // ensure we update the related command now.
       goUpdateCommand("downloadsCmd_pauseResume");
     }
     return true;
   },
 
-  onKeyPress: function DPV_onKeyPress(aEvent) {
+  onKeyPress(aEvent) {
     let selectedElements = this._richlistbox.selectedItems;
     if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
       // In the content tree, opening bookmarks by pressing return is only
       // supported when a single item is selected. To be consistent, do the
       // same here.
       if (selectedElements.length == 1) {
         let element = selectedElements[0];
-        if (element._shell)
+        if (element._shell) {
           element._shell.doDefaultCommand();
+        }
       }
     }
     else if (aEvent.charCode == " ".charCodeAt(0)) {
       // Pause/Resume every selected download
       for (let element of selectedElements) {
-        if (element._shell.isCommandEnabled("downloadsCmd_pauseResume"))
+        if (element._shell.isCommandEnabled("downloadsCmd_pauseResume")) {
           element._shell.doCommand("downloadsCmd_pauseResume");
+        }
       }
     }
   },
 
-  onDoubleClick: function DPV_onDoubleClick(aEvent) {
-    if (aEvent.button != 0)
+  onDoubleClick(aEvent) {
+    if (aEvent.button != 0) {
       return;
+    }
 
     let selectedElements = this._richlistbox.selectedItems;
-    if (selectedElements.length != 1)
+    if (selectedElements.length != 1) {
       return;
+    }
 
     let element = selectedElements[0];
-    if (element._shell)
+    if (element._shell) {
       element._shell.doDefaultCommand();
+    }
   },
 
-  onScroll: function DPV_onScroll() {
+  onScroll() {
     this._ensureVisibleElementsAreActive();
   },
 
-  onSelect: function DPV_onSelect() {
+  onSelect() {
     goUpdateDownloadCommands();
 
     let selectedElements = this._richlistbox.selectedItems;
     for (let elt of selectedElements) {
-      if (elt._shell)
+      if (elt._shell) {
         elt._shell.onSelect();
+      }
     }
   },
 
-  onDragStart: function DPV_onDragStart(aEvent) {
+  onDragStart(aEvent) {
     // TODO Bug 831358: Support d&d for multiple selection.
     // For now, we just drag the first element.
     let selectedItem = this._richlistbox.selectedItem;
-    if (!selectedItem)
+    if (!selectedItem) {
       return;
+    }
 
     let metaData = selectedItem._shell.getDownloadMetaData();
-    if (!("filePath" in metaData))
+    if (!("filePath" in metaData)) {
       return;
+    }
     let file = new FileUtils.File(metaData.filePath);
-    if (!file.exists())
+    if (!file.exists()) {
       return;
+    }
 
     let dt = aEvent.dataTransfer;
     dt.mozSetDataAt("application/x-moz-file", file, 0);
     let url = Services.io.newFileURI(file).spec;
     dt.setData("text/uri-list", url);
     dt.setData("text/plain", url);
     dt.effectAllowed = "copyMove";
     dt.addElement(selectedItem);
   },
 
-  onDragOver: function DPV_onDragOver(aEvent) {
+  onDragOver(aEvent) {
     let types = aEvent.dataTransfer.types;
     if (types.contains("text/uri-list") ||
         types.contains("text/x-moz-url") ||
         types.contains("text/plain")) {
       aEvent.preventDefault();
     }
   },
 
-  onDrop: function DPV_onDrop(aEvent) {
+  onDrop(aEvent) {
     let dt = aEvent.dataTransfer;
     // If dragged item is from our source, do not try to
     // redownload already downloaded file.
-    if (dt.mozGetDataAt("application/x-moz-file", 0))
+    if (dt.mozGetDataAt("application/x-moz-file", 0)) {
       return;
+    }
 
-    let name = { };
+    let name = {};
     let url = Services.droppedLinkHandler.dropLink(aEvent, name);
     if (url) {
       let browserWin = RecentWindow.getMostRecentBrowserWindow();
       let initiatingDoc = browserWin ? browserWin.document : document;
       DownloadURL(url, name.value, initiatingDoc);
     }
-  }
+  },
 };
 
 for (let methodName of ["load", "applyFilter", "selectNode", "selectItems"]) {
-  DownloadsPlacesView.prototype[methodName] = function() {
-    throw new Error("|" + methodName + "| is not implemented by the downloads view.");
+  DownloadsPlacesView.prototype[methodName] = function () {
+    throw new Error("|" + methodName +
+                    "| is not implemented by the downloads view.");
   }
 }
 
 function goUpdateDownloadCommands() {
   for (let command of DOWNLOAD_VIEW_SUPPORTED_COMMANDS) {
     goUpdateCommand(command);
   }
 }
--- a/browser/components/downloads/content/contentAreaDownloadsView.js
+++ b/browser/components/downloads/content/contentAreaDownloadsView.js
@@ -1,15 +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/. */
 
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 let ContentAreaDownloadsView = {
-  init: function CADV_init() {
+  init() {
     let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
     // Do not display the Places downloads in private windows
     if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
       view.place = "place:transition=7&sort=4";
     }
-  }
+  },
 };
old mode 100644
new mode 100755
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -116,18 +116,17 @@ const DownloadsPanel = {
 
   /**
    * Starts loading the download data in background, without opening the panel.
    * Use showPanel instead to load the data and open the panel at the same time.
    *
    * @param aCallback
    *        Called when initialization is complete.
    */
-  initialize: function DP_initialize(aCallback)
-  {
+  initialize(aCallback) {
     DownloadsCommon.log("Attempting to initialize DownloadsPanel for a window.");
     if (this._state != this.kStateUninitialized) {
       DownloadsCommon.log("DownloadsPanel is already initialized.");
       DownloadsOverlayLoader.ensureOverlayLoaded(this.kDownloadsOverlay,
                                                  aCallback);
       return;
     }
     this._state = this.kStateHidden;
@@ -136,18 +135,17 @@ const DownloadsPanel = {
 
     // Load and resume active downloads if required.  If there are downloads to
     // be shown in the panel, they will be loaded asynchronously.
     DownloadsCommon.initializeAllDataLinks();
 
     // Now that data loading has eventually started, load the required XUL
     // elements and initialize our views.
     DownloadsCommon.log("Ensuring DownloadsPanel overlay loaded.");
-    DownloadsOverlayLoader.ensureOverlayLoaded(this.kDownloadsOverlay,
-                                               function DP_I_callback() {
+    DownloadsOverlayLoader.ensureOverlayLoaded(this.kDownloadsOverlay, () => {
       DownloadsViewController.initialize();
       DownloadsCommon.log("Attaching DownloadsView...");
       DownloadsCommon.getData(window).addView(DownloadsView);
       DownloadsCommon.getSummary(window, DownloadsView.kItemCountLimit)
                      .addView(DownloadsSummary);
       DownloadsCommon.log("DownloadsView attached - the panel for this window",
                           "should now see download items come in.");
       DownloadsPanel._attachEventListeners();
@@ -156,18 +154,17 @@ const DownloadsPanel = {
     });
   },
 
   /**
    * Closes the downloads panel and frees the internal resources related to the
    * downloads.  The downloads panel can be reopened later, even after this
    * function has been called.
    */
-  terminate: function DP_terminate()
-  {
+  terminate() {
     DownloadsCommon.log("Attempting to terminate DownloadsPanel for a window.");
     if (this._state == this.kStateUninitialized) {
       DownloadsCommon.log("DownloadsPanel was never initialized. Nothing to do.");
       return;
     }
 
     window.removeEventListener("unload", this.onWindowUnload, false);
 
@@ -188,62 +185,59 @@ const DownloadsPanel = {
 
   //////////////////////////////////////////////////////////////////////////////
   //// Panel interface
 
   /**
    * Main panel element in the browser window, or null if the panel overlay
    * hasn't been loaded yet.
    */
-  get panel()
-  {
+  get panel() {
     // If the downloads panel overlay hasn't loaded yet, just return null
     // without resetting this.panel.
     let downloadsPanel = document.getElementById("downloadsPanel");
     if (!downloadsPanel)
       return null;
 
     delete this.panel;
     return this.panel = downloadsPanel;
   },
 
   /**
    * Starts opening the downloads panel interface, anchored to the downloads
    * button of the browser window.  The list of downloads to display is
    * initialized the first time this method is called, and the panel is shown
    * only when data is ready.
    */
-  showPanel: function DP_showPanel()
-  {
+  showPanel() {
     DownloadsCommon.log("Opening the downloads panel.");
 
     if (this.isPanelShowing) {
       DownloadsCommon.log("Panel is already showing - focusing instead.");
       this._focusPanel();
       return;
     }
 
-    this.initialize(function DP_SP_callback() {
+    this.initialize(() => {
       // Delay displaying the panel because this function will sometimes be
       // called while another window is closing (like the window for selecting
       // whether to save or open the file), and that would cause the panel to
       // close immediately.
-      setTimeout(function () DownloadsPanel._openPopupIfDataReady(), 0);
-    }.bind(this));
+      setTimeout(() => this._openPopupIfDataReady(), 0);
+    });
 
     DownloadsCommon.log("Waiting for the downloads panel to appear.");
     this._state = this.kStateWaitingData;
   },
 
   /**
    * Hides the downloads panel, if visible, but keeps the internal state so that
    * the panel can be reopened quickly if required.
    */
-  hidePanel: function DP_hidePanel()
-  {
+  hidePanel() {
     DownloadsCommon.log("Closing the downloads panel.");
 
     if (!this.isPanelShowing) {
       DownloadsCommon.log("Downloads panel is not showing - nothing to do.");
       return;
     }
 
     this.panel.hidePopup();
@@ -253,81 +247,74 @@ const DownloadsPanel = {
     // current state, otherwise we must update the state ourselves.
     this._state = this.kStateHidden;
     DownloadsCommon.log("Downloads panel is now closed.");
   },
 
   /**
    * Indicates whether the panel is shown or will be shown.
    */
-  get isPanelShowing()
-  {
+  get isPanelShowing() {
     return this._state == this.kStateWaitingData ||
            this._state == this.kStateWaitingAnchor ||
            this._state == this.kStateShown;
   },
 
   /**
    * Returns whether the user has started keyboard navigation.
    */
-  get keyFocusing()
-  {
+  get keyFocusing() {
     return this.panel.hasAttribute("keyfocus");
   },
 
   /**
    * Set to true if the user has started keyboard navigation, and we should be
    * showing focusrings in the panel. Also adds a mousemove event handler to
    * the panel which disables keyFocusing.
    */
-  set keyFocusing(aValue)
-  {
+  set keyFocusing(aValue) {
     if (aValue) {
       this.panel.setAttribute("keyfocus", "true");
       this.panel.addEventListener("mousemove", this);
     } else {
       this.panel.removeAttribute("keyfocus");
       this.panel.removeEventListener("mousemove", this);
     }
     return aValue;
   },
 
   /**
    * Handles the mousemove event for the panel, which disables focusring
    * visualization.
    */
-  handleEvent: function DP_handleEvent(aEvent)
-  {
+  handleEvent(aEvent) {
     if (aEvent.type == "mousemove") {
       this.keyFocusing = false;
     }
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsView
 
   /**
    * Called after data loading finished.
    */
-  onViewLoadCompleted: function DP_onViewLoadCompleted()
-  {
+  onViewLoadCompleted() {
     this._openPopupIfDataReady();
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// User interface event functions
 
-  onWindowUnload: function DP_onWindowUnload()
-  {
+  onWindowUnload() {
     // This function is registered as an event listener, we can't use "this".
     DownloadsPanel.terminate();
   },
 
-  onPopupShown: function DP_onPopupShown(aEvent)
-  {
+  onPopupShown(aEvent) {
     // Ignore events raised by nested popups.
     if (aEvent.target != aEvent.currentTarget) {
       return;
     }
 
     DownloadsCommon.log("Downloads panel has shown.");
     this._state = this.kStateShown;
 
@@ -338,18 +325,17 @@ const DownloadsPanel = {
     if (DownloadsView.richListBox.itemCount > 0 &&
         DownloadsView.richListBox.selectedIndex == -1) {
       DownloadsView.richListBox.selectedIndex = 0;
     }
 
     this._focusPanel();
   },
 
-  onPopupHidden: function DP_onPopupHidden(aEvent)
-  {
+  onPopupHidden(aEvent) {
     // Ignore events raised by nested popups.
     if (aEvent.target != aEvent.currentTarget) {
       return;
     }
 
     DownloadsCommon.log("Downloads panel has hidden.");
 
     // Removes the keyfocus attribute so that we stop handling keyboard
@@ -367,57 +353,53 @@ const DownloadsPanel = {
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Related operations
 
   /**
    * Shows or focuses the user interface dedicated to downloads history.
    */
-  showDownloadsHistory: function DP_showDownloadsHistory()
-  {
+  showDownloadsHistory() {
     DownloadsCommon.log("Showing download history.");
     // Hide the panel before showing another window, otherwise focus will return
     // to the browser window when the panel closes automatically.
     this.hidePanel();
 
     BrowserDownloadsUI();
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Internal functions
 
   /**
    * Attach event listeners to a panel element. These listeners should be
    * removed in _unattachEventListeners. This is called automatically after the
    * panel has successfully loaded.
    */
-  _attachEventListeners: function DP__attachEventListeners()
-  {
+  _attachEventListeners() {
     // Handle keydown to support accel-V.
     this.panel.addEventListener("keydown", this._onKeyDown.bind(this), false);
     // Handle keypress to be able to preventDefault() events before they reach
     // the richlistbox, for keyboard navigation.
     this.panel.addEventListener("keypress", this._onKeyPress.bind(this), false);
   },
 
   /**
    * Unattach event listeners that were added in _attachEventListeners. This
    * is called automatically on panel termination.
    */
-  _unattachEventListeners: function DP__unattachEventListeners()
-  {
+  _unattachEventListeners() {
     this.panel.removeEventListener("keydown", this._onKeyDown.bind(this),
                                    false);
     this.panel.removeEventListener("keypress", this._onKeyPress.bind(this),
                                    false);
   },
 
-  _onKeyPress: function DP__onKeyPress(aEvent)
-  {
+  _onKeyPress(aEvent) {
     // Handle unmodified keys only.
     if (aEvent.altKey || aEvent.ctrlKey || aEvent.shiftKey || aEvent.metaKey) {
       return;
     }
 
     let richListBox = DownloadsView.richListBox;
 
     // If the user has pressed the tab, up, or down cursor key, start keyboard
@@ -426,18 +408,19 @@ const DownloadsPanel = {
     // if the panel is closed.
     if ((aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_TAB ||
         aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_UP ||
         aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_DOWN) &&
         !this.keyFocusing) {
       this.keyFocusing = true;
       // Ensure there's a selection, we will show the focus ring around it and
       // prevent the richlistbox from changing the selection.
-      if (DownloadsView.richListBox.selectedIndex == -1)
+      if (DownloadsView.richListBox.selectedIndex == -1) {
         DownloadsView.richListBox.selectedIndex = 0;
+      }
       aEvent.preventDefault();
       return;
     }
 
     if (aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_DOWN) {
       // If the last element in the list is selected, or the footer is already
       // focused, focus the footer.
       if (richListBox.selectedItem === richListBox.lastChild ||
@@ -454,18 +437,17 @@ const DownloadsPanel = {
     }
   },
 
   /**
    * Keydown listener that listens for the keys to start key focusing, as well
    * as the the accel-V "paste" event, which initiates a file download if the
    * pasted item can be resolved to a URI.
    */
-  _onKeyDown: function DP__onKeyDown(aEvent)
-  {
+  _onKeyDown(aEvent) {
     // If the footer is focused and the downloads list has at least 1 element
     // in it, focus the last element in the list when going up.
     if (aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_UP &&
         document.activeElement.parentNode.id === "downloadsFooter" &&
         DownloadsView.richListBox.firstChild) {
       DownloadsView.richListBox.focus();
       DownloadsView.richListBox.selectedItem = DownloadsView.richListBox.lastChild;
       aEvent.preventDefault();
@@ -508,18 +490,17 @@ const DownloadsPanel = {
       DownloadURL(uri.spec, name, document);
     } catch (ex) {}
   },
 
   /**
    * Move focus to the main element in the downloads panel, unless another
    * element in the panel is already focused.
    */
-  _focusPanel: function DP_focusPanel()
-  {
+  _focusPanel() {
     // We may be invoked while the panel is still waiting to be shown.
     if (this._state != this.kStateShown) {
       return;
     }
 
     let element = document.commandDispatcher.focusedElement;
     while (element && element != this.panel) {
       element = element.parentNode;
@@ -531,65 +512,61 @@ const DownloadsPanel = {
         DownloadsFooter.focus();
       }
     }
   },
 
   /**
    * Opens the downloads panel when data is ready to be displayed.
    */
-  _openPopupIfDataReady: function DP_openPopupIfDataReady()
-  {
+  _openPopupIfDataReady() {
     // We don't want to open the popup if we already displayed it, or if we are
     // still loading data.
     if (this._state != this.kStateWaitingData || DownloadsView.loading) {
       return;
     }
 
     this._state = this.kStateWaitingAnchor;
 
     // Ensure the anchor is visible.  If that is not possible, show the panel
     // anchored to the top area of the window, near the default anchor position.
-    DownloadsButton.getAnchor(function DP_OPIDR_callback(aAnchor) {
+    DownloadsButton.getAnchor(anchor => {
       // If somehow we've switched states already (by getting a panel hiding
       // event before an overlay is loaded, for example), bail out.
-      if (this._state != this.kStateWaitingAnchor)
+      if (this._state != this.kStateWaitingAnchor) {
         return;
+      }
 
       // At this point, if the window is minimized, opening the panel could fail
       // without any notification, and there would be no way to either open or
       // close the panel any more.  To prevent this, check if the window is
       // minimized and in that case force the panel to the closed state.
       if (window.windowState == Ci.nsIDOMChromeWindow.STATE_MINIMIZED) {
         DownloadsButton.releaseAnchor();
         this._state = this.kStateHidden;
         return;
       }
 
+      if (!anchor) {
+        DownloadsCommon.error("Downloads button cannot be found.");
+        return;
+      }
+
       // When the panel is opened, we check if the target files of visible items
       // still exist, and update the allowed items interactions accordingly.  We
       // do these checks on a background thread, and don't prevent the panel to
       // be displayed while these checks are being performed.
       for each (let viewItem in DownloadsView._viewItems) {
         viewItem.verifyTargetExists();
       }
 
-      if (aAnchor) {
-        DownloadsCommon.log("Opening downloads panel popup.");
-        this.panel.openPopup(aAnchor, "bottomcenter topright", 0, 0, false,
-                             null);
-      } else {
-        DownloadsCommon.error("We can't find the anchor! Failure case - opening",
-                              "downloads panel on TabsToolbar. We should never",
-                              "get here!");
-        Components.utils.reportError(
-          "Downloads button cannot be found");
-      }
-    }.bind(this));
-  }
+      DownloadsCommon.log("Opening downloads panel popup.");
+      this.panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, null);
+    });
+  },
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsOverlayLoader
 
 /**
  * Allows loading the downloads panel and the status indicator interfaces on
  * demand, to improve startup performance.
@@ -617,61 +594,57 @@ const DownloadsOverlayLoader = {
    * @param aOverlay
    *        String containing the URI of the overlay to load in the current
    *        window.  If this overlay has already been loaded using this
    *        function, then the overlay is not loaded again.
    * @param aCallback
    *        Invoked when loading is completed.  If the overlay is already
    *        loaded, the function is called immediately.
    */
-  ensureOverlayLoaded: function DOL_ensureOverlayLoaded(aOverlay, aCallback)
-  {
+  ensureOverlayLoaded(aOverlay, aCallback) {
     // The overlay is already loaded, invoke the callback immediately.
     if (aOverlay in this._loadedOverlays) {
       aCallback();
       return;
     }
 
     // The callback will be invoked when loading is finished.
     this._loadRequests.push({ overlay: aOverlay, callback: aCallback });
     if (this._overlayLoading) {
       return;
     }
 
-    function DOL_EOL_loadCallback() {
+    this._overlayLoading = true;
+    DownloadsCommon.log("Loading overlay ", aOverlay);
+    document.loadOverlay(aOverlay, () => {
       this._overlayLoading = false;
       this._loadedOverlays[aOverlay] = true;
 
       this.processPendingRequests();
-    }
-
-    this._overlayLoading = true;
-    DownloadsCommon.log("Loading overlay ", aOverlay);
-    document.loadOverlay(aOverlay, DOL_EOL_loadCallback.bind(this));
+    });
   },
 
   /**
    * Re-processes all the currently pending requests, invoking the callbacks
    * and/or loading more overlays as needed.  In most cases, there will be a
    * single request for one overlay, that will be processed immediately.
    */
-  processPendingRequests: function DOL_processPendingRequests()
-  {
+  processPendingRequests() {
     // Re-process all the currently pending requests, yet allow more requests
     // to be appended at the end of the array if we're not ready for them.
     let currentLength = this._loadRequests.length;
     for (let i = 0; i < currentLength; i++) {
       let request = this._loadRequests.shift();
 
       // We must call ensureOverlayLoaded again for each request, to check if
       // the associated callback can be invoked now, or if we must still wait
       // for the associated overlay to load.
       this.ensureOverlayLoaded(request.overlay, request.callback);
     }
-  }
+  },
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsView
 
 /**
  * Builds and updates the downloads list widget, responding to changes in the
  * download state and real-time data.  In addition, handles part of the user
@@ -704,18 +677,17 @@ const DownloadsView = {
    * numeric download identifier.  There is a limited number of view items in
    * the panel at any given time.
    */
   _viewItems: {},
 
   /**
    * Called when the number of items in the list changes.
    */
-  _itemCountChanged: function DV_itemCountChanged()
-  {
+  _itemCountChanged() {
     DownloadsCommon.log("The downloads item count has changed - we are tracking",
                         this._dataItems.length, "downloads in total.");
     let count = this._dataItems.length;
     let hiddenCount = count - this.kItemCountLimit;
 
     if (count > 0) {
       DownloadsCommon.log("Setting the panel's hasdownloads attribute to true.");
       DownloadsPanel.panel.setAttribute("hasdownloads", "true");
@@ -728,48 +700,44 @@ const DownloadsView = {
     // DownloadsSummary. The DownloadsSummary will determine whether or not
     // it's appropriate to actually display the summary.
     DownloadsSummary.active = hiddenCount > 0;
   },
 
   /**
    * Element corresponding to the list of downloads.
    */
-  get richListBox()
-  {
+  get richListBox() {
     delete this.richListBox;
     return this.richListBox = document.getElementById("downloadsListBox");
   },
 
   /**
    * Element corresponding to the button for showing more downloads.
    */
-  get downloadsHistory()
-  {
+  get downloadsHistory() {
     delete this.downloadsHistory;
     return this.downloadsHistory = document.getElementById("downloadsHistory");
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsData
 
   /**
    * Called before multiple downloads are about to be loaded.
    */
-  onDataLoadStarting: function DV_onDataLoadStarting()
-  {
+  onDataLoadStarting() {
     DownloadsCommon.log("onDataLoadStarting called for DownloadsView.");
     this.loading = true;
   },
 
   /**
    * Called after data loading finished.
    */
-  onDataLoadCompleted: function DV_onDataLoadCompleted()
-  {
+  onDataLoadCompleted() {
     DownloadsCommon.log("onDataLoadCompleted called for DownloadsView.");
 
     this.loading = false;
 
     // We suppressed item count change notifications during the batch load, at
     // this point we should just call the function once.
     this._itemCountChanged();
 
@@ -786,18 +754,17 @@ const DownloadsView = {
    *        DownloadsDataItem object that was just added.
    * @param aNewest
    *        When true, indicates that this item is the most recent and should be
    *        added in the topmost position.  This happens when a new download is
    *        started.  When false, indicates that the item is the least recent
    *        and should be appended.  The latter generally happens during the
    *        asynchronous data load.
    */
-  onDataItemAdded: function DV_onDataItemAdded(aDataItem, aNewest)
-  {
+  onDataItemAdded(aDataItem, aNewest) {
     DownloadsCommon.log("A new download data item was added - aNewest =",
                         aNewest);
 
     if (aNewest) {
       this._dataItems.unshift(aDataItem);
     } else {
       this._dataItems.push(aDataItem);
     }
@@ -824,18 +791,17 @@ const DownloadsView = {
 
   /**
    * Called when a data item is removed.  Ensures that the widget associated
    * with the view item is removed from the user interface.
    *
    * @param aDataItem
    *        DownloadsDataItem object that is being removed.
    */
-  onDataItemRemoved: function DV_onDataItemRemoved(aDataItem)
-  {
+  onDataItemRemoved(aDataItem) {
     DownloadsCommon.log("A download data item was removed.");
 
     let itemIndex = this._dataItems.indexOf(aDataItem);
     this._dataItems.splice(itemIndex, 1);
 
     if (itemIndex < this.kItemCountLimit) {
       // The item to remove is visible in the panel.
       this._removeViewItem(aDataItem);
@@ -851,39 +817,38 @@ const DownloadsView = {
   /**
    * Returns the view item associated with the provided data item for this view.
    *
    * @param aDataItem
    *        DownloadsDataItem object for which the view item is requested.
    *
    * @return Object that can be used to notify item status events.
    */
-  getViewItem: function DV_getViewItem(aDataItem)
-  {
+  getViewItem(aDataItem) {
     // If the item is visible, just return it, otherwise return a mock object
     // that doesn't react to notifications.
     if (aDataItem.downloadGuid in this._viewItems) {
       return this._viewItems[aDataItem.downloadGuid];
     }
     return this._invisibleViewItem;
   },
 
   /**
    * Mock DownloadsDataItem object that doesn't react to notifications.
    */
   _invisibleViewItem: Object.freeze({
-    onStateChange: function () { },
-    onProgressChange: function () { }
+    onStateChange() {},
+    onProgressChange() {},
   }),
 
   /**
    * Creates a new view item associated with the specified data item, and adds
    * it to the top or the bottom of the list.
    */
-  _addViewItem: function DV_addViewItem(aDataItem, aNewest)
+  _addViewItem(aDataItem, aNewest)
   {
     DownloadsCommon.log("Adding a new DownloadsViewItem to the downloads list.",
                         "aNewest =", aNewest);
 
     let element = document.createElement("richlistitem");
     let viewItem = new DownloadsViewItem(aDataItem, element);
     this._viewItems[aDataItem.downloadGuid] = viewItem;
     if (aNewest) {
@@ -891,18 +856,17 @@ const DownloadsView = {
     } else {
       this.richListBox.appendChild(element);
     }
   },
 
   /**
    * Removes the view item associated with the specified data item.
    */
-  _removeViewItem: function DV_removeViewItem(aDataItem)
-  {
+  _removeViewItem(aDataItem) {
     DownloadsCommon.log("Removing a DownloadsViewItem from the downloads list.");
     let element = this.getViewItem(aDataItem)._element;
     let previousSelectedIndex = this.richListBox.selectedIndex;
     this.richListBox.removeChild(element);
     if (previousSelectedIndex != -1) {
       this.richListBox.selectedIndex = Math.min(previousSelectedIndex,
                                                 this.richListBox.itemCount - 1);
     }
@@ -917,39 +881,36 @@ const DownloadsView = {
    *
    * @param aEvent
    *        Event object for the event being handled.  If the event target is
    *        not a richlistitem that represents a download, this function will
    *        walk up the parent nodes until it finds a DOM node that is.
    * @param aCommand
    *        The command to be performed.
    */
-  onDownloadCommand: function DV_onDownloadCommand(aEvent, aCommand)
-  {
+  onDownloadCommand(aEvent, aCommand) {
     let target = aEvent.target;
     while (target.nodeName != "richlistitem") {
       target = target.parentNode;
     }
     new DownloadsViewItemController(target).doCommand(aCommand);
   },
 
-  onDownloadClick: function DV_onDownloadClick(aEvent)
-  {
+  onDownloadClick(aEvent) {
     // Handle primary clicks only, and exclude the action button.
     if (aEvent.button == 0 &&
         !aEvent.originalTarget.hasAttribute("oncommand")) {
       goDoCommand("downloadsCmd_open");
     }
   },
 
   /**
    * Handles keypress events on a download item.
    */
-  onDownloadKeyPress: function DV_onDownloadKeyPress(aEvent)
-  {
+  onDownloadKeyPress(aEvent) {
     // Pressing the key on buttons should not invoke the action because the
     // event has already been handled by the button itself.
     if (aEvent.originalTarget.hasAttribute("command") ||
         aEvent.originalTarget.hasAttribute("oncommand")) {
       return;
     }
 
     if (aEvent.charCode == " ".charCodeAt(0)) {
@@ -957,55 +918,53 @@ const DownloadsView = {
       return;
     }
 
     if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
       goDoCommand("downloadsCmd_doDefault");
     }
   },
 
-
   /**
    * Mouse listeners to handle selection on hover.
    */
-  onDownloadMouseOver: function DV_onDownloadMouseOver(aEvent)
-  {
-    if (aEvent.originalTarget.parentNode == this.richListBox)
+  onDownloadMouseOver(aEvent) {
+    if (aEvent.originalTarget.parentNode == this.richListBox) {
       this.richListBox.selectedItem = aEvent.originalTarget;
+    }
   },
-  onDownloadMouseOut: function DV_onDownloadMouseOut(aEvent)
-  {
+
+  onDownloadMouseOut(aEvent) {
     if (aEvent.originalTarget.parentNode == this.richListBox) {
       // If the destination element is outside of the richlistitem, clear the
       // selection.
       let element = aEvent.relatedTarget;
       while (element && element != aEvent.originalTarget) {
         element = element.parentNode;
       }
-      if (!element)
+      if (!element) {
         this.richListBox.selectedIndex = -1;
+      }
     }
   },
 
-  onDownloadContextMenu: function DV_onDownloadContextMenu(aEvent)
-  {
+  onDownloadContextMenu(aEvent) {
     let element = this.richListBox.selectedItem;
     if (!element) {
       return;
     }
 
     DownloadsViewController.updateCommands();
 
     // Set the state attribute so that only the appropriate items are displayed.
     let contextMenu = document.getElementById("downloadsContextMenu");
     contextMenu.setAttribute("state", element.getAttribute("state"));
   },
 
-  onDownloadDragStart: function DV_onDownloadDragStart(aEvent)
-  {
+  onDownloadDragStart(aEvent) {
     let element = this.richListBox.selectedItem;
     if (!element) {
       return;
     }
 
     let controller = new DownloadsViewItemController(element);
     let localFile = controller.dataItem.localFile;
     if (!localFile.exists()) {
@@ -1016,33 +975,32 @@ const DownloadsView = {
     dataTransfer.mozSetDataAt("application/x-moz-file", localFile, 0);
     dataTransfer.effectAllowed = "copyMove";
     var url = Services.io.newFileURI(localFile).spec;
     dataTransfer.setData("text/uri-list", url);
     dataTransfer.setData("text/plain", url);
     dataTransfer.addElement(element);
 
     aEvent.stopPropagation();
-  }
+  },
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsViewItem
 
 /**
  * Builds and updates a single item in the downloads list widget, responding to
  * changes in the download state and real-time data.
  *
  * @param aDataItem
  *        DownloadsDataItem to be associated with the view item.
  * @param aElement
  *        XUL element corresponding to the single download item in the view.
  */
-function DownloadsViewItem(aDataItem, aElement)
-{
+function DownloadsViewItem(aDataItem, aElement) {
   this._element = aElement;
   this.dataItem = aDataItem;
 
   this.lastEstimatedSecondsLeft = Infinity;
 
   // Set the URI that represents the correct icon for the target file.  As soon
   // as bug 239948 comment 12 is handled, the "file" property will be always a
   // file URL rather than a file name.  At that point we should remove the "//"
@@ -1089,18 +1047,17 @@ DownloadsViewItem.prototype = {
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsData
 
   /**
    * Called when the download state might have changed.  Sometimes the state of
    * the download might be the same as before, if the data layer received
    * multiple events for the same download.
    */
-  onStateChange: function DVI_onStateChange(aOldState)
-  {
+  onStateChange(aOldState) {
     // If a download just finished successfully, it means that the target file
     // now exists and we can extract its specific icon.  To ensure that the icon
     // is reloaded, we must change the URI used by the XUL image element, for
     // example by adding a query parameter.  Since this URI has a "moz-icon"
     // scheme, this only works if we add one of the parameters explicitly
     // supported by the nsIMozIconURI interface.
     if (aOldState != Ci.nsIDownloadManager.DOWNLOAD_FINISHED &&
         aOldState != this.dataItem.state) {
@@ -1117,28 +1074,28 @@ DownloadsViewItem.prototype = {
     this._element.setAttribute("state", this.dataItem.state);
     this._updateProgress();
     this._updateStatusLine();
   },
 
   /**
    * Called when the download progress has changed.
    */
-  onProgressChange: function DVI_onProgressChange() {
+  onProgressChange() {
     this._updateProgress();
     this._updateStatusLine();
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Functions for updating the user interface
 
   /**
    * Updates the progress bar.
    */
-  _updateProgress: function DVI_updateProgress() {
+  _updateProgress() {
     if (this.dataItem.starting) {
       // Before the download starts, the progress meter has its initial value.
       this._element.setAttribute("progressmode", "normal");
       this._element.setAttribute("progress", "0");
     } else if (this.dataItem.state == Ci.nsIDownloadManager.DOWNLOAD_SCANNING ||
                this.dataItem.percentComplete == -1) {
       // We might not know the progress of a running download, and we don't know
       // the remaining time during the malware scanning phase.
@@ -1163,17 +1120,17 @@ DownloadsViewItem.prototype = {
       this._progressElement.dispatchEvent(event);
     }
   },
 
   /**
    * Updates the main status line, including bytes transferred, bytes total,
    * download rate, and time remaining.
    */
-  _updateStatusLine: function DVI_updateStatusLine() {
+  _updateStatusLine() {
     const nsIDM = Ci.nsIDownloadManager;
 
     let status = "";
     let statusTip = "";
 
     if (this.dataItem.paused) {
       let transfer = DownloadUtils.getTransferTotal(this.dataItem.currBytes,
                                                     this.dataItem.maxBytes);
@@ -1238,18 +1195,17 @@ DownloadsViewItem.prototype = {
     this._element.setAttribute("status", status);
     this._element.setAttribute("statusTip", statusTip || status);
   },
 
   /**
    * Localized string representing the total size of completed downloads, for
    * example "1.5 MB" or "Unknown size".
    */
-  get _fileSizeText()
-  {
+  get _fileSizeText() {
     // Display the file size, but show "Unknown" for negative sizes.
     let fileSize = this.dataItem.maxBytes;
     if (fileSize < 0) {
       return DownloadsCommon.strings.sizeUnknown;
     }
     let [size, unit] = DownloadUtils.convertByteUnits(fileSize);
     return DownloadsCommon.strings.sizeWithUnits(size, unit);
   },
@@ -1259,126 +1215,118 @@ DownloadsViewItem.prototype = {
 
   /**
    * Starts checking whether the target file of a finished download is still
    * available on disk, and sets an attribute that controls how the item is
    * presented visually.
    *
    * The existence check is executed on a background thread.
    */
-  verifyTargetExists: function DVI_verifyTargetExists() {
+  verifyTargetExists() {
     // We don't need to check if the download is not finished successfully.
     if (!this.dataItem.openable) {
       return;
     }
 
-    OS.File.exists(this.dataItem.localFile.path).then(
-      function DVI_RTE_onSuccess(aExists) {
-        if (aExists) {
-          this._element.setAttribute("exists", "true");
-        } else {
-          this._element.removeAttribute("exists");
-        }
-      }.bind(this), Cu.reportError);
+    OS.File.exists(this.dataItem.localFile.path).then(aExists => {
+      if (aExists) {
+        this._element.setAttribute("exists", "true");
+      } else {
+        this._element.removeAttribute("exists");
+      }
+    }).catch(Cu.reportError);
   },
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsViewController
 
 /**
  * Handles part of the user interaction events raised by the downloads list
  * widget, in particular the "commands" that apply to multiple items, and
  * dispatches the commands that apply to individual items.
  */
 const DownloadsViewController = {
   //////////////////////////////////////////////////////////////////////////////
   //// Initialization and termination
 
-  initialize: function DVC_initialize()
-  {
+  initialize() {
     window.controllers.insertControllerAt(0, this);
   },
 
-  terminate: function DVC_terminate()
-  {
+  terminate() {
     window.controllers.removeController(this);
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// nsIController
 
-  supportsCommand: function DVC_supportsCommand(aCommand)
-  {
+  supportsCommand(aCommand) {
     // Firstly, determine if this is a command that we can handle.
     if (!(aCommand in this.commands) &&
         !(aCommand in DownloadsViewItemController.prototype.commands)) {
       return false;
     }
     // Secondly, determine if focus is on a control in the downloads list.
     let element = document.commandDispatcher.focusedElement;
     while (element && element != DownloadsView.richListBox) {
       element = element.parentNode;
     }
     // We should handle the command only if the downloads list is among the
     // ancestors of the focused element.
     return !!element;
   },
 
-  isCommandEnabled: function DVC_isCommandEnabled(aCommand)
-  {
+  isCommandEnabled(aCommand) {
     // Handle commands that are not selection-specific.
     if (aCommand == "downloadsCmd_clearList") {
       return DownloadsCommon.getData(window).canRemoveFinished;
     }
 
     // Other commands are selection-specific.
     let element = DownloadsView.richListBox.selectedItem;
     return element &&
            new DownloadsViewItemController(element).isCommandEnabled(aCommand);
   },
 
-  doCommand: function DVC_doCommand(aCommand)
-  {
+  doCommand(aCommand) {
     // If this command is not selection-specific, execute it.
     if (aCommand in this.commands) {
       this.commands[aCommand].apply(this);
       return;
     }
 
     // Other commands are selection-specific.
     let element = DownloadsView.richListBox.selectedItem;
     if (element) {
       // The doCommand function also checks if the command is enabled.
       new DownloadsViewItemController(element).doCommand(aCommand);
     }
   },
 
-  onEvent: function () { },
+  onEvent() {},
 
   //////////////////////////////////////////////////////////////////////////////
   //// Other functions
 
-  updateCommands: function DVC_updateCommands()
-  {
+  updateCommands() {
     Object.keys(this.commands).forEach(goUpdateCommand);
     Object.keys(DownloadsViewItemController.prototype.commands)
           .forEach(goUpdateCommand);
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Selection-independent commands
 
   /**
    * This object contains one key for each command that operates regardless of
    * the currently selected item in the list.
    */
   commands: {
-    downloadsCmd_clearList: function DVC_downloadsCmd_clearList()
-    {
+    downloadsCmd_clearList() {
       DownloadsCommon.getData(window).removeFinished();
     }
   }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsViewItemController
 
@@ -1395,18 +1343,17 @@ DownloadsViewItemController.prototype = 
   //////////////////////////////////////////////////////////////////////////////
   //// Command dispatching
 
   /**
    * The DownloadDataItem controlled by this object.
    */
   dataItem: null,
 
-  isCommandEnabled: function DVIC_isCommandEnabled(aCommand)
-  {
+  isCommandEnabled(aCommand) {
     switch (aCommand) {
       case "downloadsCmd_open": {
         return this.dataItem.openable && this.dataItem.localFile.exists();
       }
       case "downloadsCmd_show": {
         return this.dataItem.localFile.exists() ||
                this.dataItem.partFile.exists();
       }
@@ -1420,91 +1367,81 @@ DownloadsViewItemController.prototype = 
       case "downloadsCmd_cancel":
       case "downloadsCmd_copyLocation":
       case "downloadsCmd_doDefault":
         return true;
     }
     return false;
   },
 
-  doCommand: function DVIC_doCommand(aCommand)
-  {
+  doCommand(aCommand) {
     if (this.isCommandEnabled(aCommand)) {
       this.commands[aCommand].apply(this);
     }
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Item commands
 
   /**
    * This object contains one key for each command that operates on this item.
    *
    * In commands, the "this" identifier points to the controller item.
    */
   commands: {
-    cmd_delete: function DVIC_cmd_delete()
-    {
+    cmd_delete() {
       this.dataItem.remove();
       PlacesUtils.bhistory.removePage(NetUtil.newURI(this.dataItem.uri));
     },
 
-    downloadsCmd_cancel: function DVIC_downloadsCmd_cancel()
-    {
+    downloadsCmd_cancel() {
       this.dataItem.cancel();
     },
 
-    downloadsCmd_open: function DVIC_downloadsCmd_open()
-    {
+    downloadsCmd_open() {
       this.dataItem.openLocalFile();
 
       // We explicitly close the panel here to give the user the feedback that
       // their click has been received, and we're handling the action.
       // Otherwise, we'd have to wait for the file-type handler to execute
       // before the panel would close. This also helps to prevent the user from
       // accidentally opening a file several times.
       DownloadsPanel.hidePanel();
     },
 
-    downloadsCmd_show: function DVIC_downloadsCmd_show()
-    {
+    downloadsCmd_show() {
       this.dataItem.showLocalFile();
 
       // We explicitly close the panel here to give the user the feedback that
       // their click has been received, and we're handling the action.
       // Otherwise, we'd have to wait for the operating system file manager
       // window to open before the panel closed. This also helps to prevent the
       // user from opening the containing folder several times.
       DownloadsPanel.hidePanel();
     },
 
-    downloadsCmd_pauseResume: function DVIC_downloadsCmd_pauseResume()
-    {
+    downloadsCmd_pauseResume() {
       this.dataItem.togglePauseResume();
     },
 
-    downloadsCmd_retry: function DVIC_downloadsCmd_retry()
-    {
+    downloadsCmd_retry() {
       this.dataItem.retry();
     },
 
-    downloadsCmd_openReferrer: function DVIC_downloadsCmd_openReferrer()
-    {
+    downloadsCmd_openReferrer() {
       openURL(this.dataItem.referrer);
     },
 
-    downloadsCmd_copyLocation: function DVIC_downloadsCmd_copyLocation()
-    {
+    downloadsCmd_copyLocation() {
       let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
                       .getService(Ci.nsIClipboardHelper);
       clipboard.copyString(this.dataItem.uri, document);
     },
 
-    downloadsCmd_doDefault: function DVIC_downloadsCmd_doDefault()
-    {
+    downloadsCmd_doDefault() {
       const nsIDM = Ci.nsIDownloadManager;
 
       // Determine the default command for the current item.
       let defaultCommand = function () {
         switch (this.dataItem.state) {
           case nsIDM.DOWNLOAD_NOTSTARTED:       return "downloadsCmd_cancel";
           case nsIDM.DOWNLOAD_FINISHED:         return "downloadsCmd_open";
           case nsIDM.DOWNLOAD_FAILED:           return "downloadsCmd_retry";
@@ -1513,20 +1450,21 @@ DownloadsViewItemController.prototype = 
           case nsIDM.DOWNLOAD_QUEUED:           return "downloadsCmd_cancel";
           case nsIDM.DOWNLOAD_BLOCKED_PARENTAL: return "downloadsCmd_openReferrer";
           case nsIDM.DOWNLOAD_SCANNING:         return "downloadsCmd_show";
           case nsIDM.DOWNLOAD_DIRTY:            return "downloadsCmd_openReferrer";
           case nsIDM.DOWNLOAD_BLOCKED_POLICY:   return "downloadsCmd_openReferrer";
         }
         return "";
       }.apply(this);
-      if (defaultCommand && this.isCommandEnabled(defaultCommand))
+      if (defaultCommand && this.isCommandEnabled(defaultCommand)) {
         this.doCommand(defaultCommand);
-    }
-  }
+      }
+    },
+  },
 };
 
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsSummary
 
 /**
  * Manages the summary at the bottom of the downloads panel list if the number
@@ -1536,18 +1474,17 @@ const DownloadsSummary = {
 
   /**
    * Sets the active state of the summary. When active, the summary subscribes
    * to the DownloadsCommon DownloadsSummaryData singleton.
    *
    * @param aActive
    *        Set to true to activate the summary.
    */
-  set active(aActive)
-  {
+  set active(aActive) {
     if (aActive == this._active || !this._summaryNode) {
       return this._active;
     }
     if (aActive) {
       DownloadsCommon.getSummary(window, DownloadsView.kItemCountLimit)
                      .refreshView(this);
     } else {
       DownloadsFooter.showingSummary = false;
@@ -1564,156 +1501,145 @@ const DownloadsSummary = {
   _active: false,
 
   /**
    * Sets whether or not we show the progress bar.
    *
    * @param aShowingProgress
    *        True if we should show the progress bar.
    */
-  set showingProgress(aShowingProgress)
-  {
+  set showingProgress(aShowingProgress) {
     if (aShowingProgress) {
       this._summaryNode.setAttribute("inprogress", "true");
     } else {
       this._summaryNode.removeAttribute("inprogress");
     }
     // If progress isn't being shown, then we simply do not show the summary.
     return DownloadsFooter.showingSummary = aShowingProgress;
   },
 
   /**
    * Sets the amount of progress that is visible in the progress bar.
    *
    * @param aValue
    *        A value between 0 and 100 to represent the progress of the
    *        summarized downloads.
    */
-  set percentComplete(aValue)
-  {
+  set percentComplete(aValue) {
     if (this._progressNode) {
       this._progressNode.setAttribute("value", aValue);
     }
     return aValue;
   },
 
   /**
    * Sets the description for the download summary.
    *
    * @param aValue
    *        A string representing the description of the summarized
    *        downloads.
    */
-  set description(aValue)
-  {
+  set description(aValue) {
     if (this._descriptionNode) {
       this._descriptionNode.setAttribute("value", aValue);
       this._descriptionNode.setAttribute("tooltiptext", aValue);
     }
     return aValue;
   },
 
   /**
    * Sets the details for the download summary, such as the time remaining,
    * the amount of bytes transferred, etc.
    *
    * @param aValue
    *        A string representing the details of the summarized
    *        downloads.
    */
-  set details(aValue)
-  {
+  set details(aValue) {
     if (this._detailsNode) {
       this._detailsNode.setAttribute("value", aValue);
       this._detailsNode.setAttribute("tooltiptext", aValue);
     }
     return aValue;
   },
 
   /**
    * Focuses the root element of the summary.
    */
-  focus: function()
-  {
+  focus() {
     if (this._summaryNode) {
       this._summaryNode.focus();
     }
   },
 
   /**
    * Respond to keydown events on the Downloads Summary node.
    *
    * @param aEvent
    *        The keydown event being handled.
    */
-  onKeyDown: function DS_onKeyDown(aEvent)
-  {
+  onKeyDown(aEvent) {
     if (aEvent.charCode == " ".charCodeAt(0) ||
         aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
       DownloadsPanel.showDownloadsHistory();
     }
   },
 
   /**
    * Respond to click events on the Downloads Summary node.
    *
    * @param aEvent
    *        The click event being handled.
    */
-  onClick: function DS_onClick(aEvent)
-  {
+  onClick(aEvent) {
     DownloadsPanel.showDownloadsHistory();
   },
 
   /**
    * Element corresponding to the root of the downloads summary.
    */
-  get _summaryNode()
-  {
+  get _summaryNode() {
     let node = document.getElementById("downloadsSummary");
     if (!node) {
       return null;
     }
     delete this._summaryNode;
     return this._summaryNode = node;
   },
 
   /**
    * Element corresponding to the progress bar in the downloads summary.
    */
-  get _progressNode()
-  {
+  get _progressNode() {
     let node = document.getElementById("downloadsSummaryProgress");
     if (!node) {
       return null;
     }
     delete this._progressNode;
     return this._progressNode = node;
   },
 
   /**
    * Element corresponding to the main description of the downloads
    * summary.
    */
-  get _descriptionNode()
-  {
+  get _descriptionNode() {
     let node = document.getElementById("downloadsSummaryDescription");
     if (!node) {
       return null;
     }
     delete this._descriptionNode;
     return this._descriptionNode = node;
   },
 
   /**
    * Element corresponding to the secondary description of the downloads
    * summary.
    */
-  get _detailsNode()
-  {
+  get _detailsNode() {
     let node = document.getElementById("downloadsSummaryDetails");
     if (!node) {
       return null;
     }
     delete this._detailsNode;
     return this._detailsNode = node;
   }
 }
@@ -1727,49 +1653,46 @@ const DownloadsSummary = {
  */
 const DownloadsFooter = {
 
   /**
    * Focuses the appropriate element within the footer. If the summary
    * is visible, focus it. If not, focus the "Show All Downloads"
    * button.
    */
-  focus: function DF_focus()
-  {
+  focus() {
     if (this._showingSummary) {
       DownloadsSummary.focus();
     } else {
       DownloadsView.downloadsHistory.focus();
     }
   },
 
   _showingSummary: false,
 
   /**
    * Sets whether or not the Downloads Summary should be displayed in the
    * footer. If not, the "Show All Downloads" button is shown instead.
    */
-  set showingSummary(aValue)
-  {
+  set showingSummary(aValue) {
     if (this._footerNode) {
       if (aValue) {
         this._footerNode.setAttribute("showingsummary", "true");
       } else {
         this._footerNode.removeAttribute("showingsummary");
       }
       this._showingSummary = aValue;
     }
     return aValue;
   },
 
   /**
    * Element corresponding to the footer of the downloads panel.
    */
-  get _footerNode()
-  {
+  get _footerNode() {
     let node = document.getElementById("downloadsFooter");
     if (!node) {
       return null;
     }
     delete this._footerNode;
     return this._footerNode = node;
   }
 };
--- a/browser/components/downloads/content/indicator.js
+++ b/browser/components/downloads/content/indicator.js
@@ -42,70 +42,65 @@ const DownloadsButton = {
    */
   get kIndicatorOverlay()
       "chrome://browser/content/downloads/indicatorOverlay.xul",
 
   /**
    * Returns a reference to the downloads button position placeholder, or null
    * if not available because it has been removed from the toolbars.
    */
-  get _placeholder()
-  {
+  get _placeholder() {
     return document.getElementById("downloads-button");
   },
 
   /**
    * This function is called asynchronously just after window initialization.
    *
    * NOTE: This function should limit the input/output it performs to improve
    *       startup time.
    */
-  initializeIndicator: function DB_initializeIndicator()
-  {
+  initializeIndicator() {
     DownloadsIndicatorView.ensureInitialized();
   },
 
   /**
    * Indicates whether toolbar customization is in progress.
    */
   _customizing: false,
 
   /**
    * This function is called when toolbar customization starts.
    *
    * During customization, we never show the actual download progress indication
    * or the event notifications, but we show a neutral placeholder.  The neutral
    * placeholder is an ordinary button defined in the browser window that can be
    * moved freely between the toolbars and the customization palette.
    */
-  customizeStart: function DB_customizeStart()
-  {
+  customizeStart() {
     // Prevent the indicator from being displayed as a temporary anchor
     // during customization, even if requested using the getAnchor method.
     this._customizing = true;
     this._anchorRequested = false;
   },
 
   /**
    * This function is called when toolbar customization ends.
    */
-  customizeDone: function DB_customizeDone()
-  {
+  customizeDone() {
     this._customizing = false;
     DownloadsIndicatorView.afterCustomize();
   },
 
   /**
    * Determines the position where the indicator should appear, and moves its
    * associated element to the new position.
    *
    * @return Anchor element, or null if the indicator is not visible.
    */
-  _getAnchorInternal: function DB_getAnchorInternal()
-  {
+  _getAnchorInternal() {
     let indicator = DownloadsIndicatorView.indicator;
     if (!indicator) {
       // Exit now if the indicator overlay isn't loaded yet, or if the button
       // is not in the document.
       return null;
     }
 
     indicator.open = this._anchorRequested;
@@ -123,78 +118,68 @@ const DownloadsButton = {
   /**
    * Checks whether the indicator is, or will soon be visible in the browser
    * window.
    *
    * @param aCallback
    *        Called once the indicator overlay has loaded. Gets a boolean
    *        argument representing the indicator visibility.
    */
-  checkIsVisible: function DB_checkIsVisible(aCallback)
-  {
-    function DB_CEV_callback() {
+  checkIsVisible(aCallback) {
+    DownloadsOverlayLoader.ensureOverlayLoaded(this.kIndicatorOverlay, () => {
       if (!this._placeholder) {
         aCallback(false);
       } else {
         let element = DownloadsIndicatorView.indicator || this._placeholder;
         aCallback(isElementVisible(element.parentNode));
       }
-    }
-    DownloadsOverlayLoader.ensureOverlayLoaded(this.kIndicatorOverlay,
-                                               DB_CEV_callback.bind(this));
+    });
   },
 
   /**
    * Indicates whether we should try and show the indicator temporarily as an
    * anchor for the panel, even if the indicator would be hidden by default.
    */
   _anchorRequested: false,
 
   /**
    * Ensures that there is an anchor available for the panel.
    *
    * @param aCallback
    *        Called when the anchor is available, passing the element where the
    *        panel should be anchored, or null if an anchor is not available (for
    *        example because both the tab bar and the navigation bar are hidden).
    */
-  getAnchor: function DB_getAnchor(aCallback)
-  {
+  getAnchor(aCallback) {
     // Do not allow anchoring the panel to the element while customizing.
     if (this._customizing) {
       aCallback(null);
       return;
     }
 
-    function DB_GA_callback() {
+    DownloadsOverlayLoader.ensureOverlayLoaded(this.kIndicatorOverlay, () => {
       this._anchorRequested = true;
       aCallback(this._getAnchorInternal());
-    }
-
-    DownloadsOverlayLoader.ensureOverlayLoaded(this.kIndicatorOverlay,
-                                               DB_GA_callback.bind(this));
+    });
   },
 
   /**
    * Allows the temporary anchor to be hidden.
    */
-  releaseAnchor: function DB_releaseAnchor()
-  {
+  releaseAnchor() {
     this._anchorRequested = false;
     this._getAnchorInternal();
   },
 
-  get _tabsToolbar()
-  {
+  get _tabsToolbar() {
     delete this._tabsToolbar;
     return this._tabsToolbar = document.getElementById("TabsToolbar");
   },
 
-  get _navBar()
-  {
+  get _navBar() {
     delete this._navBar;
     return this._navBar = document.getElementById("nav-bar");
   }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsIndicatorView
 
@@ -214,32 +199,30 @@ const DownloadsIndicatorView = {
    * True when the user interface elements required to display the indicator
    * have finished loading in the browser window, and can be referenced.
    */
   _operational: false,
 
   /**
    * Prepares the downloads indicator to be displayed.
    */
-  ensureInitialized: function DIV_ensureInitialized()
-  {
+  ensureInitialized() {
     if (this._initialized) {
       return;
     }
     this._initialized = true;
 
     window.addEventListener("unload", this.onWindowUnload, false);
     DownloadsCommon.getIndicatorData(window).addView(this);
   },
 
   /**
    * Frees the internal resources related to the indicator.
    */
-  ensureTerminated: function DIV_ensureTerminated()
-  {
+  ensureTerminated() {
     if (!this._initialized) {
       return;
     }
     this._initialized = false;
 
     window.removeEventListener("unload", this.onWindowUnload, false);
     DownloadsCommon.getIndicatorData(window).removeView(this);
 
@@ -250,80 +233,75 @@ const DownloadsIndicatorView = {
     this.paused = false;
     this.attention = false;
   },
 
   /**
    * Ensures that the user interface elements required to display the indicator
    * are loaded, then invokes the given callback.
    */
-  _ensureOperational: function DIV_ensureOperational(aCallback)
-  {
+  _ensureOperational(aCallback) {
     if (this._operational) {
       if (aCallback) {
         aCallback();
       }
       return;
     }
 
     // If we don't have a _placeholder, there's no chance that the overlay
     // will load correctly: bail (and don't set _operational to true!)
     if (!DownloadsButton._placeholder) {
       return;
     }
 
-    function DIV_EO_callback() {
-      this._operational = true;
-
-      // If the view is initialized, we need to update the elements now that
-      // they are finally available in the document.
-      if (this._initialized) {
-        DownloadsCommon.getIndicatorData(window).refreshView(this);
-      }
+    DownloadsOverlayLoader.ensureOverlayLoaded(
+      DownloadsButton.kIndicatorOverlay,
+      () => {
+        this._operational = true;
 
-      if (aCallback) {
-        aCallback();
-      }
-    }
+        // If the view is initialized, we need to update the elements now that
+        // they are finally available in the document.
+        if (this._initialized) {
+          DownloadsCommon.getIndicatorData(window).refreshView(this);
+        }
 
-    DownloadsOverlayLoader.ensureOverlayLoaded(
-                                 DownloadsButton.kIndicatorOverlay,
-                                 DIV_EO_callback.bind(this));
+        if (aCallback) {
+          aCallback();
+        }
+      });
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Direct control functions
 
   /**
    * Set while we are waiting for a notification to fade out.
    */
   _notificationTimeout: null,
 
   /**
    * Check if the panel containing aNode is open.
    * @param aNode
    *        the node whose panel we're interested in.
    */
-  _isAncestorPanelOpen: function DIV_isAncestorPanelOpen(aNode)
-  {
+  _isAncestorPanelOpen(aNode) {
     while (aNode && aNode.localName != "panel") {
       aNode = aNode.parentNode;
     }
     return aNode && aNode.state == "open";
   },
 
   /**
    * If the status indicator is visible in its assigned position, shows for a
    * brief time a visual notification of a relevant event, like a new download.
    *
    * @param aType
    *        Set to "start" for new downloads, "finish" for completed downloads.
    */
-  showEventNotification: function DIV_showEventNotification(aType)
-  {
+  showEventNotification(aType) {
     if (!this._initialized) {
       return;
     }
 
     if (!DownloadsCommon.animateNotifications) {
       return;
     }
 
@@ -368,53 +346,50 @@ const DownloadsIndicatorView = {
       let leftDiff = anchorRect.left - notifierRect.left;
       let heightDiff = anchorRect.height - notifierRect.height;
       let widthDiff = anchorRect.width - notifierRect.width;
       let translateX = (leftDiff + .5 * widthDiff) + "px";
       let translateY = (topDiff + .5 * heightDiff) + "px";
       notifier.style.transform = "translate(" +  translateX + ", " + translateY + ")";
     }
     notifier.setAttribute("notification", aType);
-    this._notificationTimeout = setTimeout(function () {
+    this._notificationTimeout = setTimeout(() => {
       notifier.removeAttribute("notification");
       notifier.style.transform = '';
     }, 1000);
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsIndicatorData
 
   /**
    * Indicates whether the indicator should be shown because there are some
    * downloads to be displayed.
    */
-  set hasDownloads(aValue)
-  {
+  set hasDownloads(aValue) {
     if (this._hasDownloads != aValue || (!this._operational && aValue)) {
       this._hasDownloads = aValue;
 
       // If there is at least one download, ensure that the view elements are
       if (aValue) {
         this._ensureOperational();
       }
     }
     return aValue;
   },
-  get hasDownloads()
-  {
+  get hasDownloads() {
     return this._hasDownloads;
   },
   _hasDownloads: false,
 
   /**
    * Status text displayed in the indicator.  If this is set to an empty value,
    * then the small downloads icon is displayed instead of the text.
    */
-  set counter(aValue)
-  {
+  set counter(aValue) {
     if (!this._operational) {
       return this._counter;
     }
 
     if (this._counter !== aValue) {
       this._counter = aValue;
       if (this._counter)
         this.indicator.setAttribute("counter", "true");
@@ -428,18 +403,17 @@ const DownloadsIndicatorView = {
   },
   _counter: null,
 
   /**
    * Progress indication to display, from 0 to 100, or -1 if unknown.  The
    * progress bar is hidden if the current progress is unknown and no status
    * text is set in the "counter" property.
    */
-  set percentComplete(aValue)
-  {
+  set percentComplete(aValue) {
     if (!this._operational) {
       return this._percentComplete;
     }
 
     if (this._percentComplete !== aValue) {
       this._percentComplete = aValue;
       if (this._percentComplete >= 0)
         this.indicator.setAttribute("progress", "true");
@@ -453,18 +427,17 @@ const DownloadsIndicatorView = {
   },
   _percentComplete: null,
 
   /**
    * Indicates whether the progress won't advance because of a paused state.
    * Setting this property forces a paused progress bar to be displayed, even if
    * the current progress information is unavailable.
    */
-  set paused(aValue)
-  {
+  set paused(aValue) {
     if (!this._operational) {
       return this._paused;
     }
 
     if (this._paused != aValue) {
       this._paused = aValue;
       if (this._paused) {
         this.indicator.setAttribute("paused", "true")
@@ -474,18 +447,17 @@ const DownloadsIndicatorView = {
     }
     return aValue;
   },
   _paused: false,
 
   /**
    * Set when the indicator should draw user attention to itself.
    */
-  set attention(aValue)
-  {
+  set attention(aValue) {
     if (!this._operational) {
       return this._attention;
     }
 
     if (this._attention != aValue) {
       this._attention = aValue;
       if (aValue) {
         this.indicator.setAttribute("attention", "true");
@@ -495,42 +467,38 @@ const DownloadsIndicatorView = {
     }
     return aValue;
   },
   _attention: false,
 
   //////////////////////////////////////////////////////////////////////////////
   //// User interface event functions
 
-  onWindowUnload: function DIV_onWindowUnload()
-  {
+  onWindowUnload() {
     // This function is registered as an event listener, we can't use "this".
     DownloadsIndicatorView.ensureTerminated();
   },
 
-  onCommand: function DIV_onCommand(aEvent)
-  {
+  onCommand(aEvent) {
     // If the downloads button is in the menu panel, open the Library
     let widgetGroup = CustomizableUI.getWidget("downloads-button");
     if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
       DownloadsPanel.showDownloadsHistory();
     } else {
       DownloadsPanel.showPanel();
     }
 
     aEvent.stopPropagation();
   },
 
-  onDragOver: function DIV_onDragOver(aEvent)
-  {
+  onDragOver(aEvent) {
     browserDragAndDrop.dragOver(aEvent);
   },
 
-  onDrop: function DIV_onDrop(aEvent)
-  {
+  onDrop(aEvent) {
     let dt = aEvent.dataTransfer;
     // If dragged item is from our source, do not try to
     // redownload already downloaded file.
     if (dt.mozGetDataAt("application/x-moz-file", 0))
       return;
 
     let name = {};
     let url = browserDragAndDrop.drop(aEvent, name);
@@ -548,68 +516,63 @@ const DownloadsIndicatorView = {
   _indicator: null,
   __indicatorCounter: null,
   __indicatorProgress: null,
 
   /**
    * Returns a reference to the main indicator element, or null if the element
    * is not present in the browser window yet.
    */
-  get indicator()
-  {
+  get indicator() {
     if (this._indicator) {
       return this._indicator;
     }
 
     let indicator = document.getElementById("downloads-button");
     if (!indicator || indicator.getAttribute("indicator") != "true") {
       return null;
     }
 
     return this._indicator = indicator;
   },
 
-  get indicatorAnchor()
-  {
+  get indicatorAnchor() {
     let widget = CustomizableUI.getWidget("downloads-button")
                                .forWindow(window);
     if (widget.overflowed) {
       return widget.anchor;
     }
     return document.getElementById("downloads-indicator-anchor");
   },
 
-  get _indicatorCounter()
-  {
+  get _indicatorCounter() {
     return this.__indicatorCounter ||
       (this.__indicatorCounter = document.getElementById("downloads-indicator-counter"));
   },
 
-  get _indicatorProgress()
-  {
+  get _indicatorProgress() {
     return this.__indicatorProgress ||
       (this.__indicatorProgress = document.getElementById("downloads-indicator-progress"));
   },
 
-  get notifier()
-  {
+  get notifier() {
     return this._notifier ||
       (this._notifier = document.getElementById("downloads-notification-anchor"));
   },
 
-  _onCustomizedAway: function() {
+  _onCustomizedAway() {
     this._indicator = null;
     this.__indicatorCounter = null;
     this.__indicatorProgress = null;
   },
 
-  afterCustomize: function() {
+  afterCustomize() {
     // If the cached indicator is not the one currently in the document,
     // invalidate our references
     if (this._indicator != document.getElementById("downloads-button")) {
       this._onCustomizedAway();
       this._operational = false;
       this.ensureTerminated();
       this.ensureInitialized();
     }
-  }
+  },
 };