Bug 1259743 - Part 2: Make devtools/server/actors/webbrowser.js eslint-clean. r=ochameau
authorJarda Snajdr <jsnajdr@gmail.com>
Thu, 28 Apr 2016 03:54:00 -0400
changeset 334279 f0222c4acdfa113eb559e344c457e8c6dc79882a
parent 334278 bb1df86bbb354397a6dc861bbb412e346185692e
child 334280 2a1bb1bceccb5eb2be04bc2bf30a3f70bb9e8674
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1259743
milestone49.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 1259743 - Part 2: Make devtools/server/actors/webbrowser.js eslint-clean. r=ochameau
.eslintignore
devtools/server/actors/webbrowser.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -103,16 +103,17 @@ devtools/client/shadereditor/**
 devtools/client/shared/**
 devtools/client/sourceeditor/**
 devtools/client/webaudioeditor/**
 devtools/client/webconsole/**
 !devtools/client/webconsole/panel.js
 !devtools/client/webconsole/jsterm.js
 devtools/client/webide/**
 devtools/server/**
+!devtools/server/actors/webbrowser.js
 devtools/shared/*.js
 !devtools/shared/css-color.js
 devtools/shared/*.jsm
 devtools/shared/apps/**
 devtools/shared/client/**
 devtools/shared/discovery/**
 devtools/shared/gcli/**
 devtools/shared/heapsnapshot/**
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -42,71 +42,74 @@ function getWindowID(window) {
                .getInterface(Ci.nsIDOMWindowUtils)
                .currentInnerWindowID;
 }
 
 function getDocShellChromeEventHandler(docShell) {
   let handler = docShell.chromeEventHandler;
   if (!handler) {
     try {
-      // toplevel xul window's docshell doesn't have chromeEventHandler attribute
-      // the chrome event handler is just the global window object
+      // Toplevel xul window's docshell doesn't have chromeEventHandler
+      // attribute. The chrome event handler is just the global window object.
       handler = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                         .getInterface(Ci.nsIDOMWindow);
-    } catch(e) {}
+    } catch (e) {
+      // ignore
+    }
   }
   return handler;
 }
-function getChildDocShells(docShell) {
-  let docShellsEnum = docShell.getDocShellEnumerator(
+
+function getChildDocShells(parentDocShell) {
+  let docShellsEnum = parentDocShell.getDocShellEnumerator(
     Ci.nsIDocShellTreeItem.typeAll,
     Ci.nsIDocShell.ENUMERATE_FORWARDS
   );
 
   let docShells = [];
   while (docShellsEnum.hasMoreElements()) {
     let docShell = docShellsEnum.getNext();
     docShell.QueryInterface(Ci.nsIInterfaceRequestor)
             .getInterface(Ci.nsIWebProgress);
     docShells.push(docShell);
   }
   return docShells;
 }
+
 exports.getChildDocShells = getChildDocShells;
 
 /**
  * Browser-specific actors.
  */
 
 function getInnerId(window) {
-  return window.QueryInterface(Ci.nsIInterfaceRequestor).
-                getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
-};
+  return window.QueryInterface(Ci.nsIInterfaceRequestor)
+               .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
+}
 
 /**
- * Yield all windows of type |aWindowType|, from the oldest window to the
+ * Yield all windows of type |windowType|, from the oldest window to the
  * youngest, using nsIWindowMediator::getEnumerator. We're usually
  * interested in "navigator:browser" windows.
  */
