Bug 1326334 - Fix more errors in devtools/shared. r=jryans draft
authorTim Nguyen <ntim.bugs@gmail.com>
Tue, 03 Jan 2017 23:45:39 +0100
changeset 455497 5f4cd7e2307e0e77cd5da81ac4de3ecdeb12a5e8
parent 455495 78d315ef8ebf104b3707979c2f5dfff0900c250d
child 541008 71e2a36d22aadc0caffdfd0c37bc9c48a5a9e686
push id40257
push userbmo:ntim.bugs@gmail.com
push dateTue, 03 Jan 2017 22:46:13 +0000
reviewersjryans
bugs1326334
milestone53.0a1
Bug 1326334 - Fix more errors in devtools/shared. r=jryans MozReview-Commit-ID: 2MOe5hEyqYo
.eslintignore
devtools/.eslintrc.js
devtools/shared/apps/Devices.jsm
devtools/shared/apps/app-actor-front.js
devtools/shared/gcli/commands/addon.js
devtools/shared/gcli/commands/appcache.js
devtools/shared/gcli/commands/calllog.js
devtools/shared/gcli/commands/cmd.js
devtools/shared/gcli/commands/cookie.js
devtools/shared/gcli/commands/csscoverage.js
devtools/shared/gcli/commands/folder.js
devtools/shared/gcli/commands/highlight.js
devtools/shared/gcli/commands/index.js
devtools/shared/gcli/commands/inject.js
devtools/shared/gcli/commands/jsb.js
devtools/shared/gcli/commands/listen.js
devtools/shared/gcli/commands/mdn.js
devtools/shared/gcli/commands/measure.js
devtools/shared/gcli/commands/media.js
devtools/shared/gcli/commands/pagemod.js
devtools/shared/gcli/commands/paintflashing.js
devtools/shared/gcli/commands/qsa.js
devtools/shared/gcli/commands/restart.js
devtools/shared/gcli/commands/rulers.js
devtools/shared/gcli/commands/screenshot.js
devtools/shared/gcli/commands/security.js
devtools/shared/transport/packets.js
devtools/shared/transport/stream-utils.js
devtools/shared/worker/helper.js
devtools/shared/worker/loader.js
devtools/shared/worker/tests/browser/browser_worker-01.js
devtools/shared/worker/tests/browser/browser_worker-02.js
devtools/shared/worker/tests/browser/browser_worker-03.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -111,47 +111,41 @@ devtools/server/actors/*.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/tests/browser/**
 !devtools/server/tests/browser/browser_webextension_inspected_window.js
 devtools/server/tests/mochitest/**
 devtools/server/tests/unit/**
-devtools/shared/apps/**
-devtools/shared/gcli/**
-!devtools/shared/gcli/templater.js
 devtools/shared/heapsnapshot/**
-devtools/shared/transport/**
-!devtools/shared/transport/transport.js
-!devtools/shared/transport/websocket-transport.js
+devtools/shared/transport/tests/unit/**
 devtools/shared/webconsole/test/**
-devtools/shared/worker/**
-!devtools/shared/worker/worker.js
 
 # Ignore devtools pre-processed files
 devtools/client/framework/toolbox-process-window.js
 devtools/client/performance/system.js
 devtools/client/webide/webide-prefs.js
 devtools/client/preferences/**
 
 # Ignore devtools third-party libs
 devtools/shared/jsbeautify/*
 devtools/shared/acorn/*
-devtools/client/sourceeditor/tern/*
+devtools/shared/gcli/source/*
 devtools/shared/node-properties/*
 devtools/shared/pretty-fast/*
 devtools/shared/sourcemap/*
 devtools/shared/sprintfjs/*
 devtools/shared/qrcode/decoder/*
 devtools/shared/qrcode/encoder/*
 devtools/client/shared/demangle.js
 devtools/client/shared/vendor/*
 devtools/client/sourceeditor/codemirror/*.js
 devtools/client/sourceeditor/codemirror/**/*.js
