Bug 1556849 - Enable ESLint for dom/base/. r=Standard8,mccr8
authorsoniasingla <soniasingla.1812@gmail.com>
Mon, 15 Jul 2019 17:22:45 +0000
changeset 482842 cff2824766d7bf528a663b0dcac146d1dba318cd
parent 482841 d0d5a57af5028b4520cded9481d021bad04668b6
child 482843 8b0cba1b8d94268c766b823d43128678c0916aa0
push id90023
push usermbanner@mozilla.com
push dateMon, 15 Jul 2019 20:36:29 +0000
treeherderautoland@cff2824766d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, mccr8
bugs1556849
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1556849 - Enable ESLint for dom/base/. r=Standard8,mccr8 # ignore-this-changeset These are all automatic changes via ESLint/prettier. Differential Revision: https://phabricator.services.mozilla.com/D37978
.eslintignore
dom/base/ContentAreaDropListener.jsm
dom/base/DOMRequestHelper.jsm
dom/base/IndexedDBHelper.jsm
dom/base/ProcessSelector.jsm
dom/base/SlowScriptDebug.jsm
--- a/.eslintignore
+++ b/.eslintignore
@@ -7,17 +7,16 @@
 # Also ignore reftest - specially crafted to produce expected output.
 **/reftest/**
 **/reftests/**
 
 # Exclude expected objdirs.
 obj*/**
 
 # dom/ exclusions which should be removed (aka ESLint enabled)
