Bug 1518546 - Fix method signatures throughout SearchService.jsm to be consistent. r=mikedeboer
authorMark Banner <standard8@mozilla.com>
Wed, 17 Apr 2019 14:41:39 +0000
changeset 469901 67d59eccba20c9a96f3e0a06a8e947dc06918ecc
parent 469900 d969c3ed6999b34bfaa1a23bb7db115076b7f760
child 469902 1f13810ca79e630b96812c10331b8f03691fe728
push id83414
push usermbanner@mozilla.com
push dateWed, 17 Apr 2019 18:08:05 +0000
treeherderautoland@67d59eccba20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1518546
milestone68.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 1518546 - Fix method signatures throughout SearchService.jsm to be consistent. r=mikedeboer Differential Revision: https://phabricator.services.mozilla.com/D27823
toolkit/components/search/SearchService.jsm
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -1,13 +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/. */
 
+/* eslint no-shadow: error, mozilla/no-aArgs: error */
+
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
 const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   DeferredTask: "resource://gre/modules/DeferredTask.jsm",
@@ -183,22 +185,22 @@ const MULTI_LOCALE_ENGINES = [
 const DEFAULT_TAG = "default";
 
 /**
  * Prefixed to all search debug output.
  */
 const SEARCH_LOG_PREFIX = "*** Search: ";
 
 /**
- * Outputs aText to the JavaScript console as well as to stdout.
+ * Outputs text to the JavaScript console as well as to stdout.
  */
-function LOG(aText) {
+function LOG(text) {
   if (loggingEnabled) {
-    dump(SEARCH_LOG_PREFIX + aText + "\n");
-    Services.console.logStringMessage(aText);
+    dump(SEARCH_LOG_PREFIX + text + "\n");
+    Services.console.logStringMessage(text);
   }
 }
 
 /**
  * Presents an assertion dialog in non-release builds and throws.
  * @param  message
  *         A message to display
  * @param  resultCode
@@ -247,21 +249,21 @@ function limitURILength(str, len) {
  *         The NS_ERROR_* value to throw if the assertion is not met
  * @throws resultCode
  */
 function ENSURE_WARN(assertion, message, resultCode) {
   if (!assertion)
     throw Components.Exception(message, resultCode);
 }
 
-function loadListener(aChannel, aEngine, aCallback) {
-  this._channel = aChannel;
+function loadListener(channel, engine, callback) {
+  this._channel = channel;
   this._bytes = [];
-  this._engine = aEngine;
-  this._callback = aCallback;
+  this._engine = engine;
+  this._callback = callback;
 }
 loadListener.prototype = {
   _callback: null,
   _channel: null,
   _countRead: 0,
   _engine: null,
   _stream: null,
 
@@ -269,88 +271,91 @@ loadListener.prototype = {
     Ci.nsIRequestObserver,
     Ci.nsIStreamListener,
     Ci.nsIChannelEventSink,
     Ci.nsIInterfaceRequestor,
     Ci.nsIProgressEventSink,
   ]),
 
   // nsIRequestObserver
-  onStartRequest: function SRCH_loadStartR(aRequest) {
-    LOG("loadListener: Starting request: " + aRequest.name);
+  onStartRequest(request) {
+    LOG("loadListener: Starting request: " + request.name);
     this._stream = Cc["@mozilla.org/binaryinputstream;1"].
                    createInstance(Ci.nsIBinaryInputStream);
   },
 
-  onStopRequest: function SRCH_loadStopR(aRequest, aStatusCode) {
-    LOG("loadListener: Stopping request: " + aRequest.name);
-
-    var requestFailed = !Components.isSuccessCode(aStatusCode);
-    if (!requestFailed && (aRequest instanceof Ci.nsIHttpChannel))
-      requestFailed = !aRequest.requestSucceeded;
+  onStopRequest(request, statusCode) {
+    LOG("loadListener: Stopping request: " + request.name);
+
+    var requestFailed = !Components.isSuccessCode(statusCode);
+    if (!requestFailed && (request instanceof Ci.nsIHttpChannel))
+      requestFailed = !request.requestSucceeded;
 
     if (requestFailed || this._countRead == 0) {
       LOG("loadListener: request failed!");
       // send null so the callback can deal with the failure
       this._bytes = null;
     }
     this._callback(this._bytes, this._engine);
     this._channel = null;
     this._engine = null;
   },
 
   // nsIStreamListener
-  onDataAvailable: function SRCH_loadDAvailable(aRequest,
-                                                aInputStream, aOffset,
-                                                aCount) {
-    this._stream.setInputStream(aInputStream);
+  onDataAvailable(request, inputStream, offset, count) {
+    this._stream.setInputStream(inputStream);
 
     // Get a byte array of the data
-    this._bytes = this._bytes.concat(this._stream.readByteArray(aCount));
-    this._countRead += aCount;
+    this._bytes = this._bytes.concat(this._stream.readByteArray(count));
+    this._countRead += count;
   },
 
   // nsIChannelEventSink
-  asyncOnChannelRedirect: function SRCH_loadCRedirect(aOldChannel, aNewChannel,
-                                                      aFlags, callback) {
-    this._channel = aNewChannel;
+  asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
+    this._channel = newChannel;
     callback.onRedirectVerifyCallback(Cr.NS_OK);
   },
 
   // nsIInterfaceRequestor
-  getInterface: function SRCH_load_GI(aIID) {
-    return this.QueryInterface(aIID);
+  getInterface(iid) {
+    return this.QueryInterface(iid);
   },
 
   // nsIProgressEventSink
-  onProgress(aRequest, aContext, aProgress, aProgressMax) {},
-  onStatus(aRequest, aContext, aStatus, aStatusArg) {},
+  onProgress(request, context, progress, progressMax) {},
+  onStatus(request, context, status, statusArg) {},
 };
 
 /**
  * Tries to rescale an icon to a given size.
  *
- * @param aByteArray Byte array containing the icon payload.
- * @param aContentType Mime type of the payload.
- * @param [optional] aSize desired icon size.
+ * @param {array} byteArray
+ *   Byte array containing the icon payload.
+ * @param {string} contentType
+ *   Mime type of the payload.
+ * @param {number} [size]
+ *   Desired icon size.
+ * @returns {array}
+ *   An array of two elements - an array of integers and a string for the content
+ *   type.
  * @throws if the icon cannot be rescaled or the rescaled icon is too big.
  */
-function rescaleIcon(aByteArray, aContentType, aSize = 32) {
-  if (aContentType == "image/svg+xml")
+function rescaleIcon(byteArray, contentType, size = 32) {
+  if (contentType == "image/svg+xml")
     throw new Error("Cannot rescale SVG image");
 
   let imgTools = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools);
-  let arrayBuffer = (new Int8Array(aByteArray)).buffer;
-  let container = imgTools.decodeImageFromArrayBuffer(arrayBuffer, aContentType);
-  let stream = imgTools.encodeScaledImage(container, "image/png", aSize, aSize);
-  let size = stream.available();
-  if (size > MAX_ICON_SIZE)
+  let arrayBuffer = (new Int8Array(byteArray)).buffer;
+  let container = imgTools.decodeImageFromArrayBuffer(arrayBuffer, contentType);
+  let stream = imgTools.encodeScaledImage(container, "image/png", size, size);
+  let streamSize = stream.available();
+  if (streamSize > MAX_ICON_SIZE)
     throw new Error("Icon is too big");
   let bis = new BinaryInputStream(stream);
-  return [bis.readByteArray(size), "image/png"];
+  return [bis.readByteArray(streamSize), "image/png"];
 }
 
 function isPartnerBuild() {
   // Mozilla-provided builds (i.e. funnelcakes) are not partner builds
   return distroID && !distroID.startsWith("mozilla");
 }
 
 // Method to determine if we should be using geo-specific defaults
@@ -694,25 +699,25 @@ var fetchRegionDefault = (ss) => new Pro
     resolve();
   };
   request.open("GET", endpoint, true);
   request.setRequestHeader("Content-Type", "application/json");
   request.responseType = "json";
   request.send();
 });
 
-function getVerificationHash(aName) {
+function getVerificationHash(name) {
   let disclaimer = "By modifying this file, I agree that I am doing so " +
     "only within $appName itself, using official, user-driven search " +
     "engine selection processes, and in a way which does not circumvent " +
     "user consent. I acknowledge that any attempt to change this file " +
     "from outside of $appName is a malicious act, and will be responded " +
     "to accordingly.";
 
-  let salt = OS.Path.basename(OS.Constants.Path.profileDir) + aName +
+  let salt = OS.Path.basename(OS.Constants.Path.profileDir) + name +
              disclaimer.replace(/\$appName/g, Services.appinfo.name);
 
   let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                     .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
 
   // Data is an array of bytes.
   let data = converter.convertToByteArray(salt, {});
@@ -721,23 +726,23 @@ function getVerificationHash(aName) {
   hasher.init(hasher.SHA256);
   hasher.update(data, data.length);
 
   return hasher.finish(true);
 }
 
 /**
  * Wrapper function for nsIIOService::newURI.
- * @param aURLSpec
+ * @param {string} urlSpec
  *        The URL string from which to create an nsIURI.
- * @returns an nsIURI object, or null if the creation of the URI failed.
+ * @returns {nsIURI} an nsIURI object, or null if the creation of the URI failed.
  */
-function makeURI(aURLSpec, aCharset) {
+function makeURI(urlSpec) {
   try {
-    return Services.io.newURI(aURLSpec, aCharset);
+    return Services.io.newURI(urlSpec);
   } catch (ex) { }
 
   return null;
 }
 
 /**
  * Wrapper function for nsIIOService::newChannel.
  * @param url
@@ -755,68 +760,78 @@ function makeChannel(url) {
                                          Ci.nsIContentPolicy.TYPE_OTHER);
   } catch (ex) { }
 
   return null;
 }
 
 /**
  * Gets a directory from the directory service.
- * @param aKey
- *        The directory service key indicating the directory to get.
+ * @param {string} key
+ *   The directory service key indicating the directory to get.
+ * @param {nsIIDRef} iface
+ *   The expected interface type of the directory information.
+ * @returns {object}
  */
-function getDir(aKey, aIFace) {
-  if (!aKey)
+function getDir(key, iface) {
+  if (!key)
     FAIL("getDir requires a directory key!");
 
-  return Services.dirsvc.get(aKey, aIFace || Ci.nsIFile);
+  return Services.dirsvc.get(key, iface || Ci.nsIFile);
 }
 
 /**
  * Gets the current value of the locale.  It's possible for this preference to
  * be localized, so we have to do a little extra work here.  Similar code
  * exists in nsHttpHandler.cpp when building the UA string.
  */
 function getLocale() {
   return Services.locale.requestedLocale;
 }
 
 /**
  * Wrapper for nsIPrefBranch::getComplexValue.
- * @param aPrefName
- *        The name of the pref to get.
- * @returns aDefault if the requested pref doesn't exist.
+ * @param {string} prefName
+ *   The name of the pref to get.
+ * @param {*} defaultValue
+ *   The value to return if the preference isn't found.
+ * @returns {*}
+ *   Returns either the preference value, or the default value.
  */
-function getLocalizedPref(aPrefName, aDefault) {
-  const nsIPLS = Ci.nsIPrefLocalizedString;
+function getLocalizedPref(prefName, defaultValue) {
   try {
-    return Services.prefs.getComplexValue(aPrefName, nsIPLS).data;
+    return Services.prefs.getComplexValue(prefName,
+      Ci.nsIPrefLocalizedString).data;
   } catch (ex) {}
 
-  return aDefault;
+  return defaultValue;
 }
 
 /**
- * @return a sanitized name to be used as a filename, or a random name
- *         if a sanitized name cannot be obtained (if aName contains
- *         no valid characters).
+ * Sanitizes a name so that it can be used as a filename. If it cannot be
+ * sanitized (e.g. no valid characters), then it returns a random name.
+ *
+ * @param {string} name
+ *  The name to be sanitized.
+ * @returns {string}
+ *  The sanitized name.
  */
-function sanitizeName(aName) {
+function sanitizeName(name) {
   const maxLength = 60;
   const minLength = 1;
-  var name = aName.toLowerCase();
-  name = name.replace(/\s+/g, "-");
-  name = name.replace(/[^-a-z0-9]/g, "");
+  var result = name.toLowerCase();
+  result = result.replace(/\s+/g, "-");
+  result = result.replace(/[^-a-z0-9]/g, "");
 
   // Use a random name if our input had no valid characters.
-  if (name.length < minLength)
-    name = Math.random().toString(36).replace(/^.*\./, "");
+  if (result.length < minLength)
+    result = Math.random().toString(36).replace(/^.*\./, "");
 
   // Force max length.
-  return name.substring(0, maxLength);
+  return result.substring(0, maxLength);
 }
 
 /**
  * Retrieve a pref from the search param branch. Returns null if the
  * preference is not found.
  *
  * @param prefName
  *        The name of the pref.
@@ -826,72 +841,77 @@ function getMozParamPref(prefName) {
   let prefValue = branch.getCharPref(prefName, null);
   return prefValue ? encodeURIComponent(prefValue) : null;
 }
 
 /**
  * Notifies watchers of SEARCH_ENGINE_TOPIC about changes to an engine or to
  * the state of the search service.
  *
- * @param aEngine
- *        The nsISearchEngine object to which the change applies.
- * @param aVerb
- *        A verb describing the change.
+ * @param {nsISearchEngine} engine
+ *   The engine to which the change applies.
+ * @param {string} verb
+ *   A verb describing the change.
  *
  * @see nsISearchService.idl
  */
 var gInitialized = false;
 var gReinitializing = false;
-function notifyAction(aEngine, aVerb) {
+function notifyAction(engine, verb) {
   if (gInitialized) {
-    LOG("NOTIFY: Engine: \"" + aEngine.name + "\"; Verb: \"" + aVerb + "\"");
-    Services.obs.notifyObservers(aEngine, SEARCH_ENGINE_TOPIC, aVerb);
+    LOG("NOTIFY: Engine: \"" + engine.name + "\"; Verb: \"" + verb + "\"");
+    Services.obs.notifyObservers(engine, SEARCH_ENGINE_TOPIC, verb);
   }
 }
 
 /**
  * Simple object representing a name/value pair.
+ * @see nsISearchEngine::addParam
+ *
+ * @param {string} name
+ * @param {string} value
+ * @param {string} purpose
  */
-function QueryParameter(aName, aValue, aPurpose) {
-  if (!aName || (aValue == null))
+function QueryParameter(name, value, purpose) {
+  if (!name || (value == null))
     FAIL("missing name or value for QueryParameter!");
 
-  this.name = aName;
-  this.value = aValue;
-  this.purpose = aPurpose;
+  this.name = name;
+  this.value = value;
+  this.purpose = purpose;
 }
 
 /**
  * Perform OpenSearch parameter substitution on aParamValue.
  *
- * @param aParamValue
- *        A string containing OpenSearch search parameters.
- * @param aSearchTerms
- *        The user-provided search terms. This string will inserted into
- *        aParamValue as the value of the OS_PARAM_USER_DEFINED parameter.
- *        This value must already be escaped appropriately - it is inserted
- *        as-is.
- * @param aEngine
- *        The engine which owns the string being acted on.
+ * @param {string} paramValue
+ *   The OpenSearch search parameters.
+ * @param {string} searchTerms
+ *   The user-provided search terms. This string will inserted into
+ *   paramValue as the value of the OS_PARAM_USER_DEFINED parameter.
+ *   This value must already be escaped appropriately - it is inserted
+ *   as-is.
+ * @param {nsISearchEngine} engine
+ *   The engine which owns the string being acted on.
  *
  * @see http://opensearch.a9.com/spec/1.1/querysyntax/#core
  */
-function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
+function ParamSubstitution(paramValue, searchTerms, engine) {
   const PARAM_REGEXP = /\{((?:\w+:)?\w+)(\??)\}/g;
-  return aParamValue.replace(PARAM_REGEXP, function(match, name, optional) {
+  return paramValue.replace(PARAM_REGEXP, function(match, name, optional) {
     // {searchTerms} is by far the most common param so handle it first.
     if (name == USER_DEFINED)
-      return aSearchTerms;
+      return searchTerms;
 
     // {inputEncoding} is the second most common param.
     if (name == OS_PARAM_INPUT_ENCODING)
-      return aEngine.queryCharset;
+      return engine.queryCharset;
 
     // moz: parameters are only available for default search engines.
-    if (name.startsWith("moz:") && aEngine._isDefault) {
+    if (name.startsWith("moz:") && engine._isDefault) {
       // {moz:locale} and {moz:distributionID} are common
       if (name == MOZ_PARAM_LOCALE)
         return getLocale();
       if (name == MOZ_PARAM_DIST_ID) {
         return Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
                                           Services.appinfo.distributionID || "");
       }
       // {moz:official} seems to have little use.
@@ -951,104 +971,103 @@ function getInternalAliases(engine) {
     }
   }
   return [];
 }
 
 /**
  * Creates an engineURL object, which holds the query URL and all parameters.
  *
- * @param aType
- *        A string containing the name of the MIME type of the search results
- *        returned by this URL.
- * @param aMethod
- *        The HTTP request method. Must be a case insensitive value of either
- *        "GET" or "POST".
- * @param aTemplate
- *        The URL to which search queries should be sent. For GET requests,
- *        must contain the string "{searchTerms}", to indicate where the user
- *        entered search terms should be inserted.
- * @param aResultDomain
- *        The root domain for this URL.  Defaults to the template's host.
+ * @param {string} mimeType
+ *   The name of the MIME type of the search results returned by this URL.
+ * @param {string} requestMethod
+ *   The HTTP request method. Must be a case insensitive value of either
+ *   "GET" or "POST".
+ * @param {string} template
+ *   The URL to which search queries should be sent. For GET requests,
+ *   must contain the string "{searchTerms}", to indicate where the user
+ *   entered search terms should be inserted.
+ * @param {string} [resultDomain]
+ *   The root domain for this URL.  Defaults to the template's host.
  *
  * @see http://opensearch.a9.com/spec/1.1/querysyntax/#urltag
  *
  * @throws NS_ERROR_NOT_IMPLEMENTED if aType is unsupported.
  */
-function EngineURL(aType, aMethod, aTemplate, aResultDomain) {
-  if (!aType || !aMethod || !aTemplate)
-    FAIL("missing type, method or template for EngineURL!");
-
-  var method = aMethod.toUpperCase();
-  var type   = aType.toLowerCase();
+function EngineURL(mimeType, requestMethod, template, resultDomain) {
+  if (!mimeType || !requestMethod || !template)
+    FAIL("missing mimeType, method or template for EngineURL!");
+
+  var method = requestMethod.toUpperCase();
+  var type   = mimeType.toLowerCase();
 
   if (method != "GET" && method != "POST")
     FAIL("method passed to EngineURL must be \"GET\" or \"POST\"");
 
   this.type     = type;
   this.method   = method;
   this.params   = [];
   this.rels     = [];
   // Don't serialize expanded mozparams
   this.mozparams = {};
 
-  var templateURI = makeURI(aTemplate);
+  var templateURI = makeURI(template);
   if (!templateURI)
     FAIL("new EngineURL: template is not a valid URI!", Cr.NS_ERROR_FAILURE);
 
   switch (templateURI.scheme) {
     case "http":
     case "https":
     // Disable these for now, see bug 295018
     // case "file":
     // case "resource":
-      this.template = aTemplate;
+      this.template = template;
       break;
     default:
       FAIL("new EngineURL: template uses invalid scheme!", Cr.NS_ERROR_FAILURE);
   }
 
   this.templateHost = templateURI.host;
   // If no resultDomain was specified in the engine definition file, use the
   // host from the template.
-  this.resultDomain = aResultDomain || this.templateHost;
+  this.resultDomain = resultDomain || this.templateHost;
 }
 EngineURL.prototype = {
 
-  addParam: function SRCH_EURL_addParam(aName, aValue, aPurpose) {
-    this.params.push(new QueryParameter(aName, aValue, aPurpose));
+  addParam(name, value, purpose) {
+    this.params.push(new QueryParameter(name, value, purpose));
   },
 
   // Note: This method requires that aObj has a unique name or the previous MozParams entry with
   // that name will be overwritten.
-  _addMozParam: function SRCH_EURL__addMozParam(aObj) {
-    aObj.mozparam = true;
-    this.mozparams[aObj.name] = aObj;
+  _addMozParam(obj) {
+    obj.mozparam = true;
+    this.mozparams[obj.name] = obj;
   },
 
-  getSubmission: function SRCH_EURL_getSubmission(aSearchTerms, aEngine, aPurpose) {
-    var url = ParamSubstitution(this.template, aSearchTerms, aEngine);
+  getSubmission(searchTerms, engine, purpose) {
+    var url = ParamSubstitution(this.template, searchTerms, engine);
     // Default to searchbar if the purpose is not provided
-    var purpose = aPurpose || "searchbar";
+    var requestPurpose = purpose || "searchbar";
 
     // If a particular purpose isn't defined in the plugin, fallback to 'searchbar'.
-    if (!this.params.some(p => p.purpose !== undefined && p.purpose == purpose))
-      purpose = "searchbar";
+    if (!this.params.some(p => p.purpose !== undefined && p.purpose == requestPurpose))
+      requestPurpose = "searchbar";
 
     // Create an application/x-www-form-urlencoded representation of our params
     // (name=value&name=value&name=value)
     let dataArray = [];
     for (var i = 0; i < this.params.length; ++i) {
       var param = this.params[i];
 
       // If this parameter has a purpose, only add it if the purpose matches
-      if (param.purpose !== undefined && param.purpose != purpose)
+      if (param.purpose !== undefined && param.purpose != requestPurpose)
         continue;
 
-      var value = ParamSubstitution(param.value, aSearchTerms, aEngine);
+      var value = ParamSubstitution(param.value, searchTerms, engine);
 
       dataArray.push(param.name + "=" + value);
     }
     let dataString = dataArray.join("&");
 
     var postData = null;
     if (this.method == "GET") {
       // GET method requests have no post data, and append the encoded
@@ -1071,33 +1090,33 @@ EngineURL.prototype = {
                  createInstance(Ci.nsIMIMEInputStream);
       postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
       postData.setData(stringStream);
     }
 
     return new Submission(Services.io.newURI(url), postData);
   },
 
-  _getTermsParameterName: function SRCH_EURL__getTermsParameterName() {
+  _getTermsParameterName() {
     let queryParam = this.params.find(p => p.value == "{" + USER_DEFINED + "}");
     return queryParam ? queryParam.name : "";
   },
 
-  _hasRelation: function SRC_EURL__hasRelation(aRel) {
-    return this.rels.some(e => e == aRel.toLowerCase());
+  _hasRelation(rel) {
+    return this.rels.some(e => e == rel.toLowerCase());
   },
 
-  _initWithJSON: function SRC_EURL__initWithJSON(aJson, aEngine) {
-    if (!aJson.params)
+  _initWithJSON(json) {
+    if (!json.params)
       return;
 
-    this.rels = aJson.rels;
-
-    for (let i = 0; i < aJson.params.length; ++i) {
-      let param = aJson.params[i];
+    this.rels = json.rels;
+
+    for (let i = 0; i < json.params.length; ++i) {
+      let param = json.params[i];
       if (param.mozparam) {
         if (param.condition == "pref") {
           let value = getMozParamPref(param.pref);
           if (value) {
             this.addParam(param.name, value);
           }
         }
         this._addMozParam(param);
@@ -1106,65 +1125,64 @@ EngineURL.prototype = {
       }
     }
   },
 
   /**
    * Creates a JavaScript object that represents this URL.
    * @returns An object suitable for serialization as JSON.
    **/
-  toJSON: function SRCH_EURL_toJSON() {
+  toJSON() {
     var json = {
       template: this.template,
       rels: this.rels,
       resultDomain: this.resultDomain,
     };
 
     if (this.type != URLTYPE_SEARCH_HTML)
       json.type = this.type;
     if (this.method != "GET")
       json.method = this.method;
 
-    function collapseMozParams(aParam) {
-      return this.mozparams[aParam.name] || aParam;
+    function collapseMozParams(param) {
+      return this.mozparams[param.name] || param;
     }
     json.params = this.params.map(collapseMozParams, this);
 
     return json;
   },
 };
 
 /**
  * nsISearchEngine constructor.
- * @param aLocation
- *        A nsIFile or nsIURI object representing the location of the
- *        search engine data file.
- * @param aIsReadOnly
- *        Boolean indicating whether the engine should be treated as read-only.
+ * @param {nsIFile|nsIURI} location
+ *   Represents the location of the search engine data file.
+ * @param {boolean} isReadOnly
+ *   Indicates whether the engine should be treated as read-only.
  */
-function Engine(aLocation, aIsReadOnly) {
-  this._readOnly = aIsReadOnly;
+function Engine(location, isReadOnly) {
+  this._readOnly = isReadOnly;
   this._urls = [];
   this._metaData = {};
 
   let file, uri;
-  if (typeof aLocation == "string") {
-    this._shortName = aLocation;
-  } else if (aLocation instanceof Ci.nsIFile) {
-    file = aLocation;
-  } else if (aLocation instanceof Ci.nsIURI) {
-    switch (aLocation.scheme) {
+  if (typeof location == "string") {
+    this._shortName = location;
+  } else if (location instanceof Ci.nsIFile) {
+    file = location;
+  } else if (location instanceof Ci.nsIURI) {
+    switch (location.scheme) {
       case "https":
       case "http":
       case "ftp":
       case "data":
       case "file":
       case "resource":
       case "chrome":
-        uri = aLocation;
+        uri = location;
         break;
       default:
         ERROR("Invalid URI passed to the nsISearchEngine constructor",
               Cr.NS_ERROR_INVALID_ARG);
     }
   } else {
     ERROR("Engine location is neither a File nor a URI object",
           Cr.NS_ERROR_INVALID_ARG);
@@ -1172,41 +1190,41 @@ function Engine(aLocation, aIsReadOnly) 
 
   if (!this._shortName) {
     // If we don't have a shortName at this point, it's the first time we load
     // this engine, so let's generate the shortName, id and loadPath values.
     let shortName;
     if (file) {
       shortName = file.leafName;
     } else if (uri && uri instanceof Ci.nsIURL) {
-      if (aIsReadOnly || (gEnvironment.get("XPCSHELL_TEST_PROFILE_DIR") &&
+      if (isReadOnly || (gEnvironment.get("XPCSHELL_TEST_PROFILE_DIR") &&
                           uri.scheme == "resource")) {
         shortName = uri.fileName;
       }
     }
     if (shortName && shortName.endsWith(".xml")) {
       this._shortName = shortName.slice(0, -4);
     }
     this._loadPath = this.getAnonymizedLoadPath(file, uri);
 
-    if (!shortName && !aIsReadOnly) {
+    if (!shortName && !isReadOnly) {
       // We are in the process of downloading and installing the engine.
       // We'll have the shortName and id once we are done parsing it.
      return;
     }
 
     // Build the id used for the legacy metadata storage, so that we
     // can do a one-time import of data from old profiles.
     if (this._isDefault ||
         (uri && uri.spec.startsWith(APP_SEARCH_PREFIX))) {
       // The second part of the check is to catch engines from language packs.
       // They aren't default engines (because they aren't app-shipped), but we
       // still need to give their id an [app] prefix for backward compat.
       this._id = "[app]/" + this._shortName + ".xml";
-    } else if (!aIsReadOnly) {
+    } else if (!isReadOnly) {
       this._id = "[profile]/" + this._shortName + ".xml";
     } else {
       // If the engine is neither a default one, nor a user-installed one,
       // it must be extension-shipped, so use the full path as id.
       LOG("Setting _id to full path for engine from " + this._loadPath);
       this._id = file ? file.path : uri.spec;
     }
   }
@@ -1235,19 +1253,19 @@ Engine.prototype = {
   _name: null,
   // The name of the charset used to submit the search terms.
   _queryCharset: null,
   // The engine's raw SearchForm value (URL string pointing to a search form).
   __searchForm: null,
   get _searchForm() {
     return this.__searchForm;
   },
-  set _searchForm(aValue) {
-    if (/^https?:/i.test(aValue))
-      this.__searchForm = aValue;
+  set _searchForm(value) {
+    if (/^https?:/i.test(value))
+      this.__searchForm = value;
     else
       LOG("_searchForm: Invalid URL dropped for " + this._name ||
           "the current engine");
   },
   // Whether to obtain user confirmation before adding the engine. This is only
   // used when the engine is first added to the list.
   _confirm: false,
   // Whether to set this as the current engine as soon as it is loaded.  This
@@ -1288,17 +1306,17 @@ Engine.prototype = {
   },
 
   /**
    * Retrieves the engine data from a URI. Initializes the engine, flushes to
    * disk, and notifies the search service once initialization is complete.
    *
    * @param uri The uri to load the search plugin from.
    */
-  _initFromURIAndLoad: function SRCH_ENG_initFromURIAndLoad(uri) {
+  _initFromURIAndLoad(uri) {
     ENSURE_WARN(uri instanceof Ci.nsIURI,
                 "Must have URI when calling _initFromURIAndLoad!",
                 Cr.NS_ERROR_UNEXPECTED);
 
     LOG("_initFromURIAndLoad: Downloading engine from: \"" + uri.spec + "\".");
 
     var chan = makeChannel(uri);
 
@@ -1326,56 +1344,60 @@ Engine.prototype = {
     await this._retrieveSearchXMLData(uri.spec);
     // Now that the data is loaded, initialize the engine object
     this._initFromData();
   },
 
   /**
    * Retrieves the engine data for a given URI asynchronously.
    *
-   * @returns {Promise} A promise, resolved successfully if retrieveing data
-   * succeeds.
+   * @param {string} url
+   *   The URL to get engine data from.
+   * @returns {Promise}
+   *   A promise, resolved successfully if retrieveing data succeeds.
    */
-  _retrieveSearchXMLData: function SRCH_ENG__retrieveSearchXMLData(aURL) {
+  _retrieveSearchXMLData(url) {
     return new Promise(resolve => {
       let request = new XMLHttpRequest();
       request.overrideMimeType("text/xml");
-      request.onload = (aEvent) => {
-        let responseXML = aEvent.target.responseXML;
+      request.onload = event => {
+        let responseXML = event.target.responseXML;
         this._data = responseXML.documentElement;
         resolve();
       };
-      request.onerror = function(aEvent) {
+      request.onerror = function(event) {
         resolve();
       };
-      request.open("GET", aURL, true);
+      request.open("GET", url, true);
       request.send();
     });
   },
 
   /**
    * Attempts to find an EngineURL object in the set of EngineURLs for
    * this Engine that has the given type string.  (This corresponds to the
    * "type" attribute in the "Url" node in the OpenSearch spec.)
-   * This method will return the first matching URL object found, or null
-   * if no matching URL is found.
    *
-   * @param aType string to match the EngineURL's type attribute
-   * @param aRel [optional] only return URLs that with this rel value
+   * @param {string} type
+   *   The type to match the EngineURL's type attribute.
+   * @param {string} [rel]
+   *   Only return URLs that with this rel value.
+   * @returns {EngineURL|null}
+   *   Returns the first matching URL found, null otherwise.
    */
-  _getURLOfType: function SRCH_ENG__getURLOfType(aType, aRel) {
+  _getURLOfType(type, rel) {
     for (let url of this._urls) {
-      if (url.type == aType && (!aRel || url._hasRelation(aRel)))
+      if (url.type == type && (!rel || url._hasRelation(rel)))
         return url;
     }
 
     return null;
   },
 
-  _confirmAddEngine: function SRCH_SVC_confirmAddEngine() {
+  _confirmAddEngine() {
     var stringBundle = Services.strings.createBundle(SEARCH_BUNDLE);
     var titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
 
     // Display only the hostname portion of the URL.
     var dialogMessage =
         stringBundle.formatStringFromName("addEngineConfirmation",
                                           [this._name, this._uri.host], 2);
     var checkboxMessage = null;
@@ -1404,204 +1426,210 @@ Engine.prototype = {
 
     return {confirmed: confirm, useNow: checked.value};
   },
 
   /**
    * Handle the successful download of an engine. Initializes the engine and
    * triggers parsing of the data. The engine is then flushed to disk. Notifies
    * the search service once initialization is complete.
+   *
+   * @param {array} bytes
+   *  The loaded search engine data.
+   * @param {nsISearchEngine} engine
+   *  The engine being loaded.
    */
-  _onLoad: function SRCH_ENG_onLoad(aBytes, aEngine) {
+  _onLoad(bytes, engine) {
     /**
      * Handle an error during the load of an engine by notifying the engine's
      * error callback, if any.
      */
     function onError(errorCode = Ci.nsISearchService.ERROR_UNKNOWN_FAILURE) {
       // Notify the callback of the failure
-      if (aEngine._installCallback) {
-        aEngine._installCallback(errorCode);
+      if (engine._installCallback) {
+        engine._installCallback(errorCode);
       }
     }
 
     function promptError(strings = {}, error = undefined) {
       onError(error);
 
-      if (aEngine._engineToUpdate) {
+      if (engine._engineToUpdate) {
         // We're in an update, so just fail quietly
-        LOG("updating " + aEngine._engineToUpdate.name + " failed");
+        LOG("updating " + engine._engineToUpdate.name + " failed");
         return;
       }
       var brandBundle = Services.strings.createBundle(BRAND_BUNDLE);
       var brandName = brandBundle.GetStringFromName("brandShortName");
 
       var searchBundle = Services.strings.createBundle(SEARCH_BUNDLE);
       var msgStringName = strings.error || "error_loading_engine_msg2";
       var titleStringName = strings.title || "error_loading_engine_title";
       var title = searchBundle.GetStringFromName(titleStringName);
       var text = searchBundle.formatStringFromName(msgStringName,
-                                                   [brandName, aEngine._location],
+                                                   [brandName, engine._location],
                                                    2);
 
       Services.ww.getNewPrompter(null).alert(title, text);
     }
 
-    if (!aBytes) {
+    if (!bytes) {
       promptError();
       return;
     }
 
     var parser = new DOMParser();
-    var doc = parser.parseFromBuffer(aBytes, "text/xml");
-    aEngine._data = doc.documentElement;
+    var doc = parser.parseFromBuffer(bytes, "text/xml");
+    engine._data = doc.documentElement;
 
     try {
       // Initialize the engine from the obtained data
-      aEngine._initFromData();
+      engine._initFromData();
     } catch (ex) {
       LOG("_onLoad: Failed to init engine!\n" + ex);
       // Report an error to the user
       if (ex.result == Cr.NS_ERROR_FILE_CORRUPTED) {
         promptError({ error: "error_invalid_engine_msg2",
                       title: "error_invalid_format_title",
                     });
       } else {
         promptError();
       }
       return;
     }
 
-    if (aEngine._engineToUpdate) {
-      let engineToUpdate = aEngine._engineToUpdate.wrappedJSObject;
+    if (engine._engineToUpdate) {
+      let engineToUpdate = engine._engineToUpdate.wrappedJSObject;
 
       // Make this new engine use the old engine's shortName, and preserve
       // metadata.
-      aEngine._shortName = engineToUpdate._shortName;
+      engine._shortName = engineToUpdate._shortName;
       Object.keys(engineToUpdate._metaData).forEach(key => {
-        aEngine.setAttr(key, engineToUpdate.getAttr(key));
+        engine.setAttr(key, engineToUpdate.getAttr(key));
       });
-      aEngine._loadPath = engineToUpdate._loadPath;
+      engine._loadPath = engineToUpdate._loadPath;
 
       // Keep track of the last modified date, so that we can make conditional
       // requests for future updates.
-      aEngine.setAttr("updatelastmodified", (new Date()).toUTCString());
+      engine.setAttr("updatelastmodified", (new Date()).toUTCString());
 
       // Set the new engine's icon, if it doesn't yet have one.
-      if (!aEngine._iconURI && engineToUpdate._iconURI)
-        aEngine._iconURI = engineToUpdate._iconURI;
+      if (!engine._iconURI && engineToUpdate._iconURI)
+        engine._iconURI = engineToUpdate._iconURI;
     } else {
       // Check that when adding a new engine (e.g., not updating an
       // existing one), a duplicate engine does not already exist.
-      if (Services.search.getEngineByName(aEngine.name)) {
+      if (Services.search.getEngineByName(engine.name)) {
         // If we're confirming the engine load, then display a "this is a
         // duplicate engine" prompt; otherwise, fail silently.
-        if (aEngine._confirm) {
+        if (engine._confirm) {
           promptError({ error: "error_duplicate_engine_msg",
                         title: "error_invalid_engine_title",
                       }, Ci.nsISearchService.ERROR_DUPLICATE_ENGINE);
         } else {
           onError(Ci.nsISearchService.ERROR_DUPLICATE_ENGINE);
         }
         LOG("_onLoad: duplicate engine found, bailing");
         return;
       }
 
       // If requested, confirm the addition now that we have the title.
       // This property is only ever true for engines added via
       // nsISearchService::addEngine.
-      if (aEngine._confirm) {
-        var confirmation = aEngine._confirmAddEngine();
+      if (engine._confirm) {
+        var confirmation = engine._confirmAddEngine();
         LOG("_onLoad: confirm is " + confirmation.confirmed +
             "; useNow is " + confirmation.useNow);
         if (!confirmation.confirmed) {
           onError();
           return;
         }
-        aEngine._useNow = confirmation.useNow;
+        engine._useNow = confirmation.useNow;
       }
 
-      aEngine._shortName = sanitizeName(aEngine.name);
-      aEngine._loadPath = aEngine.getAnonymizedLoadPath(null, aEngine._uri);
-      if (aEngine._extensionID) {
-        aEngine._loadPath += ":" + aEngine._extensionID;
+      engine._shortName = sanitizeName(engine.name);
+      engine._loadPath = engine.getAnonymizedLoadPath(null, engine._uri);
+      if (engine._extensionID) {
+        engine._loadPath += ":" + engine._extensionID;
       }
-      aEngine.setAttr("loadPathHash", getVerificationHash(aEngine._loadPath));
+      engine.setAttr("loadPathHash", getVerificationHash(engine._loadPath));
     }
 
     // Notify the search service of the successful load. It will deal with
     // updates by checking aEngine._engineToUpdate.
-    notifyAction(aEngine, SEARCH_ENGINE_LOADED);
+    notifyAction(engine, SEARCH_ENGINE_LOADED);
 
     // Notify the callback if needed
-    if (aEngine._installCallback) {
-      aEngine._installCallback();
+    if (engine._installCallback) {
+      engine._installCallback();
     }
   },
 
   /**
    * Creates a key by serializing an object that contains the icon's width
    * and height.
    *
-   * @param aWidth
-   *        Width of the icon.
-   * @param aHeight
-   *        Height of the icon.
-   * @returns key string
+   * @param {number} width
+   *   Width of the icon.
+   * @param {number} height
+   *   Height of the icon.
+   * @returns {string}
+   *   Key string.
    */
-  _getIconKey: function SRCH_ENG_getIconKey(aWidth, aHeight) {
+  _getIconKey(width, height) {
     let keyObj = {
-     width: aWidth,
-     height: aHeight,
+     width,
+     height,
     };
 
     return JSON.stringify(keyObj);
   },
 
   /**
    * Add an icon to the icon map used by getIconURIBySize() and getIcons().
    *
-   * @param aWidth
-   *        Width of the icon.
-   * @param aHeight
-   *        Height of the icon.
-   * @param aURISpec
-   *        String with the icon's URI.
+   * @param {number} width
+   *   Width of the icon.
+   * @param {number} height
+   *   Height of the icon.
+   * @param {string} uriSpec
+   *   String with the icon's URI.
    */
-  _addIconToMap: function SRCH_ENG_addIconToMap(aWidth, aHeight, aURISpec) {
-    if (aWidth == 16 && aHeight == 16) {
+  _addIconToMap(width, height, uriSpec) {
+    if (width == 16 && height == 16) {
       // The 16x16 icon is stored in _iconURL, we don't need to store it twice.
       return;
     }
 
     // Use an object instead of a Map() because it needs to be serializable.
     this._iconMapObj = this._iconMapObj || {};
-    let key = this._getIconKey(aWidth, aHeight);
-    this._iconMapObj[key] = aURISpec;
+    let key = this._getIconKey(width, height);
+    this._iconMapObj[key] = uriSpec;
   },
 
   /**
    * Sets the .iconURI property of the engine. If both aWidth and aHeight are
    * provided an entry will be added to _iconMapObj that will enable accessing
    * icon's data through getIcons() and getIconURIBySize() APIs.
    *
-   *  @param aIconURL
-   *         A URI string pointing to the engine's icon. Must have a http[s],
-   *         ftp, or data scheme. Icons with HTTP[S] or FTP schemes will be
-   *         downloaded and converted to data URIs for storage in the engine
-   *         XML files, if the engine is not readonly.
-   *  @param aIsPreferred
-   *         Whether or not this icon is to be preferred. Preferred icons can
-   *         override non-preferred icons.
-   *  @param aWidth (optional)
-   *         Width of the icon.
-   *  @param aHeight (optional)
-   *         Height of the icon.
+   * @param {string} iconURL
+   *   A URI string pointing to the engine's icon. Must have a http[s],
+   *   ftp, or data scheme. Icons with HTTP[S] or FTP schemes will be
+   *   downloaded and converted to data URIs for storage in the engine
+   *   XML files, if the engine is not readonly.
+   * @param {boolean} isPreferred
+   *   Whether or not this icon is to be preferred. Preferred icons can
+   *   override non-preferred icons.
+   * @param {number} [width]
+   *   Width of the icon.
+   * @param {number} [height]
+   *   Height of the icon.
    */
-  _setIcon: function SRCH_ENG_setIcon(aIconURL, aIsPreferred, aWidth, aHeight) {
-    var uri = makeURI(aIconURL);
+  _setIcon(iconURL, isPreferred, width, height) {
+    var uri = makeURI(iconURL);
 
     // Ignore bad URIs
     if (!uri)
       return;
 
     LOG("_setIcon: Setting icon url \"" + limitURILength(uri.spec) + "\" for engine \""
         + this.name + "\".");
     // Only accept remote icons from http[s] or ftp
@@ -1610,69 +1638,69 @@ Engine.prototype = {
       case "chrome":
         // We only allow chrome and resource icon URLs for built-in search engines
         if (!this._isDefault) {
           return;
         }
         // Fall through to the data case
       case "moz-extension":
       case "data":
-        if (!this._hasPreferredIcon || aIsPreferred) {
+        if (!this._hasPreferredIcon || isPreferred) {
           this._iconURI = uri;
           notifyAction(this, SEARCH_ENGINE_CHANGED);
-          this._hasPreferredIcon = aIsPreferred;
+          this._hasPreferredIcon = isPreferred;
         }
 
-        if (aWidth && aHeight) {
-          this._addIconToMap(aWidth, aHeight, aIconURL);
+        if (width && height) {
+          this._addIconToMap(width, height, iconURL);
         }
         break;
       case "http":
       case "https":
       case "ftp":
         LOG("_setIcon: Downloading icon: \"" + uri.spec +
             "\" for engine: \"" + this.name + "\"");
         var chan = makeChannel(uri);
 
-        let iconLoadCallback = function(aByteArray, aEngine) {
+        let iconLoadCallback = function(byteArray, engine) {
           // This callback may run after we've already set a preferred icon,
           // so check again.
-          if (aEngine._hasPreferredIcon && !aIsPreferred)
+          if (engine._hasPreferredIcon && !isPreferred)
             return;
 
-          if (!aByteArray) {
+          if (!byteArray) {
             LOG("iconLoadCallback: load failed");
             return;
           }
 
           let contentType = chan.contentType;
-          if (aByteArray.length > MAX_ICON_SIZE) {
+          if (byteArray.length > MAX_ICON_SIZE) {
             try {
               LOG("iconLoadCallback: rescaling icon");
-              [aByteArray, contentType] = rescaleIcon(aByteArray, contentType);
+              [byteArray, contentType] = rescaleIcon(byteArray, contentType);
             } catch (ex) {
               LOG("iconLoadCallback: got exception: " + ex);
               Cu.reportError("Unable to set an icon for the search engine because: " + ex);
               return;
             }
           }
 
           if (!contentType.startsWith("image/"))
             contentType = "image/x-icon";
           let dataURL = "data:" + contentType + ";base64," +
-            btoa(String.fromCharCode.apply(null, aByteArray));
-
-          aEngine._iconURI = makeURI(dataURL);
-
-          if (aWidth && aHeight) {
-            aEngine._addIconToMap(aWidth, aHeight, dataURL);
+            btoa(String.fromCharCode.apply(null, byteArray));
+
+          engine._iconURI = makeURI(dataURL);
+
+          if (width && height) {
+            engine._addIconToMap(width, height, dataURL);
           }
 
-          notifyAction(aEngine, SEARCH_ENGINE_CHANGED);
-          aEngine._hasPreferredIcon = aIsPreferred;
+          notifyAction(engine, SEARCH_ENGINE_CHANGED);
+          engine._hasPreferredIcon = isPreferred;
         };
 
         // If we're currently acting as an "update engine", then the callback
         // should set the icon on the engine we're updating and not us, since
         // |this| might be gone by the time the callback runs.
         var engineToSet = this._engineToUpdate || this;
 
         var listener = new loadListener(chan, engineToSet, iconLoadCallback);
@@ -1680,17 +1708,17 @@ Engine.prototype = {
         chan.asyncOpen(listener);
         break;
     }
   },
 
   /**
    * Initialize this Engine object from the collected data.
    */
-  _initFromData: function SRCH_ENG_initFromData() {
+  _initFromData() {
     ENSURE_WARN(this._data, "Can't init an engine with no data!",
                 Cr.NS_ERROR_UNEXPECTED);
 
     // Ensure we have a supported engine type before attempting to parse it.
     let element = this._data;
     if ((element.localName == MOZSEARCH_LOCALNAME &&
          element.namespaceURI == MOZSEARCH_NS_10) ||
         (element.localName == OPENSEARCH_LOCALNAME &&
@@ -1704,127 +1732,158 @@ Engine.prototype = {
     }
     // No need to keep a ref to our data (which in some cases can be a document
     // element) past this point
     this._data = null;
   },
 
   /**
    * Initialize an EngineURL object from metadata.
+   *
+   * @param {string} type
+   *   The url type.
+   * @param {object} params
+   *   The URL parameters.
+   * @param {string} [params.getParams]
+   *   Any parameters for a GET method.
+   * @param {string} [params.method]
+   *   The type of method, defaults to GET.
+   * @param {string} [params.mozParams]
+   *   Any special Mozilla Parameters.
+   * @param {string} [params.postParams]
+   *   Any parameters for a POST method.
+   * @param {string} params.template
+   *   The url template.
    */
-  _initEngineURLFromMetaData(aType, aParams) {
-    let url = new EngineURL(aType, aParams.method || "GET", aParams.template);
-
-    if (aParams.postParams) {
-      let queries = new URLSearchParams(aParams.postParams);
+  _initEngineURLFromMetaData(type, params) {
+    let url = new EngineURL(type, params.method || "GET", params.template);
+
+    if (params.postParams) {
+      let queries = new URLSearchParams(params.postParams);
       for (let [name, value] of queries) {
         url.addParam(name, value);
       }
     }
 
-    if (aParams.getParams) {
-      let queries = new URLSearchParams(aParams.getParams);
+    if (params.getParams) {
+      let queries = new URLSearchParams(params.getParams);
       for (let [name, value] of queries) {
         url.addParam(name, value);
       }
     }
 
-    if (aParams.mozParams) {
-      for (let p of aParams.mozParams) {
+    if (params.mozParams) {
+      for (let p of params.mozParams) {
         if ((p.condition || p.purpose) && !this._isDefault) {
           continue;
         }
         if (p.condition == "pref") {
           let value = getMozParamPref(p.pref);
           if (value) {
             url.addParam(p.name, value);
           }
           url._addMozParam(p);
         } else {
           url.addParam(p.name, p.value, p.purpose || undefined);
         }
       }
     }
 
     this._urls.push(url);
-    return url;
   },
 
   /**
    * Initialize this Engine object from a collection of metadata.
+   *
+   * @param {string} engineName
+   *   The name of the search engine.
+   * @param {object} params
+   *   The URL parameters.
+   * @param {string} [params.getParams]
+   *   Any parameters for a GET method.
+   * @param {string} [params.method]
+   *   The type of method, defaults to GET.
+   * @param {string} [params.mozParams]
+   *   Any special Mozilla Parameters.
+   * @param {string} [params.postParams]
+   *   Any parameters for a POST method.
+   * @param {string} params.template
+   *   The url template.
    */
-  _initFromMetadata: function SRCH_ENG_initMetaData(aName, aParams) {
-    this._extensionID = aParams.extensionID;
-    this._isBuiltin = !!aParams.isBuiltin;
+  _initFromMetadata(engineName, params) {
+    this._extensionID = params.extensionID;
+    this._isBuiltin = !!params.isBuiltin;
 
     this._initEngineURLFromMetaData(URLTYPE_SEARCH_HTML, {
-      method: (aParams.searchPostParams && "POST") || aParams.method || "GET",
-      template: aParams.template,
-      getParams: aParams.searchGetParams,
-      postParams: aParams.searchPostParams,
-      mozParams: aParams.mozParams,
+      method: (params.searchPostParams && "POST") || params.method || "GET",
+      template: params.template,
+      getParams: params.searchGetParams,
+      postParams: params.searchPostParams,
+      mozParams: params.mozParams,
     });
 
-    if (aParams.suggestURL) {
+    if (params.suggestURL) {
       this._initEngineURLFromMetaData(URLTYPE_SUGGEST_JSON, {
-        method: (aParams.suggestPostParams && "POST") || aParams.method || "GET",
-        template: aParams.suggestURL,
-        getParams: aParams.suggestGetParams,
-        postParams: aParams.suggestPostParams,
+        method: (params.suggestPostParams && "POST") || params.method || "GET",
+        template: params.suggestURL,
+        getParams: params.suggestGetParams,
+        postParams: params.suggestPostParams,
       });
     }
 
-    if (aParams.queryCharset) {
-      this._queryCharset = aParams.queryCharset;
+    if (params.queryCharset) {
+      this._queryCharset = params.queryCharset;
     }
-    if (aParams.postData) {
-      let queries = new URLSearchParams(aParams.postData);
+    if (params.postData) {
+      let queries = new URLSearchParams(params.postData);
       for (let [name, value] of queries) {
         this.addParam(name, value);
       }
     }
 
-    this._name = aName;
-    if (aParams.shortName) {
-      this._shortName = aParams.shortName;
+    this._name = engineName;
+    if (params.shortName) {
+      this._shortName = params.shortName;
     }
-    this.alias = aParams.alias;
-    this._description = aParams.description;
-    this.__searchForm = aParams.searchForm;
-    if (aParams.iconURL) {
-      this._setIcon(aParams.iconURL, true);
+    this.alias = params.alias;
+    this._description = params.description;
+    this.__searchForm = params.searchForm;
+    if (params.iconURL) {
+      this._setIcon(params.iconURL, true);
     }
     // Other sizes
-    if (aParams.icons) {
-      for (let icon of aParams.icons) {
+    if (params.icons) {
+      for (let icon of params.icons) {
         this._addIconToMap(icon.size, icon.size, icon.url);
       }
     }
   },
 
   /**
    * Extracts data from an OpenSearch URL element and creates an EngineURL
    * object which is then added to the engine's list of URLs.
    *
+   * @param {HTMLLinkElement} element
+   *   The OpenSearch URL element.
    * @throws NS_ERROR_FAILURE if a URL object could not be created.
    *
    * @see http://opensearch.a9.com/spec/1.1/querysyntax/#urltag.
    * @see EngineURL()
    */
-  _parseURL: function SRCH_ENG_parseURL(aElement) {
-    var type     = aElement.getAttribute("type");
+  _parseURL(element) {
+    var type     = element.getAttribute("type");
     // According to the spec, method is optional, defaulting to "GET" if not
     // specified
-    var method   = aElement.getAttribute("method") || "GET";
-    var template = aElement.getAttribute("template");
-    var resultDomain = aElement.getAttribute("resultdomain");
+    var method   = element.getAttribute("method") || "GET";
+    var template = element.getAttribute("template");
+    var resultDomain = element.getAttribute("resultdomain");
 
     let rels = [];
-    if (aElement.hasAttribute("rel")) {
-      rels = aElement.getAttribute("rel").toLowerCase().split(/\s+/);
+    if (element.hasAttribute("rel")) {
+      rels = element.getAttribute("rel").toLowerCase().split(/\s+/);
     }
 
     // Support an alternate suggestion type, see bug 1425827 for details.
     if (type == "application/json" && rels.includes("suggestions")) {
       type = URLTYPE_SUGGEST_JSON;
     }
 
     try {
@@ -1833,18 +1892,18 @@ Engine.prototype = {
       FAIL("_parseURL: failed to add " + template + " as a URL",
            Cr.NS_ERROR_FAILURE);
     }
 
     if (rels.length) {
       url.rels = rels;
     }
 
-    for (var i = 0; i < aElement.children.length; ++i) {
-      var param = aElement.children[i];
+    for (var i = 0; i < element.children.length; ++i) {
+      var param = element.children[i];
       if (param.localName == "Param") {
         try {
           url.addParam(param.getAttribute("name"), param.getAttribute("value"));
         } catch (ex) {
           // Ignore failure
           LOG("_parseURL: Url element has an invalid param");
         }
       } else if (param.localName == "MozParam" &&
@@ -1889,38 +1948,41 @@ Engine.prototype = {
       }
     }
 
     this._urls.push(url);
   },
 
   /**
    * Get the icon from an OpenSearch Image element.
+   *
+   * @param {HTMLLinkElement} element
+   *   The OpenSearch URL element.
    * @see http://opensearch.a9.com/spec/1.1/description/#image
    */
-  _parseImage: function SRCH_ENG_parseImage(aElement) {
-    LOG("_parseImage: Image textContent: \"" + limitURILength(aElement.textContent) + "\"");
-
-    let width = parseInt(aElement.getAttribute("width"), 10);
-    let height = parseInt(aElement.getAttribute("height"), 10);
+  _parseImage(element) {
+    LOG("_parseImage: Image textContent: \"" + limitURILength(element.textContent) + "\"");
+
+    let width = parseInt(element.getAttribute("width"), 10);
+    let height = parseInt(element.getAttribute("height"), 10);
     let isPrefered = width == 16 && height == 16;
 
     if (isNaN(width) || isNaN(height) || width <= 0 || height <= 0) {
       LOG("OpenSearch image element must have positive width and height.");
       return;
     }
 
-    this._setIcon(aElement.textContent, isPrefered, width, height);
+    this._setIcon(element.textContent, isPrefered, width, height);
   },
 
   /**
    * Extract search engine information from the collected data to initialize
    * the engine object.
    */
-  _parse: function SRCH_ENG_parse() {
+  _parse() {
     var doc = this._data;
 
     // The OpenSearch spec sets a default value for the input encoding.
     this._queryCharset = OS_PARAM_INPUT_ENCODING_DEF;
 
     for (var i = 0; i < doc.children.length; ++i) {
       var child = doc.children[i];
       switch (child.localName) {
@@ -1966,54 +2028,58 @@ Engine.prototype = {
     if (!this.name || (this._urls.length == 0))
       FAIL("_parse: No name, or missing URL!", Cr.NS_ERROR_FAILURE);
     if (!this.supportsResponseType(URLTYPE_SEARCH_HTML))
       FAIL("_parse: No text/html result type!", Cr.NS_ERROR_FAILURE);
   },
 
   /**
    * Init from a JSON record.
-   **/
-  _initWithJSON: function SRCH_ENG__initWithJSON(aJson) {
-    this._name = aJson._name;
-    this._shortName = aJson._shortName;
-    this._loadPath = aJson._loadPath;
-    this._description = aJson.description;
-    this._hasPreferredIcon = aJson._hasPreferredIcon == undefined;
-    this._queryCharset = aJson.queryCharset || DEFAULT_QUERY_CHARSET;
-    this.__searchForm = aJson.__searchForm;
-    this._updateInterval = aJson._updateInterval || null;
-    this._updateURL = aJson._updateURL || null;
-    this._iconUpdateURL = aJson._iconUpdateURL || null;
-    this._readOnly = aJson._readOnly == undefined;
-    this._iconURI = makeURI(aJson._iconURL);
-    this._iconMapObj = aJson._iconMapObj;
-    this._metaData = aJson._metaData || {};
-    this._isBuiltin = aJson._isBuiltin;
-    if (aJson.filePath) {
-      this._filePath = aJson.filePath;
+   *
+   * @param {object} json
+   *   The json record to use.
+   */
+  _initWithJSON(json) {
+    this._name = json._name;
+    this._shortName = json._shortName;
+    this._loadPath = json._loadPath;
+    this._description = json.description;
+    this._hasPreferredIcon = json._hasPreferredIcon == undefined;
+    this._queryCharset = json.queryCharset || DEFAULT_QUERY_CHARSET;
+    this.__searchForm = json.__searchForm;
+    this._updateInterval = json._updateInterval || null;
+    this._updateURL = json._updateURL || null;
+    this._iconUpdateURL = json._iconUpdateURL || null;
+    this._readOnly = json._readOnly == undefined;
+    this._iconURI = makeURI(json._iconURL);
+    this._iconMapObj = json._iconMapObj;
+    this._metaData = json._metaData || {};
+    this._isBuiltin = json._isBuiltin;
+    if (json.filePath) {
+      this._filePath = json.filePath;
     }
-    if (aJson.extensionID) {
-      this._extensionID = aJson.extensionID;
+    if (json.extensionID) {
+      this._extensionID = json.extensionID;
     }
-    for (let i = 0; i < aJson._urls.length; ++i) {
-      let url = aJson._urls[i];
+    for (let i = 0; i < json._urls.length; ++i) {
+      let url = json._urls[i];
       let engineURL = new EngineURL(url.type || URLTYPE_SEARCH_HTML,
                                     url.method || "GET", url.template,
                                     url.resultDomain || undefined);
-      engineURL._initWithJSON(url, this);
+      engineURL._initWithJSON(url);
       this._urls.push(engineURL);
     }
   },
 
   /**
    * Creates a JavaScript object that represents this engine.
-   * @returns An object suitable for serialization as JSON.
-   **/
-  toJSON: function SRCH_ENG_toJSON() {
+   * @returns {object}
+   *   An object suitable for serialization as JSON.
+   */
+  toJSON() {
     var json = {
       _name: this._name,
       _shortName: this._shortName,
       _loadPath: this._loadPath,
       description: this.description,
       __searchForm: this.__searchForm,
       _iconURL: this._iconURL,
       _iconMapObj: this._iconMapObj,
@@ -2286,31 +2352,31 @@ Engine.prototype = {
 
   get queryCharset() {
     if (this._queryCharset)
       return this._queryCharset;
     return this._queryCharset = "windows-1252"; // the default
   },
 
   // from nsISearchEngine
-  addParam: function SRCH_ENG_addParam(aName, aValue, aResponseType) {
-    if (!aName || (aValue == null))
+  addParam(name, value, responseType) {
+    if (!name || (value == null))
       FAIL("missing name or value for nsISearchEngine::addParam!");
     ENSURE_WARN(!this._readOnly,
                 "called nsISearchEngine::addParam on a read-only engine!",
                 Cr.NS_ERROR_FAILURE);
-    if (!aResponseType)
-      aResponseType = URLTYPE_SEARCH_HTML;
-
-    var url = this._getURLOfType(aResponseType);
+    if (!responseType)
+      responseType = URLTYPE_SEARCH_HTML;
+
+    var url = this._getURLOfType(responseType);
     if (!url)
-      FAIL("Engine object has no URL for response type " + aResponseType,
+      FAIL("Engine object has no URL for response type " + responseType,
            Cr.NS_ERROR_FAILURE);
 
-    url.addParam(aName, aValue);
+    url.addParam(name, value);
   },
 
   get _defaultMobileResponseType() {
     let type = URLTYPE_SEARCH_HTML;
 
     let isTablet = Services.sysinfo.get("tablet");
     if (isTablet && this.supportsResponseType("application/x-moz-tabletsearch")) {
       // Check for a tablet-specific search URL override
@@ -2339,59 +2405,59 @@ Engine.prototype = {
           "we won't show the search reset prompt");
       return true;
     }
 
     return false;
   },
 
   // from nsISearchEngine
-  getSubmission: function SRCH_ENG_getSubmission(aData, aResponseType, aPurpose) {
-    if (!aResponseType) {
-      aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
-                                                           URLTYPE_SEARCH_HTML;
+  getSubmission(data, responseType, purpose) {
+    if (!responseType) {
+      responseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
+                                                          URLTYPE_SEARCH_HTML;
     }
 
-    var url = this._getURLOfType(aResponseType);
+    var url = this._getURLOfType(responseType);
 
     if (!url)
       return null;
 
-    if (!aData) {
+    if (!data) {
       // Return a dummy submission object with our searchForm attribute
-      return new Submission(makeURI(this._getSearchFormWithPurpose(aPurpose)));
+      return new Submission(makeURI(this._getSearchFormWithPurpose(purpose)));
     }
 
-    LOG("getSubmission: In data: \"" + aData + "\"; Purpose: \"" + aPurpose + "\"");
-    var data = "";
+    LOG("getSubmission: In data: \"" + data + "\"; Purpose: \"" + purpose + "\"");
+    var submissionData = "";
     try {
-      data = Services.textToSubURI.ConvertAndEscape(this.queryCharset, aData);
+      submissionData = Services.textToSubURI.ConvertAndEscape(this.queryCharset, data);
     } catch (ex) {
       LOG("getSubmission: Falling back to default queryCharset!");
-      data = Services.textToSubURI.ConvertAndEscape(DEFAULT_QUERY_CHARSET, aData);
+      submissionData = Services.textToSubURI.ConvertAndEscape(DEFAULT_QUERY_CHARSET, data);
     }
-    LOG("getSubmission: Out data: \"" + data + "\"");
-    return url.getSubmission(data, this, aPurpose);
+    LOG("getSubmission: Out data: \"" + submissionData + "\"");
+    return url.getSubmission(submissionData, this, purpose);
   },
 
   // from nsISearchEngine
-  supportsResponseType: function SRCH_ENG_supportsResponseType(type) {
+  supportsResponseType(type) {
     return (this._getURLOfType(type) != null);
   },
 
   // from nsISearchEngine
-  getResultDomain: function SRCH_ENG_getResultDomain(aResponseType) {
-    if (!aResponseType) {
-      aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
-                                                           URLTYPE_SEARCH_HTML;
+  getResultDomain(responseType) {
+    if (!responseType) {
+      responseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
+                                                          URLTYPE_SEARCH_HTML;
     }
 
-    LOG("getResultDomain: responseType: \"" + aResponseType + "\"");
-
-    let url = this._getURLOfType(aResponseType);
+    LOG("getResultDomain: responseType: \"" + responseType + "\"");
+
+    let url = this._getURLOfType(responseType);
     if (url)
       return url.resultDomain;
     return "";
   },
 
   /**
    * Returns URL parsing properties used by _buildParseSubmissionMap.
    */
@@ -2423,42 +2489,43 @@ Engine.prototype = {
   get wrappedJSObject() {
     return this;
   },
 
   /**
    * Returns a string with the URL to an engine's icon matching both width and
    * height. Returns null if icon with specified dimensions is not found.
    *
-   * @param width
-   *        Width of the requested icon.
-   * @param height
-   *        Height of the requested icon.
+   * @param {number} width
+   *   Width of the requested icon.
+   * @param {number} height
+   *   Height of the requested icon.
+   * @returns {string|null}
    */
-  getIconURLBySize: function SRCH_ENG_getIconURLBySize(aWidth, aHeight) {
-    if (aWidth == 16 && aHeight == 16)
+  getIconURLBySize(width, height) {
+    if (width == 16 && height == 16)
       return this._iconURL;
 
     if (!this._iconMapObj)
       return null;
 
-    let key = this._getIconKey(aWidth, aHeight);
+    let key = this._getIconKey(width, height);
     if (key in this._iconMapObj) {
       return this._iconMapObj[key];
     }
     return null;
   },
 
   /**
    * Gets an array of all available icons. Each entry is an object with
    * width, height and url properties. width and height are numeric and
    * represent the icon's dimensions. url is a string with the URL for
    * the icon.
    */
-  getIcons: function SRCH_ENG_getIcons() {
+  getIcons() {
     let result = [];
     if (this._iconURL)
       result.push({width: 16, height: 16, url: this._iconURL});
 
     if (!this._iconMapObj)
       return result;
 
     for (let key of Object.keys(this._iconMapObj)) {
@@ -2480,17 +2547,17 @@ Engine.prototype = {
    * @param  options
    *         An object that must contain the following fields:
    *         {window} the content window for the window performing the search
    *         {originAttributes} the originAttributes for performing the search
    *
    * @throws NS_ERROR_INVALID_ARG if options is omitted or lacks required
    *         elemeents
    */
-  speculativeConnect: function SRCH_ENG_speculativeConnect(options) {
+  speculativeConnect(options) {
     if (!options || !options.window) {
       Cu.reportError("invalid options arg passed to nsISearchEngine.speculativeConnect");
       throw Cr.NS_ERROR_INVALID_ARG;
     }
     let connector =
         Services.io.QueryInterface(Ci.nsISpeculativeConnect);
 
     let searchURI = this.getSubmission("dummy").uri;
@@ -2526,36 +2593,36 @@ Engine.prototype = {
           // Can't setup speculative connection for this url, just ignore it.
           Cu.reportError(e);
         }
     }
   },
 };
 
 // nsISearchSubmission
-function Submission(aURI, aPostData = null) {
-  this._uri = aURI;
-  this._postData = aPostData;
+function Submission(uri, postData = null) {
+  this._uri = uri;
+  this._postData = postData;
 }
 Submission.prototype = {
   get uri() {
     return this._uri;
   },
   get postData() {
     return this._postData;
   },
   QueryInterface: ChromeUtils.generateQI([Ci.nsISearchSubmission]),
 };
 
 // nsISearchParseSubmissionResult
-function ParseSubmissionResult(aEngine, aTerms, aTermsOffset, aTermsLength) {
-  this._engine = aEngine;
-  this._terms = aTerms;
-  this._termsOffset = aTermsOffset;
-  this._termsLength = aTermsLength;
+function ParseSubmissionResult(engine, terms, termsOffset, termsLength) {
+  this._engine = engine;
+  this._terms = terms;
+  this._termsOffset = termsOffset;
+  this._termsLength = termsLength;
 }
 ParseSubmissionResult.prototype = {
   get engine() {
     return this._engine;
   },
   get terms() {
     return this._terms;
   },
@@ -2593,17 +2660,17 @@ SearchService.prototype = {
   // sync init before the async init finishes, we can avoid reading the cache
   // with sync disk I/O and handling lz4 decompression synchronously.
   // This is set back to null as soon as the initialization is finished.
   _cacheFileJSON: null,
 
   // If initialization has not been completed yet, perform synchronous
   // initialization.
   // Throws in case of initialization error.
-  _ensureInitialized: function SRCH_SVC__ensureInitialized() {
+  _ensureInitialized() {
     if (gInitialized) {
       if (!Components.isSuccessCode(this._initRV)) {
         LOG("_ensureInitialized: failure");
         throw this._initRV;
       }
       return;
     }
 
@@ -2732,17 +2799,17 @@ SearchService.prototype = {
       // Something unexpected as happened. In order to recover the original default engine,
       // use the first visible engine which us what currentEngine will use.
       return this._getSortedEngines(false)[0];
     }
 
     return defaultEngine;
   },
 
-  resetToOriginalDefaultEngine: function SRCH_SVC__resetToOriginalDefaultEngine() {
+  resetToOriginalDefaultEngine() {
     let originalDefaultEngine = this.originalDefaultEngine;
     originalDefaultEngine.hidden = false;
     this.defaultEngine = originalDefaultEngine;
   },
 
   async _buildCache() {
     if (this._batchTask)
       this._batchTask.disarm();
@@ -2819,18 +2886,18 @@ SearchService.prototype = {
         if (!done) {
           distDirs.push(dir);
         }
       } finally {
         iterator.close();
       }
     }
 
-    function notInCacheVisibleEngines(aEngineName) {
-      return !cache.visibleDefaultEngines.includes(aEngineName);
+    function notInCacheVisibleEngines(engineName) {
+      return !cache.visibleDefaultEngines.includes(engineName);
     }
 
     // Parse the engine name into the extension name + locale pair, some engines
     // will be exempt (ie yahoo-jp-auctions), can turn this from a whitelist to a
     // blacklist when more engines are multilocale than not.
     function parseEngineName(engineName) {
       let [name, locale] = engineName.split(/-(.+)/);
 
@@ -3107,96 +3174,95 @@ SearchService.prototype = {
     "[https]opensearch.startpageweb.com/bing-search.xml",
     "[https]opensearch.startwebsearch.com/bing-search.xml",
     "[https]opensearch.webstartsearch.com/bing-search.xml",
     "[https]opensearch.webofsearch.com/bing-search.xml",
     "[profile]/searchplugins/Yahoo! Powered.xml",
     "[profile]/searchplugins/yahoo! powered.xml",
   ],
 
-  _addEngineToStore: function SRCH_SVC_addEngineToStore(aEngine) {
-    let url = aEngine._getURLOfType("text/html").getSubmission("dummy", aEngine).uri.spec.toLowerCase();
+  _addEngineToStore(engine) {
+    let url = engine._getURLOfType("text/html").getSubmission("dummy", engine).uri.spec.toLowerCase();
     if (this._submissionURLIgnoreList.some(code => url.includes(code.toLowerCase()))) {
       LOG("_addEngineToStore: Ignoring engine");
       return;
     }
-    if (this._loadPathIgnoreList.includes(aEngine._loadPath)) {
+    if (this._loadPathIgnoreList.includes(engine._loadPath)) {
       LOG("_addEngineToStore: Ignoring engine");
       return;
     }
 
-    LOG("_addEngineToStore: Adding engine: \"" + aEngine.name + "\"");
+    LOG("_addEngineToStore: Adding engine: \"" + engine.name + "\"");
 
     // See if there is an existing engine with the same name. However, if this
     // engine is updating another engine, it's allowed to have the same name.
-    var hasSameNameAsUpdate = (aEngine._engineToUpdate &&
-                               aEngine.name == aEngine._engineToUpdate.name);
-    if (aEngine.name in this._engines && !hasSameNameAsUpdate) {
+    var hasSameNameAsUpdate = (engine._engineToUpdate &&
+                               engine.name == engine._engineToUpdate.name);
+    if (engine.name in this._engines && !hasSameNameAsUpdate) {
       LOG("_addEngineToStore: Duplicate engine found, aborting!");
       return;
     }
 
-    if (aEngine._engineToUpdate) {
+    if (engine._engineToUpdate) {
       // We need to replace engineToUpdate with the engine that just loaded.
-      var oldEngine = aEngine._engineToUpdate;
+      var oldEngine = engine._engineToUpdate;
 
       // Remove the old engine from the hash, since it's keyed by name, and our
       // name might change (the update might have a new name).
       delete this._engines[oldEngine.name];
 
       // Hack: we want to replace the old engine with the new one, but since
       // people may be holding refs to the nsISearchEngine objects themselves,
       // we'll just copy over all "private" properties (those without a getter
       // or setter) from one object to the other.
-      for (var p in aEngine) {
-        if (!(aEngine.__lookupGetter__(p) || aEngine.__lookupSetter__(p)))
-          oldEngine[p] = aEngine[p];
+      for (var p in engine) {
+        if (!(engine.__lookupGetter__(p) || engine.__lookupSetter__(p)))
+          oldEngine[p] = engine[p];
       }
-      aEngine = oldEngine;
-      aEngine._engineToUpdate = null;
+      engine = oldEngine;
+      engine._engineToUpdate = null;
 
       // Add the engine back
-      this._engines[aEngine.name] = aEngine;
-      notifyAction(aEngine, SEARCH_ENGINE_CHANGED);
+      this._engines[engine.name] = engine;
+      notifyAction(engine, SEARCH_ENGINE_CHANGED);
     } else {
       // Not an update, just add the new engine.
-      this._engines[aEngine.name] = aEngine;
+      this._engines[engine.name] = engine;
       // Only add the engine to the list of sorted engines if the initial list
       // has already been built (i.e. if this.__sortedEngines is non-null). If
       // it hasn't, we're loading engines from disk and the sorted engine list
       // will be built once we need it.
       if (this.__sortedEngines) {
-        this.__sortedEngines.push(aEngine);
+        this.__sortedEngines.push(engine);
         this._saveSortedEngineList();
       }
-      notifyAction(aEngine, SEARCH_ENGINE_ADDED);
+      notifyAction(engine, SEARCH_ENGINE_ADDED);
     }
 
-    if (aEngine._hasUpdates) {
+    if (engine._hasUpdates) {
       // Schedule the engine's next update, if it isn't already.
-      if (!aEngine.getAttr("updateexpir"))
-        engineUpdateService.scheduleNextUpdate(aEngine);
+      if (!engine.getAttr("updateexpir"))
+        engineUpdateService.scheduleNextUpdate(engine);
     }
   },
 
-  _loadEnginesMetadataFromCache: function SRCH_SVC__loadEnginesMetadataFromCache(cache) {
+  _loadEnginesMetadataFromCache(cache) {
     if (!cache.engines)
       return;
 
     for (let engine of cache.engines) {
       let name = engine._name;
       if (name in this._engines) {
         LOG("_loadEnginesMetadataFromCache, transfering metadata for " + name);
         this._engines[name]._metaData = engine._metaData || {};
       }
     }
   },
 
-  _loadEnginesFromCache: function SRCH_SVC__loadEnginesFromCache(cache,
-                                                                 skipReadOnly) {
+  _loadEnginesFromCache(cache, skipReadOnly) {
     if (!cache.engines)
       return;
 
     LOG("_loadEnginesFromCache: Loading " +
         cache.engines.length + " engines from cache");
 
     let skippedEngines = 0;
     for (let engine of cache.engines) {
@@ -3208,39 +3274,39 @@ SearchService.prototype = {
       this._loadEngineFromCache(engine);
     }
 
     if (skippedEngines) {
       LOG("_loadEnginesFromCache: skipped " + skippedEngines + " read-only engines.");
     }
   },
 
-  _loadEngineFromCache: function SRCH_SVC__loadEngineFromCache(json) {
+  _loadEngineFromCache(json) {
     try {
       let engine = new Engine(json._shortName, json._readOnly == undefined);
       engine._initWithJSON(json);
       this._addEngineToStore(engine);
     } catch (ex) {
       LOG("Failed to load " + json._name + " from cache: " + ex);
       LOG("Engine JSON: " + json.toSource());
     }
   },
 
   /**
    * Loads engines from a given directory asynchronously.
    *
-   * @param aDir the directory.
+   * @param {OS.File} dir the directory.
    *
    * @returns {Promise} A promise, resolved successfully if retrieveing data
    * succeeds.
    */
-  async _loadEnginesFromDir(aDir) {
-    LOG("_loadEnginesFromDir: Searching in " + aDir.path + " for search engines.");
-
-    let iterator = new OS.File.DirectoryIterator(aDir.path);
+  async _loadEnginesFromDir(dir) {
+    LOG("_loadEnginesFromDir: Searching in " + dir.path + " for search engines.");
+
+    let iterator = new OS.File.DirectoryIterator(dir.path);
 
     let osfiles = await iterator.nextBatch();
     iterator.close();
 
     let engines = [];
     for (let osfile of osfiles) {
       if (osfile.isDir || osfile.isSymLink)
         continue;
@@ -3267,25 +3333,26 @@ SearchService.prototype = {
       }
     }
     return engines;
   },
 
   /**
    * Loads engines from Chrome URLs asynchronously.
    *
-   * @param aURLs a list of URLs.
-   * @param isReload is being called from maybeReloadEngines.
-   *
+   * @param {array} urls
+   *   a list of URLs.
+   * @param {boolean} [isReload]
+   *   is being called from maybeReloadEngines.
    * @returns {Promise} A promise, resolved successfully if loading data
    * succeeds.
    */
-  async _loadFromChromeURLs(aURLs, isReload = false) {
+  async _loadFromChromeURLs(urls, isReload = false) {
     let engines = [];
-    for (let url of aURLs) {
+    for (let url of urls) {
       try {
         LOG("_loadFromChromeURLs: loading engine from chrome url: " + url);
         let uri = Services.io.newURI(APP_SEARCH_PREFIX + url + ".xml");
         let engine = new Engine(uri, true);
         await engine._initFromURI(uri);
         // If there is an existing engine with the same name then update that engine.
         // Only do this during reloads so it doesnt interfere with distribution
         // engines
@@ -3318,32 +3385,32 @@ SearchService.prototype = {
     }
 
     let uris = [];
 
     // Read list.json to find the engines we need to load.
     let request = new XMLHttpRequest();
     request.overrideMimeType("text/plain");
     let list = await new Promise(resolve => {
-      request.onload = function(aEvent) {
-        resolve(aEvent.target.responseText);
+      request.onload = function(event) {
+        resolve(event.target.responseText);
       };
-      request.onerror = function(aEvent) {
+      request.onerror = function(event) {
         LOG("_findEngines: failed to read " + listURL);
         resolve();
       };
       request.open("GET", Services.io.newURI(listURL).spec, true);
       request.send();
     });
 
     this._parseListJSON(list, uris);
     return uris;
   },
 
-  _parseListJSON: function SRCH_SVC_parseListJSON(list, uris) {
+  _parseListJSON(list, uris) {
     let json;
     try {
       json = JSON.parse(list);
     } catch (e) {
       Cu.reportError("parseListJSON: Failed to parse list.json: " + e);
       dump("parseListJSON: Failed to parse list.json: " + e + "\n");
       return;
     }
@@ -3485,37 +3552,36 @@ SearchService.prototype = {
       this._searchOrder = searchSettings[searchRegion].searchOrder;
     } else if ("searchOrder" in searchSettings.default) {
       this._searchOrder = searchSettings.default.searchOrder;
     } else if ("searchOrder" in json.default) {
       this._searchOrder = json.default.searchOrder;
     }
   },
 
-  _saveSortedEngineList: function SRCH_SVC_saveSortedEngineList() {
-    LOG("SRCH_SVC_saveSortedEngineList: starting");
+  _saveSortedEngineList() {
+    LOG("_saveSortedEngineList: starting");
 
     // Set the useDB pref to indicate that from now on we should use the order
     // information stored in the database.
     Services.prefs.setBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", true);
 
     var engines = this._getSortedEngines(true);
 
     for (var i = 0; i < engines.length; ++i) {
       engines[i].setAttr("order", i + 1);
     }
 
-    LOG("SRCH_SVC_saveSortedEngineList: done");
+    LOG("_saveSortedEngineList: done");
   },
 
-  _buildSortedEngineList: function SRCH_SVC_buildSortedEngineList() {
+  _buildSortedEngineList() {
     LOG("_buildSortedEngineList: building list");
     var addedEngines = { };
     this.__sortedEngines = [];
-    var engine;
 
     // If the user has specified a custom engine order, read the order
     // information from the metadata instead of the default prefs.
     if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
       LOG("_buildSortedEngineList: using db for order");
 
       // Flag to keep track of whether or not we need to call _saveSortedEngineList.
       let needToSaveEngineList = false;
@@ -3543,59 +3609,58 @@ SearchService.prototype = {
         needToSaveEngineList = true;
       this.__sortedEngines = filteredEngines;
 
       if (needToSaveEngineList)
         this._saveSortedEngineList();
     } else {
       // The DB isn't being used, so just read the engine order from the prefs
       var i = 0;
-      var engineName;
       var prefName;
 
       // The original default engine should always be first in the list
       if (this.originalDefaultEngine) {
         this.__sortedEngines.push(this.originalDefaultEngine);
         addedEngines[this.originalDefaultEngine.name] = this.originalDefaultEngine;
       }
 
       if (distroID) {
         try {
           var extras =
             Services.prefs.getChildList(BROWSER_SEARCH_PREF + "order.extra.");
 
           for (prefName of extras) {
-            engineName = Services.prefs.getCharPref(prefName);
-
-            engine = this._engines[engineName];
+            let engineName = Services.prefs.getCharPref(prefName);
+
+            let engine = this._engines[engineName];
             if (!engine || engine.name in addedEngines)
               continue;
 
             this.__sortedEngines.push(engine);
             addedEngines[engine.name] = engine;
           }
         } catch (e) { }
 
         while (true) {
           prefName = `${BROWSER_SEARCH_PREF}order.${++i}`;
-          engineName = getLocalizedPref(prefName);
+          let engineName = getLocalizedPref(prefName);
           if (!engineName)
             break;
 
-          engine = this._engines[engineName];
+          let engine = this._engines[engineName];
           if (!engine || engine.name in addedEngines)
             continue;
 
           this.__sortedEngines.push(engine);
           addedEngines[engine.name] = engine;
         }
       }
 
       for (let engineName of this._searchOrder) {
-        engine = this._engines[engineName];
+        let engine = this._engines[engineName];
         if (!engine || engine.name in addedEngines)
           continue;
 
         this.__sortedEngines.push(engine);
         addedEngines[engine.name] = engine;
       }
     }
 
@@ -3614,21 +3679,21 @@ SearchService.prototype = {
     const strength = Ci.nsICollation.kCollationCaseInsensitiveAscii;
     let comparator = (a, b) => collation.compareString(strength, a.name, b.name);
     alphaEngines.sort(comparator);
     return this.__sortedEngines = this.__sortedEngines.concat(alphaEngines);
   },
 
   /**
    * Get a sorted array of engines.
-   * @param aWithHidden
-   *        True if hidden plugins should be included in the result.
+   * @param {boolean} withHidden
+   *   True if hidden plugins should be included in the result.
    */
-  _getSortedEngines: function SRCH_SVC_getSorted(aWithHidden) {
-    if (aWithHidden)
+  _getSortedEngines(withHidden) {
+    if (withHidden)
       return this._sortedEngines;
 
     return this._sortedEngines.filter(function(engine) {
                                         return !engine.hidden;
                                       });
   },
 
   // nsISearchService
@@ -3690,42 +3755,41 @@ SearchService.prototype = {
 
   async getDefaultEngines() {
     await this.init(true);
     function isDefault(engine) {
       return engine._isDefault;
     }
     var engines = this._sortedEngines.filter(isDefault);
     var engineOrder = {};
-    var engineName;
     var i = 1;
 
     // Build a list of engines which we have ordering information for.
     // We're rebuilding the list here because _sortedEngines contain the
     // current order, but we want the original order.
 
     if (distroID) {
       // First, look at the "browser.search.order.extra" branch.
       try {
         var extras = Services.prefs.getChildList(BROWSER_SEARCH_PREF + "order.extra.");
 
-        for (var prefName of extras) {
-          engineName = Services.prefs.getCharPref(prefName);
+        for (let prefName of extras) {
+          let engineName = Services.prefs.getCharPref(prefName);
 
           if (!(engineName in engineOrder))
             engineOrder[engineName] = i++;
         }
       } catch (e) {
         LOG("Getting extra order prefs failed: " + e);
       }
 
       // Now look through the "browser.search.order" branch.
       for (var j = 1; ; j++) {
         let prefName = `${BROWSER_SEARCH_PREF}order.${j}`;
-        engineName = getLocalizedPref(prefName);
+        let engineName = getLocalizedPref(prefName);
         if (!engineName)
           break;
 
         if (!(engineName in engineOrder))
           engineOrder[engineName] = i++;
       }
     }
 
@@ -3757,26 +3821,26 @@ SearchService.prototype = {
     await this.init(true);
     LOG("getEngines: getting all engines for " + extensionID);
     var engines = this._getSortedEngines(true).filter(function(engine) {
       return engine._extensionID == extensionID;
     });
     return engines;
   },
 
-  getEngineByName: function SRCH_SVC_getEngineByName(aEngineName) {
+  getEngineByName(engineName) {
     this._ensureInitialized();
-    return this._engines[aEngineName] || null;
+    return this._engines[engineName] || null;
   },
 
-  getEngineByAlias: function SRCH_SVC_getEngineByAlias(aAlias) {
+  getEngineByAlias(alias) {
     this._ensureInitialized();
     for (var engineName in this._engines) {
       var engine = this._engines[engineName];
-      if (engine && (engine.alias == aAlias || engine._internalAliases.includes(aAlias))) {
+      if (engine && (engine.alias == alias || engine._internalAliases.includes(alias))) {
         return engine;
       }
     }
     return null;
   },
 
   async addEngineWithDetails(name, iconURL, alias, description, method, template, extensionID) {
     let isCurrent = false;
@@ -4017,19 +4081,19 @@ SearchService.prototype = {
       this._saveSortedEngineList();
     }
     notifyAction(engineToRemove, SEARCH_ENGINE_REMOVED);
   },
 
   async moveEngine(engine, newIndex) {
     await this.init(true);
     if ((newIndex > this._sortedEngines.length) || (newIndex < 0))
-      FAIL("SRCH_SVC_moveEngine: Index out of bounds!");
+      FAIL("moveEngine: Index out of bounds!");
     if (!(engine instanceof Ci.nsISearchEngine) && !(engine instanceof Engine))
-      FAIL("SRCH_SVC_moveEngine: Invalid engine passed to moveEngine!");
+      FAIL("moveEngine: Invalid engine passed to moveEngine!");
     if (engine.hidden)
       FAIL("moveEngine: Can't move a hidden engine!", Cr.NS_ERROR_FAILURE);
 
     engine = engine.wrappedJSObject;
 
     var currentIndex = this._sortedEngines.indexOf(engine);
     if (currentIndex == -1)
       FAIL("moveEngine: Can't find engine to move!", Cr.NS_ERROR_UNEXPECTED);
@@ -4304,17 +4368,17 @@ SearchService.prototype = {
    * {
    *   engine: The associated nsISearchEngine.
    *   termsParameterName: Name of the URL parameter containing the search
    *                       terms, for example "q".
    * }
    */
   _parseSubmissionMap: null,
 
-  _buildParseSubmissionMap: function SRCH_SVC__buildParseSubmissionMap() {
+  _buildParseSubmissionMap() {
     this._parseSubmissionMap = new Map();
 
     // Used only while building the map, indicates which entries do not refer to
     // the main domain of the engine but to an alternate domain, for example
     // "www.google.fr" for the "www.google.com" search engine.
     let keysOfAlternates = new Set();
 
     for (let engine of this._sortedEngines) {
@@ -4393,46 +4457,46 @@ SearchService.prototype = {
             url.params.length != sortedFormLength) {
           return false;
         }
 
         // Ensure engineURL formData is pre-sorted. Then, we're
         // not an engineURL match if any queryParam doesn't compare.
         let sortedParams = getSortedFormData(url.params);
         for (let i = 0; i < sortedFormLength; i++) {
-          let formData = sortedFormData[i];
+          let data = sortedFormData[i];
           let param = sortedParams[i];
-          if (param.name != formData.name ||
-              param.value != formData.value ||
-              param.purpose != formData.purpose) {
+          if (param.name != data.name ||
+              param.value != data.value ||
+              param.purpose != data.purpose) {
             return false;
           }
         }
         // Else we're a match.
         return true;
       });
     });
   },
 
-  parseSubmissionURL: function SRCH_SVC_parseSubmissionURL(aURL) {
+  parseSubmissionURL(url) {
     if (!gInitialized) {
       // If search is not initialized, do nothing.
       // This allows us to use this function early in telemetry.
       // The only other consumer of this (places) uses it much later.
       return gEmptyParseSubmissionResult;
     }
 
     if (!this._parseSubmissionMap) {
       this._buildParseSubmissionMap();
     }
 
     // Extract the elements of the provided URL first.
     let soughtKey, soughtQuery;
     try {
-      let soughtUrl = Services.io.newURI(aURL).QueryInterface(Ci.nsIURL);
+      let soughtUrl = Services.io.newURI(url).QueryInterface(Ci.nsIURL);
 
       // Exclude any URL that is not HTTP or HTTPS from the beginning.
       if (soughtUrl.scheme != "http" && soughtUrl.scheme != "https") {
         return gEmptyParseSubmissionResult;
       }
 
       // Reading these URL properties may fail and raise an exception.
       soughtKey = soughtUrl.host + soughtUrl.filePath.toLowerCase();
@@ -4460,18 +4524,18 @@ SearchService.prototype = {
         break;
       }
     }
     if (encodedTerms === null) {
       return gEmptyParseSubmissionResult;
     }
 
     let length = 0;
-    let offset = aURL.indexOf("?") + 1;
-    let query = aURL.slice(offset);
+    let offset = url.indexOf("?") + 1;
+    let query = url.slice(offset);
     // Iterate a second time over the original input string to determine the
     // correct search term offset and length in the original encoding.
     for (let param of query.split("&")) {
       let equalPos = param.indexOf("=");
       if (equalPos != -1 &&
           param.substr(0, equalPos) == mapEntry.termsParameterName) {
         // This is the parameter we are looking for.
         offset += equalPos + 1;
@@ -4491,28 +4555,28 @@ SearchService.prototype = {
       // Decoding errors will cause this match to be ignored.
       return gEmptyParseSubmissionResult;
     }
 
     return new ParseSubmissionResult(mapEntry.engine, terms, offset, length);
   },
 
   // nsIObserver
-  observe: function SRCH_SVC_observe(aEngine, aTopic, aVerb) {
-    switch (aTopic) {
+  observe(engine, topic, verb) {
+    switch (topic) {
       case SEARCH_ENGINE_TOPIC:
-        switch (aVerb) {
+        switch (verb) {
           case SEARCH_ENGINE_LOADED:
-            var engine = aEngine.QueryInterface(Ci.nsISearchEngine);
+            engine = engine.QueryInterface(Ci.nsISearchEngine);
             LOG("nsSearchService::observe: Done installation of " + engine.name
                 + ".");
             this._addEngineToStore(engine.wrappedJSObject);
             if (engine.wrappedJSObject._useNow) {
               LOG("nsSearchService::observe: setting current");
-              this.defaultEngine = aEngine;
+              this.defaultEngine = engine;
             }
             // The addition of the engine to the store always triggers an ADDED
             // or a CHANGED notification, that will trigger the task below.
             break;
           case SEARCH_ENGINE_ADDED:
           case SEARCH_ENGINE_CHANGED:
           case SEARCH_ENGINE_REMOVED:
             this.batchTask.disarm();
@@ -4528,24 +4592,24 @@ SearchService.prototype = {
         break;
 
       case TOPIC_LOCALES_CHANGE:
         // Locale changed. Re-init. We rely on observers, because we can't
         // return this promise to anyone.
         // FYI, This is also used by the search tests to do an async reinit.
         // Locales are removed during shutdown, so ignore this message
         if (!Services.startup.shuttingDown) {
-          this._reInit(aVerb);
+          this._reInit(verb);
         }
         break;
     }
   },
 
   // nsITimerCallback
-  notify: function SRCH_SVC_notify(aTimer) {
+  notify(timer) {
     LOG("_notify: checking for updates");
 
     if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
       return;
 
     // Our timer has expired, but unfortunately, we can't get any data from it.
     // Therefore, we need to walk our engine-list, looking for expired engines
     var currentTime = Date.now();
@@ -4572,17 +4636,17 @@ SearchService.prototype = {
 
       engineUpdateService.update(engine);
 
       // Schedule the next update
       engineUpdateService.scheduleNextUpdate(engine);
     } // end engine iteration
   },
 
-  _addObservers: function SRCH_SVC_addObservers() {
+  _addObservers() {
     if (this._observersAdded) {
       // There might be a race between synchronous and asynchronous
       // initialization for which we try to register the observers twice.
       return;
     }
     this._observersAdded = true;
 
     Services.obs.addObserver(this, SEARCH_ENGINE_TOPIC);
@@ -4621,53 +4685,53 @@ SearchService.prototype = {
         }
       })(),
 
       () => shutdownState
     );
   },
   _observersAdded: false,
 
-  _removeObservers: function SRCH_SVC_removeObservers() {
+  _removeObservers() {
     Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
     Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
     Services.obs.removeObserver(this, TOPIC_LOCALES_CHANGE);
   },
 
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsISearchService,
     Ci.nsIObserver,
     Ci.nsITimerCallback,
   ]),
 };
 
 
 const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
 
 /**
- * Outputs aText to the JavaScript console as well as to stdout, if the search
+ * Outputs text to the JavaScript console as well as to stdout, if the search
  * logging pref (browser.search.update.log) is set to true.
  */
-function ULOG(aText) {
+function ULOG(text) {
   if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
-    dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
-    Services.console.logStringMessage(aText);
+    dump(SEARCH_UPDATE_LOG_PREFIX + text + "\n");
+    Services.console.logStringMessage(text);
   }
 }
 
 var engineUpdateService = {
-  scheduleNextUpdate: function eus_scheduleNextUpdate(aEngine) {
-    var interval = aEngine._updateInterval || SEARCH_DEFAULT_UPDATE_INTERVAL;
+  scheduleNextUpdate(engine) {
+    var interval = engine._updateInterval || SEARCH_DEFAULT_UPDATE_INTERVAL;
     var milliseconds = interval * 86400000; // |interval| is in days
-    aEngine.setAttr("updateexpir", Date.now() + milliseconds);
+    engine.setAttr("updateexpir", Date.now() + milliseconds);
   },
 
-  update: function eus_Update(aEngine) {
-    let engine = aEngine.wrappedJSObject;
-    ULOG("update called for " + aEngine._name);
+  update(engine) {
+    engine = engine.wrappedJSObject;
+    ULOG("update called for " + engine._name);
     if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) ||
         !engine._hasUpdates)
       return;
 
     let testEngine = null;
     let updateURL = engine._getURLOfType(URLTYPE_OPENSEARCH);
     let updateURI = (updateURL && updateURL._hasRelation("self")) ?
                      updateURL.getSubmission("", engine).uri :