+devtools/client/sourceeditor/tern/*
 devtools/client/sourceeditor/test/cm_mode_ruby.js
 devtools/client/sourceeditor/test/codemirror/*
 devtools/client/inspector/markup/test/lib_*
 devtools/client/jsonview/lib/require.js
 devtools/server/actors/utils/automation-timeline.js
 
 # Ignore devtools files testing sourcemaps / code style
 devtools/client/debugger/test/mochitest/code_binary_search.js
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -268,17 +268,17 @@ module.exports = {
     "no-process-env": "off",
     // Allow using process.exit (not a node environment).
     "no-process-exit": "off",
     // Disallow usage of __proto__ property.
     "no-proto": "error",
     // Disallow declaring the same variable more than once (we use let anyway).
     "no-redeclare": "error",
     // Disallow multiple spaces in a regular expression literal.
-    "no-regex-spaces": "error",
+    "no-regex-spaces": "off",
     // Allow reserved words being used as object literal keys.
     "no-reserved-keys": "off",
     // Don't restrict usage of specified node modules (not a node environment).
     "no-restricted-modules": "off",
     // Disallow use of assignment in return statement. It is preferable for a
     // single line of code to have only one easily predictable effect.
     "no-return-assign": "error",
     // Allow use of javascript: urls.
--- a/devtools/shared/apps/Devices.jsm
+++ b/devtools/shared/apps/Devices.jsm
@@ -1,16 +1,18 @@
 /* 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";
 
 Components.utils.import("resource://devtools/shared/event-emitter.js");
 
+/* exported EXPORTED_SYMBOLS */
+
 const EXPORTED_SYMBOLS = ["Devices"];
 
 var addonInstalled = false;
 
 const Devices = {
   _devices: {},
 
   get helperAddonInstalled() {
--- a/devtools/shared/apps/app-actor-front.js
+++ b/devtools/shared/apps/app-actor-front.js
@@ -32,18 +32,17 @@ const appTargets = new Map();
 function addDirToZip(writer, dir, basePath) {
   let files = dir.directoryEntries;
 
   while (files.hasMoreElements()) {
     let file = files.getNext().QueryInterface(Ci.nsIFile);
 
     if (file.isHidden() ||
         file.isSpecial() ||
-        file.equals(writer.file))
-    {
+        file.equals(writer.file)) {
       continue;
     }
 
     if (file.isDirectory()) {
       writer.addEntryDirectory(basePath + file.leafName + "/",
                                file.lastModifiedTime * PR_USEC_PER_MSEC,
                                true);
       addDirToZip(writer, file, basePath + file.leafName + "/");
@@ -57,54 +56,55 @@ function addDirToZip(writer, dir, basePa
 }
 
 /**
  * Convert an XPConnect result code to its name and message.
  * We have to extract them from an exception per bug 637307 comment 5.
  */
 function getResultText(code) {
   let regexp =
-    /^\[Exception... "(.*)"  nsresult: "0x[0-9a-fA-F]* \((.*)\)"  location: ".*"  data: .*\]$/;
-  let ex = Cc["@mozilla.org/js/xpc/Exception;1"].
-           createInstance(Ci.nsIXPCException);
+    /^\[Exception... "(.*)"  nsresult: "0x[0-9a-fA-F]* \((.*)\)"  location: ".*"  data: .*\]$/; // eslint-disable-line
+  let ex = Cc["@mozilla.org/js/xpc/Exception;1"]
+           .createInstance(Ci.nsIXPCException);
   ex.initialize(null, code, null, null, null, null);
   let [, message, name] = regexp.exec(ex.toString());
-  return { name: name, message: message };
+  return {
+    name,
+    message
+  };
 }
 
 function zipDirectory(zipFile, dirToArchive) {
   let deferred = defer();
   let writer = Cc["@mozilla.org/zipwriter;1"].createInstance(Ci.nsIZipWriter);
   writer.open(zipFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
 
-  this.addDirToZip(writer, dirToArchive, "");
+  addDirToZip(writer, dirToArchive, "");
 
   writer.processQueue({
     onStartRequest: function onStartRequest(request, context) {},
     onStopRequest: (request, context, status) => {
       if (status == Cr.NS_OK) {
         writer.close();
         deferred.resolve(zipFile);
-      }
-      else {
+      } else {
         let { name, message } = getResultText(status);
         deferred.reject(name + ": " + message);
       }
     }
   }, null);
 
   return deferred.promise;
 }
 
 function uploadPackage(client, webappsActor, packageFile, progressCallback) {
   if (client.traits.bulk) {
     return uploadPackageBulk(client, webappsActor, packageFile, progressCallback);
-  } else {
-    return uploadPackageJSON(client, webappsActor, packageFile, progressCallback);
   }
+  return uploadPackageJSON(client, webappsActor, packageFile, progressCallback);
 }
 
 function uploadPackageJSON(client, webappsActor, packageFile, progressCallback) {
   let deferred = defer();
 
   let request = {
     to: webappsActor,
     type: "uploadPackage"
@@ -120,58 +120,55 @@ function uploadPackageJSON(client, webap
     progressCallback({
       bytesSent: bytesRead,
       totalBytes: fileSize
     });
   }
 
   function openFile(actor) {
     let openedFile;
-    OS.File.open(packageFile.path)
-      .then(file => {
-        openedFile = file;
-        return openedFile.stat();
-      })
-      .then(fileInfo => {
-        fileSize = fileInfo.size;
-        emitProgress();
-        uploadChunk(actor, openedFile);
-      });
+    OS.File.open(packageFile.path).then(file => {
+      openedFile = file;
+      return openedFile.stat();
+    }).then(fileInfo => {
+      fileSize = fileInfo.size;
+      emitProgress();
+      uploadChunk(actor, openedFile);
+    });
   }
   function uploadChunk(actor, file) {
-    file.read(CHUNK_SIZE)
-        .then(function (bytes) {
-          bytesRead += bytes.length;
-          emitProgress();
-          // To work around the fact that JSON.stringify translates the typed
-          // array to object, we are encoding the typed array here into a string
-          let chunk = String.fromCharCode.apply(null, bytes);
+    file.read(CHUNK_SIZE).then(function (bytes) {
+      bytesRead += bytes.length;
+      emitProgress();
+      // To work around the fact that JSON.stringify translates the typed
+      // array to object, we are encoding the typed array here into a string
+      let chunk = String.fromCharCode.apply(null, bytes);
 
-          let request = {
-            to: actor,
-            type: "chunk",
-            chunk: chunk
-          };
-          client.request(request, (res) => {
-            if (bytes.length == CHUNK_SIZE) {
-              uploadChunk(actor, file);
-            } else {
-              file.close().then(function () {
-                endsUpload(actor);
-              });
-            }
+      let chunkRequest = {
+        to: actor,
+        type: "chunk",
+        chunk,
+      };
+      client.request(chunkRequest, (res) => {
+        if (bytes.length == CHUNK_SIZE) {
+          uploadChunk(actor, file);
+        } else {
+          file.close().then(function () {
+            endsUpload(actor);
           });
-        });
+        }
+      });
+    });
   }
   function endsUpload(actor) {
-    let request = {
+    let doneRequest = {
       to: actor,
       type: "done"
     };
-    client.request(request, (res) => {
+    client.request(doneRequest, (res) => {
       deferred.resolve(actor);
     });
   }
   return deferred.promise;
 }
 
 function uploadPackageBulk(client, webappsActor, packageFile, progressCallback) {
   let deferred = defer();
@@ -185,23 +182,23 @@ function uploadPackageBulk(client, webap
     startBulkUpload(res.actor);
   });
 
   function startBulkUpload(actor) {
     console.log("Starting bulk upload");
     let fileSize = packageFile.fileSize;
     console.log("File size: " + fileSize);
 
-    let request = client.startBulkRequest({
+    let streamRequest = client.startBulkRequest({
       actor: actor,
       type: "stream",
       length: fileSize
     });
 
-    request.on("bulk-send-ready", ({copyFrom}) => {
+    streamRequest.on("bulk-send-ready", ({copyFrom}) => {
       NetUtil.asyncFetch({
         uri: NetUtil.newURI(packageFile),
         loadUsingSystemPrincipal: true
       }, function (inputStream) {
         let copying = copyFrom(inputStream);
         copying.on("progress", (e, progress) => {
           progressCallback(progress);
         });
@@ -240,46 +237,47 @@ function installPackaged(client, webapps
     let tmpZipFile = FileUtils.getDir("TmpD", [], true);
     tmpZipFile.append("application.zip");
     tmpZipFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8));
     packagePromise = zipDirectory(tmpZipFile, file);
   } else {
     packagePromise = promise.resolve(file);
   }
   packagePromise.then((zipFile) => {
-    uploadPackage(client, webappsActor, zipFile, progressCallback)
-        .then((fileActor) => {
-          let request = {
-            to: webappsActor,
-            type: "install",
-            appId: appId,
-            upload: fileActor
-          };
-          client.request(request, (res) => {
-            // If the install method immediatly fails,
-            // reject immediatly the installPackaged promise.
-            // Otherwise, wait for webappsEvent for completion
-            if (res.error) {
-              deferred.reject(res);
-            }
-            if ("error" in res)
-              deferred.reject({error: res.error, message: res.message});
-            else
-              deferred.resolve({appId: res.appId});
-          });
-          // Ensure deleting the temporary package file, but only if that a temporary
-          // package created when we pass a directory as `packagePath`
-          if (zipFile != file)
-            zipFile.remove(false);
-          // In case of success or error, ensure deleting the temporary package file
-          // also created on the device, but only once install request is done
-          deferred.promise.then(
-            () => removeServerTemporaryFile(client, fileActor),
-            () => removeServerTemporaryFile(client, fileActor));
-        });
+    uploadPackage(client, webappsActor, zipFile, progressCallback).then((fileActor) => {
+      let request = {
+        to: webappsActor,
+        type: "install",
+        appId: appId,
+        upload: fileActor
+      };
+      client.request(request, (res) => {
+        // If the install method immediatly fails,
+        // reject immediatly the installPackaged promise.
+        // Otherwise, wait for webappsEvent for completion
+        if (res.error) {
+          deferred.reject(res);
+        }
+        if ("error" in res) {
+          deferred.reject({error: res.error, message: res.message});
+        } else {
+          deferred.resolve({appId: res.appId});
+        }
+      });
+      // Ensure deleting the temporary package file, but only if that a temporary
+      // package created when we pass a directory as `packagePath`
+      if (zipFile != file) {
+        zipFile.remove(false);
+      }
+      // In case of success or error, ensure deleting the temporary package file
+      // also created on the device, but only once install request is done
+      deferred.promise.then(
+        () => removeServerTemporaryFile(client, fileActor),
+        () => removeServerTemporaryFile(client, fileActor));
+    });
   });
   return deferred.promise;
 }
 exports.installPackaged = installPackaged;
 
 function installHosted(client, webappsActor, appId, metadata, manifest) {
   let deferred = defer();
   let request = {
@@ -288,32 +286,34 @@ function installHosted(client, webappsAc
     appId: appId,
     metadata: metadata,
     manifest: manifest
   };
   client.request(request, (res) => {
     if (res.error) {
       deferred.reject(res);
     }
-    if ("error" in res)
+    if ("error" in res) {
       deferred.reject({error: res.error, message: res.message});
-    else
+    } else {
       deferred.resolve({appId: res.appId});
+    }
   });
   return deferred.promise;
 }
 exports.installHosted = installHosted;
 
 function getTargetForApp(client, webappsActor, manifestURL) {
   // Ensure always returning the exact same JS object for a target
   // of the same app in order to show only one toolbox per app and
   // avoid re-creating lot of objects twice.
   let existingTarget = appTargets.get(manifestURL);
-  if (existingTarget)
+  if (existingTarget) {
     return promise.resolve(existingTarget);
+  }
 
   let deferred = defer();
   let request = {
     to: webappsActor,
     type: "getAppActor",
     manifestURL: manifestURL,
   };
   client.request(request, (res) => {
@@ -338,33 +338,32 @@ function getTargetForApp(client, webapps
       });
     }
   });
   return deferred.promise;
 }
 exports.getTargetForApp = getTargetForApp;
 
 function reloadApp(client, webappsActor, manifestURL) {
-  return getTargetForApp(client,
-                         webappsActor,
-                         manifestURL).
-    then((target) => {
-      // Request the ContentActor to reload the app
-      let request = {
-        to: target.form.actor,
-        type: "reload",
-        options: {
-          force: true
-        },
-        manifestURL: manifestURL
-      };
-      return client.request(request);
-    }, () => {
-      throw new Error("Not running");
-    });
+  return getTargetForApp(
+    client, webappsActor, manifestURL
+  ).then((target) => {
+    // Request the ContentActor to reload the app
+    let request = {
+      to: target.form.actor,
+      type: "reload",
+      options: {
+        force: true
+      },
+      manifestURL,
+    };
+    return client.request(request);
+  }, () => {
+    throw new Error("Not running");
+  });
 }
 exports.reloadApp = reloadApp;
 
 function launchApp(client, webappsActor, manifestURL) {
   return client.request({
     to: webappsActor,
     type: "launch",
     manifestURL: manifestURL
@@ -418,35 +417,36 @@ App.prototype = {
     if (this._form) {
       return promise.resolve(this._form);
     }
     let request = {
       to: this.webappsActor,
       type: "getAppActor",
       manifestURL: this.manifest.manifestURL
     };
-    return this.client.request(request)
-                      .then(res => {
-                        return this._form = res.actor;
-                      });
+    return this.client.request(request).then(res => {
+      this._form = res.actor;
+      return this._form;
+    });
   },
 
   getTarget: function () {
     if (this._target) {
       return promise.resolve(this._target);
     }
-    return this.getForm().
-      then((form) => getTarget(this.client, form)).
-      then((target) => {
-        target.on("close", () => {
-          delete this._form;
-          delete this._target;
-        });
-        return this._target = target;
+    return this.getForm().then(
+      (form) => getTarget(this.client, form)
+    ).then((target) => {
+      target.on("close", () => {
+        delete this._form;
+        delete this._target;
       });
+      this._target = target;
+      return this._target;
+    });
   },
 
   launch: function () {
     return launchApp(this.client, this.webappsActor,
                      this.manifest.manifestURL);
   },
 
   reload: function () {
@@ -482,17 +482,16 @@ App.prototype = {
         deferred.reject("Unable to fetch app icon");
       }
     });
 
     return deferred.promise;
   }
 };
 
-
 /**
  * `AppActorFront` is a client for the webapps actor.
  */
 function AppActorFront(client, form) {
   this.client = client;
   this.actor = form.webappsActor;
 
   this._clientListener = this._clientListener.bind(this);
@@ -532,33 +531,31 @@ AppActorFront.prototype = {
   /**
    * Returns a `App` object instance for the given manifest URL
    * (and cache it per AppActorFront object)
    */
   _getApp: function (manifestURL) {
     let app = this._apps ? this._apps.get(manifestURL) : null;
     if (app) {
       return promise.resolve(app);
-    } else {
-      let request = {
-        to: this.actor,
-        type: "getApp",
-        manifestURL: manifestURL
-      };
-      return this.client.request(request)
-                 .then(res => {
-                   let app = new App(this.client, this.actor, res.app);
-                   if (this._apps) {
-                     this._apps.set(manifestURL, app);
-                   }
-                   return app;
-                 }, e => {
-                   console.error("Unable to retrieve app", manifestURL, e);
-                 });
     }
+    let request = {
+      to: this.actor,
+      type: "getApp",
+      manifestURL,
+    };
+    return this.client.request(request).then(res => {
+      app = new App(this.client, this.actor, res.app);
+      if (this._apps) {
+        this._apps.set(manifestURL, app);
+      }
+      return app;
+    }, e => {
+      console.error("Unable to retrieve app", manifestURL, e);
+    });
   },
 
   /**
    * Starts watching for app opening/closing installing/uninstalling.
    * Needs to be called before using `apps` or `runningApps` attributes.
    */
   watchApps: function (listener) {
     // Fixes race between two references to the same front
@@ -578,57 +575,52 @@ AppActorFront.prototype = {
     }
 
     // First retrieve all installed apps and create
     // related `App` object for each
     let request = {
       to: this.actor,
       type: "getAll"
     };
-    return this._loadingPromise = this.client.request(request)
-      .then(res => {
-        delete this._loadingPromise;
-        this._apps = new Map();
-        for (let a of res.apps) {
-          let app = new App(this.client, this.actor, a);
-          this._apps.set(a.manifestURL, app);
-        }
-      })
-      .then(() => {
-        // Then retrieve all running apps in order to flag them as running
-        let request = {
-          to: this.actor,
-          type: "listRunningApps"
-        };
-        return this.client.request(request)
-                   .then(res => res.apps);
-      })
-      .then(apps => {
-        let promises = apps.map(manifestURL => {
-          // _getApp creates `App` instance and register it to AppActorFront
-          return this._getApp(manifestURL)
-                      .then(app => {
-                        app.running = true;
-                        // Fake appOpen event for all already opened
-                        this._notifyListeners("appOpen", app);
-                      });
+    this._loadingPromise = this.client.request(request).then(res => {
+      delete this._loadingPromise;
+      this._apps = new Map();
+      for (let a of res.apps) {
+        let app = new App(this.client, this.actor, a);
+        this._apps.set(a.manifestURL, app);
+      }
+    }).then(() => {
+      // Then retrieve all running apps in order to flag them as running
+      let listRequest = {
+        to: this.actor,
+        type: "listRunningApps"
+      };
+      return this.client.request(listRequest).then(res => res.apps);
+    }).then(apps => {
+      let promises = apps.map(manifestURL => {
+        // _getApp creates `App` instance and register it to AppActorFront
+        return this._getApp(manifestURL).then(app => {
+          app.running = true;
+          // Fake appOpen event for all already opened
+          this._notifyListeners("appOpen", app);
         });
-        return promise.all(promises);
-      })
-      .then(() => {
-        // Finally ask to receive all app events
-        return this._listenAppEvents(listener);
       });
+      return promise.all(promises);
+    }).then(() => {
+      // Finally ask to receive all app events
+      return this._listenAppEvents(listener);
+    });
+    return this._loadingPromise;
   },
 
   fetchIcons: function () {
     // On demand, retrieve apps icons in order to be able
     // to synchronously retrieve it on `App` objects
     let promises = [];
-    for (let [manifestURL, app] of this._apps) {
+    for (let [, app] of this._apps) {
       promises.push(app.getIcon());
     }
 
     return DevToolsUtils.settleAll(promises)
                         .then(null, () => {});
   },
 
   _listenAppEvents: function (listener) {
@@ -703,26 +695,25 @@ AppActorFront.prototype = {
           // The call to _getApp is going to create App object
 
           // This app may have been running while being installed, so check the list
           // of running apps again to get the right answer.
           let request = {
             to: this.actor,
             type: "listRunningApps"
           };
-          this.client.request(request)
-              .then(res => {
-                if (res.apps.indexOf(manifestURL) !== -1) {
-                  app.running = true;
-                  this._notifyListeners("appInstall", app);
-                  this._notifyListeners("appOpen", app);
-                } else {
-                  this._notifyListeners("appInstall", app);
-                }
-              });
+          this.client.request(request).then(res => {
+            if (res.apps.indexOf(manifestURL) !== -1) {
+              app.running = true;
+              this._notifyListeners("appInstall", app);
+              this._notifyListeners("appOpen", app);
+            } else {
+              this._notifyListeners("appInstall", app);
+            }
+          });
           break;
         case "appUninstall":
           // Fake a appClose event if we didn't got one before uninstall
           if (app.running) {
             app.running = false;
             this._notifyListeners("appClose", app);
           }
           this._apps.delete(manifestURL);
@@ -791,50 +782,47 @@ AppActorFront.prototype = {
         // when the request gets its response.
         if (app.manifest.manifestURL === manifestURL) {
           resolve(app);
         } else {
           installs[app.manifest.manifestURL] = app;
         }
       }
     };
-    this._listenAppEvents(listener)
-        // Execute the request
-        .then(request)
-        .then(response => {
-          finalAppId = response.appId;
-          manifestURL = response.manifestURL;
+    // Execute the request
+    this._listenAppEvents(listener).then(request).then(response => {
+      finalAppId = response.appId;
+      manifestURL = response.manifestURL;
 
-          // Resolves immediately if the appInstall event
-          // was dispatched during the request.
-          if (manifestURL in installs) {
-            resolve(installs[manifestURL]);
-          }
-        }, deferred.reject);
+      // Resolves immediately if the appInstall event
+      // was dispatched during the request.
+      if (manifestURL in installs) {
+        resolve(installs[manifestURL]);
+      }
+    }, deferred.reject);
 
     return deferred.promise;
-
   },
 
   /*
    * Install a hosted app.
    *
    * Events are going to be emitted on the front
    * as install progresses. Events will have the following fields:
    *  * bytesSent:  The number of bytes sent so far
    *  * totalBytes: The total number of bytes to send
    */
   installHosted: function (appId, metadata, manifest) {
     let manifestURL = metadata.manifestURL ||
                       metadata.origin + "/manifest.webapp";
     let request = () => {
-      return installHosted(this.client, this.actor, appId, metadata,
-                           manifest)
-        .then(response => ({
-          appId: response.appId,
-          manifestURL: manifestURL
-        }));
+      return installHosted(
+        this.client, this.actor, appId, metadata, manifest
+      ).then(response => ({
+        appId: response.appId,
+        manifestURL: manifestURL
+      }));
     };
     return this._install(request);
   }
 };
 
 exports.AppActorFront = AppActorFront;
--- a/devtools/shared/gcli/commands/addon.js
+++ b/devtools/shared/gcli/commands/addon.js
@@ -10,89 +10,86 @@
  * AddonManager is not available
  */
 function getAddonManager() {
   try {
     return {
       AddonManager: require("resource://gre/modules/AddonManager.jsm").AddonManager,
       addonManagerActive: true
     };
-  }
-  catch (ex) {
+  } catch (ex) {
     // Fake up an AddonManager just enough to let the file load
     return {
       AddonManager: {
         getAllAddons() {},
         getAddonsByTypes() {}
       },
       addonManagerActive: false
     };
   }
 }
 
-const { Cc, Ci, Cu } = require("chrome");
 const { AddonManager, addonManagerActive } = getAddonManager();
 const l10n = require("gcli/l10n");
 
-const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
-                           .getService(Ci.nsIStringBundleService)
-                           .createBundle("chrome://branding/locale/brand.properties")
-                           .GetStringFromName("brandShortName");
-
 /**
  * Takes a function that uses a callback as its last parameter, and returns a
  * new function that returns a promise instead.
  * This should probably live in async-util
  */
-const promiseify = function(scope, functionWithLastParamCallback) {
+const promiseify = function (scope, functionWithLastParamCallback) {
   return (...args) => {
     return new Promise(resolve => {
       args.push((...results) => {
         resolve(results.length > 1 ? results : results[0]);
       });
       functionWithLastParamCallback.apply(scope, args);
     });
-  }
+  };
 };
 
 // Convert callback based functions to promise based ones
 const getAllAddons = promiseify(AddonManager, AddonManager.getAllAddons);
 const getAddonsByTypes = promiseify(AddonManager, AddonManager.getAddonsByTypes);
 
 /**
  * Return a string array containing the pending operations on an addon
  */
 function pendingOperations(addon) {
   let allOperations = [
     "PENDING_ENABLE", "PENDING_DISABLE", "PENDING_UNINSTALL",
     "PENDING_INSTALL", "PENDING_UPGRADE"
   ];
-  return allOperations.reduce(function(operations, opName) {
+  return allOperations.reduce(function (operations, opName) {
     return addon.pendingOperations & AddonManager[opName] ?
       operations.concat(opName) :
       operations;
   }, []);
 }
 
 var items = [
   {
     item: "type",
     name: "addon",
     parent: "selection",
     stringifyProperty: "name",
     cacheable: true,
-    constructor: function() {
+    constructor: function () {
       // Tell GCLI to clear the cache of addons when one is added or removed
       let listener = {
-        onInstalled: addon => { this.clearCache(); },
-        onUninstalled: addon => { this.clearCache(); },
+        onInstalled: addon => {
+          this.clearCache();
+        },
+        onUninstalled: addon => {
+          this.clearCache();
+        },
       };
       AddonManager.addAddonListener(listener);
     },
-    lookup: function() {
+    lookup: function () {
       return getAllAddons().then(addons => {
         return addons.map(addon => {
           let name = addon.name + " " + addon.version;
           name = name.trim().replace(/\s/g, "_");
           return { name: name, value: addon };
         });
       });
     }
@@ -109,36 +106,36 @@ var items = [
       name: "type",
       type: {
         name: "selection",
         data: [ "dictionary", "extension", "locale", "plugin", "theme", "all" ]
       },
       defaultValue: "all",
       description: l10n.lookup("addonListTypeDesc")
     }],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let types = (args.type === "all") ? null : [ args.type ];
       return getAddonsByTypes(types).then(addons => {
-        addons = addons.map(function(addon) {
+        addons = addons.map(function (addon) {
           return {
             name: addon.name,
             version: addon.version,
             isActive: addon.isActive,
             pendingOperations: pendingOperations(addon)
           };
         });
         return { addons: addons, type: args.type };
       });
     }
   },
   {
     item: "converter",
     from: "addonsInfo",
     to: "view",
-    exec: function(addonsInfo, context) {
+    exec: function (addonsInfo, context) {
       if (!addonsInfo.addons.length) {
         return context.createView({
           html: "<p>${message}</p>",
           data: { message: l10n.lookup("addonNoneOfType") }
         });
       }
 
       let headerLookups = {
@@ -162,17 +159,17 @@ var items = [
       function lookupOperation(opName) {
         let lookupName = operationLookups[opName];
         return lookupName ? l10n.lookup(lookupName) : opName;
       }
 
       function arrangeAddons(addons) {
         let enabledAddons = [];
         let disabledAddons = [];
-        addons.forEach(function(addon) {
+        addons.forEach(function (addon) {
           if (addon.isActive) {
             enabledAddons.push(addon);
           } else {
             disabledAddons.push(addon);
           }
         });
 
         function compareAddonNames(nameA, nameB) {
@@ -203,29 +200,29 @@ var items = [
           "          onclick='${onclick}' ondblclick='${ondblclick}'" +
           "      >${addon.toggleActionMessage}</span>" +
           "    </td>" +
           "  </tr>" +
           " </tbody>" +
           "</table>",
         data: {
           header: header,
-          addons: arrangeAddons(addonsInfo.addons).map(function(addon) {
+          addons: arrangeAddons(addonsInfo.addons).map(function (addon) {
             return {
               name: addon.name,
               label: addon.name.replace(/\s/g, "_") +
                     (addon.version ? "_" + addon.version : ""),
               status: addon.isActive ? "enabled" : "disabled",
               version: addon.version,
               pendingOperations: addon.pendingOperations.length ?
                 (" (" + l10n.lookup("addonPending") + ": "
                  + addon.pendingOperations.map(lookupOperation).join(", ")
                  + ")") :
                 "",
-              toggleActionName: isActiveForToggle(addon) ? "disable": "enable",
+              toggleActionName: isActiveForToggle(addon) ? "disable" : "enable",
               toggleActionMessage: isActiveForToggle(addon) ?
                 l10n.lookup("addonListOutDisable") :
                 l10n.lookup("addonListOutEnable")
             };
           }),
           onclick: context.update,
           ondblclick: context.updateExec
         }
@@ -239,17 +236,17 @@ var items = [
     description: l10n.lookup("addonEnableDesc"),
     params: [
       {
         name: "addon",
         type: "addon",
         description: l10n.lookup("addonNameDesc")
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let name = (args.addon.name + " " + args.addon.version).trim();
       if (args.addon.userDisabled) {
         args.addon.userDisabled = false;
         return l10n.lookupFormat("addonEnabled", [ name ]);
       }
 
       return l10n.lookupFormat("addonAlreadyEnabled", [ name ]);
     }
@@ -261,17 +258,17 @@ var items = [
     description: l10n.lookup("addonDisableDesc"),
     params: [
       {
         name: "addon",
         type: "addon",
         description: l10n.lookup("addonNameDesc")
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       // If the addon is not disabled or is set to "click to play" then
       // disable it. Otherwise display the message "Add-on is already
       // disabled."
       let name = (args.addon.name + " " + args.addon.version).trim();
       if (!args.addon.userDisabled ||
           args.addon.userDisabled === AddonManager.STATE_ASK_TO_ACTIVATE) {
         args.addon.userDisabled = true;
         return l10n.lookupFormat("addonDisabled", [ name ]);
@@ -287,17 +284,17 @@ var items = [
     description: l10n.lookup("addonCtpDesc"),
     params: [
       {
         name: "addon",
         type: "addon",
         description: l10n.lookup("addonNameDesc")
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let name = (args.addon.name + " " + args.addon.version).trim();
       if (args.addon.type !== "plugin") {
         return l10n.lookupFormat("addonCantCtp", [ name ]);
       }
 
       if (!args.addon.userDisabled ||
           args.addon.userDisabled === true) {
         args.addon.userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE;
--- a/devtools/shared/gcli/commands/appcache.js
+++ b/devtools/shared/gcli/commands/appcache.js
@@ -27,38 +27,38 @@ exports.items = [
         {
           type: "string",
           name: "uri",
           description: l10n.lookup("appCacheValidateUriDesc"),
           defaultValue: null,
         }
       ]
     }],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let utils;
       let deferred = context.defer();
 
       if (args.uri) {
         utils = new AppCacheUtils(args.uri);
       } else {
         utils = new AppCacheUtils(context.environment.document);
       }
 
-      utils.validateManifest().then(function(errors) {
+      utils.validateManifest().then(function (errors) {
         deferred.resolve([errors, utils.manifestURI || "-"]);
       });
 
       return deferred.promise;
     }
   },
   {
     item: "converter",
     from: "appcacheerrors",
     to: "view",
-    exec: function([errors, manifestURI], context) {
+    exec: function ([errors, manifestURI], context) {
       if (errors.length == 0) {
         return context.createView({
           html: "<span>" + l10n.lookup("appCacheValidatedSuccessfully") + "</span>"
         });
       }
 
       return context.createView({
         html:
@@ -76,17 +76,17 @@ exports.items = [
     }
   },
   {
     item: "command",
     runAt: "server",
     name: "appcache clear",
     description: l10n.lookup("appCacheClearDesc"),
     manual: l10n.lookup("appCacheClearManual"),
-    exec: function(args, context) {
+    exec: function (args, context) {
       let utils = new AppCacheUtils(args.uri);
       utils.clearAll();
 
       return l10n.lookup("appCacheClearCleared");
     }
   },
   {
     item: "command",
@@ -101,26 +101,26 @@ exports.items = [
         {
           type: "string",
           name: "search",
           description: l10n.lookup("appCacheListSearchDesc"),
           defaultValue: null,
         },
       ]
     }],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let utils = new AppCacheUtils();
       return utils.listEntries(args.search);
     }
   },
   {
     item: "converter",
     from: "appcacheentries",
     to: "view",
-    exec: function(entries, context) {
+    exec: function (entries, context) {
       return context.createView({
         html: "" +
           "<ul class='gcli-appcache-list'>" +
           "  <li foreach='entry in ${entries}'>" +
           "    <table class='gcli-appcache-detail'>" +
           "      <tr>" +
           "        <td>" + l10n.lookup("appCacheListKey") + "</td>" +
           "        <td>${entry.key}</td>" +
@@ -173,14 +173,14 @@ exports.items = [
     params: [
       {
         type: "string",
         name: "key",
         description: l10n.lookup("appCacheViewEntryKey"),
         defaultValue: null,
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let utils = new AppCacheUtils();
       return utils.viewEntry(args.key);
     }
   }
 ];
--- a/devtools/shared/gcli/commands/calllog.js
+++ b/devtools/shared/gcli/commands/calllog.js
@@ -22,64 +22,63 @@ exports.items = [
     description: l10n.lookup("calllogDesc")
   },
   {
     item: "command",
     runAt: "client",
     name: "calllog start",
     description: l10n.lookup("calllogStartDesc"),
 
-    exec: function(args, context) {
+    exec: function (args, context) {
       let contentWindow = context.environment.window;
 
       let dbg = new Debugger(contentWindow);
-      dbg.onEnterFrame = function(frame) {
+      dbg.onEnterFrame = function (frame) {
         // BUG 773652 -  Make the output from the GCLI calllog command nicer
         contentWindow.console.log("Method call: " + this.callDescription(frame));
       }.bind(this);
 
       debuggers.push(dbg);
 
       let gBrowser = context.environment.chromeDocument.defaultView.gBrowser;
       let target = TargetFactory.forTab(gBrowser.selectedTab);
       gDevTools.showToolbox(target, "webconsole");
 
       return l10n.lookup("calllogStartReply");
     },
 
-    callDescription: function(frame) {
+    callDescription: function (frame) {
       let name = "<anonymous>";
       if (frame.callee.name) {
         name = frame.callee.name;
-      }
-      else {
+      } else {
         let desc = frame.callee.getOwnPropertyDescriptor("displayName");
         if (desc && desc.value && typeof desc.value == "string") {
           name = desc.value;
         }
       }
 
       let args = frame.arguments.map(this.valueToString).join(", ");
       return name + "(" + args + ")";
     },
 
-    valueToString: function(value) {
+    valueToString: function (value) {
       if (typeof value !== "object" || value === null) {
         return uneval(value);
       }
       return "[object " + value.class + "]";
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "calllog stop",
     description: l10n.lookup("calllogStopDesc"),
 
-    exec: function(args, context) {
+    exec: function (args, context) {
       let numDebuggers = debuggers.length;
       if (numDebuggers == 0) {
         return l10n.lookup("calllogStopNoLogging");
       }
 
       for (let dbg of debuggers) {
         dbg.onEnterFrame = undefined;
       }
@@ -106,17 +105,17 @@ exports.items = [
       },
       {
         name: "source",
         type: "string",
         description: l10n.lookup("calllogChromeSourceTypeDesc"),
         manual: l10n.lookup("calllogChromeSourceTypeManual"),
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let globalObj;
       let contentWindow = context.environment.window;
 
       if (args.sourceType == "jsm") {
         try {
           globalObj = Cu.import(args.source, {});
         } catch (e) {
           return l10n.lookup("callLogChromeInvalidJSM");
@@ -131,27 +130,26 @@ exports.items = [
         let chromeWin = context.environment.chromeDocument.defaultView;
         if (args.source in chromeWin) {
           globalObj = Cu.getGlobalForObject(chromeWin[args.source]);
         } else {
           return l10n.lookup("callLogChromeVarNotFoundChrome");
         }
       } else {
         let chromeWin = context.environment.chromeDocument.defaultView;
-        let sandbox = new Cu.Sandbox(chromeWin,
-                                    {
-                                      sandboxPrototype: chromeWin,
-                                      wantXrays: false,
-                                      sandboxName: "gcli-cmd-calllog-chrome"
-                                    });
+        let sandbox = new Cu.Sandbox(chromeWin, {
+          sandboxPrototype: chromeWin,
+          wantXrays: false,
+          sandboxName: "gcli-cmd-calllog-chrome"
+        });
         let returnVal;
         try {
           returnVal = Cu.evalInSandbox(args.source, sandbox, "ECMAv5");
           sandboxes.push(sandbox);
-        } catch(e) {
+        } catch (e) {
           // We need to save the message before cleaning up else e contains a dead
           // object.
           let msg = l10n.lookup("callLogChromeEvalException") + ": " + e;
           Cu.nukeSandbox(sandbox);
           return msg;
         }
 
         if (typeof returnVal == "undefined") {
@@ -159,50 +157,51 @@ exports.items = [
         }
 
         globalObj = Cu.getGlobalForObject(returnVal);
       }
 
       let dbg = new Debugger(globalObj);
       chromeDebuggers.push(dbg);
 
-      dbg.onEnterFrame = function(frame) {
+      dbg.onEnterFrame = function (frame) {
         // BUG 773652 -  Make the output from the GCLI calllog command nicer
         contentWindow.console.log(l10n.lookup("callLogChromeMethodCall") +
                                   ": " + this.callDescription(frame));
       }.bind(this);
 
       let gBrowser = context.environment.chromeDocument.defaultView.gBrowser;
       let target = TargetFactory.forTab(gBrowser.selectedTab);
       gDevTools.showToolbox(target, "webconsole");
 
       return l10n.lookup("calllogChromeStartReply");
     },
 
-    valueToString: function(value) {
-      if (typeof value !== "object" || value === null)
+    valueToString: function (value) {
+      if (typeof value !== "object" || value === null) {
         return uneval(value);
+      }
       return "[object " + value.class + "]";
     },
 
-    callDescription: function(frame) {
+    callDescription: function (frame) {
       let name = frame.callee.name || l10n.lookup("callLogChromeAnonFunction");
       let args = frame.arguments.map(this.valueToString).join(", ");
       return name + "(" + args + ")";
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "calllog chromestop",
     description: l10n.lookup("calllogChromeStopDesc"),
     get hidden() {
       return gcli.hiddenByChromePref();
     },
-    exec: function(args, context) {
+    exec: function (args, context) {
       let numDebuggers = chromeDebuggers.length;
       if (numDebuggers == 0) {
         return l10n.lookup("calllogChromeStopNoLogging");
       }
 
       for (let dbg of chromeDebuggers) {
         dbg.onEnterFrame = undefined;
         dbg.enabled = false;
--- a/devtools/shared/gcli/commands/cmd.js
+++ b/devtools/shared/gcli/commands/cmd.js
@@ -1,27 +1,28 @@
 /* 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 } = require("chrome");
+const { OS, TextDecoder } = Cu.import("resource://gre/modules/osfile.jsm", {});
+const { Task } = require("devtools/shared/task");
 
-const { OS } = Cu.import("resource://gre/modules/osfile.jsm", {});
-const { TextEncoder, TextDecoder } = Cu.import('resource://gre/modules/commonjs/toolkit/loader.js', {});
 const gcli = require("gcli/index");
 const l10n = require("gcli/l10n");
 
-loader.lazyGetter(this, "prefBranch", function() {
-  let prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
+loader.lazyGetter(this, "prefBranch", function () {
+  let prefService = Cc["@mozilla.org/preferences-service;1"]
+                      .getService(Ci.nsIPrefService);
   return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
 });
 
-loader.lazyGetter(this, "supportsString", function() {
+loader.lazyGetter(this, "supportsString", function () {
   return Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
 });
 
 loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
 
 const PREF_DIR = "devtools.commands.dir";
 
 /**
@@ -61,68 +62,71 @@ function loadItemsFromMozDir() {
       } else {
         throw reason;
       }
     }
   );
 
   // We need to return (a promise of) an array of items from the *.mozcmd
   // files in dirName (which we can assume to be a valid directory now)
-  return statPromise.then(() => {
+  return Task.async(function* () {
+    yield statPromise;
     let itemPromises = [];
 
     let iterator = new OS.File.DirectoryIterator(dirName);
-    let iterPromise = iterator.forEach(entry => {
-      if (entry.name.match(/.*\.mozcmd$/) && !entry.isDir) {
-        itemPromises.push(loadCommandFile(entry));
-      }
-    });
-
-    return iterPromise.then(() => {
+    try {
+      yield iterator.forEach(entry => {
+        if (entry.name.match(/.*\.mozcmd$/) && !entry.isDir) {
+          itemPromises.push(loadCommandFile(entry));
+        }
+      });
       iterator.close();
-      return Promise.all(itemPromises).then((itemsArray) => {
-        return itemsArray.reduce((prev, curr) => {
-          return prev.concat(curr);
-        }, []);
-      });
-    }, reason => { iterator.close(); throw reason; });
+      let itemsArray = yield Promise.all(itemPromises);
+      return itemsArray.reduce((prev, curr) => {
+        return prev.concat(curr);
+      }, []);
+    } catch (e) {
+      iterator.close();
+      throw e;
+    }
   });
 }
 
-exports.mozDirLoader = function(name) {
+exports.mozDirLoader = function (name) {
   return loadItemsFromMozDir().then(items => {
-    return { items: items };
+    return { items };
   });
 };
 
 /**
  * Load the commands from a single file
  * @param OS.File.DirectoryIterator.Entry entry The DirectoryIterator
  * Entry of the file containing the commands that we should read
  */
 function loadCommandFile(entry) {
   let readPromise = OS.File.read(entry.path);
-  return readPromise = readPromise.then(array => {
+  readPromise = readPromise.then(array => {
     let decoder = new TextDecoder();
     let source = decoder.decode(array);
-    var principal = Cc["@mozilla.org/systemprincipal;1"]
+    let principal = Cc["@mozilla.org/systemprincipal;1"]
                       .createInstance(Ci.nsIPrincipal);
 
     let sandbox = new Cu.Sandbox(principal, {
       sandboxName: entry.path
     });
     let data = Cu.evalInSandbox(source, sandbox, "1.8", entry.name, 1);
 
     if (!Array.isArray(data)) {
       console.error("Command file '" + entry.name + "' does not have top level array.");
-      return;
+      return null;
     }
 
     return data;
   });
+  return readPromise;
 }
 
 exports.items = [
   {
     name: "cmd",
     get hidden() {
       return !prefBranch.prefHasUserValue(PREF_DIR);
     },
@@ -131,17 +135,17 @@ exports.items = [
   {
     item: "command",
     runAt: "client",
     name: "cmd refresh",
     description: l10n.lookup("cmdRefreshDesc"),
     get hidden() {
       return !prefBranch.prefHasUserValue(PREF_DIR);
     },
-    exec: function(args, context) {
+    exec: function (args, context) {
       gcli.load();
 
       let dirName = prefBranch.getComplexValue(PREF_DIR,
                                               Ci.nsISupportsString).data.trim();
       return l10n.lookupFormat("cmdStatus3", [ dirName ]);
     }
   },
   {
@@ -159,19 +163,20 @@ exports.items = [
           filetype: "directory",
           existing: "yes"
         },
         defaultValue: null
       }
     ],
     returnType: "string",
     get hidden() {
-      return true; // !prefBranch.prefHasUserValue(PREF_DIR);
+      // !prefBranch.prefHasUserValue(PREF_DIR);
+      return true;
     },
-    exec: function(args, context) {
+    exec: function (args, context) {
       supportsString.data = args.directory;
       prefBranch.setComplexValue(PREF_DIR, Ci.nsISupportsString, supportsString);
 
       gcli.load();
 
       return l10n.lookupFormat("cmdStatus3", [ args.directory ]);
     }
   }
--- a/devtools/shared/gcli/commands/cookie.js
+++ b/devtools/shared/gcli/commands/cookie.js
@@ -19,17 +19,17 @@
  * make the commands run on the client.
  * This way, they'll always run in the parent process.
  */
 
 const { Ci, Cc } = require("chrome");
 const l10n = require("gcli/l10n");
 const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
 
-XPCOMUtils.defineLazyGetter(this, "cookieMgr", function() {
+XPCOMUtils.defineLazyGetter(this, "cookieMgr", function () {
   return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
 });
 
 /**
  * Check host value and remove port part as it is not used
  * for storing cookies.
  *
  * Parameter will usually be `new URL(context.environment.target.url).host`
@@ -47,19 +47,19 @@ function sanitizeHost(host) {
  * And the unit of expires is sec, the unit that in argument of Date() needs
  * millisecond.
  */
 function translateExpires(expires) {
   if (expires == 0) {
     return l10n.lookup("cookieListOutSession");
   }
 
-  let expires_msec = expires * 1000;
+  let expiresMsec = expires * 1000;
 
-  return (new Date(expires_msec)).toLocaleString();
+  return (new Date(expiresMsec)).toLocaleString();
 }
 
 /**
  * Check if a given cookie matches a given host
  */
 function isCookieAtHost(cookie, host) {
   if (cookie.host == null) {
     return host == null;
@@ -81,27 +81,26 @@ exports.items = [
   },
   {
     item: "command",
     runAt: "client",
     name: "cookie list",
     description: l10n.lookup("cookieListDesc"),
     manual: l10n.lookup("cookieListManual"),
     returnType: "cookies",
-    exec: function(args, context) {
+    exec: function (args, context) {
       if (context.environment.target.isRemote) {
         throw new Error("The cookie gcli commands only work in a local tab, " +
                         "see bug 1221488");
       }
       let host = new URL(context.environment.target.url).host;
-      let contentWindow  = context.environment.window;
+      let contentWindow = context.environment.window;
       host = sanitizeHost(host);
-      let enm = cookieMgr.getCookiesFromHost(host, contentWindow.document.
-                                                   nodePrincipal.
-                                                   originAttributes);
+      let { originAttributes } = contentWindow.document.nodePrincipal;
+      let enm = cookieMgr.getCookiesFromHost(host, originAttributes);
 
       let cookies = [];
       while (enm.hasMoreElements()) {
         let cookie = enm.getNext().QueryInterface(Ci.nsICookie);
         if (isCookieAtHost(cookie, host)) {
           cookies.push({
             host: cookie.host,
             name: cookie.name,
@@ -126,44 +125,43 @@ exports.items = [
     manual: l10n.lookup("cookieRemoveManual"),
     params: [
       {
         name: "name",
         type: "string",
         description: l10n.lookup("cookieRemoveKeyDesc"),
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       if (context.environment.target.isRemote) {
         throw new Error("The cookie gcli commands only work in a local tab, " +
                         "see bug 1221488");
       }
       let host = new URL(context.environment.target.url).host;
-      let contentWindow  = context.environment.window;
+      let contentWindow = context.environment.window;
       host = sanitizeHost(host);
-      let enm = cookieMgr.getCookiesFromHost(host, contentWindow.document.
-                                                   nodePrincipal.
-                                                   originAttributes);
+      let { originAttributes } = contentWindow.document.nodePrincipal;
+      let enm = cookieMgr.getCookiesFromHost(host, originAttributes);
 
       while (enm.hasMoreElements()) {
         let cookie = enm.getNext().QueryInterface(Ci.nsICookie);
         if (isCookieAtHost(cookie, host)) {
           if (cookie.name == args.name) {
             cookieMgr.remove(cookie.host, cookie.name, cookie.path,
                              false, cookie.originAttributes);
           }
         }
       }
     }
   },
   {
     item: "converter",
     from: "cookies",
     to: "view",
-    exec: function(cookies, context) {
+    exec: function (cookies, context) {
       if (cookies.length == 0) {
         let host = new URL(context.environment.target.url).host;
         host = sanitizeHost(host);
         let msg = l10n.lookupFormat("cookieListOutNoneHost", [ host ]);
         return context.createView({ html: "<span>" + msg + "</span>" });
       }
 
       for (let cookie of cookies) {
@@ -270,31 +268,29 @@ exports.items = [
             name: "expires",
             type: "string",
             defaultValue: "Jan 17, 2038",
             description: l10n.lookup("cookieSetExpiresDesc")
           },
         ]
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       if (context.environment.target.isRemote) {
         throw new Error("The cookie gcli commands only work in a local tab, " +
                         "see bug 1221488");
       }
       let host = new URL(context.environment.target.url).host;
       host = sanitizeHost(host);
       let time = Date.parse(args.expires) / 1000;
-      let contentWindow  = context.environment.window;
+      let contentWindow = context.environment.window;
       cookieMgr.add(args.domain ? "." + args.domain : host,
                     args.path ? args.path : "/",
                     args.name,
                     args.value,
                     args.secure,
                     args.httpOnly,
                     args.session,
                     time,
-                    contentWindow.document.
-                                  nodePrincipal.
-                                  originAttributes);
+                    contentWindow.document.nodePrincipal.originAttributes);
     }
   }
 ];
--- a/devtools/shared/gcli/commands/csscoverage.js
+++ b/devtools/shared/gcli/commands/csscoverage.js
@@ -1,16 +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 { Cc, Ci } = require("chrome");
-
 const domtemplate = require("gcli/util/domtemplate");
 const csscoverage = require("devtools/shared/fronts/csscoverage");
 const l10n = csscoverage.l10n;
 
 loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
 
 loader.lazyImporter(this, "Chart", "resource://devtools/client/shared/widgets/Chart.jsm");
 
@@ -32,117 +30,119 @@ exports.items = [
     params: [
       {
         name: "noreload",
         type: "boolean",
         description: l10n.lookup("csscoverageStartNoReloadDesc"),
         manual: l10n.lookup("csscoverageStartNoReloadManual")
       }
     ],
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let usage = yield csscoverage.getUsage(context.environment.target);
       if (usage == null) {
         throw new Error(l10n.lookup("csscoverageNoRemoteError"));
       }
       yield usage.start(context.environment.chromeWindow,
                         context.environment.target, args.noreload);
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "csscoverage stop",
     hidden: true,
     description: l10n.lookup("csscoverageStopDesc2"),
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let target = context.environment.target;
       let usage = yield csscoverage.getUsage(target);
       if (usage == null) {
         throw new Error(l10n.lookup("csscoverageNoRemoteError"));
       }
       yield usage.stop();
       yield gDevTools.showToolbox(target, "styleeditor");
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "csscoverage oneshot",
     hidden: true,
     description: l10n.lookup("csscoverageOneShotDesc2"),
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let target = context.environment.target;
       let usage = yield csscoverage.getUsage(target);
       if (usage == null) {
         throw new Error(l10n.lookup("csscoverageNoRemoteError"));
       }
       yield usage.oneshot();
       yield gDevTools.showToolbox(target, "styleeditor");
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "csscoverage toggle",
     hidden: true,
     description: l10n.lookup("csscoverageToggleDesc2"),
     state: {
-      isChecked: function(target) {
+      isChecked: function (target) {
         return csscoverage.getUsage(target).then(usage => {
           return usage.isRunning();
         });
       },
-      onChange: function(target, handler) {
+      onChange: function (target, handler) {
         csscoverage.getUsage(target).then(usage => {
-          this.handler = ev => { handler("state-change", ev); };
+          this.handler = ev => {
+            handler("state-change", ev);
+          };
           usage.on("state-change", this.handler);
         });
       },
-      offChange: function(target, handler) {
+      offChange: function (target, handler) {
         csscoverage.getUsage(target).then(usage => {
           usage.off("state-change", this.handler);
           this.handler = undefined;
         });
       },
     },
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let target = context.environment.target;
       let usage = yield csscoverage.getUsage(target);
       if (usage == null) {
         throw new Error(l10n.lookup("csscoverageNoRemoteError"));
       }
 
       yield usage.toggle(context.environment.chromeWindow,
                          context.environment.target);
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "csscoverage report",
     hidden: true,
     description: l10n.lookup("csscoverageReportDesc2"),
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let usage = yield csscoverage.getUsage(context.environment.target);
       if (usage == null) {
         throw new Error(l10n.lookup("csscoverageNoRemoteError"));
       }
 
       return {
         isTypedData: true,
         type: "csscoveragePageReport",
         data: yield usage.createPageReport()
       };
     }
   },
   {
     item: "converter",
     from: "csscoveragePageReport",
     to: "dom",
-    exec: function*(csscoveragePageReport, context) {
+    exec: function* (csscoveragePageReport, context) {
       let target = context.environment.target;
 
       let toolbox = yield gDevTools.showToolbox(target, "styleeditor");
       let panel = toolbox.getCurrentPanel();
 
       let host = panel._panelDoc.querySelector(".csscoverage-report");
       let templ = panel._panelDoc.querySelector(".csscoverage-template");
 
@@ -180,17 +180,18 @@ exports.items = [
 
       while (templ.hasChildNodes()) {
         host.appendChild(templ.firstChild);
       }
 
       // Create a new chart.
       let container = host.querySelector(".csscoverage-report-chart");
       let chart = Chart.PieTable(panel._panelDoc, {
-        diameter: 200, // px
+        // px
+        diameter: 200,
         title: "CSS Usage",
         data: [
           { size: data.summary.preload, label: "Used Preload" },
           { size: data.summary.used, label: "Used" },
           { size: data.summary.unused, label: "Unused" }
         ]
       });
       container.appendChild(chart.node);
--- a/devtools/shared/gcli/commands/folder.js
+++ b/devtools/shared/gcli/commands/folder.js
@@ -1,33 +1,32 @@
 /* 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, CC } = require("chrome");
+const { Cc, Ci, CC } = require("chrome");
 const Services = require("Services");
 const l10n = require("gcli/l10n");
 const dirService = Cc["@mozilla.org/file/directory_service;1"]
                       .getService(Ci.nsIProperties);
 
-function showFolder(aPath) {
-  let nsLocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
+function showFolder(path) {
+  let NSLocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
                         "initWithPath");
 
   try {
-    let file = new nsLocalFile(aPath);
+    let file = new NSLocalFile(path);
 
     if (file.exists()) {
       file.reveal();
-      return l10n.lookupFormat("folderOpenDirResult", [aPath]);
-    } else {
-      return l10n.lookup("folderInvalidPath");
+      return l10n.lookupFormat("folderOpenDirResult", [path]);
     }
+    return l10n.lookup("folderInvalidPath");
   } catch (e) {
     return l10n.lookup("folderInvalidPath");
   }
 }
 
 exports.items = [
   {
     name: "folder",
@@ -42,17 +41,17 @@ exports.items = [
       {
         name: "path",
         type: { name: "string", allowBlank: true },
         defaultValue: "~",
         description: l10n.lookup("folderOpenDir")
       }
     ],
     returnType: "string",
-    exec: function(args, context) {
+    exec: function (args, context) {
       let dirName = args.path;
 
       // replaces ~ with the home directory path in unix and windows
       if (dirName.indexOf("~") == 0) {
         let homeDirFile = dirService.get("Home", Ci.nsIFile);
         let homeDir = homeDirFile.path;
         dirName = dirName.substr(1);
         dirName = homeDir + dirName;
@@ -62,16 +61,16 @@ exports.items = [
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "folder openprofile",
     description: l10n.lookup("folderOpenProfileDesc"),
     returnType: "string",
-    exec: function(args, context) {
+    exec: function (args, context) {
       // Get the profile directory.
       let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
       let profileDir = currProfD.path;
       return showFolder(profileDir);
     }
   }
 ];
--- a/devtools/shared/gcli/commands/highlight.js
+++ b/devtools/shared/gcli/commands/highlight.js
@@ -98,17 +98,17 @@ exports.items = [
             name: "keep",
             type: "boolean",
             description: l10n.lookup("highlightKeepDesc"),
             manual: l10n.lookup("highlightKeepManual")
           }
         ]
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       // Remove all existing highlighters unless told otherwise
       if (!args.keep) {
         unhighlightAll();
       }
 
       let env = context.environment;
       highlighterEnv = new HighlighterEnvironment();
       highlighterEnv.initFromWindow(env.window);
--- a/devtools/shared/gcli/commands/index.js
+++ b/devtools/shared/gcli/commands/index.js
@@ -102,17 +102,17 @@ try {
 } catch (e) {
   // "devtools/client/definitions" is only accessible from Firefox
   exports.devtoolsButtonModules = [];
 }
 
 /**
  * Add modules to a system for use in a content process (but don't call load)
  */
-exports.addAllItemsByModule = function(system) {
+exports.addAllItemsByModule = function (system) {
   system.addItemsByModule(exports.baseModules, { delayedLoad: true });
   system.addItemsByModule(exports.devtoolsModules, { delayedLoad: true });
   system.addItemsByModule(exports.devtoolsToolModules, { delayedLoad: true });
   system.addItemsByModule(exports.devtoolsButtonModules, { delayedLoad: true });
 
   const { mozDirLoader } = require("devtools/shared/gcli/commands/cmd");
   system.addItemsByModule("mozcmd", { delayedLoad: true, loader: mozDirLoader });
 };
@@ -128,17 +128,17 @@ var linksForTarget = new WeakMap();
  * added to the toolbox toolbar
  */
 var customProperties = [ "buttonId", "buttonClass", "tooltipText" ];
 
 /**
  * Create a system which connects to a GCLI in a remote target
  * @return Promise<System> for the given target
  */
-exports.getSystem = function(target) {
+exports.getSystem = function (target) {
   const existingLinks = linksForTarget.get(target);
   if (existingLinks != null) {
     existingLinks.refs++;
     return existingLinks.promise;
   }
 
   const system = createSystem({ location: "client" });
 
@@ -159,17 +159,17 @@ exports.getSystem = function(target) {
   linksForTarget.set(target, links);
   return links.promise;
 };
 
 /**
  * Someone that called getSystem doesn't need it any more, so decrement the
  * count of users of the system for that target, and destroy if needed
  */
-exports.releaseSystem = function(target) {
+exports.releaseSystem = function (target) {
   const links = linksForTarget.get(target);
   if (links == null) {
     throw new Error("releaseSystem called for unknown target");
   }
 
   links.refs--;
   if (links.refs === 0) {
     disconnectFront(links.system, links.front);
--- a/devtools/shared/gcli/commands/inject.js
+++ b/devtools/shared/gcli/commands/inject.js
@@ -48,32 +48,32 @@ exports.items = [
           },
           {
             name: "url"
           }
         ]
       },
       description: l10n.lookup("injectLibraryDesc")
     }],
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let document = context.environment.document;
       let library = args.library;
       let name = (library.type === "selection") ?
           library.selection.name : library.url;
       let src = (library.type === "selection") ?
           library.selection.src : library.url;
 
       if (context.environment.window.location.protocol == "https:") {
         src = src.replace(/^http:/, "https:");
       }
 
       try {
         // Check if URI is valid
         Services.io.newURI(src, null, null);
-      } catch(e) {
+      } catch (e) {
         return l10n.lookupFormat("injectFailed", [name]);
       }
 
       let newSource = document.createElement("script");
       newSource.setAttribute("src", src);
 
       let loadPromise = listenOnce(newSource, "load");
       document.head.appendChild(newSource);
--- a/devtools/shared/gcli/commands/jsb.js
+++ b/devtools/shared/gcli/commands/jsb.js
@@ -1,30 +1,30 @@
 /* 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 } = require("chrome");
+const { Cc } = require("chrome");
 const l10n = require("gcli/l10n");
 const XMLHttpRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"];
 
 loader.lazyImporter(this, "Preferences", "resource://gre/modules/Preferences.jsm");
 loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
 
 loader.lazyRequireGetter(this, "beautify", "devtools/shared/jsbeautify/beautify");
 
 exports.items = [
   {
     item: "command",
     runAt: "client",
     name: "jsb",
     description: l10n.lookup("jsbDesc"),
-    returnValue:"string",
+    returnValue: "string",
     params: [
       {
         name: "url",
         type: "string",
         description: l10n.lookup("jsbUrlDesc")
       },
       {
         group: l10n.lookup("jsbOptionsDesc"),
@@ -86,49 +86,50 @@ exports.items = [
             name: "unescapeStrings",
             type: "boolean",
             description: l10n.lookup("jsbUnescapeStringsDesc"),
             manual: l10n.lookup("jsbUnescapeStringsManual")
           }
         ]
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
+      /* eslint-disable camelcase */
       let opts = {
         indent_size: args.indentSize,
         indent_char: args.indentChar,
         preserve_newlines: !args.doNotPreserveNewlines,
         max_preserve_newlines: args.preserveMaxNewlines == -1 ?
                               undefined : args.preserveMaxNewlines,
         jslint_happy: args.jslintHappy,
         brace_style: args.braceStyle,
         space_before_conditional: !args.noSpaceBeforeConditional,
         unescape_strings: args.unescapeStrings
       };
-
+      /* eslint-enable camelcase */
       let xhr = new XMLHttpRequest();
 
       let deferred = context.defer();
 
-      xhr.onreadystatechange = function() {
+      xhr.onreadystatechange = function () {
         if (xhr.readyState == 4) {
           if (xhr.status == 200 || xhr.status == 0) {
             let result = beautify.js(xhr.responseText, opts);
 
             ScratchpadManager.openScratchpad({text: result});
 
             deferred.resolve();
           } else {
             deferred.reject("Unable to load page to beautify: " + args.url + " " +
                             xhr.status + " " + xhr.statusText);
           }
-        };
-      }
+        }
+      };
       try {
         xhr.open("GET", args.url, true);
         xhr.send(null);
-      } catch(e) {
+      } catch (e) {
         return l10n.lookup("jsbInvalidURL");
       }
       return deferred.promise;
     }
   }
 ];
--- a/devtools/shared/gcli/commands/listen.js
+++ b/devtools/shared/gcli/commands/listen.js
@@ -64,17 +64,17 @@ exports.items = [
         type: {
           name: "selection",
           data: [ "mozilla-rdp", "websocket"],
         },
         description: l10n.lookup("listenProtocolDesc"),
       },
     ],
     exec: function (args, context) {
-      var listener = debuggerServer.createListener();
+      let listener = debuggerServer.createListener();
       if (!listener) {
         throw new Error(l10n.lookup("listenDisabledOutput"));
       }
 
       let webSocket = false;
       if (args.protocol === "websocket") {
         webSocket = true;
       } else if (args.protocol === "mozilla-rdp") {
--- a/devtools/shared/gcli/commands/mdn.js
+++ b/devtools/shared/gcli/commands/mdn.js
@@ -23,17 +23,17 @@ exports.items = [{
   description: l10n.lookup("mdnCssDesc"),
   returnType: "cssPropertyOutput",
   params: [{
     name: "property",
     type: { name: "string" },
     defaultValue: null,
     description: l10n.lookup("mdnCssProp")
   }],
-  exec: function(args) {
+  exec: function (args) {
     if (!MdnDocsWidget) {
       return null;
     }
 
     return MdnDocsWidget.getCssDocs(args.property).then(result => {
       return {
         data: result,
         url: MdnDocsWidget.PAGE_LINK_URL + args.property,
@@ -42,17 +42,17 @@ exports.items = [{
     }, error => {
       return { error, property: args.property };
     });
   }
 }, {
   item: "converter",
   from: "cssPropertyOutput",
   to: "dom",
-  exec: function(result, context) {
+  exec: function (result, context) {
     let propertyName = result.property;
 
     let document = context.document;
     let root = document.createElement("div");
 
     if (result.error) {
       // The css property specified doesn't exist.
       root.appendChild(document.createTextNode(
--- a/devtools/shared/gcli/commands/measure.js
+++ b/devtools/shared/gcli/commands/measure.js
@@ -35,17 +35,17 @@ exports.items = [
     buttonId: "command-button-measure",
     buttonClass: "command-button command-button-invertable",
     tooltipText: l10n.lookup("measureTooltip"),
     state: {
       isChecked: ({_tab}) => isCheckedFor(_tab),
       onChange: (target, handler) => eventEmitter.on("changed", handler),
       offChange: (target, handler) => eventEmitter.off("changed", handler)
     },
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let { target } = context.environment;
 
       // Pipe the call to the server command.
       let response = yield context.updateExec("measure_server");
       let { visible, id } = response.data;
 
       if (visible) {
         visibleHighlighters.add(id);
@@ -68,17 +68,17 @@ exports.items = [
   },
   // The server measure command is hidden by default, it's just used by the
   // client command.
   {
     name: "measure_server",
     runAt: "server",
     hidden: true,
     returnType: "highlighterVisibility",
-    exec: function(args, context) {
+    exec: function (args, context) {
       let env = context.environment;
       let { document } = env;
       let id = getOuterId(env.window);
 
       // Calling the command again after the measuring tool has been shown once,
       // hides it.
       if (highlighters.has(document)) {
         let { highlighter } = highlighters.get(document);
@@ -94,18 +94,18 @@ exports.items = [
       // Store the instance of the measuring tool highlighter for this document
       // so we can hide it later.
       highlighters.set(document, { highlighter, environment });
 
       // Listen to the highlighter's destroy event which may happen if the
       // window is refreshed or closed with the measuring tool shown.
       events.once(highlighter, "destroy", () => {
         if (highlighters.has(document)) {
-          let { environment } = highlighters.get(document);
-          environment.destroy();
+          let { environment: toDestroy } = highlighters.get(document);
+          toDestroy.destroy();
           highlighters.delete(document);
         }
       });
 
       highlighter.show();
       return {visible: true, id};
     }
   }
--- a/devtools/shared/gcli/commands/media.js
+++ b/devtools/shared/gcli/commands/media.js
@@ -33,24 +33,24 @@ exports.items = [
           name: "selection",
           data: [
             "braille", "embossed", "handheld", "print", "projection",
             "screen", "speech", "tty", "tv"
           ]
         }
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let contentViewer = getContentViewer(context);
       contentViewer.emulateMedium(args.type);
     }
   },
   {
     item: "command",
     runAt: "server",
     name: "media reset",
     description: l10n.lookup("mediaResetDesc"),
-    exec: function(args, context) {
+    exec: function (args, context) {
       let contentViewer = getContentViewer(context);
       contentViewer.stopEmulatingMedium();
     }
   }
 ];
--- a/devtools/shared/gcli/commands/pagemod.js
+++ b/devtools/shared/gcli/commands/pagemod.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const { Cc, Ci, Cu } = require("chrome");
+const { Cc, Ci } = require("chrome");
 const l10n = require("gcli/l10n");
 
 exports.items = [
   {
     name: "pagemod",
     description: l10n.lookup("pagemodDesc"),
   },
   {
@@ -32,17 +32,17 @@ exports.items = [
         name: "ignoreCase",
         type: "boolean",
         description: l10n.lookup("pagemodReplaceIgnoreCaseDesc"),
       },
       {
         name: "selector",
         type: "string",
         description: l10n.lookup("pagemodReplaceSelectorDesc"),
-        defaultValue: "*:not(script):not(style):not(embed):not(object):not(frame):not(iframe):not(frameset)",
+        defaultValue: "*:not(script):not(style):not(embed):not(object):not(frame):not(iframe):not(frameset)", // eslint-disable-line
       },
       {
         name: "root",
         type: "node",
         description: l10n.lookup("pagemodReplaceRootDesc"),
         defaultValue: null,
       },
       {
@@ -58,20 +58,20 @@ exports.items = [
       {
         name: "attributes",
         type: "string",
         description: l10n.lookup("pagemodReplaceAttributesDesc"),
         defaultValue: null,
       },
     ],
     // Make a given string safe to use in a regular expression.
-    escapeRegex: function(aString) {
-      return aString.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+    escapeRegex: function (string) {
+      return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
     },
-    exec: function(args, context) {
+    exec: function (args, context) {
       let searchTextNodes = !args.attrOnly;
       let searchAttributes = !args.contentOnly;
       let regexOptions = args.ignoreCase ? "ig" : "g";
       let search = new RegExp(this.escapeRegex(args.search), regexOptions);
       let attributeRegex = null;
       if (args.attributes) {
         attributeRegex = new RegExp(args.attributes, regexOptions);
       }
@@ -148,17 +148,17 @@ exports.items = [
         description: l10n.lookup("pagemodRemoveElementStripOnlyDesc"),
       },
       {
         name: "ifEmptyOnly",
         type: "boolean",
         description: l10n.lookup("pagemodRemoveElementIfEmptyOnlyDesc"),
       },
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let root = args.root || context.environment.document;
       let elements = Array.prototype.slice.call(root.querySelectorAll(args.search));
 
       let removed = 0;
       for (let i = 0; i < elements.length; i++) {
         let element = elements[i];
         let parentNode = element.parentNode;
         if (!parentNode || !element.removeChild) {
@@ -202,31 +202,31 @@ exports.items = [
         defaultValue: null,
       },
       {
         name: "ignoreCase",
         type: "boolean",
         description: l10n.lookup("pagemodRemoveAttributeIgnoreCaseDesc"),
       },
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let root = args.root || context.environment.document;
       let regexOptions = args.ignoreCase ? "ig" : "g";
       let attributeRegex = new RegExp(args.searchAttributes, regexOptions);
       let elements = root.querySelectorAll(args.searchElements);
       elements = Array.prototype.slice.call(elements);
 
       let removed = 0;
       for (let i = 0; i < elements.length; i++) {
         let element = elements[i];
         if (!element.attributes) {
           continue;
         }
 
-        var attrs = Array.prototype.slice.call(element.attributes);
+        let attrs = Array.prototype.slice.call(element.attributes);
         for (let y = 0; y < attrs.length; y++) {
           let attr = attrs[y];
           if (attributeRegex.test(attr.name)) {
             element.removeAttribute(attr.name);
             removed++;
           }
         }
       }
@@ -250,27 +250,27 @@ exports.items = [
         name: "destination",
         type: {
           name: "selection",
           data: [ "window", "stdout", "clipboard" ]
         },
         defaultValue: "window"
       }
     ],
-    exec: function(args, context) {
+    exec: function (args, context) {
       let html = context.environment.document.documentElement.outerHTML;
       if (args.destination === "stdout") {
         return html;
       }
 
       if (args.desination === "clipboard") {
         let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
                           .getService(Ci.nsIClipboardHelper);
         clipboard.copyString(url);
-        return '';
+        return "";
       }
 
       let url = "data:text/plain;charset=utf8," + encodeURIComponent(html);
       context.environment.window.open(url);
-      return '';
+      return "";
     }
   }
 ];
--- a/devtools/shared/gcli/commands/paintflashing.js
+++ b/devtools/shared/gcli/commands/paintflashing.js
@@ -7,17 +7,17 @@
 const { Ci } = require("chrome");
 loader.lazyRequireGetter(this, "getOuterId", "sdk/window/utils", true);
 loader.lazyRequireGetter(this, "getBrowserForTab", "sdk/tabs/utils", true);
 
 var telemetry;
 try {
   const Telemetry = require("devtools/client/shared/telemetry");
   telemetry = new Telemetry();
-} catch(e) {
+} catch (e) {
   // DevTools Telemetry module only available in Firefox
 }
 
 const EventEmitter = require("devtools/shared/event-emitter");
 const eventEmitter = new EventEmitter();
 
 const gcli = require("gcli/index");
 const l10n = require("gcli/l10n");
@@ -110,17 +110,17 @@ exports.items = [
           name: "chrome",
           get hidden() {
             return gcli.hiddenByChromePref();
           },
           description: l10n.lookup("paintflashingChromeDesc"),
         }
       ]
     }],
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       if (!args.chrome) {
         const output = yield context.updateExec("paintflashing_server --state on");
 
         onPaintFlashingChanged(context.environment.target, output.data);
       } else {
         setPaintFlashing(context.environment.chromeWindow, "on");
       }
     }
@@ -139,17 +139,17 @@ exports.items = [
           name: "chrome",
           get hidden() {
             return gcli.hiddenByChromePref();
           },
           description: l10n.lookup("paintflashingChromeDesc"),
         }
       ]
     }],
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       if (!args.chrome) {
         const output = yield context.updateExec("paintflashing_server --state off");
 
         onPaintFlashingChanged(context.environment.target, output.data);
       } else {
         setPaintFlashing(context.environment.chromeWindow, "off");
       }
     }
@@ -164,17 +164,17 @@ exports.items = [
     state: {
       isChecked: ({_tab}) => isCheckedFor(_tab),
       onChange: (_, handler) => eventEmitter.on("changed", handler),
       offChange: (_, handler) => eventEmitter.off("changed", handler),
     },
     tooltipText: l10n.lookup("paintflashingTooltip"),
     description: l10n.lookup("paintflashingToggleDesc"),
     manual: l10n.lookup("paintflashingManual"),
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       const output = yield context.updateExec("paintflashing_server --state toggle");
 
       onPaintFlashingChanged(context.environment.target, output.data);
     }
   },
   {
     item: "command",
     runAt: "server",
@@ -185,17 +185,17 @@ exports.items = [
         name: "state",
         type: {
           name: "selection",
           data: [ "on", "off", "toggle", "query" ]
         }
       },
     ],
     returnType: "paintFlashingState",
-    exec: function(args, context) {
+    exec: function (args, context) {
       let { window } = context.environment;
       let id = getOuterId(window);
       let flashing = setPaintFlashing(window, args.state);
 
       return { flashing, id };
     }
   }
 ];
--- a/devtools/shared/gcli/commands/qsa.js
+++ b/devtools/shared/gcli/commands/qsa.js
@@ -1,24 +1,24 @@
-/* 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 l10n = require("gcli/l10n");
-
-exports.items = [
-  {
-    item: "command",
-    runAt: "server",
-    name: "qsa",
-    description: l10n.lookup("qsaDesc"),
-    params: [{
-      name: "query",
-      type: "nodelist",
-      description: l10n.lookup("qsaQueryDesc")
-    }],
-    exec: function(args, context) {
-      return args.query.length;
-    }
-  }
-];
+/* 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 l10n = require("gcli/l10n");
+
+exports.items = [
+  {
+    item: "command",
+    runAt: "server",
+    name: "qsa",
+    description: l10n.lookup("qsaDesc"),
+    params: [{
+      name: "query",
+      type: "nodelist",
+      description: l10n.lookup("qsaQueryDesc")
+    }],
+    exec: function (args, context) {
+      return args.query.length;
+    }
+  }
+];
--- a/devtools/shared/gcli/commands/restart.js
+++ b/devtools/shared/gcli/commands/restart.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const { Cc, Ci, Cu } = require("chrome");
+const { Cc, Ci } = require("chrome");
 const l10n = require("gcli/l10n");
 const Services = require("Services");
 
 const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
                            .getService(Ci.nsIStringBundleService)
                            .createBundle("chrome://branding/locale/brand.properties")
                            .GetStringFromName("brandShortName");
 
--- a/devtools/shared/gcli/commands/rulers.js
+++ b/devtools/shared/gcli/commands/rulers.js
@@ -34,17 +34,17 @@ exports.items = [
     buttonId: "command-button-rulers",
     buttonClass: "command-button command-button-invertable",
     tooltipText: l10n.lookup("rulersTooltip"),
     state: {
       isChecked: ({_tab}) => isCheckedFor(_tab),
       onChange: (target, handler) => eventEmitter.on("changed", handler),
       offChange: (target, handler) => eventEmitter.off("changed", handler)
     },
-    exec: function*(args, context) {
+    exec: function* (args, context) {
       let { target } = context.environment;
 
       // Pipe the call to the server command.
       let response = yield context.updateExec("rulers_server");
       let { visible, id } = response.data;
 
       if (visible) {
         visibleHighlighters.add(id);
@@ -66,17 +66,17 @@ exports.items = [
   },
   // The server rulers command is hidden by default, it's just used by the
   // client command.
   {
     name: "rulers_server",
     runAt: "server",
     hidden: true,
     returnType: "highlighterVisibility",
-    exec: function(args, context) {
+    exec: function (args, context) {
       let env = context.environment;
       let { document } = env;
       let id = getOuterId(env.window);
 
       // Calling the command again after the rulers have been shown once hides
       // them.
       if (highlighters.has(document)) {
         let { highlighter } = highlighters.get(document);
@@ -92,18 +92,18 @@ exports.items = [
       // Store the instance of the rulers highlighter for this document so we
       // can hide it later.
       highlighters.set(document, { highlighter, environment });
 
       // Listen to the highlighter's destroy event which may happen if the
       // window is refreshed or closed with the rulers shown.
       events.once(highlighter, "destroy", () => {
         if (highlighters.has(document)) {
-          let { environment } = highlighters.get(document);
-          environment.destroy();
+          let { environment: toDestroy } = highlighters.get(document);
+          toDestroy.destroy();
           highlighters.delete(document);
         }
       });
 
       highlighter.show();
       return {visible: true, id};
     }
   }
--- a/devtools/shared/gcli/commands/screenshot.js
+++ b/devtools/shared/gcli/commands/screenshot.js
@@ -4,31 +4,25 @@
 
 "use strict";
 
 const { Cc, Ci, Cr, Cu } = require("chrome");
 const l10n = require("gcli/l10n");
 const Services = require("Services");
 const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
 const { getRect } = require("devtools/shared/layout/utils");
-const promise = require("promise");
 const defer = require("devtools/shared/defer");
 const { Task } = require("devtools/shared/task");
 
 loader.lazyImporter(this, "Downloads", "resource://gre/modules/Downloads.jsm");
 loader.lazyImporter(this, "OS", "resource://gre/modules/osfile.jsm");
 loader.lazyImporter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
 loader.lazyImporter(this, "PrivateBrowsingUtils",
                           "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
-const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
-                           .getService(Ci.nsIStringBundleService)
-                           .createBundle("chrome://branding/locale/brand.properties")
-                           .GetStringFromName("brandShortName");
-
 // String used as an indication to generate default file name in the following
 // format: "Screen Shot yyyy-mm-dd at HH.MM.SS.png"
 const FILENAME_DEFAULT_VALUE = " ";
 const CONTAINER_FLASHING_DURATION = 500;
 
 /*
  * There are 2 commands and 1 converter here. The 2 commands are nearly
  * identical except that one runs on the client and one in the server.
@@ -123,31 +117,32 @@ exports.items = [
      *                            // folder containing the given file
      *   href: "...",             // If set, clicking the image will open the
      *                            // link in a new tab
      * }
      */
     item: "converter",
     from: "imageSummary",
     to: "dom",
-    exec: function(imageSummary, context) {
+    exec: function (imageSummary, context) {
       const document = context.document;
       const root = document.createElement("div");
 
       // Add a line to the result for each destination
       imageSummary.destinations.forEach(destination => {
         const title = document.createElement("div");
         title.textContent = destination;
         root.appendChild(title);
       });
 
       // Add the thumbnail image
       if (imageSummary.data != null) {
         const image = context.document.createElement("div");
-        const previewHeight = parseInt(256 * imageSummary.height / imageSummary.width);
+        const previewHeight = parseInt(256 * imageSummary.height / imageSummary.width,
+                                       10);
         const style = "" +
             "width: 256px;" +
             "height: " + previewHeight + "px;" +
             "max-height: 256px;" +
             "background-image: url('" + imageSummary.data + "');" +
             "background-size: 256px " + previewHeight + "px;" +
             "margin: 4px;" +
             "display: block;";
@@ -235,19 +230,17 @@ function simulateCameraEffect(document, 
 function captureScreenshot(args, document) {
   if (args.delay > 0) {
     return new Promise((resolve, reject) => {
       document.defaultView.setTimeout(() => {
         createScreenshotData(document, args).then(resolve, reject);
       }, args.delay * 1000);
     });
   }
-  else {
-    return createScreenshotData(document, args);
-  }
+  return createScreenshotData(document, args);
 }
 
 /**
  * There are several possible destinations for the screenshot, SKIP is used
  * in saveScreenshot() whenever one of them is not used
  */
 const SKIP = Promise.resolve();
 
@@ -255,18 +248,18 @@ const SKIP = Promise.resolve();
  * Save the captured screenshot to one of several destinations.
  */
 function saveScreenshot(args, context, reply) {
   const fileNeeded = args.filename != FILENAME_DEFAULT_VALUE ||
     (!args.imgur && !args.clipboard) || args.file;
 
   return Promise.all([
     args.clipboard ? saveToClipboard(context, reply) : SKIP,
-    args.imgur     ? uploadToImgur(reply)            : SKIP,
-    fileNeeded     ? saveToFile(context, reply)      : SKIP,
+    args.imgur ? uploadToImgur(reply) : SKIP,
+    fileNeeded ? saveToFile(context, reply) : SKIP,
   ]).then(() => reply);
 }
 
 /**
  * This does the dirty work of creating a base64 string out of an
  * area of the browser window
  */
 function createScreenshotData(document, args) {
@@ -278,25 +271,23 @@ function createScreenshotData(document, 
   const currentX = window.scrollX;
   const currentY = window.scrollY;
 
   let filename = getFilename(args.filename);
 
   if (args.fullpage) {
     // Bug 961832: GCLI screenshot shows fixed position element in wrong
     // position if we don't scroll to top
-    window.scrollTo(0,0);
+    window.scrollTo(0, 0);
     width = window.innerWidth + window.scrollMaxX - window.scrollMinX;
     height = window.innerHeight + window.scrollMaxY - window.scrollMinY;
     filename = filename.replace(".png", "-fullpage.png");
-  }
-  else if (args.selector) {
+  } else if (args.selector) {
     ({ top, left, width, height } = getRect(window, args.selector, window));
-  }
-  else {
+  } else {
     left = window.scrollX;
     top = window.scrollY;
     width = window.innerWidth;
     height = window.innerHeight;
   }
 
   // Only adjust for scrollbars when considering the full window
   if (!args.selector) {
@@ -342,17 +333,17 @@ function getFilename(defaultName) {
   // Create a name for the file if not present
   if (defaultName != FILENAME_DEFAULT_VALUE) {
     return defaultName;
   }
 
   const date = new Date();
   let dateString = date.getFullYear() + "-" + (date.getMonth() + 1) +
                   "-" + date.getDate();
-  dateString = dateString.split("-").map(function(part) {
+  dateString = dateString.split("-").map(function (part) {
     if (part.length == 1) {
       part = "0" + part;
     }
     return part;
   }).join("-");
 
   const timeString = date.toTimeString().replace(/:/g, ".").split(" ")[0];
   return l10n.lookupFormat("screenshotGeneratedFilename",
@@ -394,18 +385,17 @@ function saveToClipboard(context, reply)
     trans.addDataFlavor(channel.contentType);
     trans.setTransferData(channel.contentType, wrapped, -1);
 
     const clip = Cc["@mozilla.org/widget/clipboard;1"]
                     .getService(Ci.nsIClipboard);
     clip.setData(trans, null, Ci.nsIClipboard.kGlobalClipboard);
 
     reply.destinations.push(l10n.lookup("screenshotCopied"));
-  }
-  catch (ex) {
+  } catch (ex) {
     console.error(ex);
     reply.destinations.push(l10n.lookup("screenshotErrorCopying"));
   }
 
   return Promise.resolve();
 }
 
 /**
@@ -417,24 +407,25 @@ function uploadToImgur(reply) {
                   .createInstance(Ci.nsIXMLHttpRequest);
     const fd = Cc["@mozilla.org/files/formdata;1"]
                   .createInstance(Ci.nsIDOMFormData);
     fd.append("image", reply.data.split(",")[1]);
     fd.append("type", "base64");
     fd.append("title", reply.filename);
 
     const postURL = Services.prefs.getCharPref("devtools.gcli.imgurUploadURL");
-    const clientID = "Client-ID " + Services.prefs.getCharPref("devtools.gcli.imgurClientID");
+    const clientID = "Client-ID " +
+                     Services.prefs.getCharPref("devtools.gcli.imgurClientID");
 
     xhr.open("POST", postURL);
     xhr.setRequestHeader("Authorization", clientID);
     xhr.send(fd);
     xhr.responseType = "json";
 
-    xhr.onreadystatechange = function() {
+    xhr.onreadystatechange = function () {
       if (xhr.readyState == 4) {
         if (xhr.status == 200) {
           reply.href = xhr.response.data.link;
           reply.destinations.push(l10n.lookupFormat("screenshotImgurUploaded",
                                                     [ reply.href ]));
         } else {
           reply.destinations.push(l10n.lookup("screenshotImgurError"));
         }
@@ -472,38 +463,38 @@ function DownloadListener(win, transfer)
   }
 
   // Allow saveToFile to await completion for error handling
   this._completedDeferred = defer();
   this.completed = this._completedDeferred.promise;
 }
 
 DownloadListener.prototype = {
-  QueryInterface: function(iid) {
+  QueryInterface: function (iid) {
     if (iid.equals(Ci.nsIInterfaceRequestor) ||
         iid.equals(Ci.nsIWebProgressListener) ||
         iid.equals(Ci.nsIWebProgressListener2) ||
         iid.equals(Ci.nsISupports)) {
       return this;
     }
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
 
-  getInterface: function(iid) {
+  getInterface: function (iid) {
     if (iid.equals(Ci.nsIAuthPrompt) ||
         iid.equals(Ci.nsIAuthPrompt2)) {
       let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
                  .getService(Ci.nsIPromptFactory);
       return ww.getPrompt(this.window, iid);
     }
 
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
 
-  onStateChange: function(webProgress, request, state, status) {
+  onStateChange: function (webProgress, request, state, status) {
     // Check if the download has completed
     if ((state & Ci.nsIWebProgressListener.STATE_STOP) &&
         (state & Ci.nsIWebProgressListener.STATE_IS_NETWORK)) {
       if (status == Cr.NS_OK) {
         this._completedDeferred.resolve();
       } else {
         this._completedDeferred.reject();
       }
@@ -512,17 +503,17 @@ DownloadListener.prototype = {
     this.transfer.onStateChange.apply(this.transfer, arguments);
   }
 };
 
 /**
  * Save the screenshot data to disk, returning a promise which is resolved on
  * completion.
  */
-var saveToFile = Task.async(function*(context, reply) {
+var saveToFile = Task.async(function* (context, reply) {
   let document = context.environment.chromeDocument;
   let window = context.environment.chromeWindow;
 
   // Check there is a .png extension to filename
   if (!reply.filename.match(/.png$/i)) {
     reply.filename += ".png";
   }
 
--- a/devtools/shared/gcli/commands/security.js
+++ b/devtools/shared/gcli/commands/security.js
@@ -8,27 +8,25 @@
  *   Provides feedback about the current CSP
  *
  *  * Security referrer
  *    Provides information about the current referrer policy
  */
 
 "use strict";
 
-const { Cc, Ci, Cu, CC } = require("chrome");
+const { Ci } = require("chrome");
 const l10n = require("gcli/l10n");
-const CSP = Cc["@mozilla.org/cspcontext;1"].getService(Ci.nsIContentSecurityPolicy);
 
 const GOOD_IMG_SRC = "chrome://browser/content/gcli_sec_good.svg";
 const MOD_IMG_SRC = "chrome://browser/content/gcli_sec_moderate.svg";
 const BAD_IMG_SRC = "chrome://browser/content/gcli_sec_bad.svg";
 
-
 // special handling within policy
-const POLICY_REPORT_ONLY = "report-only"
+const POLICY_REPORT_ONLY = "report-only";
 
 // special handling of directives
 const DIR_UPGRADE_INSECURE = "upgrade-insecure-requests";
 const DIR_BLOCK_ALL_MIXED_CONTENT = "block-all-mixed-content";
 
 // special handling of sources
 const SRC_UNSAFE_INLINE = "'unsafe-inline'";
 const SRC_UNSAFE_EVAL = "'unsafe-eval'";
@@ -37,82 +35,87 @@ const WILDCARD_MSG = l10n.lookup("securi
 const XSS_WARNING_MSG = l10n.lookup("securityCSPPotentialXSS");
 const NO_CSP_ON_PAGE_MSG = l10n.lookup("securityCSPNoCSPOnPage");
 const CONTENT_SECURITY_POLICY_MSG = l10n.lookup("securityCSPHeaderOnPage");
 const CONTENT_SECURITY_POLICY_REPORT_ONLY_MSG = l10n.lookup("securityCSPROHeaderOnPage");
 
 const NEXT_URI_HEADER = l10n.lookup("securityReferrerNextURI");
 const CALCULATED_REFERRER_HEADER = l10n.lookup("securityReferrerCalculatedReferrer");
 /* The official names from the W3C Referrer Policy Draft http://www.w3.org/TR/referrer-policy/ */
-const REFERRER_POLICY_NAMES = [ "None When Downgrade (default)", "None", "Origin Only", "Origin When Cross-Origin", "Unsafe URL" ];
+const REFERRER_POLICY_NAMES = [
+  "None When Downgrade (default)",
+  "None", "Origin Only",
+  "Origin When Cross-Origin", "Unsafe URL"
+];
 
 exports.items = [
   {
     // --- General Security information
     name: "security",
     description: l10n.lookup("securityPrivacyDesc"),
     manual: l10n.lookup("securityManual")
   },
   {
     // --- CSP specific Security information
     item: "command",
     runAt: "server",
     name: "security csp",
     description: l10n.lookup("securityCSPDesc"),
     manual: l10n.lookup("securityCSPManual"),
     returnType: "securityCSPInfo",
-    exec: function(args, context) {
+    exec: function (args, context) {
+      let cspJSON = context.environment.document.nodePrincipal.cspJSON;
+      let cspOBJ = JSON.parse(cspJSON);
 
-      var cspJSON = context.environment.document.nodePrincipal.cspJSON;
-      var cspOBJ = JSON.parse(cspJSON);
+      let outPolicies = [];
 
-      var outPolicies = [];
-
-      var policies = cspOBJ["csp-policies"];
+      let policies = cspOBJ["csp-policies"];
 
       // loop over all the different policies
-      for (var csp in policies) {
-        var curPolicy = policies[csp];
+      for (let csp in policies) {
+        let curPolicy = policies[csp];
 
         // loop over all the directive-values within that policy
-        var outDirectives = [];
-        var outHeader = CONTENT_SECURITY_POLICY_MSG;
-        for (var dir in curPolicy) {
-          var curDir = curPolicy[dir];
+        let outDirectives = [];
+        let outHeader = CONTENT_SECURITY_POLICY_MSG;
+        for (let dir in curPolicy) {
+          let curDir = curPolicy[dir];
 
           // when iterating properties within the obj we might also
           // encounter the 'report-only' flag, which is not a csp directive.
           if (dir === POLICY_REPORT_ONLY) {
             outHeader = curPolicy[POLICY_REPORT_ONLY] === true ?
                           CONTENT_SECURITY_POLICY_REPORT_ONLY_MSG :
                           CONTENT_SECURITY_POLICY_MSG;
             continue;
           }
 
           // loop over all the directive-sources within that directive
-          var outSrcs = [];
+          let outSrcs = [];
 
           // special case handling for the directives
           // upgrade-insecure-requests and block-all-mixed-content
           // which do not include any srcs
           if (dir === DIR_UPGRADE_INSECURE ||
               dir === DIR_BLOCK_ALL_MIXED_CONTENT) {
             outSrcs.push({
               icon: GOOD_IMG_SRC,
-              src: "", // no src
-              desc: "" // no description
+              // no src
+              src: "",
+              // no description
+              desc: ""
             });
           }
 
-          for (var src in curDir) {
-            var curSrc = curDir[src];
+          for (let src in curDir) {
+            let curSrc = curDir[src];
 
             // the default icon and descritpion of the directive-src
-            var outIcon = GOOD_IMG_SRC;
-            var outDesc = "";
+            let outIcon = GOOD_IMG_SRC;
+            let outDesc = "";
 
             if (curSrc.indexOf("*") > -1) {
               outIcon = MOD_IMG_SRC;
               outDesc = WILDCARD_MSG;
             }
             if (curSrc == SRC_UNSAFE_INLINE || curSrc == SRC_UNSAFE_EVAL) {
               outIcon = BAD_IMG_SRC;
               outDesc = XSS_WARNING_MSG;
@@ -137,30 +140,31 @@ exports.items = [
       }
       return outPolicies;
     }
   },
   {
     item: "converter",
     from: "securityCSPInfo",
     to: "view",
-    exec: function(cspInfo, context) {
-      var url = context.environment.target.url;
+    exec: function (cspInfo, context) {
+      const url = context.environment.target.url;
 
       if (cspInfo.length == 0) {
         return context.createView({
           html:
             "<table class='gcli-csp-detail' cellspacing='10' valign='top'>" +
             "  <tr>" +
             "    <td> <img src='chrome://browser/content/gcli_sec_bad.svg' width='20px' /> </td> " +
             "    <td>" + NO_CSP_ON_PAGE_MSG + " <b>" + url + "</b></td>" +
             "  </tr>" +
             "</table>"});
       }
 
+      /* eslint-disable max-len */
       return context.createView({
         html:
           "<table class='gcli-csp-detail' cellspacing='10' valign='top'>" +
           // iterate all policies
           "  <tr foreach='csp in ${cspinfo}' >" +
           "    <td> ${csp.header} <b>" + url + "</b><br/><br/>" +
           "      <table class='gcli-csp-dir-detail' valign='top'>" +
           // >> iterate all directives
@@ -176,41 +180,42 @@ exports.items = [
           "              </tr>" +
           "            </table>" +
           "          </td>" +
           "        </tr>" +
           "      </table>" +
           "    </td>" +
           "  </tr>" +
           "</table>",
-          data: {
-            cspinfo: cspInfo,
-          }
-        });
+        data: {
+          cspinfo: cspInfo,
+        }
+      });
+      /* eslint-enable max-len */
     }
   },
   {
     // --- Referrer Policy specific Security information
     item: "command",
     runAt: "server",
     name: "security referrer",
     description: l10n.lookup("securityReferrerPolicyDesc"),
     manual: l10n.lookup("securityReferrerPolicyManual"),
     returnType: "securityReferrerPolicyInfo",
-    exec: function(args, context) {
-      var doc = context.environment.document;
+    exec: function (args, context) {
+      let doc = context.environment.document;
 
-      var referrerPolicy = doc.referrerPolicy;
+      let { referrerPolicy } = doc;
 
-      var pageURI = doc.documentURIObject;
-      var sameDomainReferrer = "";
-      var otherDomainReferrer = "";
-      var downgradeReferrer = "";
-      var otherDowngradeReferrer = "";
-      var origin = pageURI.prePath;
+      let pageURI = doc.documentURIObject;
+      let sameDomainReferrer = "";
+      let otherDomainReferrer = "";
+      let downgradeReferrer = "";
+      let otherDowngradeReferrer = "";
+      let origin = pageURI.prePath;
 
       switch (referrerPolicy) {
         case Ci.nsIHttpChannel.REFERRER_POLICY_NO_REFERRER:
           // sends no referrer
           sameDomainReferrer
             = otherDomainReferrer
             = downgradeReferrer
             = otherDowngradeReferrer
@@ -250,79 +255,79 @@ exports.items = [
           sameDomainReferrer
             = otherDomainReferrer
             = downgradeReferrer
             = otherDowngradeReferrer
             = "(unknown Referrer Policy)";
           break;
       }
 
-      var sameDomainUri = origin + "/*";
+      let sameDomainUri = origin + "/*";
 
-      var referrerUrls = [
+      let referrerUrls = [
         // add the referrer uri 'referrer' we would send when visiting 'uri'
         {
-          uri: pageURI.scheme+'://example.com/',
+          uri: pageURI.scheme + "://example.com/",
           referrer: otherDomainReferrer,
-          description: l10n.lookup('securityReferrerPolicyOtherDomain')},
+          description: l10n.lookup("securityReferrerPolicyOtherDomain")},
         {
           uri: sameDomainUri,
           referrer: sameDomainReferrer,
-          description: l10n.lookup('securityReferrerPolicySameDomain')}
+          description: l10n.lookup("securityReferrerPolicySameDomain")}
       ];
 
-      if (pageURI.schemeIs('https')) {
+      if (pageURI.schemeIs("https")) {
         // add the referrer we would send on downgrading http->https
         if (sameDomainReferrer != downgradeReferrer) {
           referrerUrls.push({
-            uri: "http://"+pageURI.hostPort+"/*",
+            uri: "http://" + pageURI.hostPort + "/*",
             referrer: downgradeReferrer,
             description:
-              l10n.lookup('securityReferrerPolicySameDomainDowngrade')
+              l10n.lookup("securityReferrerPolicySameDomainDowngrade")
           });
         }
         if (otherDomainReferrer != otherDowngradeReferrer) {
           referrerUrls.push({
             uri: "http://example.com/",
             referrer: otherDowngradeReferrer,
             description:
-              l10n.lookup('securityReferrerPolicyOtherDomainDowngrade')
+              l10n.lookup("securityReferrerPolicyOtherDomainDowngrade")
           });
         }
       }
 
       return {
         header: l10n.lookupFormat("securityReferrerPolicyReportHeader",
                                   [pageURI.spec]),
         policyName: REFERRER_POLICY_NAMES[referrerPolicy],
         urls: referrerUrls
-      }
+      };
     }
   },
   {
     item: "converter",
     from: "securityReferrerPolicyInfo",
     to: "view",
-    exec: function(referrerPolicyInfo, context) {
+    exec: function (referrerPolicyInfo, context) {
       return context.createView({
-          html:
+        html:
           "<div class='gcli-referrer-policy'>" +
           "  <strong> ${rpi.header} </strong> <br />" +
           "  ${rpi.policyName} <br />" +
           "  <table class='gcli-referrer-policy-detail' cellspacing='10' >" +
           "    <tr>" +
           "      <th> " + NEXT_URI_HEADER + " </th>" +
           "      <th> " + CALCULATED_REFERRER_HEADER + " </th>" +
           "    </tr>" +
           // iterate all policies
           "    <tr foreach='nextURI in ${rpi.urls}' >" +
           "      <td> ${nextURI.description} (e.g., ${nextURI.uri}) </td>" +
           "      <td> ${nextURI.referrer} </td>" +
           "    </tr>" +
           "  </table>" +
           "</div>",
-          data: {
-            rpi: referrerPolicyInfo,
-          }
-        });
-     }
+        data: {
+          rpi: referrerPolicyInfo,
+        }
+      });
+    }
   }
 ];
--- a/devtools/shared/transport/packets.js
+++ b/devtools/shared/transport/packets.js
@@ -19,22 +19,21 @@
  *   * write(stream)
  *     Called when the output stream is ready to write
  *   * get done()
  *     Returns true once the packet is done being read / written
  *   * destroy()
  *     Called to clean up at the end of use
  */
 
-const { Cc, Ci, Cu } = require("chrome");
+const { Cc, Ci } = require("chrome");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { dumpn, dumpv } = DevToolsUtils;
 const flags = require("devtools/shared/flags");
 const StreamUtils = require("devtools/shared/transport/stream-utils");
-const promise = require("promise");
 const defer = require("devtools/shared/defer");
 
 DevToolsUtils.defineLazyGetter(this, "unicodeConverter", () => {
   const unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                            .createInstance(Ci.nsIScriptableUnicodeConverter);
   unicodeConverter.charset = "UTF-8";
   return unicodeConverter;
 });
@@ -131,17 +130,19 @@ JSONPacket.fromHeader = function (header
 JSONPacket.HEADER_PATTERN = /^(\d+):$/;
 
 JSONPacket.prototype = Object.create(Packet.prototype);
 
 Object.defineProperty(JSONPacket.prototype, "object", {
   /**
    * Gets the object (not the serialized string) being read or written.
    */
-  get: function () { return this._object; },
+  get: function () {
+    return this._object;
+  },
 
   /**
    * Sets the object to be sent when write() is called.
    */
   set: function (object) {
     this._object = object;
     let data = JSON.stringify(object);
     this._data = unicodeConverter.ConvertFromUnicode(data);
@@ -195,17 +196,19 @@ JSONPacket.prototype.write = function (s
   }
 
   let written = stream.write(this._outgoing, this._outgoing.length);
   this._outgoing = this._outgoing.slice(written);
   this._done = !this._outgoing.length;
 };
 
 Object.defineProperty(JSONPacket.prototype, "done", {
-  get: function () { return this._done; }
+  get: function () {
+    return this._done;
+  }
 });
 
 JSONPacket.prototype.toString = function () {
   return JSON.stringify(this._object, null, 2);
 };
 
 exports.JSONPacket = JSONPacket;
 
@@ -364,20 +367,21 @@ Object.defineProperty(BulkPacket.prototy
   set: function (header) {
     this.actor = header.actor;
     this.type = header.type;
     this.length = header.length;
   },
 });
 
 Object.defineProperty(BulkPacket.prototype, "done", {
-  get: function () { return this._done; },
+  get: function () {
+    return this._done;
+  },
 });
 
-
 BulkPacket.prototype.toString = function () {
   return "Bulk: " + JSON.stringify(this.header, null, 2);
 };
 
 exports.BulkPacket = BulkPacket;
 
 /**
  * RawPacket is used to test the transport's error handling of malformed
@@ -403,12 +407,14 @@ RawPacket.prototype.read = function (str
 
 RawPacket.prototype.write = function (stream) {
   let written = stream.write(this._data, this._data.length);
   this._data = this._data.slice(written);
   this._done = !this._data.length;
 };
 
 Object.defineProperty(RawPacket.prototype, "done", {
-  get: function () { return this._done; }
+  get: function () {
+    return this._done;
+  }
 });
 
 exports.RawPacket = RawPacket;
--- a/devtools/shared/transport/stream-utils.js
+++ b/devtools/shared/transport/stream-utils.js
@@ -1,20 +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/. */
 
 "use strict";
 
-const { Ci, Cc, Cu, Cr, CC } = require("chrome");
+const { Ci, Cc, Cr, CC } = require("chrome");
 const Services = require("Services");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { dumpv } = DevToolsUtils;
 const EventEmitter = require("devtools/shared/event-emitter");
-const promise = require("promise");
 const defer = require("devtools/shared/defer");
 
 DevToolsUtils.defineLazyGetter(this, "IOUtil", () => {
   return Cc["@mozilla.org/io-util;1"].getService(Ci.nsIIOUtil);
 });
 
 DevToolsUtils.defineLazyGetter(this, "ScriptableInputStream", () => {
   return CC("@mozilla.org/scriptableinputstream;1",
@@ -65,18 +64,18 @@ function StreamCopier(input, output, len
   EventEmitter.decorate(this);
   this._id = StreamCopier._nextId++;
   this.input = input;
   // Save off the base output stream, since we know it's async as we've required
   this.baseAsyncOutput = output;
   if (IOUtil.outputStreamIsBuffered(output)) {
     this.output = output;
   } else {
-    this.output = Cc["@mozilla.org/network/buffered-output-stream;1"].
-                  createInstance(Ci.nsIBufferedOutputStream);
+    this.output = Cc["@mozilla.org/network/buffered-output-stream;1"]
+                  .createInstance(Ci.nsIBufferedOutputStream);
     this.output.init(output, BUFFER_SIZE);
   }
   this._length = length;
   this._amountLeft = length;
   this._deferred = defer();
 
   this._copy = this._copy.bind(this);
   this._flush = this._flush.bind(this);
@@ -119,19 +118,18 @@ StreamCopier.prototype = {
     try {
       bytesCopied = this.output.writeFrom(this.input, amountToCopy);
     } catch (e) {
       if (e.result == Cr.NS_BASE_STREAM_WOULD_BLOCK) {
         this._debug("Base stream would block, will retry");
         this._debug("Waiting for output stream");
         this.baseAsyncOutput.asyncWait(this, 0, 0, Services.tm.currentThread);
         return;
-      } else {
-        throw e;
       }
+      throw e;
     }
 
     this._amountLeft -= bytesCopied;
     this._debug("Copied: " + bytesCopied +
                 ", Left: " + this._amountLeft);
     this._emitProgress();
 
     if (this._amountLeft === 0) {
@@ -157,19 +155,18 @@ StreamCopier.prototype = {
     } catch (e) {
       if (e.result == Cr.NS_BASE_STREAM_WOULD_BLOCK ||
           e.result == Cr.NS_ERROR_FAILURE) {
         this._debug("Flush would block, will retry");
         this._streamReadyCallback = this._flush;
         this._debug("Waiting for output stream");
         this.baseAsyncOutput.asyncWait(this, 0, 0, Services.tm.currentThread);
         return;
-      } else {
-        throw e;
       }
+      throw e;
     }
     this._deferred.resolve();
   },
 
   _destroy: function () {
     this._destroy = null;
     this._copy = null;
     this._flush = null;
--- a/devtools/shared/worker/helper.js
+++ b/devtools/shared/worker/helper.js
@@ -1,24 +1,25 @@
 /* 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-env amd */
+
+"use strict";
+
 (function (root, factory) {
-  "use strict";
-
   if (typeof define === "function" && define.amd) {
     define(factory);
   } else if (typeof exports === "object") {
     module.exports = factory();
   } else {
     root.workerHelper = factory();
   }
 }(this, function () {
-  "use strict";
-
   /**
    * This file is to only be included by ChromeWorkers. This exposes
    * a `createTask` function to workers to register tasks for communication
    * back to `devtools/shared/worker`.
    *
    * Tasks can be send their responses via a return value, either a primitive
    * or a promise.
    *
@@ -76,58 +77,57 @@
       let taskFn = self._tasks[task];
 
       if (!taskFn) {
         self.postMessage({ id, error: `Task "${task}" not found in worker.` });
         return;
       }
 
       try {
-        let results;
         handleResponse(taskFn(data));
-      } catch (e) {
-        handleError(e);
+      } catch (ex) {
+        handleError(ex);
       }
 
       function handleResponse(response) {
         // If a promise
         if (response && typeof response.then === "function") {
           response.then(val => self.postMessage({ id, response: val }), handleError);
-        }
-        // If an error object
-        else if (response instanceof Error) {
+        } else if (response instanceof Error) {
+          // If an error object
           handleError(response);
-        }
-        // If anything else
-        else {
+        } else {
+          // If anything else
           self.postMessage({ id, response });
         }
       }
 
       function handleError(error = "Error") {
         try {
           // First, try and structured clone the error across directly.
           self.postMessage({ id, error });
-        } catch (_) {
+        } catch (x) {
           // We could not clone whatever error value was given. Do our best to
           // stringify it.
           let errorString = `Error while performing task "${task}": `;
 
           try {
             errorString += error.toString();
-          } catch (_) {
+          } catch (ex) {
             errorString += "<could not stringify error>";
           }
 
           if ("stack" in error) {
             try {
               errorString += "\n" + error.stack;
-            } catch (_) { }
+            } catch (err) {
+              // Do nothing
+            }
           }
 
           self.postMessage({ id, error: errorString });
         }
       }
     };
   }
 
   return { createTask: createTask };
-}.bind(this)));
+}));
--- a/devtools/shared/worker/loader.js
+++ b/devtools/shared/worker/loader.js
@@ -1,14 +1,16 @@
 /* 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";
 
+/* global worker */
+
 // A CommonJS module loader that is designed to run inside a worker debugger.
 // We can't simply use the SDK module loader, because it relies heavily on
 // Components, which isn't available in workers.
 //
 // In principle, the standard instance of the worker loader should provide the
 // same built-in modules as its devtools counterpart, so that both loaders are
 // interchangable on the main thread, making them easier to test.
 //
@@ -55,37 +57,35 @@ function resolveId(id, baseId) {
  *
  * @return String
  *         A normalized id.
  */
 function normalizeId(id) {
   // An id consists of an optional root and a path. A root consists of either
   // a scheme name followed by 2 or 3 slashes, or a single slash. Slashes in the
   // root are not used as separators, so only normalize the path.
-  let [_, root, path] = id.match(/^(\w+:\/\/\/?|\/)?(.*)/);
+  let [, root, path] = id.match(/^(\w+:\/\/\/?|\/)?(.*)/);
 
   let stack = [];
   path.split("/").forEach(function (component) {
     switch (component) {
       case "":
       case ".":
         break;
       case "..":
         if (stack.length === 0) {
           if (root !== undefined) {
             throw new Error("Can't normalize absolute id '" + id + "'!");
           } else {
             stack.push("..");
           }
+        } else if (stack[stack.length - 1] == "..") {
+          stack.push("..");
         } else {
-          if (stack[stack.length - 1] == "..") {
-            stack.push("..");
-          } else {
-            stack.pop();
-          }
+          stack.pop();
         }
         break;
       default:
         stack.push(component);
         break;
     }
   });
 
@@ -331,17 +331,18 @@ var chrome = {
   components: undefined
 };
 
 var loader = {
   lazyGetter: function (object, name, lambda) {
     Object.defineProperty(object, name, {
       get: function () {
         delete object[name];
-        return object[name] = lambda.apply(object);
+        object[name] = lambda.apply(object);
+        return object[name];
       },
       configurable: true,
       enumerable: true
     });
   },
   lazyImporter: function () {
     throw new Error("Can't import JSM from worker thread!");
   },
@@ -356,34 +357,34 @@ var loader = {
   }
 };
 
 // The following APIs are defined differently depending on whether we are on the
 // main thread or a worker thread. On the main thread, we use the Components
 // object to implement them. On worker threads, we use the APIs provided by
 // the worker debugger.
 
+/* eslint-disable no-shadow */
 var {
   Debugger,
   URL,
   createSandbox,
   dump,
   rpc,
   loadSubScript,
   reportError,
   setImmediate,
   xpcInspector,
 } = (function () {
-  if (typeof Components === "object") { // Main thread
+  // Main thread
+  if (typeof Components === "object") {
     let {
       Constructor: CC,
       classes: Cc,
-      manager: Cm,
       interfaces: Ci,
-      results: Cr,
       utils: Cu
     } = Components;
 
     let principal = CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")();
 
     // To ensure that the this passed to addDebuggerToGlobal is a global, the
     // Debugger object needs to be defined in a sandbox.
     let sandbox = Cu.Sandbox(principal, {});
@@ -401,85 +402,86 @@ var {
         sandboxPrototype: prototype,
         wantComponents: false,
         wantXrays: false
       });
     };
 
     let rpc = undefined;
 
-    let subScriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
-                 getService(Ci.mozIJSSubScriptLoader);
+    let subScriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
+                 .getService(Ci.mozIJSSubScriptLoader);
 
     let loadSubScript = function (url, sandbox) {
       subScriptLoader.loadSubScript(url, sandbox, "UTF-8");
     };
 
     let reportError = Cu.reportError;
 
     let Timer = Cu.import("resource://gre/modules/Timer.jsm", {});
 
     let setImmediate = function (callback) {
       Timer.setTimeout(callback, 0);
     };
 
-    let xpcInspector = Cc["@mozilla.org/jsinspector;1"].
-                       getService(Ci.nsIJSInspector);
+    let xpcInspector = Cc["@mozilla.org/jsinspector;1"]
+                       .getService(Ci.nsIJSInspector);
 
     return {
       Debugger,
       URL: this.URL,
       createSandbox,
       dump: this.dump,
       rpc,
       loadSubScript,
       reportError,
       setImmediate,
       xpcInspector
     };
-  } else { // Worker thread
-    let requestors = [];
-
-    let scope = this;
+  }
+  // Worker thread
+  let requestors = [];
 
-    let xpcInspector = {
-      get eventLoopNestLevel() {
-        return requestors.length;
-      },
+  let scope = this;
 
-      get lastNestRequestor() {
-        return requestors.length === 0 ? null : requestors[requestors.length - 1];
-      },
+  let xpcInspector = {
+    get eventLoopNestLevel() {
+      return requestors.length;
+    },
 
-      enterNestedEventLoop: function (requestor) {
-        requestors.push(requestor);
-        scope.enterEventLoop();
-        return requestors.length;
-      },
+    get lastNestRequestor() {
+      return requestors.length === 0 ? null : requestors[requestors.length - 1];
+    },
+
+    enterNestedEventLoop: function (requestor) {
+      requestors.push(requestor);
+      scope.enterEventLoop();
+      return requestors.length;
+    },
 
-      exitNestedEventLoop: function () {
-        requestors.pop();
-        scope.leaveEventLoop();
-        return requestors.length;
-      }
-    };
+    exitNestedEventLoop: function () {
+      requestors.pop();
+      scope.leaveEventLoop();
+      return requestors.length;
+    }
+  };
 
-    return {
-      Debugger: this.Debugger,
-      URL: this.URL,
-      createSandbox: this.createSandbox,
-      dump: this.dump,
-      rpc: this.rpc,
-      loadSubScript: this.loadSubScript,
-      reportError: this.reportError,
-      setImmediate: this.setImmediate,
-      xpcInspector: xpcInspector
-    };
-  }
+  return {
+    Debugger: this.Debugger,
+    URL: this.URL,
+    createSandbox: this.createSandbox,
+    dump: this.dump,
+    rpc: this.rpc,
+    loadSubScript: this.loadSubScript,
+    reportError: this.reportError,
+    setImmediate: this.setImmediate,
+    xpcInspector: xpcInspector
+  };
 }).call(this);
+/* eslint-enable no-shadow */
 
 // Create the default instance of the worker loader, using the APIs we defined
 // above.
 
 this.worker = new WorkerDebuggerLoader({
   createSandbox: createSandbox,
   globals: {
     "isWorker": true,
--- a/devtools/shared/worker/tests/browser/browser_worker-01.js
+++ b/devtools/shared/worker/tests/browser/browser_worker-01.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 // Tests that the devtools/shared/worker communicates properly
 // as both CommonJS module and as a JSM.
 
 const WORKER_URL =
   "resource://devtools/client/shared/widgets/GraphsWorker.js";
 
 const count = 100000;
 const WORKER_DATA = (function () {
@@ -32,14 +34,14 @@ function* testWorker(context, workerFact
     timestamps: WORKER_DATA,
     interval: INTERVAL,
     duration: DURATION
   });
 
   ok(results.plottedData.length,
     `worker should have returned an object with array properties in ${context}`);
 
-  let fn = workerify(function (x) { return x * x; });
+  let fn = workerify(x => x * x);
   is((yield fn(5)), 25, `workerify works in ${context}`);
   fn.destroy();
 
   worker.destroy();
 }
--- a/devtools/shared/worker/tests/browser/browser_worker-02.js
+++ b/devtools/shared/worker/tests/browser/browser_worker-02.js
@@ -1,45 +1,49 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 // Tests errors are handled properly by the DevToolsWorker.
 
 const { DevToolsWorker } = require("devtools/shared/worker/worker");
 const WORKER_URL =
   "resource://devtools/client/shared/widgets/GraphsWorker.js";
 
 add_task(function* () {
   try {
-    let workerNotFound = new DevToolsWorker("resource://i/dont/exist.js");
+    new DevToolsWorker("resource://i/dont/exist.js");
     ok(false, "Creating a DevToolsWorker with an invalid URL throws");
   } catch (e) {
     ok(true, "Creating a DevToolsWorker with an invalid URL throws");
   }
 
   let worker = new DevToolsWorker(WORKER_URL);
   try {
     // plotTimestampsGraph requires timestamp, interval an duration props on the object
     // passed in so there should be an error thrown in the worker
-    let results = yield worker.performTask("plotTimestampsGraph", {});
-    ok(false, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
+    yield worker.performTask("plotTimestampsGraph", {});
+    ok(false,
+       "DevToolsWorker returns a rejected promise when an error occurs in the worker");
   } catch (e) {
-    ok(true, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
+    ok(true,
+       "DevToolsWorker returns a rejected promise when an error occurs in the worker");
   }
 
   try {
-    let results = yield worker.performTask("not a real task");
+    yield worker.performTask("not a real task");
     ok(false, "DevToolsWorker returns a rejected promise when task does not exist");
   } catch (e) {
     ok(true, "DevToolsWorker returns a rejected promise when task does not exist");
   }
 
   worker.destroy();
   try {
-    let results = yield worker.performTask("plotTimestampsGraph", {
+    yield worker.performTask("plotTimestampsGraph", {
       timestamps: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       interval: 1,
       duration: 1
     });
     ok(false, "DevToolsWorker rejects when performing a task on a destroyed worker");
   } catch (e) {
     ok(true, "DevToolsWorker rejects when performing a task on a destroyed worker");
   }
--- a/devtools/shared/worker/tests/browser/browser_worker-03.js
+++ b/devtools/shared/worker/tests/browser/browser_worker-03.js
@@ -1,17 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 // Tests that the devtools/shared/worker can handle:
 // returned primitives (or promise or Error)
 //
 // And tests `workerify` by doing so.
 
-const { DevToolsWorker, workerify } = require("devtools/shared/worker/worker");
+const { workerify } = require("devtools/shared/worker/worker");
 function square(x) {
   return x * x;
 }
 
 function squarePromise(x) {
   return new Promise((resolve) => resolve(x * x));
 }