-dom/base/*.*
 dom/media/test/**
 !dom/media/test/marionette/yttest/*.js
 dom/xhr/**
 
 # build/ third-party code
 build/pgo/js-input/**
 
 # browser/ exclusions
--- a/dom/base/ContentAreaDropListener.jsm
+++ b/dom/base/ContentAreaDropListener.jsm
@@ -1,48 +1,46 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 // This component is used for handling dragover and drop of urls.
 //
 // It checks to see whether a drop of a url is allowed. For instance, a url
 // cannot be dropped if it is not a valid uri or the source of the drag cannot
 // access the uri. This prevents, for example, a source document from tricking
 // the user into dragging a chrome url.
 
-function ContentAreaDropListener() { };
+function ContentAreaDropListener() {}
 
-ContentAreaDropListener.prototype =
-{
-  classID:          Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"),
-  QueryInterface:   ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]),
+ContentAreaDropListener.prototype = {
+  classID: Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"),
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]),
 
-  _addLink : function(links, url, name, type)
-   {
+  _addLink: function(links, url, name, type) {
     links.push({ url, name, type });
   },
 
-  _addLinksFromItem: function(links, dt, i)
-  {
+  _addLinksFromItem: function(links, dt, i) {
     let types = dt.mozTypesAt(i);
     let type, data;
 
     type = "text/uri-list";
     if (types.contains(type)) {
       data = dt.mozGetDataAt(type, i);
       if (data) {
         let urls = data.split("\n");
         for (let url of urls) {
           // lines beginning with # are comments
-          if (url.startsWith("#"))
+          if (url.startsWith("#")) {
             continue;
+          }
           url = url.replace(/^\s+|\s+$/g, "");
           this._addLink(links, url, url, type);
         }
         return;
       }
     }
 
     type = "text/x-moz-url";
@@ -56,31 +54,32 @@ ContentAreaDropListener.prototype =
         return;
       }
     }
 
     for (let type of ["text/plain", "text/x-moz-text-internal"]) {
       if (types.contains(type)) {
         data = dt.mozGetDataAt(type, i);
         if (data) {
-          let lines = data.replace(/^\s+|\s+$/mg, "").split("\n");
+          let lines = data.replace(/^\s+|\s+$/gm, "").split("\n");
           if (!lines.length) {
             return;
           }
 
           // For plain text, there are 2 cases:
           //   * if there is at least one URI:
           //       Add all URIs, ignoring non-URI lines, so that all URIs
           //       are opened in tabs.
           //   * if there's no URI:
           //       Add the entire text as a single entry, so that the entire
           //       text is searched.
           let hasURI = false;
-          let flags = Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
-              Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
+          let flags =
+            Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
+            Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
           for (let line of lines) {
             let info = Services.uriFixup.getFixupURIInfo(line, flags);
             if (info.fixedURI) {
               // Use the original line here, and let the caller decide
               // whether to perform fixup or not.
               hasURI = true;
               this._addLink(links, line, line, type);
             }
@@ -94,74 +93,88 @@ ContentAreaDropListener.prototype =
       }
     }
 
     // For shortcuts, we want to check for the file type last, so that the
     // url pointed to in one of the url types is found first before the file
     // type, which points to the actual file.
     let files = dt.files;
     if (files && i < files.length) {
-      this._addLink(links, OS.Path.toFileURI(files[i].mozFullPath),
-                    files[i].name, "application/x-moz-file");
+      this._addLink(
+        links,
+        OS.Path.toFileURI(files[i].mozFullPath),
+        files[i].name,
+        "application/x-moz-file"
+      );
     }
   },
 
-  _getDropLinks : function (dt)
-  {
+  _getDropLinks: function(dt) {
     let links = [];
     for (let i = 0; i < dt.mozItemCount; i++) {
       this._addLinksFromItem(links, dt, i);
     }
     return links;
   },
 
-  _validateURI: function(dataTransfer, uriString, disallowInherit,
-                         triggeringPrincipal)
-  {
-    if (!uriString)
+  _validateURI: function(
+    dataTransfer,
+    uriString,
+    disallowInherit,
+    triggeringPrincipal
+  ) {
+    if (!uriString) {
       return "";
+    }
 
     // Strip leading and trailing whitespace, then try to create a
     // URI from the dropped string. If that succeeds, we're
     // dropping a URI and we need to do a security check to make
     // sure the source document can load the dropped URI.
-    uriString = uriString.replace(/^\s*|\s*$/g, '');
+    uriString = uriString.replace(/^\s*|\s*$/g, "");
 
     // Apply URI fixup so that this validation prevents bad URIs even if the
     // similar fixup is applied later, especialy fixing typos up will convert
     // non-URI to URI.
-    let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
-        Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
+    let fixupFlags =
+      Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
+      Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
     let info = Services.uriFixup.getFixupURIInfo(uriString, fixupFlags);
     if (!info.fixedURI || info.keywordProviderName) {
       // Loading a keyword search should always be fine for all cases.
       return uriString;
     }
     let uri = info.fixedURI;
 
-    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
-                   getService(Ci.nsIScriptSecurityManager);
+    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
+      Ci.nsIScriptSecurityManager
+    );
     let flags = secMan.STANDARD;
-    if (disallowInherit)
+    if (disallowInherit) {
       flags |= secMan.DISALLOW_INHERIT_PRINCIPAL;
+    }
 
     secMan.checkLoadURIWithPrincipal(triggeringPrincipal, uri, flags);
 
     // Once we validated, return the URI after fixup, instead of the original
     // uriString.
     return uri.spec;
   },
 
-  _getTriggeringPrincipalFromDataTransfer: function(aDataTransfer,
-                                                    fallbackToSystemPrincipal)
-  {
+  _getTriggeringPrincipalFromDataTransfer: function(
+    aDataTransfer,
+    fallbackToSystemPrincipal
+  ) {
     let sourceNode = aDataTransfer.mozSourceNode;
-    if (sourceNode &&
-        (sourceNode.localName !== "browser" ||
-         sourceNode.namespaceURI !== "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")) {
+    if (
+      sourceNode &&
+      (sourceNode.localName !== "browser" ||
+        sourceNode.namespaceURI !==
+          "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
+    ) {
       // Use sourceNode's principal only if the sourceNode is not browser.
       //
       // If sourceNode is browser, the actual triggering principal may be
       // differ than sourceNode's principal, since sourceNode's principal is
       // top level document's one and the drag may be triggered from a frame
       // with different principal.
       if (sourceNode.nodePrincipal) {
         return sourceNode.nodePrincipal;
@@ -174,154 +187,180 @@ ContentAreaDropListener.prototype =
     if (!principalURISpec) {
       // Fallback to either system principal or file principal, supposing
       // the drop comes from outside of the browser, so that drops of file
       // URIs are always allowed.
       //
       // TODO: Investigate and describe the difference between them,
       //       or use only one principal. (Bug 1367038)
       if (fallbackToSystemPrincipal) {
-        let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
-            getService(Ci.nsIScriptSecurityManager);
+        let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
+          Ci.nsIScriptSecurityManager
+        );
         return secMan.getSystemPrincipal();
       } else {
         principalURISpec = "file:///";
       }
     }
-    let ioService = Cc["@mozilla.org/network/io-service;1"]
-        .getService(Ci.nsIIOService);
-    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
-        getService(Ci.nsIScriptSecurityManager);
-    return secMan.createContentPrincipal(ioService.newURI(principalURISpec), {});
+    let ioService = Cc["@mozilla.org/network/io-service;1"].getService(
+      Ci.nsIIOService
+    );
+    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
+      Ci.nsIScriptSecurityManager
+    );
+    return secMan.createContentPrincipal(
+      ioService.newURI(principalURISpec),
+      {}
+    );
   },
 
-  getTriggeringPrincipal: function(aEvent)
-  {
+  getTriggeringPrincipal: function(aEvent) {
     let dataTransfer = aEvent.dataTransfer;
     return this._getTriggeringPrincipalFromDataTransfer(dataTransfer, true);
-
   },
 
-  getCSP: function(aEvent)
-  {
+  getCSP: function(aEvent) {
     let sourceNode = aEvent.dataTransfer.mozSourceNode;
-    if (sourceNode &&
-        (sourceNode.localName !== "browser" ||
-         sourceNode.namespaceURI !== "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")) {
+    if (
+      sourceNode &&
+      (sourceNode.localName !== "browser" ||
+        sourceNode.namespaceURI !==
+          "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
+    ) {
       // Use sourceNode's csp only if the sourceNode is not browser.
       //
       // If sourceNode is browser, the actual triggering csp may be differ than sourceNode's csp,
       // since sourceNode's csp is top level document's one and the drag may be triggered from a
       // frame with different csp.
       return sourceNode.csp;
     }
     return null;
   },
 
-  canDropLink: function(aEvent, aAllowSameDocument)
-  {
-    if (this._eventTargetIsDisabled(aEvent))
+  canDropLink: function(aEvent, aAllowSameDocument) {
+    if (this._eventTargetIsDisabled(aEvent)) {
       return false;
+    }
 
     let dataTransfer = aEvent.dataTransfer;
     let types = dataTransfer.types;
-    if (!types.includes("application/x-moz-file") &&
-        !types.includes("text/x-moz-url") &&
-        !types.includes("text/uri-list") &&
-        !types.includes("text/x-moz-text-internal") &&
-        !types.includes("text/plain"))
+    if (
+      !types.includes("application/x-moz-file") &&
+      !types.includes("text/x-moz-url") &&
+      !types.includes("text/uri-list") &&
+      !types.includes("text/x-moz-text-internal") &&
+      !types.includes("text/plain")
+    ) {
       return false;
+    }
 
-    if (aAllowSameDocument)
+    if (aAllowSameDocument) {
       return true;
+    }
 
     let sourceNode = dataTransfer.mozSourceNode;
-    if (!sourceNode)
+    if (!sourceNode) {
       return true;
+    }
 
     // don't allow a drop of a node from the same document onto this one
     let sourceDocument = sourceNode.ownerDocument;
     let eventDocument = aEvent.originalTarget.ownerDocument;
-    if (sourceDocument == eventDocument)
+    if (sourceDocument == eventDocument) {
       return false;
+    }
 
     // also check for nodes in other child or sibling frames by checking
     // if both have the same top window.
     if (sourceDocument && eventDocument) {
-      if (sourceDocument.defaultView == null)
+      if (sourceDocument.defaultView == null) {
         return true;
+      }
       let sourceRoot = sourceDocument.defaultView.top;
-      if (sourceRoot && sourceRoot == eventDocument.defaultView.top)
+      if (sourceRoot && sourceRoot == eventDocument.defaultView.top) {
         return false;
+      }
     }
 
     return true;
   },
 
-  dropLink: function(aEvent, aName, aDisallowInherit)
-  {
+  dropLink: function(aEvent, aName, aDisallowInherit) {
     aName.value = "";
     let links = this.dropLinks(aEvent, aDisallowInherit);
     let url = "";
     if (links.length > 0) {
       url = links[0].url;
       let name = links[0].name;
-      if (name)
+      if (name) {
         aName.value = name;
+      }
     }
 
     return url;
   },
 
-  dropLinks: function(aEvent, aDisallowInherit)
-  {
-    if (aEvent && this._eventTargetIsDisabled(aEvent))
+  dropLinks: function(aEvent, aDisallowInherit) {
+    if (aEvent && this._eventTargetIsDisabled(aEvent)) {
       return [];
+    }
 
     let dataTransfer = aEvent.dataTransfer;
     let links = this._getDropLinks(dataTransfer);
-    let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(dataTransfer, false);
+    let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(
+      dataTransfer,
+      false
+    );
 
     for (let link of links) {
       try {
-        link.url = this._validateURI(dataTransfer, link.url, aDisallowInherit,
-                                     triggeringPrincipal);
+        link.url = this._validateURI(
+          dataTransfer,
+          link.url,
+          aDisallowInherit,
+          triggeringPrincipal
+        );
       } catch (ex) {
         // Prevent the drop entirely if any of the links are invalid even if
         // one of them is valid.
         aEvent.stopPropagation();
         aEvent.preventDefault();
         throw ex;
       }
     }
 
     return links;
   },
 
-  validateURIsForDrop: function(aEvent, aURIs, aDisallowInherit)
-  {
+  validateURIsForDrop: function(aEvent, aURIs, aDisallowInherit) {
     let dataTransfer = aEvent.dataTransfer;
-    let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(dataTransfer, false);
+    let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(
+      dataTransfer,
+      false
+    );
 
     for (let uri of aURIs) {
-      this._validateURI(dataTransfer, uri, aDisallowInherit,
-                        triggeringPrincipal);
+      this._validateURI(
+        dataTransfer,
+        uri,
+        aDisallowInherit,
+        triggeringPrincipal
+      );
     }
   },
 
-  queryLinks: function(aDataTransfer)
-  {
+  queryLinks: function(aDataTransfer) {
     return this._getDropLinks(aDataTransfer);
   },
 
-  _eventTargetIsDisabled: function(aEvent)
-  {
+  _eventTargetIsDisabled: function(aEvent) {
     let ownerDoc = aEvent.originalTarget.ownerDocument;
-    if (!ownerDoc || !ownerDoc.defaultView)
+    if (!ownerDoc || !ownerDoc.defaultView) {
       return false;
+    }
 
-    return ownerDoc.defaultView
-                   .windowUtils
-                   .isNodeDisabledForEvents(aEvent.originalTarget);
-  }
+    return ownerDoc.defaultView.windowUtils.isNodeDisabledForEvents(
+      aEvent.originalTarget
+    );
+  },
 };
 
 var EXPORTED_SYMBOLS = ["ContentAreaDropListener"];
--- a/dom/base/DOMRequestHelper.jsm
+++ b/dom/base/DOMRequestHelper.jsm
@@ -13,17 +13,17 @@
  * releasing the requests objects when the window goes out of scope.
  *
  * DOMRequestIPCHelper also deals with message listeners, allowing to add them
  * to the child side of frame and process message manager and removing them
  * when needed.
  */
 var EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function DOMRequestIpcHelper() {
   // _listeners keeps a list of messages for which we added a listener and the
   // kind of listener that we added (strong or weak). It's an object of this
   // form:
   //  {
   //    "message1": true,
   //    "messagen": false
@@ -36,20 +36,22 @@ function DOMRequestIpcHelper() {
   this._window = null;
 }
 
 DOMRequestIpcHelper.prototype = {
   /**
    * An object which "inherits" from DOMRequestIpcHelper and declares its own
    * queryInterface method MUST implement Ci.nsISupportsWeakReference.
    */
-  QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference,
-                                          Ci.nsIObserver]),
+  QueryInterface: ChromeUtils.generateQI([
+    Ci.nsISupportsWeakReference,
+    Ci.nsIObserver,
+  ]),
 
