Bug 1325191 - Fix Eslint errors in devtools/server/*.js. r=jryans
authorTim Nguyen <ntim.bugs@gmail.com>
Fri, 23 Dec 2016 16:45:22 +0100
changeset 327211 fe99e9ae7fce0c01bef6656a3630573e62a68685
parent 327210 d7e821f96d054045c5c30edf9c50e6f614095d81
child 327212 fd069b26630ca44b36769aeb72320f45cece4676
push id31122
push userphilringnalda@gmail.com
push dateSun, 25 Dec 2016 00:51:37 +0000
treeherdermozilla-central@1156db49e976 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1325191
milestone53.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 1325191 - Fix Eslint errors in devtools/server/*.js. r=jryans MozReview-Commit-ID: 6t7lUP2Ip3v
.eslintignore
devtools/server/actors/highlighters/rulers.js
devtools/server/actors/highlighters/utils/markup.js
devtools/server/actors/utils/TabSources.js
devtools/server/actors/utils/actor-registry-utils.js
devtools/server/actors/utils/map-uri-to-addon-id.js
devtools/server/actors/utils/walker-search.js
devtools/server/actors/utils/webconsole-listeners.js
devtools/server/actors/utils/webconsole-utils.js
devtools/server/actors/utils/webconsole-worker-listeners.js
devtools/server/content-globals.js
devtools/server/content-server.jsm
devtools/server/event-parsers.js
devtools/server/primitive.js
devtools/server/service-worker-child.js
devtools/server/worker.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -78,48 +78,38 @@ browser/extensions/mortar/**
 
 # devtools/ exclusions
 devtools/client/canvasdebugger/**
 devtools/client/commandline/**
 devtools/client/debugger/**
 devtools/client/framework/**
 !devtools/client/framework/selection.js
 !devtools/client/framework/toolbox.js
-devtools/client/jsonview/lib/**
 devtools/client/netmonitor/test/**
 devtools/client/netmonitor/har/test/**
 devtools/client/projecteditor/**
-devtools/client/promisedebugger/**
 devtools/client/responsivedesign/**
 devtools/client/scratchpad/**
 devtools/client/shadereditor/**
 devtools/client/shared/*.jsm
 devtools/client/shared/webgl-utils.js
 devtools/client/shared/widgets/*.jsm
 devtools/client/webaudioeditor/**
 devtools/client/webconsole/net/**
 devtools/client/webconsole/test/**
 devtools/client/webconsole/console-output.js
 devtools/client/webconsole/hudservice.js
 devtools/client/webconsole/utils.js
 devtools/client/webconsole/webconsole-connection-proxy.js
 devtools/client/webconsole/webconsole.js
 devtools/client/webide/**
 !devtools/client/webide/components/webideCli.js
-devtools/server/*.js
-devtools/server/*.jsm
-!devtools/server/child.js
-!devtools/server/css-logic.js
-!devtools/server/main.js
-!devtools/server/websocket-server.js
-devtools/server/actors/**
+devtools/server/actors/*.js
 !devtools/server/actors/csscoverage.js
 !devtools/server/actors/inspector.js
-!devtools/server/actors/highlighters/css-grid.js
-!devtools/server/actors/highlighters/eye-dropper.js
 !devtools/server/actors/layout.js
 !devtools/server/actors/string.js
 !devtools/server/actors/styles.js
 !devtools/server/actors/tab.js
 !devtools/server/actors/webbrowser.js
 !devtools/server/actors/webextension.js
 !devtools/server/actors/webextension-inspected-window.js
 devtools/server/performance/**
@@ -129,17 +119,16 @@ devtools/server/tests/mochitest/**
 devtools/server/tests/unit/**
 devtools/shared/apps/**
 devtools/shared/client/**
 devtools/shared/discovery/**
 devtools/shared/gcli/**
 !devtools/shared/gcli/templater.js
 devtools/shared/heapsnapshot/**
 devtools/shared/layout/**
-devtools/shared/locales/**
 devtools/shared/performance/**
 !devtools/shared/platform/**
 devtools/shared/qrcode/**
 devtools/shared/security/**
 devtools/shared/shims/**
 devtools/shared/tests/**
 !devtools/shared/tests/unit/test_csslexer.js
 devtools/shared/touch/**
--- a/devtools/server/actors/highlighters/rulers.js
+++ b/devtools/server/actors/highlighters/rulers.js
@@ -145,22 +145,20 @@ RulersHighlighter.prototype = {
         }
 
         if (isHorizontal) {
           if (i % RULERS_MARKER_STEP === 0) {
             dMarkers += `M${i} 0 L${i} ${graduationLength}`;
           } else {
             dGraduations += `M${i} 0 L${i} ${graduationLength} `;
           }
+        } else if (i % 50 === 0) {
+          dMarkers += `M0 ${i} L${graduationLength} ${i}`;
         } else {
-          if (i % 50 === 0) {
-            dMarkers += `M0 ${i} L${graduationLength} ${i}`;
-          } else {
-            dGraduations += `M0 ${i} L${graduationLength} ${i}`;
-          }
+          dGraduations += `M0 ${i} L${graduationLength} ${i}`;
         }
       }
 
       pathGraduations.setAttribute("d", dGraduations);
       pathMarkers.setAttribute("d", dMarkers);
 
       return g;
     }
--- a/devtools/server/actors/highlighters/utils/markup.js
+++ b/devtools/server/actors/highlighters/utils/markup.js
@@ -240,17 +240,17 @@ function CanvasFrameAnonymousContentHelp
 
   // Only try to create the highlighter when the document is loaded,
   // otherwise, wait for the window-ready event to fire.
   let doc = this.highlighterEnv.document;
   if (doc.documentElement && doc.readyState != "uninitialized") {
     this._insert();
   }
 
-  this._onWindowReady= this._onWindowReady.bind(this);
+  this._onWindowReady = this._onWindowReady.bind(this);
   this.highlighterEnv.on("window-ready", this._onWindowReady);
 
   this.listeners = new Map();
 }
 
 CanvasFrameAnonymousContentHelper.prototype = {
   destroy: function () {
     try {
--- a/devtools/server/actors/utils/TabSources.js
+++ b/devtools/server/actors/utils/TabSources.js
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const { Ci, Cu } = require("chrome");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { assert, fetch } = DevToolsUtils;
 const EventEmitter = require("devtools/shared/event-emitter");
 const { OriginalLocation, GeneratedLocation } = require("devtools/server/actors/common");
 const { resolve } = require("promise");
 const { joinURI } = require("devtools/shared/path");
 
 loader.lazyRequireGetter(this, "SourceActor", "devtools/server/actors/source", true);
@@ -132,28 +131,26 @@ TabSources.prototype = {
 
       if (isInlineSource) {
         // If it's an inline source, the fake HTML source hasn't been
         // created yet (would have returned above), so flip this source
         // into a sourcemapped state by giving it an `originalUrl` which
         // is the HTML url.
         originalUrl = source.url;
         source = null;
-      }
-      else if (this._sourceActors.has(source)) {
+      } else if (this._sourceActors.has(source)) {
         return this._sourceActors.get(source);
       }
-    }
-    else if (originalUrl) {
+    } else if (originalUrl) {
       // Not all "original" scripts are distinctly separate from the
       // generated script. Pretty-printed sources have a sourcemap for
       // themselves, so we need to make sure there a real source
       // doesn't already exist with this URL.
-      for (let [source, actor] of this._sourceActors) {
-        if (source.url === originalUrl) {
+      for (let [sourceData, actor] of this._sourceActors) {
+        if (sourceData.url === originalUrl) {
           return actor;
         }
       }
 
       if (originalUrl in this._sourceMappedSourceActors) {
         return this._sourceMappedSourceActors[originalUrl];
       }
     }
@@ -163,51 +160,48 @@ TabSources.prototype = {
       source: source,
       originalUrl: originalUrl,
       generatedSource: generatedSource,
       isInlineSource: isInlineSource,
       contentType: contentType
     });
 
     let sourceActorStore = this._thread.sourceActorStore;
-    var id = sourceActorStore.getReusableActorId(source, originalUrl);
+    let id = sourceActorStore.getReusableActorId(source, originalUrl);
     if (id) {
       actor.actorID = id;
     }
 
     this._thread.threadLifetimePool.addActor(actor);
     sourceActorStore.setReusableActorId(source, originalUrl, actor.actorID);
 
     if (this._autoBlackBox &&
         !this.neverAutoBlackBoxSources.has(actor.url) &&
         this._isMinifiedURL(actor.url)) {
-
       this.blackBox(actor.url);
       this.neverAutoBlackBoxSources.add(actor.url);
     }
 
     if (source) {
       this._sourceActors.set(source, actor);
-    }
-    else {
+    } else {
       this._sourceMappedSourceActors[originalUrl] = actor;
     }
 
     this._emitNewSource(actor);
     return actor;
   },
 
   _emitNewSource: function (actor) {
     if (!actor.source) {
       // Always notify if we don't have a source because that means
       // it's something that has been sourcemapped, or it represents
       // the HTML file that contains inline sources.
       this.emit("newSource", actor);
-    }
-    else {
+    } else {
       // If sourcemapping is enabled and a source has sourcemaps, we
       // create `SourceActor` instances for both the original and
       // generated sources. The source actors for the generated
       // sources are only for internal use, however; breakpoints are
       // managed by these internal actors. We only want to notify the
       // user of the original sources though, so if the actor has a
       // `Debugger.Source` instance and a valid source map (meaning
       // it's a generated source), don't send the notification.
@@ -241,298 +235,290 @@ TabSources.prototype = {
       }
 
       if (url in this._sourceMappedSourceActors) {
         return this._sourceMappedSourceActors[url];
       }
     }
 
     throw new Error("getSourceActorByURL: could not find source for " + url);
-    return null;
   },
 
   /**
    * Returns true if the URL likely points to a minified resource, false
    * otherwise.
    *
-   * @param String aURL
-   *        The URL to test.
+   * @param String uri
+   *        The url to test.
    * @returns Boolean
    */