-function* allAppShellDOMWindows(aWindowType)
-{
-  let e = Services.wm.getEnumerator(aWindowType);
+function* allAppShellDOMWindows(windowType) {
+  let e = Services.wm.getEnumerator(windowType);
   while (e.hasMoreElements()) {
     yield e.getNext();
   }
 }
 
 exports.allAppShellDOMWindows = allAppShellDOMWindows;
 
 /**
- * Retrieve the window type of the top-level window |aWindow|.
+ * Retrieve the window type of the top-level window |window|.
  */
-function appShellDOMWindowType(aWindow) {
+function appShellDOMWindowType(window) {
   /* This is what nsIWindowMediator's enumerator checks. */
-  return aWindow.document.documentElement.getAttribute('windowtype');
+  return window.document.documentElement.getAttribute("windowtype");
 }
 
 /**
  * Send Debugger:Shutdown events to all "navigator:browser" windows.
  */
 function sendShutdownEvent() {
   for (let win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
     let evt = win.document.createEvent("Event");
@@ -120,45 +123,43 @@ exports.sendShutdownEvent = sendShutdown
 /**
  * Construct a root actor appropriate for use in a server running in a
  * browser. The returned root actor:
  * - respects the factories registered with DebuggerServer.addGlobalActor,
  * - uses a BrowserTabList to supply tab actors,
  * - sends all navigator:browser window documents a Debugger:Shutdown event
  *   when it exits.
  *
- * * @param aConnection DebuggerServerConnection
- *        The conection to the client.
+ * * @param connection DebuggerServerConnection
+ *          The conection to the client.
  */
-function createRootActor(aConnection)
-{
-  return new RootActor(aConnection,
-                       {
-                         tabList: new BrowserTabList(aConnection),
-                         addonList: new BrowserAddonList(aConnection),
-                         workerList: new WorkerActorList(aConnection, {}),
-                         serviceWorkerRegistrationList:
-                           new ServiceWorkerRegistrationActorList(aConnection),
-                         processList: new ProcessActorList(),
-                         globalActorFactories: DebuggerServer.globalActorFactories,
-                         onShutdown: sendShutdownEvent
-                       });
+function createRootActor(connection) {
+  return new RootActor(connection, {
+    tabList: new BrowserTabList(connection),
+    addonList: new BrowserAddonList(connection),
+    workerList: new WorkerActorList(connection, {}),
+    serviceWorkerRegistrationList:
+      new ServiceWorkerRegistrationActorList(connection),
+    processList: new ProcessActorList(),
+    globalActorFactories: DebuggerServer.globalActorFactories,
+    onShutdown: sendShutdownEvent
+  });
 }
 
 /**
  * A live list of BrowserTabActors representing the current browser tabs,
  * to be provided to the root actor to answer 'listTabs' requests.
  *
  * This object also takes care of listening for TabClose events and
  * onCloseWindow notifications, and exiting the BrowserTabActors concerned.
  *
  * (See the documentation for RootActor for the definition of the "live
  * list" interface.)
  *
- * @param aConnection DebuggerServerConnection
+ * @param connection DebuggerServerConnection
  *     The connection in which this list's tab actors may participate.
  *
  * Some notes:
  *
  * This constructor is specific to the desktop browser environment; it
  * maintains the tab list by tracking XUL windows and their XUL documents'
  * "tabbrowser", "tab", and "browser" elements. What's entailed in maintaining
  * an accurate list of open tabs in this context?
@@ -208,19 +209,18 @@ function createRootActor(aConnection)
  *
  * However, while we could thus assume that each tab stays with the XUL window
  * it belonged to when it was created, I'm not sure this is behavior one should
  * rely upon. When a XUL window is closed, we take the less efficient, more
  * conservative approach of simply searching the entire table for actors that
  * belong to the closing XUL window, rather than trying to somehow track which
  * XUL window each tab belongs to.
  */
-function BrowserTabList(aConnection)
-{
-  this._connection = aConnection;
+function BrowserTabList(connection) {
+  this._connection = connection;
 
   /*
    * The XUL document of a tabbed browser window has "tab" elements, whose
    * 'linkedBrowser' JavaScript properties are "browser" elements; those
    * browsers' 'contentWindow' properties are wrappers on the tabs' content
    * window objects.
    *
    * This map's keys are "browser" XUL elements; it maps each browser element
@@ -255,59 +255,59 @@ function BrowserTabList(aConnection)
   this._mustNotify = false;
 
   /* True if we're testing, and should throw if consistency checks fail. */
   this._testing = false;
 }
 
 BrowserTabList.prototype.constructor = BrowserTabList;
 
-
 /**
  * Get the selected browser for the given navigator:browser window.
  * @private
- * @param aWindow nsIChromeWindow
+ * @param window nsIChromeWindow
  *        The navigator:browser window for which you want the selected browser.
  * @return nsIDOMElement|null
  *         The currently selected xul:browser element, if any. Note that the
  *         browser window might not be loaded yet - the function will return
  *         |null| in such cases.
  */
-BrowserTabList.prototype._getSelectedBrowser = function(aWindow) {
-  return aWindow.gBrowser ? aWindow.gBrowser.selectedBrowser : null;
+BrowserTabList.prototype._getSelectedBrowser = function (window) {
+  return window.gBrowser ? window.gBrowser.selectedBrowser : null;
 };
 
 /**
  * Produces an iterable (in this case a generator) to enumerate all available
  * browser tabs.
  */
-BrowserTabList.prototype._getBrowsers = function*() {
+BrowserTabList.prototype._getBrowsers = function* () {
   // Iterate over all navigator:browser XUL windows.
   for (let win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
     // For each tab in this XUL window, ensure that we have an actor for
     // it, reusing existing actors where possible. We actually iterate
     // over 'browser' XUL elements, and BrowserTabActor uses
     // browser.contentWindow as the debuggee global.
     for (let browser of this._getChildren(win)) {
       yield browser;
     }
   }
 };
 
-BrowserTabList.prototype._getChildren = function(aWindow) {
-  let children = aWindow.gBrowser ? aWindow.gBrowser.browsers : [];
+BrowserTabList.prototype._getChildren = function (window) {
+  let children = window.gBrowser ? window.gBrowser.browsers : [];
   return children ? children : [];
 };
 
-BrowserTabList.prototype._isRemoteBrowser = function(browser) {
+BrowserTabList.prototype._isRemoteBrowser = function (browser) {
   return browser.getAttribute("remote") == "true";
 };
 
-BrowserTabList.prototype.getList = function() {
-  let topXULWindow = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
+BrowserTabList.prototype.getList = function () {
+  let topXULWindow = Services.wm.getMostRecentWindow(
+    DebuggerServer.chromeWindowType);
   let selectedBrowser = null;
   if (topXULWindow) {
     selectedBrowser = this._getSelectedBrowser(topXULWindow);
   }
 
   // As a sanity check, make sure all the actors presently in our map get
   // picked up when we iterate over all windows' tabs.
   let initialMapSize = this._actorByBrowser.size;
@@ -327,133 +327,140 @@ BrowserTabList.prototype.getList = funct
           .then(actor => {
             // Set the 'selected' properties on all actors correctly.
             actor.selected = selected;
             return actor;
           })
     );
   }
 
-  if (this._testing && initialMapSize !== this._foundCount)
-    throw Error("_actorByBrowser map contained actors for dead tabs");
+  if (this._testing && initialMapSize !== this._foundCount) {
+    throw new Error("_actorByBrowser map contained actors for dead tabs");
+  }
 
   this._mustNotify = true;
   this._checkListening();
 
   return promise.all(actorPromises);
 };
 
-BrowserTabList.prototype._getActorForBrowser = function(browser) {
+BrowserTabList.prototype._getActorForBrowser = function (browser) {
   // Do we have an existing actor for this browser? If not, create one.
   let actor = this._actorByBrowser.get(browser);
   if (actor) {
     this._foundCount++;
     return actor.update();
   } else if (this._isRemoteBrowser(browser)) {
     actor = new RemoteBrowserTabActor(this._connection, browser);
     this._actorByBrowser.set(browser, actor);
     this._checkListening();
     return actor.connect();
-  } else {
-    actor = new BrowserTabActor(this._connection, browser);
-    this._actorByBrowser.set(browser, actor);
-    this._checkListening();
-    return promise.resolve(actor);
   }
+
+  actor = new BrowserTabActor(this._connection, browser);
+  this._actorByBrowser.set(browser, actor);
+  this._checkListening();
+  return promise.resolve(actor);
 };
 
-BrowserTabList.prototype.getTab = function({ outerWindowID, tabId }) {
-  if (typeof(outerWindowID) == "number") {
+BrowserTabList.prototype.getTab = function ({ outerWindowID, tabId }) {
+  if (typeof outerWindowID == "number") {
     for (let browser of this._getBrowsers()) {
       if (browser.outerWindowID == outerWindowID) {
         return this._getActorForBrowser(browser);
       }
     }
     return promise.reject({
       error: "noTab",
       message: "Unable to find tab with outerWindowID '" + outerWindowID + "'"
     });
-  } else if (typeof(tabId) == "number") {
+  } else if (typeof tabId == "number") {
     // Tabs OOP
     for (let browser of this._getBrowsers()) {
       if (browser.frameLoader.tabParent &&
           browser.frameLoader.tabParent.tabId === tabId) {
         return this._getActorForBrowser(browser);
       }
     }
     return promise.reject({
       error: "noTab",
       message: "Unable to find tab with tabId '" + tabId + "'"
     });
   }
 
-  let topXULWindow = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
+  let topXULWindow = Services.wm.getMostRecentWindow(
+    DebuggerServer.chromeWindowType);
   if (topXULWindow) {
     let selectedBrowser = this._getSelectedBrowser(topXULWindow);
     return this._getActorForBrowser(selectedBrowser);
   }
   return promise.reject({
     error: "noTab",
     message: "Unable to find any selected browser"
   });
 };
 
-Object.defineProperty(BrowserTabList.prototype, 'onListChanged', {
-  enumerable: true, configurable:true,
-  get: function() { return this._onListChanged; },
-  set: function(v) {
-    if (v !== null && typeof v !== 'function') {
-      throw Error("onListChanged property may only be set to 'null' or a function");
+Object.defineProperty(BrowserTabList.prototype, "onListChanged", {
+  enumerable: true,
+  configurable: true,
+  get() {
+    return this._onListChanged;
+  },
+  set(v) {
+    if (v !== null && typeof v !== "function") {
+      throw new Error(
+        "onListChanged property may only be set to 'null' or a function");
     }
     this._onListChanged = v;
     this._checkListening();
   }
 });
 
 /**
  * The set of tabs has changed somehow. Call our onListChanged handler, if
  * one is set, and if we haven't already called it since the last iteration.
  */
-BrowserTabList.prototype._notifyListChanged = function() {
-  if (!this._onListChanged)
+BrowserTabList.prototype._notifyListChanged = function () {
+  if (!this._onListChanged) {
     return;
+  }
   if (this._mustNotify) {
     this._onListChanged();
     this._mustNotify = false;
   }
 };
 
 /**
- * Exit |aActor|, belonging to |aBrowser|, and notify the onListChanged
+ * Exit |actor|, belonging to |browser|, and notify the onListChanged
  * handle if needed.
  */
-BrowserTabList.prototype._handleActorClose = function(aActor, aBrowser) {
+BrowserTabList.prototype._handleActorClose = function (actor, browser) {
   if (this._testing) {
-    if (this._actorByBrowser.get(aBrowser) !== aActor) {
-      throw Error("BrowserTabActor not stored in map under given browser");
+    if (this._actorByBrowser.get(browser) !== actor) {
+      throw new Error("BrowserTabActor not stored in map under given browser");
     }
-    if (aActor.browser !== aBrowser) {
-      throw Error("actor's browser and map key don't match");
+    if (actor.browser !== browser) {
+      throw new Error("actor's browser and map key don't match");
     }
   }
 
-  this._actorByBrowser.delete(aBrowser);
-  aActor.exit();
+  this._actorByBrowser.delete(browser);
+  actor.exit();
 
   this._notifyListChanged();
   this._checkListening();
 };
 
 /**
  * Make sure we are listening or not listening for activity elsewhere in
  * the browser, as appropriate. Other than setting up newly created XUL
  * windows, all listener / observer connection and disconnection should
  * happen here.
  */
-BrowserTabList.prototype._checkListening = function() {
+BrowserTabList.prototype._checkListening = function () {
   /*
    * If we have an onListChanged handler that we haven't sent an announcement
    * to since the last iteration, we need to watch for tab creation.
    *
    * Oddly, we don't need to watch for 'close' events here. If our actor list
    * is empty, then either it was empty the last time we iterated, and no
    * close events are possible, or it was not empty the last time we
    * iterated, but all the actors have since been closed, and we must have
@@ -473,121 +480,128 @@ BrowserTabList.prototype._checkListening
    */
   this._listenToMediatorIf((this._onListChanged && this._mustNotify) ||
                            (this._actorByBrowser.size > 0));
 };
 
 /*
  * Add or remove event listeners for all XUL windows.
  *
- * @param aShouldListen boolean
+ * @param shouldListen boolean
  *    True if we should add event handlers; false if we should remove them.
- * @param aGuard string
+ * @param guard string
  *    The name of a guard property of 'this', indicating whether we're
  *    already listening for those events.
- * @param aEventNames array of strings
+ * @param eventNames array of strings
  *    An array of event names.
  */
-BrowserTabList.prototype._listenForEventsIf = function(aShouldListen, aGuard, aEventNames) {
-  if (!aShouldListen !== !this[aGuard]) {
-    let op = aShouldListen ? "addEventListener" : "removeEventListener";
-    for (let win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
-      for (let name of aEventNames) {
-        win[op](name, this, false);
+BrowserTabList.prototype._listenForEventsIf =
+  function (shouldListen, guard, eventNames) {
+    if (!shouldListen !== !this[guard]) {
+      let op = shouldListen ? "addEventListener" : "removeEventListener";
+      for (let win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
+        for (let name of eventNames) {
+          win[op](name, this, false);
+        }
       }
+      this[guard] = shouldListen;
     }
-    this[aGuard] = aShouldListen;
-  }
-};
+  };
 
 /**
  * Implement nsIDOMEventListener.
  */
-BrowserTabList.prototype.handleEvent = DevToolsUtils.makeInfallible(function(aEvent) {
-  switch (aEvent.type) {
-  case "TabOpen":
-  case "TabSelect":
-    /* Don't create a new actor; iterate will take care of that. Just notify. */
-    this._notifyListChanged();
-    this._checkListening();
-    break;
-  case "TabClose":
-    let browser = aEvent.target.linkedBrowser;
-    let actor = this._actorByBrowser.get(browser);
-    if (actor) {
-      this._handleActorClose(actor, browser);
-    }
-    break;
+BrowserTabList.prototype.handleEvent =
+DevToolsUtils.makeInfallible(function (event) {
+  switch (event.type) {
+    case "TabOpen":
+    case "TabSelect":
+      // Don't create a new actor; iterate will take care of that.
+      // Just notify.
+      this._notifyListChanged();
+      this._checkListening();
+      break;
+    case "TabClose":
+      let browser = event.target.linkedBrowser;
+      let actor = this._actorByBrowser.get(browser);
+      if (actor) {
+        this._handleActorClose(actor, browser);
+      }
+      break;
   }
 }, "BrowserTabList.prototype.handleEvent");
 
 /*
- * If |aShouldListen| is true, ensure we've registered a listener with the
+ * If |shouldListen| is true, ensure we've registered a listener with the
  * window mediator. Otherwise, ensure we haven't registered a listener.
  */
-BrowserTabList.prototype._listenToMediatorIf = function(aShouldListen) {
-  if (!aShouldListen !== !this._listeningToMediator) {
-    let op = aShouldListen ? "addListener" : "removeListener";
+BrowserTabList.prototype._listenToMediatorIf = function (shouldListen) {
+  if (!shouldListen !== !this._listeningToMediator) {
+    let op = shouldListen ? "addListener" : "removeListener";
     Services.wm[op](this);
-    this._listeningToMediator = aShouldListen;
+    this._listeningToMediator = shouldListen;
   }
 };
 
 /**
  * nsIWindowMediatorListener implementation.
  *
  * See _onTabClosed for explanation of why we needn't actually tweak any
  * actors or tables here.
  *
  * An nsIWindowMediatorListener's methods get passed all sorts of windows; we
  * only care about the tab containers. Those have 'getBrowser' methods.
  */
 BrowserTabList.prototype.onWindowTitleChange = () => { };
 
-BrowserTabList.prototype.onOpenWindow = DevToolsUtils.makeInfallible(function(aWindow) {
+BrowserTabList.prototype.onOpenWindow =
+DevToolsUtils.makeInfallible(function (window) {
   let handleLoad = DevToolsUtils.makeInfallible(() => {
     /* We don't want any further load events from this window. */
-    aWindow.removeEventListener("load", handleLoad, false);
+    window.removeEventListener("load", handleLoad, false);
 
-    if (appShellDOMWindowType(aWindow) !== DebuggerServer.chromeWindowType)
+    if (appShellDOMWindowType(window) !== DebuggerServer.chromeWindowType) {
       return;
+    }
 
     // Listen for future tab activity.
     if (this._listeningForTabOpen) {
-      aWindow.addEventListener("TabOpen", this, false);
-      aWindow.addEventListener("TabSelect", this, false);
+      window.addEventListener("TabOpen", this, false);
+      window.addEventListener("TabSelect", this, false);
     }
     if (this._listeningForTabClose) {
-      aWindow.addEventListener("TabClose", this, false);
+      window.addEventListener("TabClose", this, false);
     }
 
     // As explained above, we will not receive a TabOpen event for this
     // document's initial tab, so we must notify our client of the new tab
     // this will have.
     this._notifyListChanged();
   });
 
   /*
    * You can hardly do anything at all with a XUL window at this point; it
    * doesn't even have its document yet. Wait until its document has
    * loaded, and then see what we've got. This also avoids
    * nsIWindowMediator enumeration from within listeners (bug 873589).
    */
-  aWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                   .getInterface(Ci.nsIDOMWindow);
+  window = window.QueryInterface(Ci.nsIInterfaceRequestor)
+                 .getInterface(Ci.nsIDOMWindow);
 
-  aWindow.addEventListener("load", handleLoad, false);
+  window.addEventListener("load", handleLoad, false);
 }, "BrowserTabList.prototype.onOpenWindow");
 
-BrowserTabList.prototype.onCloseWindow = DevToolsUtils.makeInfallible(function(aWindow) {
-  aWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+BrowserTabList.prototype.onCloseWindow =
+DevToolsUtils.makeInfallible(function (window) {
+  window = window.QueryInterface(Ci.nsIInterfaceRequestor)
                    .getInterface(Ci.nsIDOMWindow);
 
-  if (appShellDOMWindowType(aWindow) !== DebuggerServer.chromeWindowType)
+  if (appShellDOMWindowType(window) !== DebuggerServer.chromeWindowType) {
     return;
+  }
 
   /*
    * nsIWindowMediator deadlocks if you call its GetEnumerator method from
    * a nsIWindowMediatorListener's onCloseWindow hook (bug 873589), so
    * handle the close in a different tick.
    */
   Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
     /*
@@ -628,47 +642,48 @@ exports.BrowserTabList = BrowserTabList;
  *
  * ### RDP events:
  *
  *  - `tabNavigated`:
  *    Sent when the tab is about to navigate or has just navigated to
  *    a different document.
  *    This event contains the following attributes:
  *     * url (string) The new URI being loaded.
- *     * nativeConsoleAPI (boolean) `false` if the console API of the page has been
- *                                          overridden (e.g. by Firebug),
+ *     * nativeConsoleAPI (boolean) `false` if the console API of the page has
+ *                                          been overridden (e.g. by Firebug),
  *                                  `true`  if the Gecko implementation is used.
  *     * state (string) `start` if we just start requesting the new URL,
  *                      `stop`  if the new URL is done loading.
  *     * isFrameSwitching (boolean) Indicates the event is dispatched when
  *                                  switching the TabActor context to
  *                                  a different frame. When we switch to
  *                                  an iframe, there is no document load.
  *                                  The targeted document is most likely
  *                                  going to be already done loading.
  *     * title (string) The document title being loaded.
  *                      (sent only on state=stop)
  *
  *  - `frameUpdate`:
  *    Sent when there was a change in the child frames contained in the document
  *    or when the tab's context was switched to another frame.
- *    This event can have four different forms depending on the type of incident:
+ *    This event can have four different forms depending on the type of change:
  *    * One or many frames are updated:
  *      { frames: [{ id, url, title, parentID }, ...] }
  *    * One frame got destroyed:
  *      { frames: [{ id, destroy: true }]}
  *    * All frames got destroyed:
  *      { destroyAll: true }
  *    * We switched the context of the TabActor to a specific frame:
  *      { selected: #id }
  *
  * ### Internal, non-rdp events:
  * Various events are also dispatched on the TabActor itself that are not
  * related to RDP, so, not sent to the client. They all relate to the documents
- * tracked by the TabActor (its main targeted document, but also any of its iframes).
+ * tracked by the TabActor (its main targeted document, but also any of its
+ * iframes).
  *  - will-navigate
  *    This event fires once navigation starts.
  *    All pending user prompts are dealt with,
  *    but it is fired before the first request starts.
  *  - navigate
  *    This event is fired once the document's readyState is "complete".
  *  - window-ready
  *    This event is fired on three distinct scenarios:
@@ -690,49 +705,54 @@ exports.BrowserTabList = BrowserTabList;
  *       The equivalent of `pagehide`.
  *  - changed-toplevel-document
  *    This event fires when we switch the TabActor targeted document
  *    to one of its iframes, or back to its original top document.
  *    It is dispatched between window-destroyed and window-ready.
  *
  * Note that *all* these events are dispatched in the following order
  * when we switch the context of the TabActor to a given iframe:
- *   will-navigate, window-destroyed, changed-toplevel-document, window-ready, navigate
+ *  - will-navigate
+ *  - window-destroyed
+ *  - changed-toplevel-document
+ *  - window-ready
+ *  - navigate
  *
  * This class is subclassed by BrowserTabActor and
  * ContentActor. Subclasses are expected to implement a getter
  * for the docShell property.
  *
- * @param aConnection DebuggerServerConnection
+ * @param connection DebuggerServerConnection
  *        The conection to the client.
  */
-function TabActor(aConnection)
-{
-  this.conn = aConnection;
+function TabActor(connection) {
+  this.conn = connection;
   this._tabActorPool = null;
   // A map of actor names to actor instances provided by extensions.
   this._extraActors = {};
   this._exited = false;
   this._sources = null;
 
   // Map of DOM stylesheets to StyleSheetActors
   this._styleSheetActors = new Map();
 
-  this._shouldAddNewGlobalAsDebuggee = this._shouldAddNewGlobalAsDebuggee.bind(this);
+  this._shouldAddNewGlobalAsDebuggee =
+    this._shouldAddNewGlobalAsDebuggee.bind(this);
 
   this.makeDebugger = makeDebugger.bind(null, {
     findDebuggees: () => {
       return this.windows.concat(this.webextensionsContentScriptGlobals);
     },
     shouldAddNewGlobalAsDebuggee: this._shouldAddNewGlobalAsDebuggee
   });
 
   // Flag eventually overloaded by sub classes in order to watch new docshells
   // Used on b2g to catch activity frames and in chrome to list all frames
-  this.listenForNewDocShells = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
+  this.listenForNewDocShells =
+    Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
 
   this.traits = {
     reconfigure: true,
     // Supports frame listing via `listFrames` request and `frameUpdate` events
     // as well as frame switching via `switchToFrame` request
     frames: true,
     // Do not require to send reconfigure request to reset the document state
     // to what it was before using the TabActor
@@ -745,24 +765,33 @@ function TabActor(aConnection)
 }
 
 // XXX (bug 710213): TabActor attach/detach/exit/disconnect is a
 // *complete* mess, needs to be rethought asap.
 
 TabActor.prototype = {
   traits: null,
 
-  get exited() { return this._exited; },
-  get attached() { return !!this._attached; },
+  get exited() {
+    return this._exited;
+  },
+
+  get attached() {
+    return !!this._attached;
+  },
 
   _tabPool: null,
-  get tabActorPool() { return this._tabPool; },
+  get tabActorPool() {
+    return this._tabPool;
+  },
 
   _contextPool: null,
-  get contextActorPool() { return this._contextPool; },
+  get contextActorPool() {
+    return this._contextPool;
+  },
 
   _pendingNavigation: null,
 
   // A constant prefix that will be used to form the actor ID by the server.
   actorPrefix: "tab",
 
   /**
    * An object on which listen for DOMWindowCreated and pageshow events.
@@ -779,17 +808,18 @@ TabActor.prototype = {
       .QueryInterface(Ci.nsIInterfaceRequestor)
       .getInterface(Ci.nsIContentFrameMessageManager);
   },
 
   /**
    * Getter for the tab's doc shell.
    */
   get docShell() {
-    throw "The docShell getter should be implemented by a subclass of TabActor";
+    throw new Error(
+      "The docShell getter should be implemented by a subclass of TabActor");
   },
 
   /**
    * Getter for the list of all docshell in this tabActor
    * @return {Array}
    */
   get docShells() {
     return getChildDocShells(this.docShell);
@@ -915,21 +945,21 @@ TabActor.prototype = {
     return this._sources;
   },
 
   /**
    * This is called by BrowserTabList.getList for existing tab actors prior to
    * calling |form| below.  It can be used to do any async work that may be
    * needed to assemble the form.
    */
-  update: function() {
+  update() {
     return promise.resolve(this);
   },
 
-  form: function BTA_form() {
+  form() {
     assert(!this.exited,
                "form() shouldn't be called on exited browser actor.");
     assert(this.actorID,
                "tab should have an actorID.");
 
     let response = {
       actor: this.actorID
     };
@@ -960,24 +990,24 @@ TabActor.prototype = {
 
     this._appendExtraActors(response);
     return response;
   },
 
   /**
    * Called when the actor is removed from the connection.
    */
-  disconnect: function BTA_disconnect() {
+  disconnect() {
     this.exit();
   },
 
   /**
    * Called by the root actor when the underlying tab is closed.
    */
-  exit: function BTA_exit() {
+  exit() {
     if (this.exited) {
       return;
     }
 
     // Tell the thread actor that the tab is closed, so that it may terminate
     // instead of resuming the debuggee script.
     if (this._attached) {
       this.threadActor._tabClosed = true;
@@ -997,17 +1027,17 @@ TabActor.prototype = {
 
     this._exited = true;
   },
 
   /**
    * Return true if the given global is associated with this tab and should be
    * added as a debuggee, false otherwise.
    */
-  _shouldAddNewGlobalAsDebuggee: function (wrappedGlobal) {
+  _shouldAddNewGlobalAsDebuggee(wrappedGlobal) {
     if (wrappedGlobal.hostAnnotations &&
         wrappedGlobal.hostAnnotations.type == "document" &&
         wrappedGlobal.hostAnnotations.element === this.window) {
       return true;
     }
 
     let global = unwrapDebuggerObjectGlobal(wrappedGlobal);
     if (!global) {
@@ -1015,35 +1045,36 @@ TabActor.prototype = {
     }
 
     // Check if the global is a sdk page-mod sandbox.
     let metadata = {};
     let id = "";
     try {
       id = getInnerId(this.window);
       metadata = Cu.getSandboxMetadata(global);
+    } catch (e) {
+      // ignore
     }
-    catch (e) {}
     if (metadata
         && metadata["inner-window-id"]
         && metadata["inner-window-id"] == id) {
       return true;
     }
 
     return false;
   },
 
   /* Support for DebuggerServer.addTabActor. */
   _createExtraActors: createExtraActors,
   _appendExtraActors: appendExtraActors,
 
   /**
    * Does the actual work of attaching to a tab.
    */
-  _attach: function BTA_attach() {
+  _attach() {
     if (this._attached) {
       return;
     }
 
     // Create a pool for tab-lifetime actors.
     assert(!this._tabPool, "Shouldn't have a tab pool if we weren't attached.");
     this._tabPool = new ActorPool(this.conn);
     this.conn.addActorPool(this._tabPool);
@@ -1061,55 +1092,58 @@ TabActor.prototype = {
       // Ensure replying to attach() request first
       // before notifying about new docshells.
       DevToolsUtils.executeSoon(() => this._watchDocshells());
     }
 
     this._attached = true;
   },
 
-  _watchDocshells: function BTA_watchDocshells() {
+  _watchDocshells() {
     // In child processes, we watch all docshells living in the process.
     if (this.listenForNewDocShells) {
       Services.obs.addObserver(this, "webnavigation-create", false);
     }
     Services.obs.addObserver(this, "webnavigation-destroy", false);
 
     // We watch for all child docshells under the current document,
     this._progressListener.watch(this.docShell);
 
     // And list all already existing ones.
     this._updateChildDocShells();
   },
 
-  onSwitchToFrame: function BTA_onSwitchToFrame(aRequest) {
-    let windowId = aRequest.windowId;
+  onSwitchToFrame(request) {
+    let windowId = request.windowId;
     let win;
+
     try {
       win = Services.wm.getOuterWindowWithId(windowId);
-    } catch(e) {}
+    } catch (e) {
+      // ignore
+    }
     if (!win) {
       return { error: "noWindow",
                message: "The related docshell is destroyed or not found" };
     } else if (win == this.window) {
       return {};
     }
 
     // Reply first before changing the document
     DevToolsUtils.executeSoon(() => this._changeTopLevelDocument(win));
 
     return {};
   },
 
-  onListFrames: function BTA_onListFrames(aRequest) {
+  onListFrames(request) {
     let windows = this._docShellsToWindows(this.docShells);
     return { frames: windows };
   },
 
-  onListWorkers: function BTA_onListWorkers(aRequest) {
+  onListWorkers(request) {
     if (!this.attached) {
       return { error: "wrongState" };
     }
 
     if (this._workerActorList === null) {
       this._workerActorList = new WorkerActorList(this.conn, {
         type: Ci.nsIWorkerDebugger.TYPE_DEDICATED,
         window: this.window
@@ -1130,77 +1164,78 @@ TabActor.prototype = {
 
       return {
         "from": this.actorID,
         "workers": actors.map((actor) => actor.form())
       };
     });
   },
 
-  _onWorkerActorListChanged: function () {
+  _onWorkerActorListChanged() {
     this._workerActorList.onListChanged = null;
     this.conn.sendActorEvent(this.actorID, "workerListChanged");
   },
 
-  observe: function (aSubject, aTopic, aData) {
+  observe(subject, topic, data) {
     // Ignore any event that comes before/after the tab actor is attached
     // That typically happens during firefox shutdown.
     if (!this.attached) {
       return;
     }
-    if (aTopic == "webnavigation-create") {
-      aSubject.QueryInterface(Ci.nsIDocShell);
-      this._onDocShellCreated(aSubject);
-    } else if (aTopic == "webnavigation-destroy") {
-      this._onDocShellDestroy(aSubject);
+    if (topic == "webnavigation-create") {
+      subject.QueryInterface(Ci.nsIDocShell);
+      this._onDocShellCreated(subject);
+    } else if (topic == "webnavigation-destroy") {
+      this._onDocShellDestroy(subject);
     }
   },
 
-  _onDocShellCreated: function (docShell) {
-    // (chrome-)webnavigation-create is fired very early during docshell construction.
-    // In new root docshells within child processes, involving TabChild,
-    // this event is from within this call:
+  _onDocShellCreated(docShell) {
+    // (chrome-)webnavigation-create is fired very early during docshell
+    // construction. In new root docshells within child processes, involving
+    // TabChild, this event is from within this call:
     //   http://hg.mozilla.org/mozilla-central/annotate/74d7fb43bb44/dom/ipc/TabChild.cpp#l912
-    // whereas the chromeEventHandler (and most likely other stuff) is set later:
+    // whereas the chromeEventHandler (and most likely other stuff) is set
+    // later:
     //   http://hg.mozilla.org/mozilla-central/annotate/74d7fb43bb44/dom/ipc/TabChild.cpp#l944
     // So wait a tick before watching it:
     DevToolsUtils.executeSoon(() => {
-      // Bug 1142752: sometimes, the docshell appears to be immediately destroyed,
-      // bailout early to prevent random exceptions.
+      // Bug 1142752: sometimes, the docshell appears to be immediately
+      // destroyed, bailout early to prevent random exceptions.
       if (docShell.isBeingDestroyed()) {
         return;
       }
 
       // In child processes, we have new root docshells,
       // let's watch them and all their child docshells.
       if (this._isRootDocShell(docShell)) {
         this._progressListener.watch(docShell);
       }
       this._notifyDocShellsUpdate([docShell]);
     });
   },
 
-  _onDocShellDestroy: function (docShell) {
+  _onDocShellDestroy(docShell) {
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
     this._notifyDocShellDestroy(webProgress);
   },
 
-  _isRootDocShell: function (docShell) {
+  _isRootDocShell(docShell) {
     // Should report as root docshell:
     //  - New top level window's docshells, when using ChromeActor against a
     // process. It allows tracking iframes of the newly opened windows
     // like Browser console or new browser windows.
     //  - MozActivities or window.open frames on B2G, where a new root docshell
     // is spawn in the child process of the app.
     return !docShell.parent;
   },
 
   // Convert docShell list to windows objects list being sent to the client
-  _docShellsToWindows: function (docshells) {
+  _docShellsToWindows(docshells) {
     return docshells.map(docShell => {
       let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                                 .getInterface(Ci.nsIWebProgress);
       let window = webProgress.DOMWindow;
       let id = window.QueryInterface(Ci.nsIInterfaceRequestor)
                      .getInterface(Ci.nsIDOMWindowUtils)
                      .outerWindowID;
       let parentID = undefined;
@@ -1216,29 +1251,29 @@ TabActor.prototype = {
         id: id,
         url: window.location.href,
         title: window.document.title,
         parentID: parentID
       };
     });
   },
 
-  _notifyDocShellsUpdate: function (docshells) {
+  _notifyDocShellsUpdate(docshells) {
     let windows = this._docShellsToWindows(docshells);
     this.conn.send({ from: this.actorID,
                      type: "frameUpdate",
                      frames: windows
                    });
   },
 
-  _updateChildDocShells: function () {
+  _updateChildDocShells() {
     this._notifyDocShellsUpdate(this.docShells);
   },
 
-  _notifyDocShellDestroy: function (webProgress) {
+  _notifyDocShellDestroy(webProgress) {
     webProgress = webProgress.QueryInterface(Ci.nsIWebProgress);
     let id = webProgress.DOMWindow
                         .QueryInterface(Ci.nsIInterfaceRequestor)
                         .getInterface(Ci.nsIDOMWindowUtils)
                         .outerWindowID;
     this.conn.send({ from: this.actorID,
                      type: "frameUpdate",
                      frames: [{
@@ -1278,57 +1313,57 @@ TabActor.prototype = {
     // and we aren't on the top-level document,
     // we have to switch to the top-level one.
     if (webProgress.DOMWindow == this.window &&
         this.window != this._originalWindow) {
       this._changeTopLevelDocument(this._originalWindow);
     }
   },
 
-  _notifyDocShellDestroyAll: function () {
+  _notifyDocShellDestroyAll() {
     this.conn.send({ from: this.actorID,
                      type: "frameUpdate",
                      destroyAll: true
                    });
   },
 
   /**
    * Creates a thread actor and a pool for context-lifetime actors. It then sets
    * up the content window for debugging.
    */
-  _pushContext: function BTA_pushContext() {
+  _pushContext() {
     assert(!this._contextPool, "Can't push multiple contexts");
 
     this._contextPool = new ActorPool(this.conn);
     this.conn.addActorPool(this._contextPool);
 
     this.threadActor = new ThreadActor(this, this.window);
     this._contextPool.addActor(this.threadActor);
   },
 
   /**
    * Exits the current thread actor and removes the context-lifetime actor pool.
    * The content window is no longer being debugged after this call.
    */
-  _popContext: function BTA_popContext() {
+  _popContext() {
     assert(!!this._contextPool, "No context to pop.");
 
     this.conn.removeActorPool(this._contextPool);
     this._contextPool = null;
     this.threadActor.exit();
     this.threadActor = null;
     this._sources = null;
   },
 
   /**
    * Does the actual work of detaching from a tab.
    *
    * @returns false if the tab wasn't attached or true of detaching succeeds.
    */
-  _detach: function BTA_detach() {
+  _detach() {
     if (!this.attached) {
       return false;
     }
 
     // Check for docShell availability, as it can be already gone
     // during Firefox shutdown.
     if (this.docShell) {
       this._progressListener.unwatch(this.docShell);
@@ -1380,100 +1415,101 @@ TabActor.prototype = {
 
     this._attached = false;
 
     return true;
   },
 
   // Protocol Request Handlers
 
-  onAttach: function BTA_onAttach(aRequest) {
+  onAttach(request) {
     if (this.exited) {
       return { type: "exited" };
     }
 
     this._attach();
 
     return {
       type: "tabAttached",
       threadActor: this.threadActor.actorID,
       cacheDisabled: this._getCacheDisabled(),
       javascriptEnabled: this._getJavascriptEnabled(),
       traits: this.traits,
     };
   },
 
-  onDetach: function BTA_onDetach(aRequest) {
+  onDetach(request) {
     if (!this._detach()) {
       return { error: "wrongState" };
     }
 
     return { type: "detached" };
   },
 
   /**
    * Bring the tab's window to front.
    */
-  onFocus: function() {
+  onFocus() {
     if (this.window) {
       this.window.focus();
     }
     return {};
   },
 
   /**
    * Reload the page in this tab.
    */
-  onReload: function(aRequest) {
-    let force = aRequest && aRequest.options && aRequest.options.force;
+  onReload(request) {
+    let force = request && request.options && request.options.force;
     // Wait a tick so that the response packet can be dispatched before the
     // subsequent navigation event packet.
     Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
       // This won't work while the browser is shutting down and we don't really
       // care.
       if (Services.startup.shuttingDown) {
         return;
       }
-      this.webNavigation.reload(force ? Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE
-                                      : Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
+      this.webNavigation.reload(force ?
+        Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE :
+        Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
     }, "TabActor.prototype.onReload's delayed body"), 0);
     return {};
   },
 
   /**
    * Navigate this tab to a new location
    */
-  onNavigateTo: function(aRequest) {
+  onNavigateTo(request) {
     // Wait a tick so that the response packet can be dispatched before the
     // subsequent navigation event packet.
     Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
-      this.window.location = aRequest.url;
+      this.window.location = request.url;
     }, "TabActor.prototype.onNavigateTo's delayed body"), 0);
     return {};
   },
 
   /**
    * Reconfigure options.
    */
-  onReconfigure: function (aRequest) {
-    let options = aRequest.options || {};
+  onReconfigure(request) {
+    let options = request.options || {};
 
     if (!this.docShell) {
       // The tab is already closed.
       return {};
     }
     this._toggleDevToolsSettings(options);
 
     return {};
   },
 
   /**
    * Handle logic to enable/disable JS/cache/Service Worker testing.
    */
-  _toggleDevToolsSettings: function(options) {
+  _toggleDevToolsSettings(options) {
     // Wait a tick so that the response packet can be dispatched before the
     // subsequent navigation event packet.
     let reload = false;
 
     if (typeof options.javascriptEnabled !== "undefined" &&
         options.javascriptEnabled !== this._getJavascriptEnabled()) {
       this._setJavascriptEnabled(options.javascriptEnabled);
       reload = true;
@@ -1505,171 +1541,171 @@ TabActor.prototype = {
       this.onReload();
     }
   },
 
   /**
    * Opposite of the _toggleDevToolsSettings method, that reset document state
    * when closing the toolbox.
    */
-  _restoreDocumentSettings: function () {
+  _restoreDocumentSettings() {
     this._restoreJavascript();
     this._setCacheDisabled(false);
     this._setServiceWorkersTestingEnabled(false);
     this._restoreUserAgent();
   },
 
   /**
    * Disable or enable the cache via docShell.
    */
-  _setCacheDisabled: function(disabled) {
-    let enable =  Ci.nsIRequest.LOAD_NORMAL;
+  _setCacheDisabled(disabled) {
+    let enable = Ci.nsIRequest.LOAD_NORMAL;
     let disable = Ci.nsIRequest.LOAD_BYPASS_CACHE |
                   Ci.nsIRequest.INHIBIT_CACHING;
 
     this.docShell.defaultLoadFlags = disabled ? disable : enable;
   },
 
   /**
    * Disable or enable JS via docShell.
    */
   _wasJavascriptEnabled: null,
-  _setJavascriptEnabled: function(allow) {
+  _setJavascriptEnabled(allow) {
     if (this._wasJavascriptEnabled === null) {
       this._wasJavascriptEnabled = this.docShell.allowJavascript;
     }
     this.docShell.allowJavascript = allow;
   },
 
   /**
    * Restore JS state, before the actor modified it.
    */
-  _restoreJavascript: function () {
+  _restoreJavascript() {
     if (this._wasJavascriptEnabled !== null) {
       this._setJavascriptEnabled(this._wasJavascriptEnabled);
       this._wasJavascriptEnabled = null;
     }
   },
 
   /**
    * Return JS allowed status.
    */
-  _getJavascriptEnabled: function() {
+  _getJavascriptEnabled() {
     if (!this.docShell) {
       // The tab is already closed.
       return null;
     }
 
     return this.docShell.allowJavascript;
   },
 
   /**
    * Disable or enable the service workers testing features.
    */
-  _setServiceWorkersTestingEnabled: function(enabled) {
+  _setServiceWorkersTestingEnabled(enabled) {
     let windowUtils = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindowUtils);
     windowUtils.serviceWorkersTestingEnabled = enabled;
   },
 
   /**
    * Return cache allowed status.
    */
-  _getCacheDisabled: function() {
+  _getCacheDisabled() {
     if (!this.docShell) {
       // The tab is already closed.
       return null;
     }
 
     let disable = Ci.nsIRequest.LOAD_BYPASS_CACHE |
                   Ci.nsIRequest.INHIBIT_CACHING;
     return this.docShell.defaultLoadFlags === disable;
   },
 
   /**
    * Return service workers testing allowed status.
    */
-  _getServiceWorkersTestingEnabled: function() {
+  _getServiceWorkersTestingEnabled() {
     if (!this.docShell) {
       // The tab is already closed.
       return null;
     }
 
     let windowUtils = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindowUtils);
     return windowUtils.serviceWorkersTestingEnabled;
   },
 
   _previousCustomUserAgent: null,
 
   /**
    * Return custom user agent.
    */
-  _getCustomUserAgent: function() {
+  _getCustomUserAgent() {
     if (!this.docShell) {
       // The tab is already closed.
       return null;
     }
     return this.docShell.customUserAgent;
   },
 
   /**
    * Sets custom user agent for the current tab
    */
-  _setCustomUserAgent: function(userAgent) {
+  _setCustomUserAgent(userAgent) {
     if (this._previousCustomUserAgent === null) {
       this._previousCustomUserAgent = this.docShell.customUserAgent;
     }
     this.docShell.customUserAgent = userAgent;
   },
 
   /**
    * Restore the user agent, before the actor modified it
    */
-  _restoreUserAgent: function() {
+  _restoreUserAgent() {
     if (this._previousCustomUserAgent !== null) {
       this.docShell.customUserAgent = this._previousCustomUserAgent;
     }
   },
 
   /**
    * Prepare to enter a nested event loop by disabling debuggee events.
    */
-  preNest: function BTA_preNest() {
+  preNest() {
     if (!this.window) {
       // The tab is already closed.
       return;
     }
     let windowUtils = this.window
                           .QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIDOMWindowUtils);
     windowUtils.suppressEventHandling(true);
     windowUtils.suspendTimeouts();
   },
 
   /**
    * Prepare to exit a nested event loop by enabling debuggee events.
    */
-  postNest: function BTA_postNest(aNestData) {
+  postNest(nestData) {
     if (!this.window) {
       // The tab is already closed.
       return;
     }
     let windowUtils = this.window
                           .QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIDOMWindowUtils);
     windowUtils.resumeTimeouts();
     windowUtils.suppressEventHandling(false);
     if (this._pendingNavigation) {
       this._pendingNavigation.resume();
       this._pendingNavigation = null;
     }
   },
 
-  _changeTopLevelDocument: function (window) {
+  _changeTopLevelDocument(window) {
     // Fake a will-navigate on the previous document
     // to let a chance to unregister it
     this._willNavigate(this.window, window.location.href, null, true);
 
     this._windowDestroyed(this.window, null, true);
 
     // Immediately change the window as this window, if in process of unload
     // may already be non working on the next cycle and start throwing
@@ -1679,17 +1715,17 @@ TabActor.prototype = {
       // Then fake window-ready and navigate on the given document
       this._windowReady(window, true);
       DevToolsUtils.executeSoon(() => {
         this._navigate(window, true);
       });
     });
   },
 
-  _setWindow: function (window) {
+  _setWindow(window) {
     let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIWebNavigation)
                          .QueryInterface(Ci.nsIDocShell);
     // Here is the very important call where we switch the currently
     // targeted context (it will indirectly update this.window and
     // many other attributes defined from docShell).
     Object.defineProperty(this, "docShell", {
       value: docShell,
@@ -1706,32 +1742,33 @@ TabActor.prototype = {
                    });
   },
 
   /**
    * Handle location changes, by clearing the previous debuggees and enabling
    * debugging, which may have been disabled temporarily by the
    * DebuggerProgressListener.
    */
-  _windowReady: function (window, isFrameSwitching = false) {
+  _windowReady(window, isFrameSwitching = false) {
     let isTopLevel = window == this.window;
 
     // We just reset iframe list on WillNavigate, so we now list all existing
     // frames when we load a new document in the original window
     if (window == this._originalWindow && !isFrameSwitching) {
       this._updateChildDocShells();
     }
 
     events.emit(this, "window-ready", {
       window: window,
       isTopLevel: isTopLevel,
       id: getWindowID(window)
     });
 
-    // TODO bug 997119: move that code to ThreadActor by listening to window-ready
+    // TODO bug 997119: move that code to ThreadActor by listening to
+    // window-ready
     let threadActor = this.threadActor;
     if (isTopLevel && threadActor.state != "detached") {
       this.sources.reset({ sourceMaps: true });
       threadActor.clearDebuggees();
       threadActor.dbg.enabled = true;
       threadActor.maybePauseOnExceptions();
       // Update the global no matter if the debugger is on or off,
       // otherwise the global will be wrong when enabled later.
@@ -1740,44 +1777,44 @@ TabActor.prototype = {
 
     // Refresh the debuggee list when a new window object appears (top window or
     // iframe).
     if (threadActor.attached) {
       threadActor.dbg.addDebuggees();
     }
   },
 
-  _windowDestroyed: function (window, id = null, isFrozen = false) {
+  _windowDestroyed(window, id = null, isFrozen = false) {
     events.emit(this, "window-destroyed", {
       window: window,
       isTopLevel: window == this.window,
       id: id || getWindowID(window),
       isFrozen: isFrozen
     });
   },
 
   /**
    * Start notifying server and client about a new document
    * being loaded in the currently targeted context.
    */
-  _willNavigate: function (window, newURI, request, isFrameSwitching = false) {
+  _willNavigate(window, newURI, request, isFrameSwitching = false) {
     let isTopLevel = window == this.window;
     let reset = false;
 
     if (window == this._originalWindow && !isFrameSwitching) {
       // Clear the iframe list if the original top-level document changes.
       this._notifyDocShellDestroyAll();
 
       // If the top level document changes and we are targeting
       // an iframe, we need to reset to the upcoming new top level document.
       // But for this will-navigate event, we will dispatch on the old window.
-      // (The inspector codebase expect to receive will-navigate for the currently
-      // displayed document in order to cleanup the markup view)
+      // (The inspector codebase expect to receive will-navigate for the
+      // currently displayed document in order to cleanup the markup view)
       if (this.window != this._originalWindow) {
-        reset=true;
+        reset = true;
         window = this.window;
         isTopLevel = true;
       }
     }
 
     // will-navigate event needs to be dispatched synchronously,
     // by calling the listeners in the order or registration.
     // This event fires once navigation starts,
@@ -1792,21 +1829,23 @@ TabActor.prototype = {
 
     // We don't do anything for inner frames in TabActor.
     // (we will only update thread actor on window-ready)
     if (!isTopLevel) {
       return;
     }
 
     // Proceed normally only if the debuggee is not paused.
-    // TODO bug 997119: move that code to ThreadActor by listening to will-navigate
+    // TODO bug 997119: move that code to ThreadActor by listening to
+    // will-navigate
     let threadActor = this.threadActor;
     if (request && threadActor.state == "paused") {
       request.suspend();
-      this.conn.send(threadActor.unsafeSynchronize(Promise.resolve(threadActor.onResume())));
+      this.conn.send(
+        threadActor.unsafeSynchronize(Promise.resolve(threadActor.onResume())));
       threadActor.dbg.enabled = false;
       this._pendingNavigation = request;
     }
     threadActor.disableAllBreakpoints();
 
     this.conn.send({
       from: this.actorID,
       type: "tabNavigated",
@@ -1820,17 +1859,17 @@ TabActor.prototype = {
       this._setWindow(this._originalWindow);
     }
   },
 
   /**
    * Notify server and client about a new document done loading in the current
    * targeted context.
    */
-  _navigate: function (window, isFrameSwitching = false) {
+  _navigate(window, isFrameSwitching = false) {
     let isTopLevel = window == this.window;
 
     // navigate event needs to be dispatched synchronously,
     // by calling the listeners in the order or registration.
     // This event is fired once the document is loaded,
     // after the load event, it's document ready-state is 'complete'.
     events.emit(this, "navigate", {
       window: window,
@@ -1859,100 +1898,115 @@ TabActor.prototype = {
       isFrameSwitching: isFrameSwitching
     });
   },
 
   /**
    * Tells if the window.console object is native or overwritten by script in
    * the page.
    *
-   * @param nsIDOMWindow aWindow
+   * @param nsIDOMWindow window
    *        The window object you want to check.
    * @return boolean
    *         True if the window.console object is native, or false otherwise.
    */
-  hasNativeConsoleAPI: function BTA_hasNativeConsoleAPI(aWindow) {
+  hasNativeConsoleAPI(window) {
     let isNative = false;
     try {
       // We are very explicitly examining the "console" property of
       // the non-Xrayed object here.
-      let console = aWindow.wrappedJSObject.console;
-      isNative = console instanceof aWindow.Console;
+      let console = window.wrappedJSObject.console;
+      isNative = console instanceof window.Console;
+    } catch (ex) {
+      // ignore
     }
-    catch (ex) { }
     return isNative;
   },
 
   /**
    * Create or return the StyleSheetActor for a style sheet. This method
    * is here because the Style Editor and Inspector share style sheet actors.
    *
    * @param DOMStyleSheet styleSheet
    *        The style sheet to create an actor for.
    * @return StyleSheetActor actor
    *         The actor for this style sheet.
    *
    */
-  createStyleSheetActor: function BTA_createStyleSheetActor(styleSheet) {
+  createStyleSheetActor(styleSheet) {
     if (this._styleSheetActors.has(styleSheet)) {
       return this._styleSheetActors.get(styleSheet);
     }
     let actor = new StyleSheetActor(styleSheet, this);
     this._styleSheetActors.set(styleSheet, actor);
 
     this._tabPool.addActor(actor);
 
     return actor;
   },
 
-  removeActorByName: function BTA_removeActor(aName) {
-    if (aName in this._extraActors) {
-      const actor = this._extraActors[aName];
+  removeActorByName(name) {
+    if (name in this._extraActors) {
+      const actor = this._extraActors[name];
       if (this._tabActorPool.has(actor)) {
         this._tabActorPool.removeActor(actor);
       }
-      delete this._extraActors[aName];
+      delete this._extraActors[name];
     }
   },
 
   /**
    * Takes a packet containing a url, line and column and returns
    * the updated url, line and column based on the current source mapping
    * (source mapped files, pretty prints).
    *
    * @param {String} request.url
    * @param {Number} request.line
    * @param {Number?} request.column
    * @return {Promise<Object>}
    */
-  onResolveLocation: function (request) {
+  onResolveLocation(request) {
     let { url, line } = request;
     let column = request.column || 0;
-    let actor;
+    let actor = this.sources.getSourceActorByURL(url);
 
-    if (actor = this.sources.getSourceActorByURL(url)) {
+    if (actor) {
       // Get the generated source actor if this is source mapped
       let generatedActor = actor.generatedSource ?
-                           this.sources.createNonSourceMappedActor(actor.generatedSource) :
-                           actor;
-      let generatedLocation = new GeneratedLocation(generatedActor, line, column);
+        this.sources.createNonSourceMappedActor(actor.generatedSource) :
+        actor;
+      let generatedLocation = new GeneratedLocation(
+        generatedActor, line, column);
 
       return this.sources.getOriginalLocation(generatedLocation).then(loc => {
         // If no map found, return this packet
         if (loc.originalLine == null) {
-          return { from: this.actorID, type: "resolveLocation", error: "MAP_NOT_FOUND" };
+          return {
+            from: this.actorID,
+            type: "resolveLocation",
+            error: "MAP_NOT_FOUND"
+          };
         }
 
         loc = loc.toJSON();
-        return { from: this.actorID, url: loc.source.url, column: loc.column, line: loc.line };
+        return {
+          from: this.actorID,
+          url: loc.source.url,
+          column: loc.column,
+          line: loc.line
+        };
       });
     }
 
     // Fall back to this packet when source is not found
-    return promise.resolve({ from: this.actorID, type: "resolveLocation", error: "SOURCE_NOT_FOUND" });
+    return promise.resolve({
+      from: this.actorID,
+      type: "resolveLocation",
+      error: "SOURCE_NOT_FOUND"
+    });
   },
 };
 
 /**
  * The request types this actor can handle.
  */
 TabActor.prototype.requestTypes = {
   "attach": TabActor.prototype.onAttach,
@@ -1969,41 +2023,40 @@ TabActor.prototype.requestTypes = {
 
 exports.TabActor = TabActor;
 
 /**
  * Creates a tab actor for handling requests to a single in-process
  * <xul:browser> tab, or <html:iframe>.
  * Most of the implementation comes from TabActor.
  *
- * @param aConnection DebuggerServerConnection
+ * @param connection DebuggerServerConnection
  *        The connection to the client.
- * @param aBrowser browser
+ * @param browser browser
  *        The frame instance that contains this tab.
  */
-function BrowserTabActor(aConnection, aBrowser)
-{
-  TabActor.call(this, aConnection, aBrowser);
-  this._browser = aBrowser;
-  if (typeof(aBrowser.getTabBrowser) == "function") {
-    this._tabbrowser = aBrowser.getTabBrowser();
+function BrowserTabActor(connection, browser) {
+  TabActor.call(this, connection, browser);
+  this._browser = browser;
+  if (typeof browser.getTabBrowser == "function") {
+    this._tabbrowser = browser.getTabBrowser();
   }
 
   Object.defineProperty(this, "docShell", {
     value: this._browser.docShell,
     configurable: true
   });
 }
 
 BrowserTabActor.prototype = Object.create(TabActor.prototype);
 
 BrowserTabActor.prototype.constructor = BrowserTabActor;
 
 Object.defineProperty(BrowserTabActor.prototype, "title", {
-  get: function() {
+  get() {
     // On Fennec, we can check the session store data for zombie tabs
     if (this._browser.__SS_restore) {
       let sessionStore = this._browser.__SS_data;
       // Get the last selected entry
       let entry = sessionStore.entries[sessionStore.index - 1];
       return entry.title;
     }
     let title = this.contentDocument.title || this._browser.contentTitle;
@@ -2018,17 +2071,17 @@ Object.defineProperty(BrowserTabActor.pr
     }
     return title;
   },
   enumerable: true,
   configurable: false
 });
 
 Object.defineProperty(BrowserTabActor.prototype, "url", {
-  get: function() {
+  get() {
     // On Fennec, we can check the session store data for zombie tabs
     if (this._browser.__SS_restore) {
       let sessionStore = this._browser.__SS_data;
       // Get the last selected entry
       let entry = sessionStore.entries[sessionStore.index - 1];
       return entry.url;
     }
     if (this.webNavigation.currentURI) {
@@ -2036,162 +2089,166 @@ Object.defineProperty(BrowserTabActor.pr
     }
     return null;
   },
   enumerable: true,
   configurable: true
 });
 
 Object.defineProperty(BrowserTabActor.prototype, "browser", {
-  get: function() {
+  get() {
     return this._browser;
   },
   enumerable: true,
   configurable: false
 });
 
-BrowserTabActor.prototype.disconnect = function() {
+BrowserTabActor.prototype.disconnect = function () {
   TabActor.prototype.disconnect.call(this);
   this._browser = null;
   this._tabbrowser = null;
 };
 
-BrowserTabActor.prototype.exit = function() {
+BrowserTabActor.prototype.exit = function () {
   TabActor.prototype.exit.call(this);
   this._browser = null;
   this._tabbrowser = null;
 };
 
 exports.BrowserTabActor = BrowserTabActor;
 
 /**
  * This actor is a shim that connects to a ContentActor in a remote
  * browser process. All RDP packets get forwarded using the message
  * manager.
  *
- * @param aConnection The main RDP connection.
- * @param aBrowser XUL <browser> element to connect to.
+ * @param connection The main RDP connection.
+ * @param browser XUL <browser> element to connect to.
  */
-function RemoteBrowserTabActor(aConnection, aBrowser)
-{
-  this._conn = aConnection;
-  this._browser = aBrowser;
+function RemoteBrowserTabActor(connection, browser) {
+  this._conn = connection;
+  this._browser = browser;
   this._form = null;
 }
 
 RemoteBrowserTabActor.prototype = {
-  connect: function() {
+  connect() {
     let onDestroy = () => {
       this._form = null;
     };
-    let connect = DebuggerServer.connectToChild(this._conn, this._browser, onDestroy);
+    let connect = DebuggerServer.connectToChild(
+      this._conn, this._browser, onDestroy);
     return connect.then(form => {
       this._form = form;
       return this;
     });
   },
 
   get _mm() {
     return this._browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader
            .messageManager;
   },
 
-  update: function() {
+  update() {
     // If the child happens to be crashed/close/detach, it won't have _form set,
-    // so only request form update if some code is still listening on the other side.
+    // so only request form update if some code is still listening on the other
+    // side.
     if (this._form) {
       let deferred = promise.defer();
       let onFormUpdate = msg => {
         // There may be more than just one childtab.js up and running
         if (this._form.actor != msg.json.actor) {
           return;
         }
         this._mm.removeMessageListener("debug:form", onFormUpdate);
         this._form = msg.json;
         deferred.resolve(this);
       };
       this._mm.addMessageListener("debug:form", onFormUpdate);
       this._mm.sendAsyncMessage("debug:form");
       return deferred.promise;
-    } else {
-      return this.connect();
     }
+
+    return this.connect();
   },
 
-  form: function() {
+  form() {
     return this._form;
   },
 
-  exit: function() {
+  exit() {
     this._browser = null;
   },
 };
 
 exports.RemoteBrowserTabActor = RemoteBrowserTabActor;
 
-function BrowserAddonList(aConnection)
-{
-  this._connection = aConnection;
+function BrowserAddonList(connection) {
+  this._connection = connection;
   this._actorByAddonId = new Map();
   this._onListChanged = null;
 }
 
-BrowserAddonList.prototype.getList = function() {
-  var deferred = promise.defer();
+BrowserAddonList.prototype.getList = function () {
+  let deferred = promise.defer();
   AddonManager.getAllAddons((addons) => {
     for (let addon of addons) {
       let actor = this._actorByAddonId.get(addon.id);
       if (!actor) {
         actor = new BrowserAddonActor(this._connection, addon);
         this._actorByAddonId.set(addon.id, actor);
       }
     }
     deferred.resolve([...this._actorByAddonId].map(([_, actor]) => actor));
   });
   return deferred.promise;
-}
+};
 
 Object.defineProperty(BrowserAddonList.prototype, "onListChanged", {
-  enumerable: true, configurable: true,
-  get: function() { return this._onListChanged; },
-  set: function(v) {
+  enumerable: true,
+  configurable: true,
+  get() {
+    return this._onListChanged;
+  },
+  set(v) {
     if (v !== null && typeof v != "function") {
-      throw Error("onListChanged property may only be set to 'null' or a function");
+      throw new Error(
+        "onListChanged property may only be set to 'null' or a function");
     }
     this._onListChanged = v;
     if (this._onListChanged) {
       AddonManager.addAddonListener(this);
     } else {
       AddonManager.removeAddonListener(this);
     }
   }
 });
 
-BrowserAddonList.prototype.onInstalled = function (aAddon) {
+BrowserAddonList.prototype.onInstalled = function (addon) {
   this._onListChanged();
 };
 
-BrowserAddonList.prototype.onUninstalled = function (aAddon) {
-  this._actorByAddonId.delete(aAddon.id);
+BrowserAddonList.prototype.onUninstalled = function (addon) {
+  this._actorByAddonId.delete(addon.id);
   this._onListChanged();
 };
 
 exports.BrowserAddonList = BrowserAddonList;
 
 /**
  * The DebuggerProgressListener object is an nsIWebProgressListener which
  * handles onStateChange events for the inspected browser. If the user tries to
  * navigate away from a paused page, the listener makes sure that the debuggee
  * is resumed before the navigation begins.
  *
  * @param TabActor aTabActor
  *        The tab actor associated with this listener.
  */
-function DebuggerProgressListener(aTabActor) {
-  this._tabActor = aTabActor;
+function DebuggerProgressListener(tabActor) {
+  this._tabActor = tabActor;
   this._onWindowCreated = this.onWindowCreated.bind(this);
   this._onWindowHidden = this.onWindowHidden.bind(this);
 
   // Watch for windows destroyed (global observer that will need filtering)
   Services.obs.addObserver(this, "inner-window-destroyed", false);
 
   // XXX: for now we maintain the list of windows we know about in this instance
   // so that we can discriminate windows we care about when observing
@@ -2203,80 +2260,84 @@ function DebuggerProgressListener(aTabAc
 
 DebuggerProgressListener.prototype = {
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIWebProgressListener,
     Ci.nsISupportsWeakReference,
     Ci.nsISupports,
   ]),
 
-  destroy: function() {
+  destroy() {
     Services.obs.removeObserver(this, "inner-window-destroyed", false);
     this._knownWindowIDs.clear();
     this._knownWindowIDs = null;
   },
 
-  watch: function(docShell) {
+  watch(docShell) {
     // Add the docshell to the watched set. We're actually adding the window,
     // because docShell objects are not wrappercached and would be rejected
     // by the WeakSet.
     let docShellWindow = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindow);
     this._watchedDocShells.add(docShellWindow);
 
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
-    webProgress.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATUS |
-                                          Ci.nsIWebProgress.NOTIFY_STATE_WINDOW |
-                                          Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+    webProgress.addProgressListener(this,
+                                    Ci.nsIWebProgress.NOTIFY_STATUS |
+                                    Ci.nsIWebProgress.NOTIFY_STATE_WINDOW |
+                                    Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
 
     let handler = getDocShellChromeEventHandler(docShell);
     handler.addEventListener("DOMWindowCreated", this._onWindowCreated, true);
     handler.addEventListener("pageshow", this._onWindowCreated, true);
     handler.addEventListener("pagehide", this._onWindowHidden, true);
 
     // Dispatch the _windowReady event on the tabActor for pre-existing windows
     for (let win of this._getWindowsInDocShell(docShell)) {
       this._tabActor._windowReady(win);
       this._knownWindowIDs.set(getWindowID(win), win);
     }
   },
 
-  unwatch: function(docShell) {
+  unwatch(docShell) {
     let docShellWindow = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindow);
     if (!this._watchedDocShells.has(docShellWindow)) {
       return;
     }
 
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
     // During process shutdown, the docshell may already be cleaned up and throw
     try {
       webProgress.removeProgressListener(this);
-    } catch(e) {}
+    } catch (e) {
+      // ignore
+    }
 
     let handler = getDocShellChromeEventHandler(docShell);
-    handler.removeEventListener("DOMWindowCreated", this._onWindowCreated, true);
+    handler.removeEventListener("DOMWindowCreated",
+      this._onWindowCreated, true);
     handler.removeEventListener("pageshow", this._onWindowCreated, true);
     handler.removeEventListener("pagehide", this._onWindowHidden, true);
 
     for (let win of this._getWindowsInDocShell(docShell)) {
       this._knownWindowIDs.delete(getWindowID(win));
     }
   },
 
-  _getWindowsInDocShell: function(docShell) {
+  _getWindowsInDocShell(docShell) {
     return getChildDocShells(docShell).map(d => {
       return d.QueryInterface(Ci.nsIInterfaceRequestor)
               .getInterface(Ci.nsIDOMWindow);
     });
   },
 
-  onWindowCreated: DevToolsUtils.makeInfallible(function(evt) {
+  onWindowCreated: DevToolsUtils.makeInfallible(function (evt) {
     if (!this._tabActor.attached) {
       return;
     }
 
     // pageshow events for non-persisted pages have already been handled by a
     // prior DOMWindowCreated event. For persisted pages, act as if the window
     // had just been created since it's been unfrozen from bfcache.
     if (evt.type == "pageshow" && !evt.persisted) {
@@ -2286,81 +2347,81 @@ DebuggerProgressListener.prototype = {
     let window = evt.target.defaultView;
     this._tabActor._windowReady(window);
 
     if (evt.type !== "pageshow") {
       this._knownWindowIDs.set(getWindowID(window), window);
     }
   }, "DebuggerProgressListener.prototype.onWindowCreated"),
 
-  onWindowHidden: DevToolsUtils.makeInfallible(function(evt) {
+  onWindowHidden: DevToolsUtils.makeInfallible(function (evt) {
     if (!this._tabActor.attached) {
       return;
     }
 
     // Only act as if the window has been destroyed if the 'pagehide' event
     // was sent for a persisted window (persisted is set when the page is put
     // and frozen in the bfcache). If the page isn't persisted, the observer's
     // inner-window-destroyed event will handle it.
     if (!evt.persisted) {
       return;
     }
 
     let window = evt.target.defaultView;
     this._tabActor._windowDestroyed(window, null, true);
   }, "DebuggerProgressListener.prototype.onWindowHidden"),
 
-  observe: DevToolsUtils.makeInfallible(function(subject, topic) {
+  observe: DevToolsUtils.makeInfallible(function (subject, topic) {
     if (!this._tabActor.attached) {
       return;
     }
 
     // Because this observer will be called for all inner-window-destroyed in
     // the application, we need to filter out events for windows we are not
     // watching
     let innerID = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
     let window = this._knownWindowIDs.get(innerID);
     if (window) {
       this._knownWindowIDs.delete(innerID);
       this._tabActor._windowDestroyed(window, innerID);
     }
   }, "DebuggerProgressListener.prototype.observe"),
 
   onStateChange:
-  DevToolsUtils.makeInfallible(function(aProgress, aRequest, aFlag, aStatus) {
+  DevToolsUtils.makeInfallible(function (progress, request, flag, status) {
     if (!this._tabActor.attached) {
       return;
     }
 
-    let isStart = aFlag & Ci.nsIWebProgressListener.STATE_START;
-    let isStop = aFlag & Ci.nsIWebProgressListener.STATE_STOP;
-    let isDocument = aFlag & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
-    let isWindow = aFlag & Ci.nsIWebProgressListener.STATE_IS_WINDOW;
+    let isStart = flag & Ci.nsIWebProgressListener.STATE_START;
+    let isStop = flag & Ci.nsIWebProgressListener.STATE_STOP;
+    let isDocument = flag & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
+    let isWindow = flag & Ci.nsIWebProgressListener.STATE_IS_WINDOW;
 
     // Catch any iframe location change
     if (isDocument && isStop) {
       // Watch document stop to ensure having the new iframe url.
-      aProgress.QueryInterface(Ci.nsIDocShell);
-      this._tabActor._notifyDocShellsUpdate([aProgress]);
+      progress.QueryInterface(Ci.nsIDocShell);
+      this._tabActor._notifyDocShellsUpdate([progress]);
     }
 
-    let window = aProgress.DOMWindow;
+    let window = progress.DOMWindow;
     if (isDocument && isStart) {
       // One of the earliest events that tells us a new URI
       // is being loaded in this window.
-      let newURI = aRequest instanceof Ci.nsIChannel ? aRequest.URI.spec : null;
-      this._tabActor._willNavigate(window, newURI, aRequest);
+      let newURI = request instanceof Ci.nsIChannel ? request.URI.spec : null;
+      this._tabActor._willNavigate(window, newURI, request);
     }
     if (isWindow && isStop) {
       // Somewhat equivalent of load event.
       // (window.document.readyState == complete)
       this._tabActor._navigate(window);
     }
   }, "DebuggerProgressListener.prototype.onStateChange")
 };
 
-exports.register = function(handle) {
+exports.register = function (handle) {
   handle.setRootActor(createRootActor);
 };
 
-exports.unregister = function(handle) {
+exports.unregister = function (handle) {
   handle.setRootActor(null);
 };