Bug 1207497 - Part 1: Remove use of expression closure from toolkit/, exept tests. r=Gijs
authorTooru Fujisawa <arai_a@mac.com>
Thu, 24 Sep 2015 21:20:04 +0900
changeset 264358 94d51a413fba7a8132f38073909693f04eb2f535
parent 264357 b38d6ae28083544b3951c1bd546923c4b2322af2
child 264359 e4f5f909df683b4b8556f00c18ba17ffc3c7c6ba
push id65606
push userarai_a@mac.com
push dateFri, 25 Sep 2015 08:14:49 +0000
treeherdermozilla-inbound@e4f5f909df68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1207497
milestone44.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 1207497 - Part 1: Remove use of expression closure from toolkit/, exept tests. r=Gijs
toolkit/content/viewZoomOverlay.js
toolkit/content/widgets/autocomplete.xml
toolkit/content/widgets/general.xml
toolkit/content/widgets/notification.xml
toolkit/content/widgets/popup.xml
toolkit/content/widgets/richlistbox.xml
toolkit/content/widgets/scrollbox.xml
toolkit/content/widgets/tabbox.xml
toolkit/content/widgets/toolbar.xml
toolkit/forgetaboutsite/ForgetAboutSite.jsm
toolkit/modules/DeferredTask.jsm
toolkit/modules/Http.jsm
toolkit/modules/LightweightThemeConsumer.jsm
toolkit/modules/Log.jsm
toolkit/modules/NewTabUtils.jsm
toolkit/modules/PopupNotifications.jsm
toolkit/modules/Preferences.jsm
toolkit/modules/PropertyListUtils.jsm
toolkit/mozapps/downloads/DownloadLastDir.jsm
toolkit/mozapps/downloads/DownloadUtils.jsm
toolkit/mozapps/downloads/content/downloads.js
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/LightweightThemeManager.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/AddonRepository.jsm
toolkit/mozapps/extensions/internal/PluginProvider.jsm
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/installer/precompile_cache.js
--- a/toolkit/content/viewZoomOverlay.js
+++ b/toolkit/content/viewZoomOverlay.js
@@ -63,17 +63,17 @@ var ZoomManager = {
       aBrowser.textZoom = aVal;
       aBrowser.fullZoom = 1;
     }
   },
 
   get zoomValues() {
     var zoomValues = this._prefBranch.getCharPref("toolkit.zoomManager.zoomValues")
                                      .split(",").map(parseFloat);
-    zoomValues.sort(function (a, b) a - b);
+    zoomValues.sort((a, b) => a - b);
 
     while (zoomValues[0] < this.MIN)
       zoomValues.shift();
 
     while (zoomValues[zoomValues.length - 1] > this.MAX)
       zoomValues.pop();
 
     delete this.zoomValues;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -562,17 +562,17 @@
         ]]></body>
       </method>
 
       <field name="_valueIsPasted">false</field>
       <field name="_pasteController"><![CDATA[
         ({
           _autocomplete: this,
           _kGlobalClipboard: Components.interfaces.nsIClipboard.kGlobalClipboard,
-          supportsCommand: function(aCommand) aCommand == "cmd_paste",
+          supportsCommand: aCommand => aCommand == "cmd_paste",
           doCommand: function(aCommand) {
             this._autocomplete._valueIsPasted = true;
             this._autocomplete.editor.paste(this._kGlobalClipboard);
             this._autocomplete._valueIsPasted = false;
           },
           isCommandEnabled: function(aCommand) {
             return this._autocomplete.editor.isSelectionEditable &&
                    this._autocomplete.editor.canPaste(this._kGlobalClipboard);
--- a/toolkit/content/widgets/general.xml
+++ b/toolkit/content/widgets/general.xml
@@ -214,16 +214,18 @@
       <field name="_dragBindingAlive">true</field>
       <constructor>
         if (!this._draggableStarted) {
           this._draggableStarted = true;
           try {
             let tmp = {};
             Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
             let draghandle = new tmp.WindowDraggingElement(this);
-            draghandle.mouseDownCheck = function () this._dragBindingAlive;
+            draghandle.mouseDownCheck = function () {
+              return this._dragBindingAlive;
+            };
           } catch (e) {}
         }
       </constructor>
     </implementation>
   </binding>
 
 </bindings>
--- a/toolkit/content/widgets/notification.xml
+++ b/toolkit/content/widgets/notification.xml
@@ -52,17 +52,17 @@
         </setter>
       </property>
 
       <property name="allNotifications" readonly="true">
         <getter>
         <![CDATA[
           var closedNotification = this._closedNotification;
           var notifications = this.getElementsByTagName('notification');
-          return Array.filter(notifications, function(n) n != closedNotification);
+          return Array.filter(notifications, n => n != closedNotification);
         ]]>
         </getter>
       </property>
 
       <method name="getNotificationWithValue">
         <parameter name="aValue"/>
         <body>
           <![CDATA[
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -267,17 +267,19 @@
       <constructor>
       <![CDATA[
         if (this.getAttribute("backdrag") == "true" && !this._draggableStarted) {
           this._draggableStarted = true;
           try {
             let tmp = {};
             Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
             let draghandle = new tmp.WindowDraggingElement(this);
-            draghandle.mouseDownCheck = function () this._dragBindingAlive;
+            draghandle.mouseDownCheck = function () {
+              return this._dragBindingAlive;
+            }
           } catch (e) {}
         }
       ]]>
       </constructor>
     </implementation>
     
     <handlers>
       <handler event="popupshowing"><![CDATA[
--- a/toolkit/content/widgets/richlistbox.xml
+++ b/toolkit/content/widgets/richlistbox.xml
@@ -551,17 +551,17 @@
       <property name="label" readonly="true">
         <!-- Setter purposely not implemented; the getter returns a
              concatentation of label text to expose via accessibility APIs -->
         <getter>
           <![CDATA[
             const XULNS =
               "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
             return Array.map(this.getElementsByTagNameNS(XULNS, "label"),
-                             function (label) label.value)
+                             label => label.value)
                         .join(" ");
           ]]>
         </getter>
       </property>
 
       <property name="searchLabel">
         <getter>
           <![CDATA[
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -509,17 +509,17 @@
         // horizontal support.
         // Because of this, we need to avoid scrolling chaos on trackpads
         // and mouse wheels that support simultaneous scrolling in both axes.
         // We do this by scrolling only when the last two scroll events were
         // on the same axis as the current scroll event.
         else {
           let isVertical = event.axis == event.VERTICAL_AXIS;
 
-          if (this._prevMouseScrolls.every(function(prev) prev == isVertical))
+          if (this._prevMouseScrolls.every(prev => prev == isVertical))
             this.scrollByIndex(isVertical && this._isRTLScrollbox ? -event.detail :
                                                                     event.detail);
 
           if (this._prevMouseScrolls.length > 1)
             this._prevMouseScrolls.shift();
           this._prevMouseScrolls.push(isVertical);
         }
 
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -807,17 +807,17 @@
           } catch (e) {}
 
           // Set '-moz-user-focus' to 'ignore' so that PostHandleEvent() can't
           // focus the tab; we only want tabs to be focusable by the mouse if
           // they are already focused. After a short timeout we'll reset
           // '-moz-user-focus' so that tabs can be focused by keyboard again.
           if (!isTabFocused) {
             this.setAttribute("ignorefocus", "true");
-            setTimeout(function (tab) tab.removeAttribute("ignorefocus"), 0, this);
+            setTimeout(tab => tab.removeAttribute("ignorefocus"), 0, this);
           }
 
           if (stopwatchid) {
             this.TelemetryStopwatch.finish(stopwatchid);
           }
         }
         // Otherwise this tab is already selected and we will fall
         // through to mousedown behavior which sets focus on the current tab,
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -409,17 +409,19 @@
       </destructor>
 
       <field name="_inactiveTimeout">null</field>
 
       <field name="_contextMenuListener"><![CDATA[({
         toolbar: this,
         contextMenu: null,
 
-        get active () !!this.contextMenu,
+        get active () {
+          return !!this.contextMenu;
+        },
 
         init: function (event) {
           var node = event.target;
           while (node != this.toolbar) {
             if (node.localName == "menupopup")
               return;
             node = node.parentNode;
           }
--- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm
+++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm
@@ -169,17 +169,17 @@ this.ForgetAboutSite = {
       // Everybody else (including extensions)
       Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
     }
 
     // Content Preferences
     let cps2 = Cc["@mozilla.org/content-pref/service;1"].
                getService(Ci.nsIContentPrefService2);
     cps2.removeBySubdomain(aDomain, null, {
-      handleCompletion: function() onContentPrefsRemovalFinished(),
+      handleCompletion: () => onContentPrefsRemovalFinished(),
       handleError: function() {}
     });
 
     // Predictive network data - like cache, no way to clear this per
     // domain, so just trash it all
     let np = Cc["@mozilla.org/network/predictor;1"].
              getService(Ci.nsINetworkPredictor);
     np.reset();
--- a/toolkit/modules/DeferredTask.jsm
+++ b/toolkit/modules/DeferredTask.jsm
@@ -129,25 +129,29 @@ this.DeferredTask.prototype = {
    * Time between executions, in milliseconds.
    */
   _delayMs: null,
 
   /**
    * Indicates whether the task is currently requested to start again later,
    * regardless of whether it is currently running.
    */
-  get isArmed() this._armed,
+  get isArmed() {
+    return this._armed;
+  },
   _armed: false,
 
   /**
    * Indicates whether the task is currently running.  This is always true when
    * read from code inside the task function, but can also be true when read
    * from external code, in case the task is an asynchronous generator function.
    */
-  get isRunning() !!this._runningPromise,
+  get isRunning() {
+    return !!this._runningPromise;
+  },
 
   /**
    * Promise resolved when the current execution of the task terminates, or null
    * if the task is not currently running.
    */
   _runningPromise: null,
 
   /**
--- a/toolkit/modules/Http.jsm
+++ b/toolkit/modules/Http.jsm
@@ -4,18 +4,19 @@
 
 const EXPORTED_SYMBOLS = ["httpRequest", "percentEncode"];
 
 const {classes: Cc, interfaces: Ci} = Components;
 
 // Strictly follow RFC 3986 when encoding URI components.
 // Accepts a unescaped string and returns the URI encoded string for use in
 // an HTTP request.
-function percentEncode(aString)
-  encodeURIComponent(aString).replace(/[!'()]/g, escape).replace(/\*/g, "%2A");
+function percentEncode(aString) {
+  return encodeURIComponent(aString).replace(/[!'()]/g, escape).replace(/\*/g, "%2A");
+}
 
 /*
  * aOptions can have a variety of fields:
  *  headers, an array of headers
  *  postData, this can be:
  *    a string: send it as is
  *    an array of parameters: encode as form values
  *    null/undefined: no POST data.
@@ -81,17 +82,17 @@ function httpRequest(aUrl, aOptions) {
     });
   }
 
   // Handle adding postData as defined above.
   let POSTData = aOptions.postData || null;
   if (POSTData && Array.isArray(POSTData)) {
     xhr.setRequestHeader("Content-Type",
                          "application/x-www-form-urlencoded; charset=utf-8");
-    POSTData = POSTData.map(function(p) p[0] + "=" + percentEncode(p[1]))
+    POSTData = POSTData.map(p => p[0] + "=" + percentEncode(p[1]))
                        .join("&");
   }
 
   if (aOptions.logger) {
     aOptions.logger.log("sending request to " + aUrl + " (POSTData = " +
                         POSTData + ")");
   }
   xhr.send(POSTData);
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -171,10 +171,10 @@ LightweightThemeConsumer.prototype = {
 function _setImage(aElement, aActive, aURL) {
   aElement.style.backgroundImage =
     (aActive && aURL) ? 'url("' + aURL.replace(/"/g, '\\"') + '")' : "";
 }
 
 function _parseRGB(aColorString) {
   var rgb = aColorString.match(/^rgba?\((\d+), (\d+), (\d+)/);
   rgb.shift();
-  return rgb.map(function (x) parseInt(x));
+  return rgb.map(x => parseInt(x));
 }
--- a/toolkit/modules/Log.jsm
+++ b/toolkit/modules/Log.jsm
@@ -275,17 +275,19 @@ Logger.prototype = {
     dumpError("Log warning: root logger configuration error: no level defined");
     return Log.Level.All;
   },
   set level(level) {
     this._level = level;
   },
 
   _parent: null,
-  get parent() this._parent,
+  get parent() {
+    return this._parent;
+  },
   set parent(parent) {
     if (this._parent == parent) {
       return;
     }
     // Remove ourselves from parent's children
     if (this._parent) {
       let index = this._parent.children.indexOf(this);
       if (index != -1) {
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -106,22 +106,26 @@ function LinksStorage() {
     this.clear();
   }
 
   // Set the version to the current one.
   this._storedVersion = this._version;
 }
 
 LinksStorage.prototype = {
-  get _version() 1,
+  get _version() {
+    return 1;
+  },
 
-  get _prefs() Object.freeze({
-    pinnedLinks: "browser.newtabpage.pinned",
-    blockedLinks: "browser.newtabpage.blocked",
-  }),
+  get _prefs() {
+    return Object.freeze({
+      pinnedLinks: "browser.newtabpage.pinned",
+      blockedLinks: "browser.newtabpage.blocked",
+    });
+  },
 
   get _storedVersion() {
     if (this.__storedVersion === undefined) {
       try {
         this.__storedVersion =
           Services.prefs.getIntPref("browser.newtabpage.storageVersion");
       } catch (ex) {
         // The storage version is unknown, so either:
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -168,17 +168,17 @@ PopupNotifications.prototype = {
    *        currently selected browser's notifications will be searched.
    *
    * @returns the corresponding Notification object, or null if no such
    *          notification exists.
    */
   getNotification: function PopupNotifications_getNotification(id, browser) {
     let n = null;
     let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
-    notifications.some(function(x) x.id == id && (n = x));
+    notifications.some(x => x.id == id && (n = x));
     return n;
   },
 
   /**
    * Adds a new popup notification.
    * @param browser
    *        The <xul:browser> element associated with the notification. Must not
    *        be null.
--- a/toolkit/modules/Preferences.jsm
+++ b/toolkit/modules/Preferences.jsm
@@ -45,17 +45,17 @@ this.Preferences =
  *
  * @param   valueType
  *          the XPCOM interface of the pref's complex value type, if any
  *
  * @returns the value of the pref, if any; otherwise the default value
  */
 Preferences.get = function(prefName, defaultValue, valueType = Ci.nsISupportsString) {
   if (Array.isArray(prefName))
-    return prefName.map(function(v) this.get(v, defaultValue), this);
+    return prefName.map(v => this.get(v, defaultValue));
 
   return this._get(prefName, defaultValue, valueType);
 };
 
 Preferences._get = function(prefName, defaultValue, valueType) {
   switch (this._prefBranch.getPrefType(prefName)) {
     case Ci.nsIPrefBranch.PREF_STRING:
       return this._prefBranch.getComplexValue(prefName, valueType).data;
@@ -199,17 +199,17 @@ Preferences.isSet = function(prefName) {
  * Whether or not the given pref has a user-set value. Use isSet instead,
  * which is equivalent.
  * @deprecated
  */
 Preferences.modified = function(prefName) { return this.isSet(prefName) },
 
 Preferences.reset = function(prefName) {
   if (Array.isArray(prefName)) {
-    prefName.map(function(v) this.reset(v), this);
+    prefName.map(v => this.reset(v));
     return;
   }
 
   this._prefBranch.clearUserPref(prefName);
 };
 
 /**
  * Lock a pref so it can't be changed.
@@ -307,19 +307,19 @@ Preferences.observe = function(prefName,
  */
 Preferences.ignore = function(prefName, callback, thisObject) {
   let fullPrefName = this._branchStr + (prefName || "");
 
   // This seems fairly inefficient, but I'm not sure how much better we can
   // make it.  We could index by fullBranch, but we can't index by callback
   // or thisObject, as far as I know, since the keys to JavaScript hashes
   // (a.k.a. objects) can apparently only be primitive values.
-  let [observer] = observers.filter(function(v) v.prefName   == fullPrefName &&
-                                                v.callback   == callback &&
-                                                v.thisObject == thisObject);
+  let [observer] = observers.filter(v => v.prefName   == fullPrefName &&
+                                         v.callback   == callback &&
+                                         v.thisObject == thisObject);
 
   if (observer) {
     Preferences._prefBranch.removeObserver(fullPrefName, observer);
     observers.splice(observers.indexOf(observer), 1);
   }
 };
 
 Preferences.resetBranch = function(prefBranch = "") {
--- a/toolkit/modules/PropertyListUtils.jsm
+++ b/toolkit/modules/PropertyListUtils.jsm
@@ -254,21 +254,24 @@ function BinaryPropertyListReader(aBuffe
   this._objects = [];
 }
 
 BinaryPropertyListReader.prototype = {
   /**
    * Checks if the given ArrayBuffer can be read as a binary property list.
    * It can be called on the prototype.
    */
-  canProcess: function BPLR_canProcess(aBuffer)
-    [String.fromCharCode(c) for each (c in new Uint8Array(aBuffer, 0, 8))].
-    join("") == "bplist00",
+  canProcess: function BPLR_canProcess(aBuffer) {
+    return [String.fromCharCode(c) for each (c in new Uint8Array(aBuffer, 0, 8))].
+           join("") == "bplist00";
+  },
 
-  get root() this._readObject(this._rootObjectIndex),
+  get root() {
+    return this._readObject(this._rootObjectIndex);
+  },
 
   _readTrailerInfo: function BPLR__readTrailer() {
     // The first 6 bytes of the 32-bytes trailer are unused
     let trailerOffset = this._dataView.byteLength - 26;
     [this._offsetTableIntegerSize, this._objectRefSize] =
       this._readUnsignedInts(trailerOffset, 1, 2);
 
     [this._numberOfObjects, this._rootObjectIndex, this._offsetTableOffset] =
@@ -651,17 +654,19 @@ function XMLPropertyListReader(aDOMDoc) 
   let docElt = aDOMDoc.documentElement;
   if (!docElt || docElt.localName != "plist" || !docElt.firstElementChild)
     throw new Error("aDoc is not a property list document");
 
   this._plistRootElement = docElt.firstElementChild;
 }
 
 XMLPropertyListReader.prototype = {
-  get root() this._readObject(this._plistRootElement),
+  get root() {
+    return this._readObject(this._plistRootElement);
+  },
 
   /**
    * Convert a dom element to a property list object.
    * @param aDOMElt
    *        a dom element in a xml tree of a property list.
    * @return a js object representing the property list object.
    */
   _readObject: function XPLR__readObject(aDOMElt) {
--- a/toolkit/mozapps/downloads/DownloadLastDir.jsm
+++ b/toolkit/mozapps/downloads/DownloadLastDir.jsm
@@ -101,17 +101,17 @@ this.DownloadLastDir = function Download
   };
 }
 
 DownloadLastDir.prototype = {
   isPrivate: function DownloadLastDir_isPrivate() {
     return this.fakeContext.usePrivateBrowsing;
   },
   // compat shims
-  get file() this._getLastFile(),
+  get file() { return this._getLastFile(); },
   set file(val) { this.setFile(null, val); },
   cleanupPrivateFile: function () {
     gDownloadLastDirFile = null;
   },
   // This function is now deprecated as it uses the sync nsIContentPrefService
   // interface. New consumers should use the getFileAsync function.
   getFile: function (aURI) {
     let Deprecated = Components.utils.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
@@ -141,27 +141,27 @@ DownloadLastDir.prototype = {
       return gDownloadLastDirFile;
     }
     return readLastDirPref();
   },
 
   getFileAsync: function(aURI, aCallback) {
     let plainPrefFile = this._getLastFile();
     if (!aURI || !isContentPrefEnabled()) {
-      Services.tm.mainThread.dispatch(function() aCallback(plainPrefFile),
+      Services.tm.mainThread.dispatch(() => aCallback(plainPrefFile),
                                       Components.interfaces.nsIThread.DISPATCH_NORMAL);
       return;
     }
 
     let uri = aURI instanceof Components.interfaces.nsIURI ? aURI.spec : aURI;
     let cps2 = Components.classes["@mozilla.org/content-pref/service;1"]
                          .getService(Components.interfaces.nsIContentPrefService2);
     let result = null;
     cps2.getByDomainAndName(uri, LAST_DIR_PREF, this.fakeContext, {
-      handleResult: function(aResult) result = aResult,
+      handleResult: aResult => result = aResult,
       handleCompletion: function(aReason) {
         let file = plainPrefFile;
         if (aReason == Components.interfaces.nsIContentPrefCallback2.COMPLETE_OK &&
            result instanceof Components.interfaces.nsIContentPref) {
           file = Components.classes["@mozilla.org/file/local;1"]
                            .createInstance(Components.interfaces.nsIFile);
           file.initWithPath(result.value);
         }
--- a/toolkit/mozapps/downloads/DownloadUtils.jsm
+++ b/toolkit/mozapps/downloads/DownloadUtils.jsm
@@ -268,17 +268,17 @@ this.DownloadUtils = {
   {
     if (aLastSec == null)
       aLastSec = Infinity;
 
     if (aSeconds < 0)
       return [gBundle.GetStringFromName(gStr.timeUnknown), aLastSec];
 
     // Try to find a cached lastSec for the given second
-    aLastSec = gCachedLast.reduce(function(aResult, aItem)
+    aLastSec = gCachedLast.reduce((aResult, aItem) =>
       aItem[0] == aSeconds ? aItem[1] : aResult, aLastSec);
 
     // Add the current second/lastSec pair unless we have too many
     gCachedLast.push([aSeconds, aLastSec]);
     if (gCachedLast.length > kCachedLastMaxSize)
       gCachedLast.shift();
 
     // Apply smoothing only if the new time isn't a huge change -- e.g., if the
--- a/toolkit/mozapps/downloads/content/downloads.js
+++ b/toolkit/mozapps/downloads/content/downloads.js
@@ -315,17 +315,17 @@ function copySourceLocation(aDownload)
 {
   var uri = aDownload.getAttribute("uri");
   var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Ci.nsIClipboardHelper);
 
   // Check if we should initialize a callback
   if (gPerformAllCallback === null) {
     let uris = [];
-    gPerformAllCallback = function(aURI) aURI ? uris.push(aURI) :
+    gPerformAllCallback = aURI => aURI ? uris.push(aURI) :
       clipboard.copyString(uris.join("\n"));
   }
 
   // We have a callback to use, so use it to add a uri
   if (typeof gPerformAllCallback == "function")
     gPerformAllCallback(uri);
   else {
     // It's a plain copy source, so copy it
@@ -409,17 +409,17 @@ function onUpdateProgress()
 
 function Startup()
 {
   gDownloadsView = document.getElementById("downloadView");
   gSearchBox = document.getElementById("searchbox");
 
   // convert strings to those in the string bundle
   let sb = document.getElementById("downloadStrings");
-  let getStr = function(string) sb.getString(string);
+  let getStr = string => sb.getString(string);
   for (let [name, value] in Iterator(gStr))
     gStr[name] = typeof value == "string" ? getStr(value) : value.map(getStr);
 
   initStatement();
   buildDownloadList(true);
 
   // The DownloadProgressListener (DownloadProgressListener.js) handles progress
   // notifications.
@@ -981,21 +981,21 @@ function updateStatus(aItem, aDownload) 
         let sizeText = gStr.doneSizeUnknown;
         if (fileSize >= 0) {
           let [size, unit] = DownloadUtils.convertByteUnits(fileSize);
           sizeText = replaceInsert(gStr.doneSize, 1, size);
           sizeText = replaceInsert(sizeText, 2, unit);
         }
         return sizeText;
       };
-      stateSize[nsIDM.DOWNLOAD_FAILED] = function() gStr.stateFailed;
-      stateSize[nsIDM.DOWNLOAD_CANCELED] = function() gStr.stateCanceled;
-      stateSize[nsIDM.DOWNLOAD_BLOCKED_PARENTAL] = function() gStr.stateBlockedParentalControls;
-      stateSize[nsIDM.DOWNLOAD_BLOCKED_POLICY] = function() gStr.stateBlockedPolicy;
-      stateSize[nsIDM.DOWNLOAD_DIRTY] = function() gStr.stateDirty;
+      stateSize[nsIDM.DOWNLOAD_FAILED] = () => gStr.stateFailed;
+      stateSize[nsIDM.DOWNLOAD_CANCELED] = () => gStr.stateCanceled;
+      stateSize[nsIDM.DOWNLOAD_BLOCKED_PARENTAL] = () => gStr.stateBlockedParentalControls;
+      stateSize[nsIDM.DOWNLOAD_BLOCKED_POLICY] = () => gStr.stateBlockedPolicy;
+      stateSize[nsIDM.DOWNLOAD_DIRTY] = () => gStr.stateDirty;
 
       // Insert 1 is the download size or download state
       status = replaceInsert(gStr.doneStatus, 1, stateSize[state]());
 
       let [displayHost, fullHost] =
         DownloadUtils.getURIHost(getReferrerOrSource(aItem));
 
       // Insert 2 is the eTLD + 1 or other variations of the host
@@ -1146,17 +1146,17 @@ function buildDownloadList(aForceBuild)
  *        Number of items to add to the list before taking a break
  */
 function stepListBuilder(aNumItems) {
   try {
     // If we're done adding all items, we can quit
     if (!gStmt.executeStep()) {
       // Send a notification that we finished, but wait for clear list to update
       updateClearListButton();
-      setTimeout(function() Cc["@mozilla.org/observer-service;1"].
+      setTimeout(() => Cc["@mozilla.org/observer-service;1"].
         getService(Ci.nsIObserverService).
         notifyObservers(window, "download-manager-ui-done", null), 0);
 
       return;
     }
 
     // Try to get the attribute values from the statement
     let attrs = {
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1100,17 +1100,17 @@ var AddonManagerInternal = {
 
     this.providers.delete(aProvider);
     // The test harness will unregister XPIProvider *after* shutdown, which is
     // after the provider will have been moved from providers to
     // pendingProviders.
     this.pendingProviders.delete(aProvider);
 
     for (let type in this.types) {
-      this.types[type].providers = this.types[type].providers.filter(function filterProvider(p) p != aProvider);
+      this.types[type].providers = this.types[type].providers.filter(p => p != aProvider);
       if (this.types[type].providers.length == 0) {
         let oldType = this.types[type].type;
         delete this.types[type];
 
         let typeListeners = this.typeListeners.slice(0);
         for (let listener of typeListeners) {
           safeCall(function listenerSafeCall() {
             listener.onTypeRemoved(oldType);
@@ -1691,18 +1691,17 @@ var AddonManagerInternal = {
                                  Cr.NS_ERROR_INVALID_ARG);
 
     if (gStartupComplete)
       return;
 
     if (!(aType in this.startupChanges))
       return;
 
-    this.startupChanges[aType] = this.startupChanges[aType].filter(
-                                 function filterItem(aItem) aItem != aID);
+    this.startupChanges[aType] = this.startupChanges[aType].filter(aItem => aItem != aID);
   },
 
   /**
    * Calls all registered AddonManagerListeners with an event. Any parameters
    * after the method parameter are passed to the listener.
    *
    * @param  aMethod
    *         The method on the listeners to call
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -88,17 +88,19 @@ var _themeIDBeingDisabled = null;
 
     if (Array.isArray(themes) && themes[0]) {
       _prefs.setCharPref("selectedThemeID", themes[0].id);
     }
   }
 })();
 
 this.LightweightThemeManager = {
-  get name() "LightweightThemeManager",
+  get name() {
+    return "LightweightThemeManager";
+  },
 
   // Themes that can be added for an application.  They can't be removed, and
   // will always show up at the top of the list.
   _builtInThemes: new Map(),
 
   get usedThemes () {
     let themes = [];
     try {
@@ -451,26 +453,32 @@ this.LightweightThemeManager = {
   },
 };
 
 /**
  * The AddonWrapper wraps lightweight theme to provide the data visible to
  * consumers of the AddonManager API.
  */
 function AddonWrapper(aTheme) {
-  this.__defineGetter__("id", function AddonWrapper_idGetter() aTheme.id + ID_SUFFIX);
-  this.__defineGetter__("type", function AddonWrapper_typeGetter() ADDON_TYPE);
+  this.__defineGetter__("id", function AddonWrapper_idGetter() {
+    return aTheme.id + ID_SUFFIX;
+  });
+  this.__defineGetter__("type", function AddonWrapper_typeGetter() {
+    return ADDON_TYPE;
+  });
   this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() {
     let current = LightweightThemeManager.currentTheme;
     if (current)
       return aTheme.id == current.id;
     return false;
   });
 
-  this.__defineGetter__("name", function AddonWrapper_nameGetter() aTheme.name);
+  this.__defineGetter__("name", function AddonWrapper_nameGetter() {
+    return aTheme.name;
+  });
   this.__defineGetter__("version", function AddonWrapper_versionGetter() {
     return "version" in aTheme ? aTheme.version : "";
   });
 
   ["description", "homepageURL", "iconURL"].forEach(function(prop) {
     this.__defineGetter__(prop, function AddonWrapper_optionalPropGetter() {
       return prop in aTheme ? aTheme[prop] : null;
     });
@@ -728,25 +736,30 @@ function _sanitizeTheme(aData, aBaseURI,
     if (!val)
       continue;
     result[optionalProperty] = val;
   }
 
   return result;
 }
 
-function _usedThemesExceptId(aId)
-  LightweightThemeManager.usedThemes.filter(
-       function usedThemesExceptId_filterID(t) "id" in t && t.id != aId);
+function _usedThemesExceptId(aId) {
+  return LightweightThemeManager.usedThemes.filter(
+    function usedThemesExceptId_filterID(t) {
+      return "id" in t && t.id != aId;
+    });
+}
 
-function _version(aThemeData)
-  aThemeData.version || "";
+function _version(aThemeData) {
+  return aThemeData.version || "";
+}
 
-function _makeURI(aURL, aBaseURI)
-  Services.io.newURI(aURL, null, aBaseURI);
+function _makeURI(aURL, aBaseURI) {
+  return Services.io.newURI(aURL, null, aBaseURI);
+}
 
 function _updateUsedThemes(aList) {
   // Remove app-specific themes before saving them to the usedThemes pref.
   aList = aList.filter(theme => !LightweightThemeManager._builtInThemes.has(theme.id));
 
   // Send uninstall events for all themes that need to be removed.
   while (aList.length > _maxUsedThemes) {
     let wrapper = new AddonWrapper(aList[aList.length - 1]);
@@ -789,25 +802,27 @@ function _prefObserver(aSubject, aTopic,
       }
       // Update the theme list to remove any themes over the number we keep
       _updateUsedThemes(LightweightThemeManager.usedThemes);
       break;
   }
 }
 
 function _persistImages(aData, aCallback) {
-  function onSuccess(key) function () {
-    let current = LightweightThemeManager.currentTheme;
-    if (current && current.id == aData.id) {
-      _prefs.setBoolPref("persisted." + key, true);
-    }
-    if (--numFilesToPersist == 0 && aCallback) {
-      aCallback();
-    }
-  };
+  function onSuccess(key) {
+    return function () {
+      let current = LightweightThemeManager.currentTheme;
+      if (current && current.id == aData.id) {
+        _prefs.setBoolPref("persisted." + key, true);
+      }
+      if (--numFilesToPersist == 0 && aCallback) {
+        aCallback();
+      }
+    };
+  }
 
   let numFilesToPersist = 0;
   for (let key in PERSIST_FILES) {
     _prefs.setBoolPref("persisted." + key, false);
     if (aData[key]) {
       numFilesToPersist++;
       _persistImage(aData[key], PERSIST_FILES[key], onSuccess(key));
     }
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -74,17 +74,19 @@ XPCOMUtils.defineLazyGetter(gStrings, "b
 XPCOMUtils.defineLazyGetter(gStrings, "appVersion", function appVersionLazyGetter() {
   return Services.appinfo.version;
 });
 
 document.addEventListener("load", initialize, true);
 window.addEventListener("unload", shutdown, false);
 
 var gPendingInitializations = 1;
-this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() gPendingInitializations > 0);
+this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() {
+  return gPendingInitializations > 0;
+});
 
 function initialize(event) {
   // XXXbz this listener gets _all_ load events for all nodes in the
   // document... but relies on not being called "too early".
   if (event.target instanceof XMLStylesheetProcessingInstruction) {
     return;
   }
   document.removeEventListener("load", initialize, true);
@@ -825,71 +827,83 @@ var gViewController = {
     cmd_focusSearch: {
       isEnabled: () => true,
       doCommand: function cmd_focusSearch_doCommand() {
         gHeader.focusSearchBox();
       }
     },
 
     cmd_restartApp: {
-      isEnabled: function cmd_restartApp_isEnabled() true,
+      isEnabled: function cmd_restartApp_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_restartApp_doCommand() {
         let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
                          createInstance(Ci.nsISupportsPRBool);
         Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
                                      "restart");
         if (cancelQuit.data)
           return; // somebody canceled our quit request
 
         let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].
                          getService(Ci.nsIAppStartup);
         appStartup.quit(Ci.nsIAppStartup.eAttemptQuit |  Ci.nsIAppStartup.eRestart);
       }
     },
 
     cmd_enableCheckCompatibility: {
-      isEnabled: function cmd_enableCheckCompatibility_isEnabled() true,
+      isEnabled: function cmd_enableCheckCompatibility_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_enableCheckCompatibility_doCommand() {
         AddonManager.checkCompatibility = true;
       }
     },
 
     cmd_enableUpdateSecurity: {
-      isEnabled: function cmd_enableUpdateSecurity_isEnabled() true,
+      isEnabled: function cmd_enableUpdateSecurity_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_enableUpdateSecurity_doCommand() {
         AddonManager.checkUpdateSecurity = true;
       }
     },
 
     cmd_pluginCheck: {
-      isEnabled: function cmd_pluginCheck_isEnabled() true,
+      isEnabled: function cmd_pluginCheck_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_pluginCheck_doCommand() {
         openURL(Services.urlFormatter.formatURLPref("plugins.update.url"));
       }
     },
 
     cmd_toggleAutoUpdateDefault: {
-      isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() true,
+      isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_toggleAutoUpdateDefault_doCommand() {
         if (!AddonManager.updateEnabled || !AddonManager.autoUpdateDefault) {
           // One or both of the prefs is false, i.e. the checkbox is not checked.
           // Now toggle both to true. If the user wants us to auto-update
           // add-ons, we also need to auto-check for updates.
           AddonManager.updateEnabled = true;
           AddonManager.autoUpdateDefault = true;
         } else {
           // Both prefs are true, i.e. the checkbox is checked.
           // Toggle the auto pref to false, but don't touch the enabled check.
           AddonManager.autoUpdateDefault = false;
         }
       }
     },
 
     cmd_resetAddonAutoUpdate: {
-      isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() true,
+      isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_resetAddonAutoUpdate_doCommand() {
         AddonManager.getAllAddons(function cmd_resetAddonAutoUpdate_getAllAddons(aAddonList) {
           for (let addon of aAddonList) {
             if ("applyBackgroundUpdates" in addon)
               addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
           }
         });
       }
@@ -900,24 +914,28 @@ var gViewController = {
         return gDiscoverView.enabled;
       },
       doCommand: function cmd_goToDiscoverPane_doCommand() {
         gViewController.loadView("addons://discover/");
       }
     },
 
     cmd_goToRecentUpdates: {
-      isEnabled: function cmd_goToRecentUpdates_isEnabled() true,
+      isEnabled: function cmd_goToRecentUpdates_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_goToRecentUpdates_doCommand() {
         gViewController.loadView("addons://updates/recent");
       }
     },
 
     cmd_goToAvailableUpdates: {
-      isEnabled: function cmd_goToAvailableUpdates_isEnabled() true,
+      isEnabled: function cmd_goToAvailableUpdates_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_goToAvailableUpdates_doCommand() {
         gViewController.loadView("addons://updates/available");
       }
     },
 
     cmd_showItemDetails: {
       isEnabled: function cmd_showItemDetails_isEnabled(aAddon) {
         return !!aAddon && (gViewController.currentViewObj != gDetailView);
@@ -926,17 +944,19 @@ var gViewController = {
         gViewController.loadView("addons://detail/" +
                                  encodeURIComponent(aAddon.id) +
                                  (aScrollToPreferences ? "/preferences" : ""));
       }
     },
 
     cmd_findAllUpdates: {
       inProgress: false,
-      isEnabled: function cmd_findAllUpdates_isEnabled() !this.inProgress,
+      isEnabled: function cmd_findAllUpdates_isEnabled() {
+        return !this.inProgress;
+      },
       doCommand: function cmd_findAllUpdates_doCommand() {
         this.inProgress = true;
         gViewController.updateCommand("cmd_findAllUpdates");
         document.getElementById("updates-noneFound").hidden = true;
         document.getElementById("updates-progress").hidden = false;
         document.getElementById("updates-manualUpdatesFound-btn").hidden = true;
 
         var pendingChecks = 0;
@@ -1229,17 +1249,19 @@ var gViewController = {
         return isPending(aAddon, "uninstall");
       },
       doCommand: function cmd_cancelUninstallItem_doCommand(aAddon) {
         aAddon.cancelUninstall();
       }
     },
 
     cmd_installFromFile: {
-      isEnabled: function cmd_installFromFile_isEnabled() true,
+      isEnabled: function cmd_installFromFile_isEnabled() {
+        return true;
+      },
       doCommand: function cmd_installFromFile_doCommand() {
         const nsIFilePicker = Ci.nsIFilePicker;
         var fp = Cc["@mozilla.org/filepicker;1"]
                    .createInstance(nsIFilePicker);
         fp.init(window,
                 gStrings.ext.GetStringFromName("installFromFile.dialogTitle"),
                 nsIFilePicker.modeOpenMultiple);
         try {
@@ -2275,17 +2297,19 @@ var gDiscoverView = {
   },
 
   onProgressChange: function gDiscoverView_onProgressChange() { },
   onStatusChange: function gDiscoverView_onStatusChange() { },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
                                          Ci.nsISupportsWeakReference]),
 
-  getSelectedAddon: function gDiscoverView_getSelectedAddon() null
+  getSelectedAddon: function gDiscoverView_getSelectedAddon() {
+    return null;
+  }
 };
 
 
 var gCachedAddons = {};
 
 var gSearchView = {
   node: null,
   _filter: null,
@@ -2306,26 +2330,25 @@ var gSearchView = {
     this._loading = document.getElementById("search-loading");
     this._listBox = document.getElementById("search-list");
     this._emptyNotice = document.getElementById("search-list-empty");
     this._allResultsLink = document.getElementById("search-allresults-link");
 
     if (!AddonManager.isInstallEnabled("application/x-xpinstall"))
       this._filter.hidden = true;
 
-    var self = this;
-    this._listBox.addEventListener("keydown", function listbox_onKeydown(aEvent) {
+    this._listBox.addEventListener("keydown", aEvent => {
       if (aEvent.keyCode == aEvent.DOM_VK_RETURN) {
-        var item = self._listBox.selectedItem;
+        var item = this._listBox.selectedItem;
         if (item)
           item.showInDetailView();
       }
     }, false);
 
-    this._filter.addEventListener("command", function filter_onCommand() self.updateView(), false);
+    this._filter.addEventListener("command", () => this.updateView(), false);
   },
 
   shutdown: function gSearchView_shutdown() {
     if (AddonRepository.isSearching)
       AddonRepository.cancelSearch();
   },
 
   get isSearching() {
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -984,17 +984,17 @@ this.AddonRepository = {
     let elementsList = aElement.getElementsByTagName(aTagName);
     return (elementsList.length == 1) ? elementsList[0] : null;
   },
 
   // Get direct descendant by unique tag name.
   // Returns null if not unique tag name.
   _getUniqueDirectDescendant: function AddonRepo_getUniqueDirectDescendant(aElement, aTagName) {
     let elementsList = Array.filter(aElement.children,
-                                    function arrayFiltering(aChild) aChild.tagName == aTagName);
+                                    aChild => aChild.tagName == aTagName);
     return (elementsList.length == 1) ? elementsList[0] : null;
   },
 
   // Parse out trimmed text content. Returns null if text content empty.
   _getTextContent: function AddonRepo_getTextContent(aElement) {
     let textContent = aElement.textContent.trim();
     return (textContent.length > 0) ? textContent : null;
   },
@@ -1298,17 +1298,17 @@ this.AddonRepository = {
       // Don't pass in compatiblity override data, because that's only returned
       // in GUID searches, which don't use _parseAddons().
       let result = this._parseAddon(element, aSkip);
       if (result == null)
         continue;
 
       // Ignore add-on missing a required attribute
       let requiredAttributes = ["id", "name", "version", "type", "creator"];
-      if (requiredAttributes.some(function parseAddons_attributeFilter(aAttribute) !result.addon[aAttribute]))
+      if (requiredAttributes.some(aAttribute => !result.addon[aAttribute]))
         continue;
 
       // Ignore add-on with a type AddonManager doesn't understand:
       if (!(result.addon.type in AddonManager.addonTypes))
         continue;
 
       // Add only if the add-on is compatible with the platform
       if (!result.addon.isPlatformCompatible)
@@ -1423,17 +1423,17 @@ this.AddonRepository = {
       override.appMinVersion = appRange.appMinVersion;
       override.appMaxVersion = appRange.appMaxVersion;
 
       return override;
     }
 
     let rangeNodes = aElement.querySelectorAll("version_ranges > version_range");
     compat.compatRanges = Array.map(rangeNodes, parseRangeNode.bind(this))
-                               .filter(function compatRangesFilter(aItem) !!aItem);
+                               .filter(aItem => !!aItem);
     if (compat.compatRanges.length == 0)
       return;
 
     aResultObj[compat.id] = compat;
   },
 
   // Parses addon_compatibility elements.
   _parseAddonCompatData: function AddonRepo_parseAddonCompatData(aElements) {
--- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
@@ -22,18 +22,17 @@ Cu.import("resource://gre/modules/Log.js
 const LOGGER_ID = "addons.plugins";
 
 // Create a new logger for use by the Addons Plugin Provider
 // (Requires AddonManager.jsm)
 var logger = Log.repository.getLogger(LOGGER_ID);
 
 function getIDHashForString(aStr) {
   // return the two-digit hexadecimal code for a byte
-  function toHexString(charCode)
-    ("0" + charCode.toString(16)).slice(-2);
+  let toHexString = charCode => ("0" + charCode.toString(16)).slice(-2);
 
   let hasher = Cc["@mozilla.org/security/hash;1"].
                createInstance(Ci.nsICryptoHash);
   hasher.init(Ci.nsICryptoHash.MD5);
   let stringStream = Cc["@mozilla.org/io/string-input-stream;1"].
                      createInstance(Ci.nsIStringInputStream);
                      stringStream.data = aStr ? aStr : "null";
   hasher.updateFromStream(stringStream, -1);
@@ -44,17 +43,19 @@ function getIDHashForString(aStr) {
   return "{" + hash.substr(0, 8) + "-" +
                hash.substr(8, 4) + "-" +
                hash.substr(12, 4) + "-" +
                hash.substr(16, 4) + "-" +
                hash.substr(20) + "}";
 }
 
 var PluginProvider = {
-  get name() "PluginProvider",
+  get name() {
+    return "PluginProvider";
+  },
 
   // A dictionary mapping IDs to names and descriptions
   plugins: null,
 
   startup: function PL_startup() {
     Services.obs.addObserver(this, LIST_UPDATED_TOPIC, false);
     Services.obs.addObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
   },
@@ -77,17 +78,17 @@ var PluginProvider = {
           return;
 
         let libLabel = aSubject.getElementById("pluginLibraries");
         libLabel.textContent = plugin.pluginLibraries.join(", ");
 
         let typeLabel = aSubject.getElementById("pluginMimeTypes"), types = [];
         for (let type of plugin.pluginMimeTypes) {
           let extras = [type.description.trim(), type.suffixes].
-                       filter(function(x) x).join(": ");
+                       filter(x => x).join(": ");
           types.push(type.type + (extras ? " (" + extras + ")" : ""));
         }
         typeLabel.textContent = types.join(",\n");
         let showProtectedModePref = canDisableFlashProtectedMode(plugin);
         aSubject.getElementById("pluginEnableProtectedMode")
           .setAttribute("collapsed", showProtectedModePref ? "" : "true");
       });
       break;
@@ -298,26 +299,26 @@ function canDisableFlashProtectedMode(aP
  * public callers through the API.
  */
 function PluginWrapper(aId, aName, aDescription, aTags) {
   let safedesc = aDescription.replace(/<\/?[a-z][^>]*>/gi, " ");
   let homepageURL = null;
   if (/<A\s+HREF=[^>]*>/i.test(aDescription))
     homepageURL = /<A\s+HREF=["']?([^>"'\s]*)/i.exec(aDescription)[1];
 
-  this.__defineGetter__("id", function() aId);
-  this.__defineGetter__("type", function() "plugin");
-  this.__defineGetter__("name", function() aName);
-  this.__defineGetter__("creator", function() null);
-  this.__defineGetter__("description", function() safedesc);
-  this.__defineGetter__("version", function() aTags[0].version);
-  this.__defineGetter__("homepageURL", function() homepageURL);
+  this.__defineGetter__("id", () => aId);
+  this.__defineGetter__("type", () => "plugin");
+  this.__defineGetter__("name", () => aName);
+  this.__defineGetter__("creator", () => null);
+  this.__defineGetter__("description", () => safedesc);
+  this.__defineGetter__("version", () => aTags[0].version);
+  this.__defineGetter__("homepageURL", () => homepageURL);
 
-  this.__defineGetter__("isActive", function() !aTags[0].blocklisted && !aTags[0].disabled);
-  this.__defineGetter__("appDisabled", function() aTags[0].blocklisted);
+  this.__defineGetter__("isActive", () => !aTags[0].blocklisted && !aTags[0].disabled);
+  this.__defineGetter__("appDisabled", () => aTags[0].blocklisted);
 
   this.__defineGetter__("userDisabled", function() {
     if (aTags[0].disabled)
       return true;
 
     if ((Services.prefs.getBoolPref("plugins.click_to_play") && aTags[0].clicktoplay) ||
         this.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE ||
         this.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE)
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -2168,17 +2168,19 @@ this.XPIStates = {
     if (location.size == 0) {
       this.db.delete(aLocation);
     }
     this.save();
   },
 };
 
 this.XPIProvider = {
-  get name() "XPIProvider",
+  get name() {
+    return "XPIProvider";
+  },
 
   // An array of known install locations
   installLocations: null,
   // A dictionary of known install locations by name
   installLocationsByName: null,
   // An array of currently active AddonInstalls
   installs: null,
   // The default skin for the application
@@ -4586,18 +4588,17 @@ this.XPIProvider = {
     // Notify any other providers that this theme is now enabled again.
     if (aAddon.type == "theme" && aAddon.active)
       AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type, false);
   }
 };
 
 function getHashStringForCrypto(aCrypto) {
   // return the two-digit hexadecimal code for a byte
-  function toHexString(charCode)
-    ("0" + charCode.toString(16)).slice(-2);
+  let toHexString = charCode => ("0" + charCode.toString(16)).slice(-2);
 
   // convert the binary hash data to a hex string.
   let binary = aCrypto.finish(false);
   return [toHexString(binary.charCodeAt(i)) for (i in binary)].join("").toLowerCase()
 }
 
 /**
  * Instantiates an AddonInstall.
@@ -5846,28 +5847,36 @@ function AddonInstallWrapper(aInstall) {
 #ifdef MOZ_EM_DEBUG
   this.__defineGetter__("__AddonInstallInternal__", function AIW_debugGetter() {
     return aInstall;
   });
 #endif
 
   ["name", "version", "icons", "releaseNotesURI", "file", "state", "error",
    "progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
-    this.__defineGetter__(aProp, function AIW_propertyGetter() aInstall[aProp]);
+    this.__defineGetter__(aProp, function AIW_propertyGetter() {
+      return aInstall[aProp];
+    });
   }, this);
 
   this.__defineGetter__("type", () => getExternalType(aInstall.type));
 
-  this.__defineGetter__("iconURL", function AIW_iconURL() aInstall.icons[32]);
+  this.__defineGetter__("iconURL", function AIW_iconURL() {
+    return aInstall.icons[32];
+  });
 
   this.__defineGetter__("existingAddon", function AIW_existingAddonGetter() {
     return createWrapper(aInstall.existingAddon);
   });
-  this.__defineGetter__("addon", function AIW_addonGetter() createWrapper(aInstall.addon));
-  this.__defineGetter__("sourceURI", function AIW_sourceURIGetter() aInstall.sourceURI);
+  this.__defineGetter__("addon", function AIW_addonGetter() {
+    return createWrapper(aInstall.addon);
+  });
+  this.__defineGetter__("sourceURI", function AIW_sourceURIGetter() {
+    return aInstall.sourceURI;
+  });
 
   this.__defineGetter__("linkedInstalls", function AIW_linkedInstallsGetter() {
     if (!aInstall.linkedInstalls)
       return null;
     return [i.wrapper for each (i in aInstall.linkedInstalls)];
   });
 
   this.install = function AIW_install() {
@@ -6438,17 +6447,19 @@ function AddonWrapper(aAddon) {
     return [objValue, false];
   }
 
   ["id", "syncGUID", "version", "isCompatible", "isPlatformCompatible",
    "providesUpdatesSecurely", "blocklistState", "blocklistURL", "appDisabled",
    "softDisabled", "skinnable", "size", "foreignInstall", "hasBinaryComponents",
    "strictCompatibility", "compatibilityOverrides", "updateURL",
    "getDataDirectory", "multiprocessCompatible", "signedState"].forEach(function(aProp) {
-     this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() aAddon[aProp]);
+     this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() {
+       return aAddon[aProp];
+     });
   }, this);
 
   this.__defineGetter__("type", () => getExternalType(aAddon.type));
 
   ["fullDescription", "developerComments", "eula", "supportURL",
    "contributionURL", "contributionAmount", "averageRating", "reviewCount",
    "reviewURL", "totalDownloads", "weeklyDownloads", "dailyUsers",
    "repositoryStatus"].forEach(function(aProp) {
@@ -6460,17 +6471,19 @@ function AddonWrapper(aAddon) {
     });
   }, this);
 
   this.__defineGetter__("aboutURL", function AddonWrapper_aboutURLGetter() {
     return this.isActive ? aAddon["aboutURL"] : null;
   });
 
   ["installDate", "updateDate"].forEach(function(aProp) {
-    this.__defineGetter__(aProp, function AddonWrapper_datePropertyGetter() new Date(aAddon[aProp]));
+    this.__defineGetter__(aProp, function AddonWrapper_datePropertyGetter() {
+      return new Date(aAddon[aProp]);
+    });
   }, this);
 
   ["sourceURI", "releaseNotesURI"].forEach(function(aProp) {
     this.__defineGetter__(aProp, function AddonWrapper_URIPropertyGetter() {
       let [target, fromRepo] = chooseValue(aAddon, aProp);
       if (!target)
         return null;
       if (fromRepo)
--- a/toolkit/mozapps/installer/precompile_cache.js
+++ b/toolkit/mozapps/installer/precompile_cache.js
@@ -34,17 +34,17 @@ function dir_entries(baseDir, subpath, e
     var enumerator = dir.directoryEntries;
   } catch (e) {
     return [];
   }
   var entries = [];
   while (enumerator.hasMoreElements()) {
     var file = enumerator.getNext().QueryInterface(Ci.nsIFile);
     if (file.isDirectory()) {
-      entries = entries.concat(dir_entries(dir, file.leafName, ext).map(function(p) subpath + "/" + p));
+      entries = entries.concat(dir_entries(dir, file.leafName, ext).map(p => subpath + "/" + p));
     } else if (endsWith(file.leafName, ext)) {
       entries.push(subpath + "/" + file.leafName);
     }
   }
   return entries;
 }
 
 function get_modules_under(uri) {