-   /**
+  /**
    *  'aMessages' is expected to be an array of either:
    *  - objects of this form:
    *    {
    *      name: "messageName",
    *      weakRef: false
    *    }
    *    where 'name' is the message identifier and 'weakRef' a boolean
    *    indicating if the listener should be a weak referred one or not.
@@ -65,35 +67,36 @@ DOMRequestIpcHelper.prototype = {
     if (!this._listeners) {
       this._listeners = {};
     }
 
     if (!Array.isArray(aMessages)) {
       aMessages = [aMessages];
     }
 
-    aMessages.forEach((aMsg) => {
+    aMessages.forEach(aMsg => {
       let name = aMsg.name || aMsg;
       // If the listener is already set and it is of the same type we just
       // increase the count and bail out. If it is not of the same type,
       // we throw an exception.
       if (this._listeners[name] != undefined) {
         if (!!aMsg.weakRef == this._listeners[name].weakRef) {
           this._listeners[name].count++;
           return;
         } else {
           throw Cr.NS_ERROR_FAILURE;
         }
       }
 
-      aMsg.weakRef ? Services.cpmm.addWeakMessageListener(name, this)
-                   : Services.cpmm.addMessageListener(name, this);
+      aMsg.weakRef
+        ? Services.cpmm.addWeakMessageListener(name, this)
+        : Services.cpmm.addMessageListener(name, this);
       this._listeners[name] = {
         weakRef: !!aMsg.weakRef,
-        count: 1
+        count: 1,
       };
     });
   },
 
   /**
    * 'aMessages' is expected to be a string or an array of strings containing
    * the message names of the listeners to be removed.
    */