-  _isMinifiedURL: function (aURL) {
-    if (!aURL) {
+  _isMinifiedURL: function (uri) {
+    if (!uri) {
       return false;
     }
 
     try {
-      let url = new URL(aURL);
+      let url = new URL(uri);
       let pathname = url.pathname;
       return MINIFIED_SOURCE_REGEXP.test(pathname.slice(pathname.lastIndexOf("/") + 1));
     } catch (e) {
       // Not a valid URL so don't try to parse out the filename, just test the
       // whole thing with the minified source regexp.
-      return MINIFIED_SOURCE_REGEXP.test(aURL);
+      return MINIFIED_SOURCE_REGEXP.test(uri);
     }
   },
 
   /**
    * Create a source actor representing this source. This ignores
    * source mapping and always returns an actor representing this real
    * source. Use `createSourceActors` if you want to respect source maps.
    *
-   * @param Debugger.Source aSource
+   * @param Debugger.Source source
    *        The source instance to create an actor for.
    * @returns SourceActor
    */
-  createNonSourceMappedActor: function (aSource) {
+  createNonSourceMappedActor: function (source) {
     // Don't use getSourceURL because we don't want to consider the
     // displayURL property if it's an eval source. We only want to
     // consider real URLs, otherwise if there is a URL but it's
     // invalid the code below will not set the content type, and we
     // will later try to fetch the contents of the URL to figure out
     // the content type, but it's a made up URL for eval sources.
-    let url = isEvalSource(aSource) ? null : aSource.url;
-    let spec = { source: aSource };
+    let url = isEvalSource(source) ? null : source.url;
+    let spec = { source };
 
     // XXX bug 915433: We can't rely on Debugger.Source.prototype.text
     // if the source is an HTML-embedded <script> tag. Since we don't
     // have an API implemented to detect whether this is the case, we
     // need to be conservative and only treat valid js files as real
     // sources. Otherwise, use the `originalUrl` property to treat it
     // as an HTML source that manages multiple inline sources.
 
     // Assume the source is inline if the element that introduced it is not a
     // script element, or does not have a src attribute.
-    let element = aSource.element ? aSource.element.unsafeDereference() : null;
+    let element = source.element ? source.element.unsafeDereference() : null;
     if (element && (element.tagName !== "SCRIPT" || !element.hasAttribute("src"))) {
       spec.isInlineSource = true;
-    } else if (aSource.introductionType === "wasm") {
+    } else if (source.introductionType === "wasm") {
       // Wasm sources are not JavaScript. Give them their own content-type.
       spec.contentType = "text/wasm";
-    } else {
-      if (url) {
-        // There are a few special URLs that we know are JavaScript:
-        // inline `javascript:` and code coming from the console
-        if (url.indexOf("Scratchpad/") === 0 ||
-            url.indexOf("javascript:") === 0 ||
-            url === "debugger eval code") {
-          spec.contentType = "text/javascript";
-        } else {
-          try {
-            let pathname = new URL(url).pathname;
-            let filename = pathname.slice(pathname.lastIndexOf("/") + 1);
-            let index = filename.lastIndexOf(".");
-            let extension = index >= 0 ? filename.slice(index + 1) : "";
-            if (extension === "xml") {
-              // XUL inline scripts may not correctly have the
-              // `source.element` property, so do a blunt check here if
-              // it's an xml page.
-              spec.isInlineSource = true;
-            }
-            else if (extension === "js") {
-              spec.contentType = "text/javascript";
-            }
-          } catch (e) {
-            // This only needs to be here because URL is not yet exposed to
-            // workers. (BUG 1258892)
-            const filename = url;
-            const index = filename.lastIndexOf(".");
-            const extension = index >= 0 ? filename.slice(index + 1) : "";
-            if (extension === "js") {
-              spec.contentType = "text/javascript";
-            }
+    } else if (url) {
+      // There are a few special URLs that we know are JavaScript:
+      // inline `javascript:` and code coming from the console
+      if (url.indexOf("Scratchpad/") === 0 ||
+          url.indexOf("javascript:") === 0 ||
+          url === "debugger eval code") {
+        spec.contentType = "text/javascript";
+      } else {
+        try {
+          let pathname = new URL(url).pathname;
+          let filename = pathname.slice(pathname.lastIndexOf("/") + 1);
+          let index = filename.lastIndexOf(".");
+          let extension = index >= 0 ? filename.slice(index + 1) : "";
+          if (extension === "xml") {
+            // XUL inline scripts may not correctly have the
+            // `source.element` property, so do a blunt check here if
+            // it's an xml page.
+            spec.isInlineSource = true;
+          } else if (extension === "js") {
+            spec.contentType = "text/javascript";
+          }
+        } catch (e) {
+          // This only needs to be here because URL is not yet exposed to
+          // workers. (BUG 1258892)
+          const filename = url;
+          const index = filename.lastIndexOf(".");
+          const extension = index >= 0 ? filename.slice(index + 1) : "";
+          if (extension === "js") {
+            spec.contentType = "text/javascript";
           }
         }
       }
-      else {
-        // Assume the content is javascript if there's no URL
-        spec.contentType = "text/javascript";
-      }
+    } else {
+      // Assume the content is javascript if there's no URL
+      spec.contentType = "text/javascript";
     }
 
     return this.source(spec);
   },
 
   /**
    * This is an internal function that returns a promise of an array
    * of source actors representing all the source mapped sources of
-   * `aSource`, or `null` if the source is not sourcemapped or
+   * `source`, or `null` if the source is not sourcemapped or
    * sourcemapping is disabled. Users should call `createSourceActors`
    * instead of this.
    *
-   * @param Debugger.Source aSource
+   * @param Debugger.Source source
    *        The source instance to create actors for.
    * @return Promise of an array of source actors
    */
-  _createSourceMappedActors: function (aSource) {
-    if (!this._useSourceMaps || !aSource.sourceMapURL) {
+  _createSourceMappedActors: function (source) {
+    if (!this._useSourceMaps || !source.sourceMapURL) {
       return resolve(null);
     }
 
-    return this.fetchSourceMap(aSource)
+    return this.fetchSourceMap(source)
       .then(map => {
         if (map) {
           return map.sources.map(s => {
-            return this.source({ originalUrl: s, generatedSource: aSource });
+            return this.source({ originalUrl: s, generatedSource: source });
           }).filter(isNotNull);
         }
         return null;
       });
   },
 
   /**
    * Creates the source actors representing the appropriate sources
-   * of `aSource`. If sourcemapped, returns actors for all of the original
+   * of `source`. If sourcemapped, returns actors for all of the original
    * sources, otherwise returns a 1-element array with the actor for
-   * `aSource`.
+   * `source`.
    *
-   * @param Debugger.Source aSource
+   * @param Debugger.Source source
    *        The source instance to create actors for.
    * @param Promise of an array of source actors
    */
-  createSourceActors: function (aSource) {
-    return this._createSourceMappedActors(aSource).then(actors => {
-      let actor = this.createNonSourceMappedActor(aSource);
+  createSourceActors: function (source) {
+    return this._createSourceMappedActors(source).then(actors => {
+      let actor = this.createNonSourceMappedActor(source);
       return (actors || [actor]).filter(isNotNull);
     });
   },
 
   /**
    * Return a promise of a SourceMapConsumer for the source map for
-   * `aSource`; if we already have such a promise extant, return that.
+   * `source`; if we already have such a promise extant, return that.
    * This will fetch the source map if we don't have a cached object
    * and source maps are enabled (see `_fetchSourceMap`).
    *
-   * @param Debugger.Source aSource
+   * @param Debugger.Source source
    *        The source instance to get sourcemaps for.
    * @return Promise of a SourceMapConsumer
    */
-  fetchSourceMap: function (aSource) {
+  fetchSourceMap: function (source) {
     if (!this._useSourceMaps) {
       return resolve(null);
-    }
-    else if (this._sourceMaps.has(aSource)) {
-      return this._sourceMaps.get(aSource);
-    }
-    else if (!aSource || !aSource.sourceMapURL) {
+    } else if (this._sourceMaps.has(source)) {
+      return this._sourceMaps.get(source);
+    } else if (!source || !source.sourceMapURL) {
       return resolve(null);
     }
 
-    let sourceMapURL = aSource.sourceMapURL;
-    if (aSource.url) {
-      sourceMapURL = joinURI(aSource.url, sourceMapURL);
+    let sourceMapURL = source.sourceMapURL;
+    if (source.url) {
+      sourceMapURL = joinURI(source.url, sourceMapURL);
     }
-    let result = this._fetchSourceMap(sourceMapURL, aSource.url);
+    let result = this._fetchSourceMap(sourceMapURL, source.url);
 
     // The promises in `_sourceMaps` must be the exact same instances
     // as returned by `_fetchSourceMap` for `clearSourceMapCache` to
     // work.
-    this._sourceMaps.set(aSource, result);
+    this._sourceMaps.set(source, result);
     return result;
   },
 
   /**
    * Return a promise of a SourceMapConsumer for the source map for
-   * `aSource`. The resolved result may be null if the source does not
+   * `source`. The resolved result may be null if the source does not
    * have a source map or source maps are disabled.
    */
-  getSourceMap: function (aSource) {
-    return resolve(this._sourceMaps.get(aSource));
+  getSourceMap: function (source) {
+    return resolve(this._sourceMaps.get(source));
   },
 
   /**
-   * Set a SourceMapConsumer for the source map for
-   * |aSource|.
+   * Set a SourceMapConsumer for the source map for |source|.
    */
-  setSourceMap: function (aSource, aMap) {
-    this._sourceMaps.set(aSource, resolve(aMap));
+  setSourceMap: function (source, map) {
+    this._sourceMaps.set(source, resolve(map));
   },
 
   /**
    * Return a promise of a SourceMapConsumer for the source map located at
-   * |aAbsSourceMapURL|, which must be absolute. If there is already such a
+   * |absSourceMapURL|, which must be absolute. If there is already such a
    * promise extant, return it. This will not fetch if source maps are
    * disabled.
    *
-   * @param string aAbsSourceMapURL
+   * @param string absSourceMapURL
    *        The source map URL, in absolute form, not relative.
-   * @param string aScriptURL
+   * @param string sourceURL
    *        When the source map URL is a data URI, there is no sourceRoot on the
    *        source map, and the source map's sources are relative, we resolve
-   *        them from aScriptURL.
+   *        them from sourceURL.
    */
-  _fetchSourceMap: function (aAbsSourceMapURL, aSourceURL) {
+  _fetchSourceMap: function (absSourceMapURL, sourceURL) {
     assert(this._useSourceMaps,
            "Cannot fetch sourcemaps if they are disabled");
 
-    if (this._sourceMapCache[aAbsSourceMapURL]) {
-      return this._sourceMapCache[aAbsSourceMapURL];
+    if (this._sourceMapCache[absSourceMapURL]) {
+      return this._sourceMapCache[absSourceMapURL];
     }
 
-    let fetching = fetch(aAbsSourceMapURL, { loadFromCache: false })
+    let fetching = fetch(absSourceMapURL, { loadFromCache: false })
       .then(({ content }) => {
         let map = new SourceMapConsumer(content);
-        this._setSourceMapRoot(map, aAbsSourceMapURL, aSourceURL);
+        this._setSourceMapRoot(map, absSourceMapURL, sourceURL);
         return map;
       })
       .then(null, error => {
         if (!DevToolsUtils.reportingDisabled) {
           DevToolsUtils.reportException("TabSources.prototype._fetchSourceMap", error);
         }
         return null;
       });
-    this._sourceMapCache[aAbsSourceMapURL] = fetching;
+    this._sourceMapCache[absSourceMapURL] = fetching;
     return fetching;
   },
 
   /**
    * Sets the source map's sourceRoot to be relative to the source map url.
    */
-  _setSourceMapRoot: function (aSourceMap, aAbsSourceMapURL, aScriptURL) {
+  _setSourceMapRoot: function (sourceMap, absSourceMapURL, scriptURL) {
     // No need to do this fiddling if we won't be fetching any sources over the
     // wire.
-    if (aSourceMap.hasContentsOfAllSources()) {
+    if (sourceMap.hasContentsOfAllSources()) {
       return;
     }
 
     const base = this._dirname(
-      aAbsSourceMapURL.indexOf("data:") === 0
-        ? aScriptURL
-        : aAbsSourceMapURL);
-    aSourceMap.sourceRoot = aSourceMap.sourceRoot
-      ? joinURI(base, aSourceMap.sourceRoot)
+      absSourceMapURL.indexOf("data:") === 0
+        ? scriptURL
+        : absSourceMapURL);
+    sourceMap.sourceRoot = sourceMap.sourceRoot
+      ? joinURI(base, sourceMap.sourceRoot)
       : base;
   },
 
-  _dirname: function (aPath) {
-    let url = new URL(aPath);
+  _dirname: function (path) {
+    let url = new URL(path);
     let href = url.href;
     return href.slice(0, href.lastIndexOf("/"));
   },
 
   /**
    * Clears the source map cache. Source maps are cached by URL so
    * they can be reused across separate Debugger instances (once in
    * this cache, they will never be reparsed again). They are
    * also cached by Debugger.Source objects for usefulness. By default
    * this just removes the Debugger.Source cache, but you can remove
    * the lower-level URL cache with the `hard` option.
    *
-   * @param aSourceMapURL string
+   * @param sourceMapURL string
    *        The source map URL to uncache
    * @param opts object
    *        An object with the following properties:
    *        - hard: Also remove the lower-level URL cache, which will
    *          make us completely forget about the source map.
    */
-  clearSourceMapCache: function (aSourceMapURL, opts = { hard: false }) {
-    let oldSm = this._sourceMapCache[aSourceMapURL];
+  clearSourceMapCache: function (sourceMapURL, opts = { hard: false }) {
+    let oldSm = this._sourceMapCache[sourceMapURL];
 
     if (opts.hard) {
-      delete this._sourceMapCache[aSourceMapURL];
+      delete this._sourceMapCache[sourceMapURL];
     }
 
     if (oldSm) {
       // Clear out the current cache so all sources will get the new one
       for (let [source, sm] of this._sourceMaps.entries()) {
         if (sm === oldSm) {
           this._sourceMaps.delete(source);
         }
@@ -542,60 +528,59 @@ TabSources.prototype = {
 
   /*
    * Forcefully change the source map of a source, changing the
    * sourceMapURL and installing the source map in the cache. This is
    * necessary to expose changes across Debugger instances
    * (pretty-printing is the use case). Generate a random url if one
    * isn't specified, allowing you to set "anonymous" source maps.
    *
-   * @param aSource Debugger.Source
+   * @param source Debugger.Source
    *        The source to change the sourceMapURL property
-   * @param aUrl string
+   * @param url string
    *        The source map URL (optional)
-   * @param aMap SourceMapConsumer
+   * @param map SourceMapConsumer
    *        The source map instance
    */
-  setSourceMapHard: function (aSource, aUrl, aMap) {
-    let url = aUrl;
+  setSourceMapHard: function (source, url, map) {
     if (!url) {
       // This is a littly hacky, but we want to forcefully set a
       // sourcemap regardless of sourcemap settings. We want to
       // literally change the sourceMapURL so that all debuggers will
       // get this and pretty-printing will Just Work (Debugger.Source
       // instances are per-debugger, so we can't key off that). To
       // avoid tons of work serializing the sourcemap into a data url,
       // just make a fake URL and stick the sourcemap there.
       url = "internal://sourcemap" + (this._anonSourceMapId++) + "/";
     }
-    aSource.sourceMapURL = url;
+    source.sourceMapURL = url;
 
     // Forcefully set the sourcemap cache. This will be used even if
     // sourcemaps are disabled.
-    this._sourceMapCache[url] = resolve(aMap);
-    this.emit("updatedSource", this.getSourceActor(aSource));
+    this._sourceMapCache[url] = resolve(map);
+    this.emit("updatedSource", this.getSourceActor(source));
   },
 
   /**
    * Return the non-source-mapped location of the given Debugger.Frame. If the
    * frame does not have a script, the location's properties are all null.
    *
-   * @param Debugger.Frame aFrame
+   * @param Debugger.Frame frame
    *        The frame whose location we are getting.
    * @returns Object
    *          Returns an object of the form { source, line, column }
    */
-  getFrameLocation: function (aFrame) {
-    if (!aFrame || !aFrame.script) {
+  getFrameLocation: function (frame) {
+    if (!frame || !frame.script) {
       return new GeneratedLocation();
     }
     let {lineNumber, columnNumber} =
-        aFrame.script.getOffsetLocation(aFrame.offset);
+        frame.script.getOffsetLocation(frame.offset);
     return new GeneratedLocation(
-      this.createNonSourceMappedActor(aFrame.script.source),
+      this.createNonSourceMappedActor(frame.script.source),
       lineNumber,
       columnNumber
     );
   },
 
   /**
    * Returns a promise of the location in the original source if the source is
    * source mapped, otherwise a promise of the same location. This can
@@ -605,17 +590,16 @@ TabSources.prototype = {
    */
   getOriginalLocation: function (generatedLocation) {
     let {
       generatedSourceActor,
       generatedLine,
       generatedColumn
     } = generatedLocation;
     let source = generatedSourceActor.source;
-    let url = source ? source.url : generatedSourceActor._originalUrl;
 
     // In certain scenarios the source map may have not been fetched
     // yet (or at least tied to this Debugger.Source instance), so use
     // `fetchSourceMap` instead of `getSourceMap`. This allows this
     // function to be called from anywere (across debuggers) and it
     // should just automatically work.
     return this.fetchSourceMap(source).then(map => {
       if (map) {
@@ -679,17 +663,16 @@ TabSources.prototype = {
           );
         });
       }
 
       return [GeneratedLocation.fromOriginalLocation(originalLocation)];
     });
   },
 
-
   /**
    * Returns a promise of the location in the generated source corresponding to
    * the original source and line given.
    *
    * When we pass a script S representing generated code to `sourceMap`,
    * above, that returns a promise P. The process of resolving P populates
    * the tables this function uses; thus, it won't know that S's original
    * source URLs map to S until P is resolved.
@@ -730,79 +713,79 @@ TabSources.prototype = {
 
       return GeneratedLocation.fromOriginalLocation(originalLocation);
     });
   },
 
   /**
    * Returns true if URL for the given source is black boxed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source which we are checking whether it is black
    *        boxed or not.
    */
-  isBlackBoxed: function (aURL) {
-    return this.blackBoxedSources.has(aURL);
+  isBlackBoxed: function (url) {
+    return this.blackBoxedSources.has(url);
   },
 
   /**
    * Add the given source URL to the set of sources that are black boxed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source which we are black boxing.
    */
-  blackBox: function (aURL) {
-    this.blackBoxedSources.add(aURL);
+  blackBox: function (url) {
+    this.blackBoxedSources.add(url);
   },
 
   /**
    * Remove the given source URL to the set of sources that are black boxed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source which we are no longer black boxing.
    */
-  unblackBox: function (aURL) {
-    this.blackBoxedSources.delete(aURL);
+  unblackBox: function (url) {
+    this.blackBoxedSources.delete(url);
   },
 
   /**
    * Returns true if the given URL is pretty printed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source that might be pretty printed.
    */
-  isPrettyPrinted: function (aURL) {
-    return this.prettyPrintedSources.has(aURL);
+  isPrettyPrinted: function (url) {
+    return this.prettyPrintedSources.has(url);
   },
 
   /**
    * Add the given URL to the set of sources that are pretty printed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source to be pretty printed.
    */
-  prettyPrint: function (aURL, aIndent) {
-    this.prettyPrintedSources.set(aURL, aIndent);
+  prettyPrint: function (url, indent) {
+    this.prettyPrintedSources.set(url, indent);
   },
 
   /**
    * Return the indent the given URL was pretty printed by.
    */
-  prettyPrintIndent: function (aURL) {
-    return this.prettyPrintedSources.get(aURL);
+  prettyPrintIndent: function (url) {
+    return this.prettyPrintedSources.get(url);
   },
 
   /**
    * Remove the given URL from the set of sources that are pretty printed.
    *
-   * @param aURL String
+   * @param url String
    *        The URL of the source that is no longer pretty printed.
    */
-  disablePrettyPrint: function (aURL) {
-    this.prettyPrintedSources.delete(aURL);
+  disablePrettyPrint: function (url) {
+    this.prettyPrintedSources.delete(url);
   },
 
   iter: function () {
     let actors = Object.keys(this._sourceMappedSourceActors).map(k => {
       return this._sourceMappedSourceActors[k];
     });
     for (let actor of this._sourceActors.values()) {
       if (!this._sourceMaps.has(actor.source)) {
@@ -812,22 +795,22 @@ TabSources.prototype = {
     return actors;
   }
 };
 
 /*
  * Checks if a source should never be displayed to the user because
  * it's either internal or we don't support in the UI yet.
  */
-function isHiddenSource(aSource) {
+function isHiddenSource(source) {
   // Ignore the internal Function.prototype script
-  return aSource.text === "() {\n}";
+  return source.text === "() {\n}";
 }
 
 /**
  * Returns true if its argument is not null.
  */
-function isNotNull(aThing) {
-  return aThing !== null;
+function isNotNull(thing) {
+  return thing !== null;
 }
 
 exports.TabSources = TabSources;
 exports.isHiddenSource = isHiddenSource;
--- a/devtools/server/actors/utils/actor-registry-utils.js
+++ b/devtools/server/actors/utils/actor-registry-utils.js
@@ -1,20 +1,19 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-var { Cu, CC, Ci, Cc } = require("chrome");
+const { Cu, CC } = require("chrome");
 
 const { DebuggerServer } = require("devtools/server/main");
-const promise = require("promise");
 
 /**
  * Support for actor registration. Main used by ActorRegistryActor
  * for dynamic registration of new actors.
  *
  * @param sourceText {String} Source of the actor implementation
  * @param fileName {String} URL of the actor module (for proper stack traces)
  * @param options {Object} Configuration object
--- a/devtools/server/actors/utils/map-uri-to-addon-id.js
+++ b/devtools/server/actors/utils/map-uri-to-addon-id.js
@@ -19,26 +19,28 @@ const GRAPHENE_ID = "{d1bfe7d9-c01e-4237
 /**
  * This is a wrapper around amIAddonPathService.mapURIToAddonID which always returns
  * false on B2G and graphene to avoid loading the add-on manager there and
  * reports any exceptions rather than throwing so that the caller doesn't have
  * to worry about them.
  */
 if (!Services.appinfo
     || Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT
-    || Services.appinfo.ID === undefined /* XPCShell */
+
+    /* XPCShell */
+    || Services.appinfo.ID === undefined
+
     || Services.appinfo.ID == B2G_ID
     || Services.appinfo.ID == GRAPHENE_ID
     || !AddonPathService) {
   module.exports = function mapURIToAddonId(uri) {
     return false;
   };
 } else {
   module.exports = function mapURIToAddonId(uri) {
     try {
       return AddonPathService.mapURIToAddonId(uri);
-    }
-    catch (e) {
+    } catch (e) {
       DevToolsUtils.reportException("mapURIToAddonId", e);
       return false;
     }
   };
 }
--- a/devtools/server/actors/utils/walker-search.js
+++ b/devtools/server/actors/utils/walker-search.js
@@ -7,18 +7,16 @@
 /**
  * The walker-search module provides a simple API to index and search strings
  * and elements inside a given document.
  * It indexes tag names, attribute names and values, and text contents.
  * It provides a simple search function that returns a list of nodes that
  * matched.
  */
 
-const {Ci, Cu} = require("chrome");
-
 /**
  * The WalkerIndex class indexes the document (and all subdocs) from
  * a given walker.
  *
  * It is only indexed the first time the data is accessed and will be
  * re-indexed if a mutation happens between requests.
  *
  * @param {Walker} walker The walker to be indexed
--- a/devtools/server/actors/utils/webconsole-listeners.js
+++ b/devtools/server/actors/utils/webconsole-listeners.js
@@ -1,10 +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/. */
 
-const {Cc, Ci, Cu, components} = require("chrome");
+"use strict";
+
+const {Cc, Ci, components} = require("chrome");
 const {isWindowIncluded} = require("devtools/shared/layout/utils");
 const Services = require("Services");
 const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
 const {CONSOLE_WORKER_IDS, WebConsoleUtils} = require("devtools/server/actors/utils/webconsole-utils");
 
 XPCOMUtils.defineLazyServiceGetter(this,
                                    "swm",
                                    "@mozilla.org/serviceworkers/manager;1",
@@ -26,18 +31,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
  *        the nsIConsoleMessage, whenever a relevant message is received.
  */
 function ConsoleServiceListener(window, listener) {
   this.window = window;
   this.listener = listener;
 }
 exports.ConsoleServiceListener = ConsoleServiceListener;
 
-ConsoleServiceListener.prototype =
-{
+ConsoleServiceListener.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIConsoleListener]),
 
   /**
    * The content window for which we listen to page errors.
    * @type nsIDOMWindow
    */
   window: null,
 
@@ -191,18 +195,17 @@ ConsoleServiceListener.prototype =
  */
 function ConsoleAPIListener(window, owner, {addonId} = {}) {
   this.window = window;
   this.owner = owner;
   this.addonId = addonId;
 }
 exports.ConsoleAPIListener = ConsoleAPIListener;
 
-ConsoleAPIListener.prototype =
-{
+ConsoleAPIListener.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   /**
    * The content window for which we listen to window.console API calls.
    * @type nsIDOMWindow
    */
   window: null,
 
@@ -379,18 +382,17 @@ function ConsoleReflowListener(window, l
                          .getInterface(Ci.nsIWebNavigation)
                          .QueryInterface(Ci.nsIDocShell);
   this.listener = listener;
   this.docshell.addWeakReflowObserver(this);
 }
 
 exports.ConsoleReflowListener = ConsoleReflowListener;
 
-ConsoleReflowListener.prototype =
-{
+ConsoleReflowListener.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver,
                                          Ci.nsISupportsWeakReference]),
   docshell: null,
   listener: null,
 
   /**
    * Forward reflow event to listener.
    *
--- a/devtools/server/actors/utils/webconsole-utils.js
+++ b/devtools/server/actors/utils/webconsole-utils.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft= javascript ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const {Cc, Ci, Cu, components} = require("chrome");
+const {Ci, Cu} = require("chrome");
 
 // Note that this is only used in WebConsoleCommands, see $0 and pprint().
 if (!isWorker) {
   loader.lazyImporter(this, "VariablesView", "resource://devtools/client/shared/widgets/VariablesView.jsm");
 }
 
 const CONSOLE_WORKER_IDS = exports.CONSOLE_WORKER_IDS = [
   "SharedWorker",
--- a/devtools/server/actors/utils/webconsole-worker-listeners.js
+++ b/devtools/server/actors/utils/webconsole-worker-listeners.js
@@ -1,37 +1,38 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft= javascript ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* global setConsoleEventHandler, retrieveConsoleEvents */
+
 "use strict";
 
 // This file is loaded on the server side for worker debugging.
 // Since the server is running in the worker thread, it doesn't
 // have access to Services / Components but the listeners defined here
 // are imported by webconsole-utils and used for the webconsole actor.
 
 function ConsoleAPIListener(window, owner, consoleID) {
   this.window = window;
   this.owner = owner;
   this.consoleID = consoleID;
   this.observe = this.observe.bind(this);
 }
 
-ConsoleAPIListener.prototype =
-{
+ConsoleAPIListener.prototype = {
   init: function () {
     setConsoleEventHandler(this.observe);
   },
   destroy: function () {
     setConsoleEventHandler(null);
   },
-  observe: function(message) {
+  observe: function (message) {
     this.owner.onConsoleAPICall(message.wrappedJSObject);
   },
-  getCachedMessages: function() {
+  getCachedMessages: function () {
     return retrieveConsoleEvents();
   }
 };
 
 exports.ConsoleAPIListener = ConsoleAPIListener;
--- a/devtools/server/content-globals.js
+++ b/devtools/server/content-globals.js
@@ -29,18 +29,19 @@ exports.removeContentGlobal = function (
     throw Error("Invalid arguments");
   }
   let cache = getGlobalCache(options["inner-window-id"]);
   let index = cache.indexOf(options.global);
   cache.splice(index, 1);
   return undefined;
 };
 
-function getGlobalCache(aInnerWindowID) {
-  return globalsCache[aInnerWindowID] = globalsCache[aInnerWindowID] || [];
+function getGlobalCache(innerWindowID) {
+  globalsCache[innerWindowID] = globalsCache[innerWindowID] || [];
+  return globalsCache[innerWindowID];
 }
 
 // when the window is destroyed, eliminate the associated globals cache
 if (!isWorker) {
   Services.obs.addObserver(function observer(subject, topic, data) {
     let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
     delete globalsCache[id];
   }, "inner-window-destroyed", false);
--- a/devtools/server/content-server.jsm
+++ b/devtools/server/content-server.jsm
@@ -1,18 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-const Cu = Components.utils;
+const { utils: Cu, interfaces: Ci } = Components;
 
+/* exported init */
 this.EXPORTED_SYMBOLS = ["init"];
 
 let gLoader;
 
 function setupServer(mm) {
   // Prevent spawning multiple server per process, even if the caller call us
   // multiple times
   if (gLoader) {
--- a/devtools/server/event-parsers.js
+++ b/devtools/server/event-parsers.js
@@ -144,18 +144,19 @@ var parsers = [
 
       if (!isFunctionInProxy(handlerDO)) {
         return handlerDO;
       }
 
       const MAX_NESTED_HANDLER_COUNT = 2;
       for (let i = 0; i < MAX_NESTED_HANDLER_COUNT; i++) {
         let funcDO = getFirstFunctionVariable(handlerDO);
-        if (!funcDO)
+        if (!funcDO) {
           return handlerDO;
+        }
 
         handlerDO = funcDO;
         if (isFunctionInProxy(handlerDO)) {
           continue;
         }
         break;
       }
 
--- a/devtools/server/primitive.js
+++ b/devtools/server/primitive.js
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
-const { on, once, off, emit } = require("sdk/event/core");
 const { Class } = require("sdk/core/heritage");
 
 const WebGLPrimitivesType = {
   "POINTS": 0,
   "LINES": 1,
   "LINE_LOOP": 2,
   "LINE_STRIP": 3,
   "TRIANGLES": 4,
@@ -18,17 +17,17 @@ const WebGLPrimitivesType = {
 
 /**
  * A utility for monitoring WebGL primitive draws. Takes a `tabActor`
  * and monitors primitive draws over time.
  */
 const WebGLDrawArrays = "drawArrays";
 const WebGLDrawElements = "drawElements";
 
-var WebGLPrimitiveCounter = exports.WebGLPrimitiveCounter = Class({
+exports.WebGLPrimitiveCounter = Class({
   initialize: function (tabActor) {
     this.tabActor = tabActor;
   },
 
   destroy: function () {},
 
   /**
    * Starts monitoring primitive draws, storing the primitives count per tick.
@@ -40,17 +39,17 @@ var WebGLPrimitiveCounter = exports.WebG
     this._lines = 0;
     this._startTime = this.tabActor.docShell.now();
   },
 
   /**
    * Stops monitoring primitive draws, returning the recorded values.
    */
   getCounts: function () {
-    var result = {
+    let result = {
       tris: this._tris,
       vertices: this._vertices,
       points: this._points,
       lines: this._lines
     };
 
     this._tris = 0;
     this._vertices = 0;
@@ -150,14 +149,15 @@ var WebGLPrimitiveCounter = exports.WebG
         break;
       case WebGLPrimitivesType.TRIANGLE_STRIP:
         this._tris += (count - 2);
         this._vertices += count;
         break;
       case WebGLPrimitivesType.TRIANGLE_FAN:
         this._tris += (count - 2);
         this._vertices += count;
+        break;
       default:
         console.error("_processDrawElements doesn't define this type.");
         break;
     }
   }
 });
--- a/devtools/server/service-worker-child.js
+++ b/devtools/server/service-worker-child.js
@@ -1,17 +1,19 @@
 /* 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/. */
 
+/* global addMessageListener */
+
 "use strict";
 
-let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-let swm = Cc["@mozilla.org/serviceworkers/manager;1"].
-  getService(Ci.nsIServiceWorkerManager);
+let { classes: Cc, interfaces: Ci } = Components;
+let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
+  .getService(Ci.nsIServiceWorkerManager);
 
 addMessageListener("serviceWorkerRegistration:start", message => {
   let { data } = message;
   let array = swm.getAllRegistrations();
 
   // Find the service worker registration with the desired scope.
   for (let i = 0; i < array.length; i++) {
     let registration =
--- a/devtools/server/worker.js
+++ b/devtools/server/worker.js
@@ -1,10 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 "use strict";
 
+/* eslint-env worker */
+/* global worker, loadSubScript, global */
+
 // This function is used to do remote procedure calls from the worker to the
 // main thread. It is exposed as a built-in global to every module by the
 // worker loader. To make sure the worker loader can access it, it needs to be
 // defined before loading the worker loader script below.
 this.rpc = function (method, ...params) {
   let id = nextId++;
 
   postMessage(JSON.stringify({
@@ -37,24 +44,24 @@ DebuggerServer.createRootActor = functio
 var connections = Object.create(null);
 var nextId = 0;
 var rpcDeferreds = [];
 
 this.addEventListener("message", function (event) {
   let packet = JSON.parse(event.data);
   switch (packet.type) {
     case "connect":
-    // Step 3: Create a connection to the parent.
+      // Step 3: Create a connection to the parent.
       let connection = DebuggerServer.connectToParent(packet.id, this);
       connections[packet.id] = {
-        connection : connection,
+        connection,
         rpcs: []
       };
 
-    // Step 4: Create a thread actor for the connection to the parent.
+      // Step 4: Create a thread actor for the connection to the parent.
       let pool = new ActorPool(connection);
       connection.addActorPool(pool);
 
       let sources = null;
 
       let parent = {
         actorID: packet.id,
 
@@ -82,18 +89,18 @@ this.addEventListener("message", functio
       pool.addActor(threadActor);
 
       // parentActor.threadActor is needed from the webconsole for grip previewing
       parent.threadActor = threadActor;
 
       let consoleActor = new WebConsoleActor(connection, parent);
       pool.addActor(consoleActor);
 
-    // Step 5: Send a response packet to the parent to notify
-    // it that a connection has been established.
+      // Step 5: Send a response packet to the parent to notify
+      // it that a connection has been established.
       postMessage(JSON.stringify({
         type: "connected",
         id: packet.id,
         threadActor: threadActor.actorID,
         consoleActor: consoleActor.actorID,
       }));
       break;