@@ -101,26 +104,26 @@ DOMRequestIpcHelper.prototype = {
     if (!this._listeners || !aMessages) {
       return;
     }
 
     if (!Array.isArray(aMessages)) {
       aMessages = [aMessages];
     }
 
-    aMessages.forEach((aName) => {
+    aMessages.forEach(aName => {
       if (this._listeners[aName] == undefined) {
         return;
       }
 
       // Only remove the listener really when we don't have anybody that could
       // be waiting on a message.
       if (!--this._listeners[aName].count) {
-        this._listeners[aName].weakRef ?
-            Services.cpmm.removeWeakMessageListener(aName, this)
+        this._listeners[aName].weakRef
+          ? Services.cpmm.removeWeakMessageListener(aName, this)
           : Services.cpmm.removeMessageListener(aName, this);
         delete this._listeners[aName];
       }
     });
   },
 
   /**
    * Initialize the helper adding the corresponding listeners to the messages
@@ -155,33 +158,36 @@ DOMRequestIpcHelper.prototype = {
     if (this._window) {
       // We don't use this.innerWindowID, but other classes rely on it.
       let util = this._window.windowUtils;
       this.innerWindowID = util.currentInnerWindowID;
     }
 
     this._destroyed = false;
 
-    Services.obs.addObserver(this, "inner-window-destroyed",
-                             /* weak-ref */ true);
+    Services.obs.addObserver(
+      this,
+      "inner-window-destroyed",
+      /* weak-ref */ true
+    );
   },
 
   destroyDOMRequestHelper: function() {
     if (this._destroyed) {
       return;
     }
 
     this._destroyed = true;
 
     Services.obs.removeObserver(this, "inner-window-destroyed");
 
     if (this._listeners) {
-      Object.keys(this._listeners).forEach((aName) => {
-        this._listeners[aName].weakRef ?
-            Services.cpmm.removeWeakMessageListener(aName, this)
+      Object.keys(this._listeners).forEach(aName => {
+        this._listeners[aName].weakRef
+          ? Services.cpmm.removeWeakMessageListener(aName, this)
           : Services.cpmm.removeMessageListener(aName, this);
       });
     }
 
     this._listeners = null;
     this._requests = null;
 
     // Objects inheriting from DOMRequestIPCHelper may have an uninit function.
@@ -257,70 +263,81 @@ DOMRequestIpcHelper.prototype = {
   takePromiseResolver: function(aId) {
     // Delegates to getRequest() since the lookup table is agnostic about
     // storage.
     return this.takeRequest(aId);
   },
 
   _getRandomId: function() {
     return Cc["@mozilla.org/uuid-generator;1"]
-             .getService(Ci.nsIUUIDGenerator).generateUUID().toString();
+      .getService(Ci.nsIUUIDGenerator)
+      .generateUUID()
+      .toString();
   },
 
   createRequest: function() {
     // If we don't have a valid window object, throw.
     if (!this._window) {
-      Cu.reportError("DOMRequestHelper trying to create a DOMRequest without a valid window, failing.");
+      Cu.reportError(
+        "DOMRequestHelper trying to create a DOMRequest without a valid window, failing."
+      );
       throw Cr.NS_ERROR_FAILURE;
     }
     return Services.DOMRequest.createRequest(this._window);
   },
 
   /**
    * createPromise() creates a new Promise, with `aPromiseInit` as the
    * PromiseInit callback. The promise constructor is obtained from the
    * reference to window owned by this DOMRequestIPCHelper.
    */
   createPromise: function(aPromiseInit) {
     // If we don't have a valid window object, throw.
     if (!this._window) {
-      Cu.reportError("DOMRequestHelper trying to create a Promise without a valid window, failing.");
+      Cu.reportError(
+        "DOMRequestHelper trying to create a Promise without a valid window, failing."
+      );
       throw Cr.NS_ERROR_FAILURE;
     }
     return new this._window.Promise(aPromiseInit);
   },
 
   /**
    * createPromiseWithId() creates a new Promise, accepting a callback
    * which is immediately called with the generated resolverId.
    */
   createPromiseWithId: function(aCallback) {
     return this.createPromise((aResolve, aReject) => {
-      let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject });
+      let resolverId = this.getPromiseResolverId({
+        resolve: aResolve,
+        reject: aReject,
+      });
       aCallback(resolverId);
     });
   },
 
   forEachRequest: function(aCallback) {
     if (!this._requests) {
       return;
     }
 
-    Object.keys(this._requests).forEach((aKey) => {
+    Object.keys(this._requests).forEach(aKey => {
       if (this.getRequest(aKey) instanceof this._window.DOMRequest) {
         aCallback(aKey);
       }
     });
   },
 
   forEachPromiseResolver: function(aCallback) {
     if (!this._requests) {
       return;
     }
 
-    Object.keys(this._requests).forEach((aKey) => {
-      if ("resolve" in this.getPromiseResolver(aKey) &&
-          "reject" in this.getPromiseResolver(aKey)) {
+    Object.keys(this._requests).forEach(aKey => {
+      if (
+        "resolve" in this.getPromiseResolver(aKey) &&
+        "reject" in this.getPromiseResolver(aKey)
+      ) {
         aCallback(aKey);
       }
     });
   },
-}
+};
--- a/dom/base/IndexedDBHelper.jsm
+++ b/dom/base/IndexedDBHelper.jsm
@@ -2,34 +2,38 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var DEBUG = 0;
 var debug;
 if (DEBUG) {
-  debug = function (s) { dump("-*- IndexedDBHelper: " + s + "\n"); }
+  debug = function(s) {
+    dump("-*- IndexedDBHelper: " + s + "\n");
+  };
 } else {
-  debug = function (s) {}
+  debug = function(s) {};
 }
 
 var EXPORTED_SYMBOLS = ["IndexedDBHelper"];
 
 Cu.importGlobalProperties(["indexedDB"]);
 
-ChromeUtils.defineModuleGetter(this, 'Services',
-  'resource://gre/modules/Services.jsm');
+ChromeUtils.defineModuleGetter(
+  this,
+  "Services",
+  "resource://gre/modules/Services.jsm"
+);
 
 function getErrorName(err) {
-  return err && err.name || "UnknownError";
+  return (err && err.name) || "UnknownError";
 }
 
-function IndexedDBHelper() {
-}
+function IndexedDBHelper() {}
 
 IndexedDBHelper.prototype = {
   // Close the database
   close: function close() {
     if (this._db) {
       this._db.close();
       this._db = null;
     }
@@ -55,63 +59,90 @@ IndexedDBHelper.prototype = {
     let self = this;
     let invokeCallbacks = err => {
       for (let callback of self._waitForOpenCallbacks) {
         callback(err);
       }
       self._waitForOpenCallbacks.clear();
     };
 
-    if (DEBUG) debug("Try to open database:" + self.dbName + " " + self.dbVersion);
+    if (DEBUG) {
+      debug("Try to open database:" + self.dbName + " " + self.dbVersion);
+    }
     let req;
     try {
       req = indexedDB.open(this.dbName, this.dbVersion);
     } catch (e) {
-      if (DEBUG) debug("Error opening database: " + self.dbName);
+      if (DEBUG) {
+        debug("Error opening database: " + self.dbName);
+      }
       Services.tm.dispatchToMainThread(() => invokeCallbacks(getErrorName(e)));
       return;
     }
-    req.onsuccess = function (event) {
-      if (DEBUG) debug("Opened database:" + self.dbName + " " + self.dbVersion);
+    req.onsuccess = function(event) {
+      if (DEBUG) {
+        debug("Opened database:" + self.dbName + " " + self.dbVersion);
+      }
       self._db = event.target.result;
       self._db.onversionchange = function(event) {
-        if (DEBUG) debug("WARNING: DB modified from a different window.");
-      }
+        if (DEBUG) {
+          debug("WARNING: DB modified from a different window.");
+        }
+      };
       invokeCallbacks();
     };
 
-    req.onupgradeneeded = function (aEvent) {
+    req.onupgradeneeded = function(aEvent) {
       if (DEBUG) {
-        debug("Database needs upgrade:" + self.dbName + aEvent.oldVersion + aEvent.newVersion);
-        debug("Correct new database version:" + (aEvent.newVersion == this.dbVersion));
+        debug(
+          "Database needs upgrade:" +
+            self.dbName +
+            aEvent.oldVersion +
+            aEvent.newVersion
+        );
+        debug(
+          "Correct new database version:" +
+            (aEvent.newVersion == this.dbVersion)
+        );
       }
 
       let _db = aEvent.target.result;
-      self.upgradeSchema(req.transaction, _db, aEvent.oldVersion, aEvent.newVersion);
+      self.upgradeSchema(
+        req.transaction,
+        _db,
+        aEvent.oldVersion,
+        aEvent.newVersion
+      );
     };
-    req.onerror = function (aEvent) {
-      if (DEBUG) debug("Failed to open database: " + self.dbName);
+    req.onerror = function(aEvent) {
+      if (DEBUG) {
+        debug("Failed to open database: " + self.dbName);
+      }
       invokeCallbacks(getErrorName(aEvent.target.error));
     };
-    req.onblocked = function (aEvent) {
-      if (DEBUG) debug("Opening database request is blocked.");
+    req.onblocked = function(aEvent) {
+      if (DEBUG) {
+        debug("Opening database request is blocked.");
+      }
     };
   },
 
   /**
    * Use the cached DB or open a new one.
    *
    * @param successCb
    *        Success callback to call.
    * @param failureCb
    *        Error callback to call when an error is encountered.
    */
   ensureDB: function ensureDB(aSuccessCb, aFailureCb) {
     if (this._db) {
-      if (DEBUG) debug("ensureDB: already have a database, returning early.");
+      if (DEBUG) {
+        debug("ensureDB: already have a database, returning early.");
+      }
       if (aSuccessCb) {
         Services.tm.dispatchToMainThread(aSuccessCb);
       }
       return;
     }
     this.open(aError => {
       if (aError) {
         aFailureCb && aFailureCb(aError);
@@ -132,40 +163,57 @@ IndexedDBHelper.prototype = {
    *        Function to call when the transaction is available. It will
    *        be invoked with the transaction and the `store' object store.
    * @param successCb
    *        Success callback to call on a successful transaction commit.
    *        The result is stored in txn.result (in the callback function).
    * @param failureCb
    *        Error callback to call when an error is encountered.
    */
-  newTxn: function newTxn(txn_type, store_name, callback, successCb, failureCb) {
+  newTxn: function newTxn(
+    txn_type,
+    store_name,
+    callback,
+    successCb,
+    failureCb
+  ) {
     this.ensureDB(() => {
-      if (DEBUG) debug("Starting new transaction" + txn_type);
+      if (DEBUG) {
+        debug("Starting new transaction" + txn_type);
+      }
       let txn;
       try {
-        txn = this._db.transaction(Array.isArray(store_name) ? store_name : this.dbStoreNames, txn_type);
+        txn = this._db.transaction(
+          Array.isArray(store_name) ? store_name : this.dbStoreNames,
+          txn_type
+        );
       } catch (e) {
-        if (DEBUG) debug("Error starting transaction: " + this.dbName);
+        if (DEBUG) {
+          debug("Error starting transaction: " + this.dbName);
+        }
         failureCb(getErrorName(e));
         return;
       }
-      if (DEBUG) debug("Retrieving object store: " + this.dbName);
+      if (DEBUG) {
+        debug("Retrieving object store: " + this.dbName);
+      }
       let stores;
       if (Array.isArray(store_name)) {
         stores = [];
         for (let i = 0; i < store_name.length; ++i) {
           stores.push(txn.objectStore(store_name[i]));
         }
       } else {
         stores = txn.objectStore(store_name);
       }
 
-      txn.oncomplete = function () {
-        if (DEBUG) debug("Transaction complete. Returning to callback.");
+      txn.oncomplete = function() {
+        if (DEBUG) {
+          debug("Transaction complete. Returning to callback.");
+        }
         /*
          * txn.result property is not part of the transaction object returned
          * by this._db.transaction method called above.
          * The property is expected to be set in the callback function.
          * However, it can happen that the property is not set for some reason,
          * so we have to check if the property exists before calling the
          * success callback.
          */
@@ -173,18 +221,20 @@ IndexedDBHelper.prototype = {
           if ("result" in txn) {
             successCb(txn.result);
           } else {
             successCb();
           }
         }
       };
 
-      txn.onabort = function () {
-        if (DEBUG) debug("Caught error on transaction");
+      txn.onabort = function() {
+        if (DEBUG) {
+          debug("Caught error on transaction");
+        }
         /*
          * txn.error property is part of the transaction object returned by
          * this._db.transaction method called above.
          * The attribute is defined in IDBTranscation WebIDL interface.
          * It may be null.
          */
         if (failureCb) {
           failureCb(getErrorName(txn.error));
@@ -206,10 +256,10 @@ IndexedDBHelper.prototype = {
    */
   initDBHelper: function initDBHelper(aDBName, aDBVersion, aDBStoreNames) {
     this.dbName = aDBName;
     this.dbVersion = aDBVersion;
     this.dbStoreNames = aDBStoreNames;
     // Cache the database.
     this._db = null;
     this._waitForOpenCallbacks = new Set();
-  }
-}
+  },
+};
--- a/dom/base/ProcessSelector.jsm
+++ b/dom/base/ProcessSelector.jsm
@@ -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/. */
 
 // Fills up aProcesses until max and then selects randomly from the available
 // ones.
-function RandomSelector() {
-}
+function RandomSelector() {}
 
 RandomSelector.prototype = {
-  classID:          Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
-  QueryInterface:   ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
+  classID: Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
 
   provideProcess(aType, aOpener, aProcesses, aMaxCount) {
     if (aProcesses.length < aMaxCount) {
       return Ci.nsIContentProcessProvider.NEW_PROCESS;
     }
 
     let startIdx = Math.floor(Math.random() * aMaxCount);
     let curIdx = startIdx;
@@ -28,22 +27,21 @@ RandomSelector.prototype = {
     } while (curIdx !== startIdx);
 
     return Ci.nsIContentProcessProvider.NEW_PROCESS;
   },
 };
 
 // Fills up aProcesses until max and then selects one from the available
 // ones that host the least number of tabs.
-function MinTabSelector() {
-}
+function MinTabSelector() {}
 
 MinTabSelector.prototype = {
-  classID:          Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"),
-  QueryInterface:   ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
+  classID: Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"),
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
 
   provideProcess(aType, aOpener, aProcesses, aMaxCount) {
     if (aProcesses.length < aMaxCount) {
       return Ci.nsIContentProcessProvider.NEW_PROCESS;
     }
 
     let min = Number.MAX_VALUE;
     let candidate = Ci.nsIContentProcessProvider.NEW_PROCESS;
@@ -61,9 +59,9 @@ MinTabSelector.prototype = {
         candidate = i;
       }
     }
 
     return candidate;
   },
 };
 
-var EXPORTED_SYMBOLS = ["RandomSelector", "MinTabSelector"]
+var EXPORTED_SYMBOLS = ["RandomSelector", "MinTabSelector"];
--- a/dom/base/SlowScriptDebug.jsm
+++ b/dom/base/SlowScriptDebug.jsm
@@ -1,20 +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";
 
-function SlowScriptDebug() { }
+function SlowScriptDebug() {}
 
 SlowScriptDebug.prototype = {
   classDescription: "Slow script debug handler",
   QueryInterface: ChromeUtils.generateQI([Ci.nsISlowScriptDebug]),
 
-  get activationHandler()   { return this._activationHandler; },
-  set activationHandler(cb) { return this._activationHandler = cb; },
+  get activationHandler() {
+    return this._activationHandler;
+  },
+  set activationHandler(cb) {
+    return (this._activationHandler = cb);
+  },
 
-  get remoteActivationHandler()   { return this._remoteActivationHandler; },
-  set remoteActivationHandler(cb) { return this._remoteActivationHandler = cb; },
+  get remoteActivationHandler() {
+    return this._remoteActivationHandler;
+  },
+  set remoteActivationHandler(cb) {
+    return (this._remoteActivationHandler = cb);
+  },
 };
 
 var EXPORTED_SYMBOLS = ["SlowScriptDebug"];