Bug 1451659 - Automated ESLint fixes for devtools/client/scratchpad/. r?jdescottes draft
authorMark Banner <standard8@mozilla.com>
Thu, 05 Apr 2018 08:01:09 +0100
changeset 777829 63a1f6ca7395b14989f43c8ea4a4d52081630e99
parent 777828 13e14ca47b8f68d4a669296652c7a47d27f13863
child 777830 47b35ecbeadd0460cd9423ecb65d5d3ed2879528
push id105298
push userbmo:standard8@mozilla.com
push dateThu, 05 Apr 2018 10:56:03 +0000
reviewersjdescottes
bugs1451659
milestone61.0a1
Bug 1451659 - Automated ESLint fixes for devtools/client/scratchpad/. r?jdescottes MozReview-Commit-ID: ACluPVPspsQ
devtools/client/scratchpad/scratchpad-commands.js
devtools/client/scratchpad/scratchpad-manager.jsm
devtools/client/scratchpad/scratchpad-panel.js
devtools/client/scratchpad/scratchpad.js
devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
devtools/client/scratchpad/test/browser_scratchpad_browser_last_window_closing.js
devtools/client/scratchpad/test/browser_scratchpad_chrome_context_pref.js
devtools/client/scratchpad/test/browser_scratchpad_confirm_close.js
devtools/client/scratchpad/test/browser_scratchpad_contexts.js
devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
devtools/client/scratchpad/test/browser_scratchpad_display_non_error_exceptions.js
devtools/client/scratchpad/test/browser_scratchpad_display_outputs_errors.js
devtools/client/scratchpad/test/browser_scratchpad_edit_ui_updates.js
devtools/client/scratchpad/test/browser_scratchpad_eval_func.js
devtools/client/scratchpad/test/browser_scratchpad_execute_print.js
devtools/client/scratchpad/test/browser_scratchpad_falsy.js
devtools/client/scratchpad/test/browser_scratchpad_files.js
devtools/client/scratchpad/test/browser_scratchpad_goto_line_ui.js
devtools/client/scratchpad/test/browser_scratchpad_help_key.js
devtools/client/scratchpad/test/browser_scratchpad_initialization.js
devtools/client/scratchpad/test/browser_scratchpad_inspect.js
devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
devtools/client/scratchpad/test/browser_scratchpad_long_string.js
devtools/client/scratchpad/test/browser_scratchpad_modeline.js
devtools/client/scratchpad/test/browser_scratchpad_open.js
devtools/client/scratchpad/test/browser_scratchpad_open_error_console.js
devtools/client/scratchpad/test/browser_scratchpad_pprint-02.js
devtools/client/scratchpad/test/browser_scratchpad_pprint.js
devtools/client/scratchpad/test/browser_scratchpad_pprint_error_goto_line.js
devtools/client/scratchpad/test/browser_scratchpad_recent_files.js
devtools/client/scratchpad/test/browser_scratchpad_reload_and_run.js
devtools/client/scratchpad/test/browser_scratchpad_remember_view_options.js
devtools/client/scratchpad/test/browser_scratchpad_reset_undo.js
devtools/client/scratchpad/test/browser_scratchpad_restore.js
devtools/client/scratchpad/test/browser_scratchpad_revert_to_saved.js
devtools/client/scratchpad/test/browser_scratchpad_run_error_goto_line.js
devtools/client/scratchpad/test/browser_scratchpad_sessions.js
devtools/client/scratchpad/test/browser_scratchpad_tab.js
devtools/client/scratchpad/test/browser_scratchpad_tab_switch.js
devtools/client/scratchpad/test/browser_scratchpad_throw_output.js
devtools/client/scratchpad/test/browser_scratchpad_ui.js
devtools/client/scratchpad/test/browser_scratchpad_unsaved.js
devtools/client/scratchpad/test/browser_scratchpad_wrong_window_focus.js
devtools/client/scratchpad/test/head.js
--- a/devtools/client/scratchpad/scratchpad-commands.js
+++ b/devtools/client/scratchpad/scratchpad-commands.js
@@ -10,13 +10,13 @@ const {Cu} = require("chrome");
 exports.items = [{
   item: "command",
   runAt: "client",
   name: "scratchpad",
   buttonId: "command-button-scratchpad",
   buttonClass: "command-button",
   tooltipText: l10n.lookup("scratchpadOpenTooltip"),
   hidden: true,
-  exec: function (args, context) {
+  exec: function(args, context) {
     const {ScratchpadManager} = require("resource://devtools/client/scratchpad/scratchpad-manager.jsm");
     ScratchpadManager.openScratchpad();
   }
 }];
--- a/devtools/client/scratchpad/scratchpad-manager.jsm
+++ b/devtools/client/scratchpad/scratchpad-manager.jsm
@@ -9,17 +9,16 @@ this.EXPORTED_SYMBOLS = ["ScratchpadMana
 
 const SCRATCHPAD_WINDOW_URL = "chrome://devtools/content/scratchpad/scratchpad.xul";
 const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
 
 const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const Services = require("Services");
 const Telemetry = require("devtools/client/shared/telemetry");
 
-
 /**
  * The ScratchpadManager object opens new Scratchpad windows and manages the state
  * of open scratchpads for session restore. There's only one ScratchpadManager in
  * the life of the browser.
  */
 this.ScratchpadManager = {
 
   _nextUid: 1,
@@ -29,39 +28,37 @@ this.ScratchpadManager = {
 
   /**
    * Get the saved states of open scratchpad windows. Called by
    * session restore.
    *
    * @return array
    *         The array of scratchpad states.
    */
-  getSessionState: function SPM_getSessionState()
-  {
+  getSessionState: function SPM_getSessionState() {
     return this._scratchpads;
   },
 
   /**
    * Restore scratchpad windows from the scratchpad session store file.
    * Called by session restore.
    *
    * @param function aSession
    *        The session object with scratchpad states.
    *
    * @return array
    *         The restored scratchpad windows.
    */
-  restoreSession: function SPM_restoreSession(aSession)
-  {
+  restoreSession: function SPM_restoreSession(aSession) {
     if (!Array.isArray(aSession)) {
       return [];
     }
 
     let wins = [];
-    aSession.forEach(function (state) {
+    aSession.forEach(function(state) {
       let win = this.openScratchpad(state);
       wins.push(win);
     }, this);
 
     return wins;
   },
 
   /**
@@ -102,18 +99,17 @@ this.ScratchpadManager = {
    *
    * @param object aState
    *        Optional. The initial state of the scratchpad, an object
    *        with properties filename, text, and executionContext.
    *
    * @return nsIDomWindow
    *         The opened scratchpad window.
    */
-  openScratchpad: function SPM_openScratchpad(aState)
-  {
+  openScratchpad: function SPM_openScratchpad(aState) {
     let params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
                  .createInstance(Ci.nsIDialogParamBlock);
 
     params.SetNumberStrings(2);
     params.SetString(0, this.createUid());
 
     if (aState) {
       if (typeof aState != "object") {
@@ -136,23 +132,21 @@ this.ScratchpadManager = {
     ShutdownObserver.init();
 
     return win;
   },
 
   /**
    * Create a unique ID for a new Scratchpad.
    */
-  createUid: function SPM_createUid()
-  {
+  createUid: function SPM_createUid() {
     return JSON.stringify(this._nextUid++);
   }
 };
 
-
 /**
  * The ShutdownObserver listens for app shutdown and saves the current state
  * of the scratchpads for session restore.
  */
 var ShutdownObserver = {
   _initialized: false,
   init() {
     if (this._initialized) {
--- a/devtools/client/scratchpad/scratchpad-panel.js
+++ b/devtools/client/scratchpad/scratchpad-panel.js
@@ -5,53 +5,52 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const {Cu} = require("chrome");
 const EventEmitter = require("devtools/shared/event-emitter");
 const promise = require("promise");
 const defer = require("devtools/shared/defer");
 
-
 function ScratchpadPanel(iframeWindow, toolbox) {
   let { Scratchpad } = iframeWindow;
   this._toolbox = toolbox;
   this.panelWin = iframeWindow;
   this.scratchpad = Scratchpad;
 
   Scratchpad.target = this.target;
   Scratchpad.hideMenu();
 
   let deferred = defer();
   this._readyObserver = deferred.promise;
   Scratchpad.addObserver({
-    onReady: function () {
+    onReady: function() {
       Scratchpad.removeObserver(this);
       deferred.resolve();
     }
   });
 
   EventEmitter.decorate(this);
 }
 exports.ScratchpadPanel = ScratchpadPanel;
 
 ScratchpadPanel.prototype = {
   /**
    * Open is effectively an asynchronous constructor. For the ScratchpadPanel,
    * by the time this is called, the Scratchpad will already be ready.
    */
-  open: function () {
+  open: function() {
     return this._readyObserver.then(() => {
       this.isReady = true;
       this.emit("ready");
       return this;
     });
   },
 
   get target() {
     return this._toolbox.target;
   },
 
-  destroy: function () {
+  destroy: function() {
     this.emit("destroyed");
     return promise.resolve();
   }
 };
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -105,18 +105,17 @@ var Scratchpad = {
 
   /**
    * Check if provided string is a mode-line and, if it is, return an
    * object with its values.
    *
    * @param string aLine
    * @return string
    */
-  _scanModeLine: function SP__scanModeLine(aLine = "")
-  {
+  _scanModeLine: function SP__scanModeLine(aLine = "") {
     aLine = aLine.trim();
 
     let obj = {};
     let ch1 = aLine.charAt(0);
     let ch2 = aLine.charAt(1);
 
     if (ch1 !== "/" || (ch2 !== "*" && ch2 !== "/")) {
       return obj;
@@ -142,17 +141,17 @@ var Scratchpad = {
    * Add the event listeners for popupshowing events.
    */
   _setupPopupShowingListeners: function SP_setupPopupShowing() {
     let elementIDs = ["sp-menu_editpopup", "scratchpad-text-popup"];
 
     for (let elementID of elementIDs) {
       let elem = document.getElementById(elementID);
       if (elem) {
-        elem.addEventListener("popupshowing", function () {
+        elem.addEventListener("popupshowing", function() {
           goUpdateGlobalEditMenuItems();
           let commands = ["cmd_undo", "cmd_redo", "cmd_delete", "cmd_findAgain"];
           commands.forEach(goUpdateCommand);
         });
       }
     }
   },
 
@@ -305,316 +304,293 @@ var Scratchpad = {
    * @boolean
    * @see addObserver
    */
   initialized: false,
 
   /**
    * Returns the 'dirty' state of this Scratchpad.
    */
-  get dirty()
-  {
+  get dirty() {
     let clean = this.editor && this.editor.isClean();
     return this._dirty || !clean;
   },
 
   /**
    * Sets the 'dirty' state of this Scratchpad.
    */
-  set dirty(aValue)
-  {
+  set dirty(aValue) {
     this._dirty = aValue;
-    if (!aValue && this.editor)
+    if (!aValue && this.editor) {
       this.editor.setClean();
+    }
     this._updateTitle();
   },
 
   /**
    * Retrieve the xul:notificationbox DOM element. It notifies the user when
    * the current code execution context is SCRATCHPAD_CONTEXT_BROWSER.
    */
-  get notificationBox()
-  {
+  get notificationBox() {
     return document.getElementById("scratchpad-notificationbox");
   },
 
   /**
    * Hide the menu bar.
    */
-  hideMenu: function SP_hideMenu()
-  {
+  hideMenu: function SP_hideMenu() {
     document.getElementById("sp-menubar").style.display = "none";
   },
 
   /**
    * Show the menu bar.
    */
-  showMenu: function SP_showMenu()
-  {
+  showMenu: function SP_showMenu() {
     document.getElementById("sp-menubar").style.display = "";
   },
 
   /**
    * Get the editor content, in the given range. If no range is given you get
    * the entire editor content.
    *
    * @param number [aStart=0]
    *        Optional, start from the given offset.
    * @param number [aEnd=content char count]
    *        Optional, end offset for the text you want. If this parameter is not
    *        given, then the text returned goes until the end of the editor
    *        content.
    * @return string
    *         The text in the given range.
    */
-  getText: function SP_getText(aStart, aEnd)
-  {
+  getText: function SP_getText(aStart, aEnd) {
     var value = this.editor.getText();
     return value.slice(aStart || 0, aEnd || value.length);
   },
 
   /**
    * Set the filename in the scratchpad UI and object
    *
    * @param string aFilename
    *        The new filename
    */
-  setFilename: function SP_setFilename(aFilename)
-  {
+  setFilename: function SP_setFilename(aFilename) {
     this.filename = aFilename;
     this._updateTitle();
   },
 
   /**
    * Update the Scratchpad window title based on the current state.
    * @private
    */
-  _updateTitle: function SP__updateTitle()
-  {
+  _updateTitle: function SP__updateTitle() {
     let title = this.filename || this._initialWindowTitle;
 
-    if (this.dirty)
+    if (this.dirty) {
       title = "*" + title;
+    }
 
     document.title = title;
   },
 
   /**
    * Get the current state of the scratchpad. Called by the
    * Scratchpad Manager for session storing.
    *
    * @return object
    *        An object with 3 properties: filename, text, and
    *        executionContext.
    */
-  getState: function SP_getState()
-  {
+  getState: function SP_getState() {
     return {
       filename: this.filename,
       text: this.getText(),
       executionContext: this.executionContext,
       saved: !this.dirty
     };
   },
 
   /**
    * Set the filename and execution context using the given state. Called
    * when scratchpad is being restored from a previous session.
    *
    * @param object aState
    *        An object with filename and executionContext properties.
    */
-  setState: function SP_setState(aState)
-  {
-    if (aState.filename)
+  setState: function SP_setState(aState) {
+    if (aState.filename) {
       this.setFilename(aState.filename);
+    }
 
     this.dirty = !aState.saved;
 
-    if (aState.executionContext == SCRATCHPAD_CONTEXT_BROWSER)
+    if (aState.executionContext == SCRATCHPAD_CONTEXT_BROWSER) {
       this.setBrowserContext();
-    else
+    } else {
       this.setContentContext();
+    }
   },
 
   /**
    * Get the most recent main chrome browser window
    */
-  get browserWindow()
-  {
+  get browserWindow() {
     return Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
   },
 
   /**
    * Get the gBrowser object of the most recent browser window.
    */
-  get gBrowser()
-  {
+  get gBrowser() {
     let recentWin = this.browserWindow;
     return recentWin ? recentWin.gBrowser : null;
   },
 
   /**
    * Unique name for the current Scratchpad instance. Used to distinguish
    * Scratchpad windows between each other. See bug 661762.
    */
-  get uniqueName()
-  {
+  get uniqueName() {
     return "Scratchpad/" + this._instanceId;
   },
 
-
   /**
    * Sidebar that contains the VariablesView for object inspection.
    */
-  get sidebar()
-  {
+  get sidebar() {
     if (!this._sidebar) {
       this._sidebar = new ScratchpadSidebar(this);
     }
     return this._sidebar;
   },
 
   /**
    * Replaces context of an editor with provided value (a string).
    * Note: this method is simply a shortcut to editor.setText.
    */
-  setText: function SP_setText(value)
-  {
+  setText: function SP_setText(value) {
     return this.editor.setText(value);
   },
 
   /**
    * Evaluate a string in the currently desired context, that is either the
    * chrome window or the tab content window object.
    *
    * @param string aString
    *        The script you want to evaluate.
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  evaluate: function SP_evaluate(aString)
-  {
+  evaluate: function SP_evaluate(aString) {
     let connection;
     if (this.target) {
       connection = ScratchpadTarget.consoleFor(this.target);
-    }
-    else if (this.executionContext == SCRATCHPAD_CONTEXT_CONTENT) {
+    } else if (this.executionContext == SCRATCHPAD_CONTEXT_CONTENT) {
       connection = ScratchpadTab.consoleFor(this.gBrowser.selectedTab);
-    }
-    else {
+    } else {
       connection = ScratchpadWindow.consoleFor(this.browserWindow);
     }
 
     let evalOptions = { url: this.uniqueName };
 
     return connection.then(({ debuggerClient, webConsoleClient }) => {
       let deferred = defer();
 
       webConsoleClient.evaluateJSAsync(aString, aResponse => {
         this.debuggerClient = debuggerClient;
         this.webConsoleClient = webConsoleClient;
         if (aResponse.error) {
           deferred.reject(aResponse);
-        }
-        else if (aResponse.exception !== null) {
+        } else if (aResponse.exception !== null) {
           deferred.resolve([aString, aResponse]);
-        }
-        else {
+        } else {
           deferred.resolve([aString, undefined, aResponse.result]);
         }
       }, evalOptions);
 
       return deferred.promise;
     });
   },
 
   /**
    * Execute the selected text (if any) or the entire editor content in the
    * current context.
    *
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  execute: function SP_execute()
-  {
+  execute: function SP_execute() {
     WebConsoleUtils.usageCount++;
     let selection = this.editor.getSelection() || this.getText();
     return this.evaluate(selection);
   },
 
   /**
    * Execute the selected text (if any) or the entire editor content in the
    * current context.
    *
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  run: function SP_run()
-  {
+  run: function SP_run() {
     let deferred = defer();
     let reject = aReason => deferred.reject(aReason);
 
     this.execute().then(([aString, aError, aResult]) => {
       let resolve = () => deferred.resolve([aString, aError, aResult]);
 
       if (aError) {
         this.writeAsErrorComment(aError).then(resolve, reject);
-      }
-      else {
+      } else {
         this.editor.dropSelection();
         resolve();
       }
     }, reject);
 
     return deferred.promise;
   },
 
   /**
    * Execute the selected text (if any) or the entire editor content in the
    * current context. The resulting object is inspected up in the sidebar.
    *
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  inspect: function SP_inspect()
-  {
+  inspect: function SP_inspect() {
     let deferred = defer();
     let reject = aReason => deferred.reject(aReason);
 
     this.execute().then(([aString, aError, aResult]) => {
       let resolve = () => deferred.resolve([aString, aError, aResult]);
 
       if (aError) {
         this.writeAsErrorComment(aError).then(resolve, reject);
-      }
-      else {
+      } else {
         this.editor.dropSelection();
         this.sidebar.open(aString, aResult).then(resolve, reject);
       }
     }, reject);
 
     return deferred.promise;
   },
 
   /**
    * Reload the current page and execute the entire editor content when
    * the page finishes loading. Note that this operation should be available
    * only in the content context.
    *
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  reloadAndRun: function SP_reloadAndRun()
-  {
+  reloadAndRun: function SP_reloadAndRun() {
     let deferred = defer();
 
     if (this.executionContext !== SCRATCHPAD_CONTEXT_CONTENT) {
-      console.error(this.strings.
-                    GetStringFromName("scratchpadContext.invalid"));
+      console.error(this.strings
+                    .GetStringFromName("scratchpadContext.invalid"));
       return;
     }
 
     let target = TargetFactory.forTab(this.gBrowser.selectedTab);
     target.once("navigate", () => {
       this.run().then(results => deferred.resolve(results));
     });
     target.makeRemote().then(() => target.activeTab.reload());
@@ -626,38 +602,34 @@ var Scratchpad = {
    * Execute the selected text (if any) or the entire editor content in the
    * current context. The evaluation result is inserted into the editor after
    * the selected text, or at the end of the editor content if there is no
    * selected text.
    *
    * @return Promise
    *         The promise for the script evaluation result.
    */
-  display: function SP_display()
-  {
+  display: function SP_display() {
     let deferred = defer();
     let reject = aReason => deferred.reject(aReason);
 
     this.execute().then(([aString, aError, aResult]) => {
       let resolve = () => deferred.resolve([aString, aError, aResult]);
 
       if (aError) {
         this.writeAsErrorComment(aError).then(resolve, reject);
-      }
-      else if (VariablesView.isPrimitive({ value: aResult })) {
+      } else if (VariablesView.isPrimitive({ value: aResult })) {
         this._writePrimitiveAsComment(aResult).then(resolve, reject);
-      }
-      else {
+      } else {
         let objectClient = new ObjectClient(this.debuggerClient, aResult);
         objectClient.getDisplayString(aResponse => {
           if (aResponse.error) {
             reportError("display", aResponse);
             reject(aResponse);
-          }
-          else {
+          } else {
             this.writeAsComment(aResponse.displayString);
             resolve();
           }
         });
       }
     }, reject);
 
     return deferred.promise;
@@ -716,17 +688,17 @@ var Scratchpad = {
   },
 
   /**
    * Determine if the given AST node location contains the given cursor
    * position.
    *
    * @returns Boolean
    */
-  _containsCursor: function (aLoc, aCursorPos) {
+  _containsCursor: function(aLoc, aCursorPos) {
     // Our line numbers are 1-based, while CodeMirror's are 0-based.
     const lineNumber = aCursorPos.line + 1;
     const columnNumber = aCursorPos.ch;
 
     if (aLoc.start.line <= lineNumber && aLoc.end.line >= lineNumber) {
       if (aLoc.start.line === aLoc.end.line) {
         return aLoc.start.column <= columnNumber
           && aLoc.end.column >= columnNumber;
@@ -869,49 +841,45 @@ var Scratchpad = {
    * to be printed directly (number, string) as well as grips to values
    * (null, undefined, longString).
    *
    * @param any aValue
    *        The value to print.
    * @return Promise
    *         The promise that resolves after the value has been printed.
    */
-  _writePrimitiveAsComment: function SP__writePrimitiveAsComment(aValue)
-  {
+  _writePrimitiveAsComment: function SP__writePrimitiveAsComment(aValue) {
     let deferred = defer();
 
     if (aValue.type == "longString") {
       let client = this.webConsoleClient;
       client.longString(aValue).substring(0, aValue.length, aResponse => {
         if (aResponse.error) {
           reportError("display", aResponse);
           deferred.reject(aResponse);
-        }
-        else {
+        } else {
           deferred.resolve(aResponse.substring);
         }
       });
-    }
-    else {
+    } else {
       deferred.resolve(aValue.type || aValue);
     }
 
     return deferred.promise.then(aComment => {
       this.writeAsComment(aComment);
     });
   },
 
   /**
    * Write out a value at the next line from the current insertion point.
    * The comment block will always be preceded by a newline character.
    * @param object aValue
    *        The Object to write out as a string
    */
-  writeAsComment: function SP_writeAsComment(aValue)
-  {
+  writeAsComment: function SP_writeAsComment(aValue) {
     let value = "\n/*\n" + aValue + "\n*/";
 
     if (this.editor.somethingSelected()) {
       let from = this.editor.getCursor("end");
       this.editor.replaceSelection(this.editor.getSelection() + value);
       let to = this.editor.getPosition(this.editor.getOffset(from) + value.length);
       this.editor.setSelection(from, to);
       return;
@@ -928,35 +896,32 @@ var Scratchpad = {
    * Write out an error at the current insertion point as a block comment
    * @param object aValue
    *        The error object to write out the message and stack trace. It must
    *        contain an |exception| property with the actual error thrown, but it
    *        will often be the entire response of an evaluateJS request.
    * @return Promise
    *         The promise that indicates when writing the comment completes.
    */
-  writeAsErrorComment: function SP_writeAsErrorComment(aError)
-  {
+  writeAsErrorComment: function SP_writeAsErrorComment(aError) {
     let deferred = defer();
 
     if (VariablesView.isPrimitive({ value: aError.exception })) {
       let error = aError.exception;
       let type = error.type;
       if (type == "undefined" ||
           type == "null" ||
           type == "Infinity" ||
           type == "-Infinity" ||
           type == "NaN" ||
           type == "-0") {
         deferred.resolve(type);
-      }
-      else if (type == "longString") {
+      } else if (type == "longString") {
         deferred.resolve(error.initial + "\u2026");
-      }
-      else {
+      } else {
         deferred.resolve(error);
       }
     } else if ("preview" in aError.exception) {
       let error = aError.exception;
       let stack = this._constructErrorStack(error.preview);
       if (typeof aError.exceptionMessage == "string") {
         deferred.resolve(aError.exceptionMessage + stack);
       } else {
@@ -982,26 +947,23 @@ var Scratchpad = {
         for (let key of Object.keys(ownProperties)) {
           error[key] = ownProperties[key].value;
         }
 
         let stack = this._constructErrorStack(error);
 
         if (typeof error.message == "string") {
           deferred.resolve(error.message + stack);
-        }
-        else {
+        } else {
           objectClient.getDisplayString(aResponse => {
             if (aResponse.error) {
               deferred.reject(aResponse);
-            }
-            else if (typeof aResponse.displayString == "string") {
+            } else if (typeof aResponse.displayString == "string") {
               deferred.resolve(aResponse.displayString + stack);
-            }
-            else {
+            } else {
               deferred.resolve(stack);
             }
           });
         }
       });
     }
 
     return deferred.promise.then(aMessage => {
@@ -1043,18 +1005,17 @@ var Scratchpad = {
 
   // Menu Operations
 
   /**
    * Open a new Scratchpad window.
    *
    * @return nsIWindow
    */
-  openScratchpad: function SP_openScratchpad()
-  {
+  openScratchpad: function SP_openScratchpad() {
     return ScratchpadManager.openScratchpad();
   },
 
   /**
    * Export the textbox content to a file.
    *
    * @param nsIFile aFile
    *        The file where you want to save the textbox content.
@@ -1064,21 +1025,20 @@ var Scratchpad = {
    *        True if you do not want to display an error when file save fails,
    *        false otherwise.
    * @param function aCallback
    *        Optional function you want to call when file save completes. It will
    *        get the following arguments:
    *        1) the nsresult status code for the export operation.
    */
   exportToFile: function SP_exportToFile(aFile, aNoConfirmation, aSilentError,
-                                         aCallback)
-  {
+                                         aCallback) {
     if (!aNoConfirmation && aFile.exists() &&
-        !window.confirm(this.strings.
-                        GetStringFromName("export.fileOverwriteConfirmation"))) {
+        !window.confirm(this.strings
+                        .GetStringFromName("export.fileOverwriteConfirmation"))) {
       return;
     }
 
     let encoder = new TextEncoder();
     let buffer = encoder.encode(this.getText());
     let writePromise = OS.File.writeAtomic(aFile.path, buffer, {tmpPath: aFile.path + ".tmp"});
     writePromise.then(value => {
       if (aCallback) {
@@ -1087,29 +1047,28 @@ var Scratchpad = {
     }, reason => {
       if (!aSilentError) {
         window.alert(this.strings.GetStringFromName("saveFile.failed"));
       }
       if (aCallback) {
         aCallback.call(this, Cr.NS_ERROR_UNEXPECTED);
       }
     });
-
   },
 
   /**
    * Get a list of applicable charsets.
    * The best charset, defaulting to "UTF-8"
    *
    * @param string aBestCharset
    * @return array of strings
    */
   _getApplicableCharsets: function SP__getApplicableCharsets(aBestCharset = "UTF-8") {
     let charsets = Services.prefs.getCharPref(
-      FALLBACK_CHARSET_LIST).split(",").filter(function (value) {
+      FALLBACK_CHARSET_LIST).split(",").filter(function(value) {
         return value.length;
       });
     charsets.unshift(aBestCharset);
     return charsets;
   },
 
   /**
    * Get content converted to unicode, using a list of input charset to try.
@@ -1148,18 +1107,17 @@ var Scratchpad = {
    *        True if you do not want to display an error when file load fails,
    *        false otherwise.
    * @param function aCallback
    *        Optional function you want to call when file load completes. It will
    *        get the following arguments:
    *        1) the nsresult status code for the import operation.
    *        2) the data that was read from the file, if any.
    */
-  importFromFile: function SP_importFromFile(aFile, aSilentError, aCallback)
-  {
+  importFromFile: function SP_importFromFile(aFile, aSilentError, aCallback) {
     // Prevent file type detection.
     let channel = NetUtil.newChannel({
       uri: NetUtil.newURI(aFile),
       loadingNode: window.document,
       securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
       contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER});
     channel.contentType = "application/javascript";
 
@@ -1197,50 +1155,48 @@ var Scratchpad = {
         if (chrome && modeline["-sp-context"] === "browser") {
           this.setBrowserContext();
         }
 
         this.editor.setText(content);
         this.editor.clearHistory();
         this.dirty = false;
         document.getElementById("sp-cmd-revert").setAttribute("disabled", true);
-      }
-      else if (!aSilentError) {
+      } else if (!aSilentError) {
         window.alert(this.strings.GetStringFromName("openFile.failed"));
       }
       this.setFilename(aFile.path);
       this.setRecentFile(aFile);
       if (aCallback) {
         aCallback.call(this, aStatus, content);
       }
     });
   },
 
   /**
    * Open a file to edit in the Scratchpad.
    *
    * @param integer aIndex
    *        Optional integer: clicked menuitem in the 'Open Recent'-menu.
    */
-  openFile: function SP_openFile(aIndex)
-  {
+  openFile: function SP_openFile(aIndex) {
     let promptCallback = aFile => {
       this.promptSave((aCloseFile, aSaved, aStatus) => {
         let shouldOpen = aCloseFile;
         if (aSaved && !Components.isSuccessCode(aStatus)) {
           shouldOpen = false;
         }
 
         if (shouldOpen) {
           let file;
           if (aFile) {
             file = aFile;
           } else {
-            file = Cc["@mozilla.org/file/local;1"].
-                   createInstance(Ci.nsIFile);
+            file = Cc["@mozilla.org/file/local;1"]
+                   .createInstance(Ci.nsIFile);
             let filePath = this.getRecentFiles()[aIndex];
             file.initWithPath(filePath);
           }
 
           if (!file.exists()) {
             this.notificationBox.appendNotification(
               this.strings.GetStringFromName("fileNoLongerExists.notification"),
               "file-no-longer-exists",
@@ -1275,18 +1231,17 @@ var Scratchpad = {
   },
 
   /**
    * Get recent files.
    *
    * @return Array
    *         File paths.
    */
-  getRecentFiles: function SP_getRecentFiles()
-  {
+  getRecentFiles: function SP_getRecentFiles() {
     let branch = Services.prefs.getBranch("devtools.scratchpad.");
     let filePaths = [];
 
     // WARNING: Do not use getCharPref here, it doesn't play nicely with
     // Unicode strings.
 
     if (branch.prefHasUserValue("recentFilePaths")) {
       let data = branch.getStringPref("recentFilePaths");
@@ -1297,18 +1252,17 @@ var Scratchpad = {
   },
 
   /**
    * Save a recent file in a JSON parsable string.
    *
    * @param nsIFile aFile
    *        The nsIFile we want to save as a recent file.
    */
-  setRecentFile: function SP_setRecentFile(aFile)
-  {
+  setRecentFile: function SP_setRecentFile(aFile) {
     let maxRecent = Services.prefs.getIntPref(PREF_RECENT_FILES_MAX);
     if (maxRecent < 1) {
       return;
     }
 
     let filePaths = this.getRecentFiles();
     let filesCount = filePaths.length;
     let pathIndex = filePaths.indexOf(aFile.path);
@@ -1338,18 +1292,17 @@ var Scratchpad = {
 
     Services.prefs.getBranch("devtools.scratchpad.")
             .setStringPref("recentFilePaths", JSON.stringify(filePaths));
   },
 
   /**
    * Populates the 'Open Recent'-menu.
    */
-  populateRecentFilesMenu: function SP_populateRecentFilesMenu()
-  {
+  populateRecentFilesMenu: function SP_populateRecentFilesMenu() {
     let maxRecent = Services.prefs.getIntPref(PREF_RECENT_FILES_MAX);
     let recentFilesMenu = document.getElementById("sp-open_recent-menu");
 
     if (maxRecent < 1) {
       recentFilesMenu.setAttribute("hidden", true);
       return;
     }
 
@@ -1379,53 +1332,50 @@ var Scratchpad = {
         menuitem.addEventListener("command", Scratchpad.openFile.bind(Scratchpad, i));
         recentFilesPopup.appendChild(menuitem);
       }
 
       recentFilesPopup.appendChild(document.createElement("menuseparator"));
       let clearItems = document.createElement("menuitem");
       clearItems.setAttribute("id", "sp-menu-clear_recent");
       clearItems.setAttribute("label",
-                              this.strings.
-                              GetStringFromName("clearRecentMenuItems.label"));
+                              this.strings
+                              .GetStringFromName("clearRecentMenuItems.label"));
       clearItems.setAttribute("command", "sp-cmd-clearRecentFiles");
       recentFilesPopup.appendChild(clearItems);
     }
   },
 
   /**
    * Clear a range of files from the list.
    *
    * @param integer aIndex
    *        Index of file in menu to remove.
    * @param integer aLength
    *        Number of files from the index 'aIndex' to remove.
    */
-  clearFiles: function SP_clearFile(aIndex, aLength)
-  {
+  clearFiles: function SP_clearFile(aIndex, aLength) {
     let filePaths = this.getRecentFiles();
     filePaths.splice(aIndex, aLength);
 
     Services.prefs.getBranch("devtools.scratchpad.")
             .setStringPref("recentFilePaths", JSON.stringify(filePaths));
   },
 
   /**
    * Clear all recent files.
    */
-  clearRecentFiles: function SP_clearRecentFiles()
-  {
+  clearRecentFiles: function SP_clearRecentFiles() {
     Services.prefs.clearUserPref("devtools.scratchpad.recentFilePaths");
   },
 
   /**
    * Handle changes to the 'PREF_RECENT_FILES_MAX'-preference.
    */
-  handleRecentFileMaxChange: function SP_handleRecentFileMaxChange()
-  {
+  handleRecentFileMaxChange: function SP_handleRecentFileMaxChange() {
     let maxRecent = Services.prefs.getIntPref(PREF_RECENT_FILES_MAX);
     let menu = document.getElementById("sp-open_recent-menu");
 
     // Hide the menu if the 'PREF_RECENT_FILES_MAX'-pref is set to zero or less.
     if (maxRecent < 1) {
       menu.setAttribute("hidden", true);
     } else {
       if (menu.hasAttribute("hidden")) {
@@ -1444,18 +1394,17 @@ var Scratchpad = {
     }
   },
   /**
    * Save the textbox content to the currently open file.
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved
    */
-  saveFile: function SP_saveFile(aCallback)
-  {
+  saveFile: function SP_saveFile(aCallback) {
     if (!this.filename) {
       return this.saveFileAs(aCallback);
     }
 
     let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
     file.initWithPath(this.filename);
 
     this.exportToFile(file, true, false, aStatus => {
@@ -1471,18 +1420,17 @@ var Scratchpad = {
   },
 
   /**
    * Save the textbox content to a new file.
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved
    */
-  saveFileAs: function SP_saveFileAs(aCallback)
-  {
+  saveFileAs: function SP_saveFileAs(aCallback) {
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     let fpCallback = aResult => {
       if (aResult != Ci.nsIFilePicker.returnCancel) {
         this.setFilename(fp.file.path);
         this.exportToFile(fp.file, true, false, aStatus => {
           if (Components.isSuccessCode(aStatus)) {
             this.dirty = false;
             this.setRecentFile(fp.file);
@@ -1503,18 +1451,17 @@ var Scratchpad = {
   },
 
   /**
    * Restore content from saved version of current file.
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved
    */
-  revertFile: function SP_revertFile(aCallback)
-  {
+  revertFile: function SP_revertFile(aCallback) {
     let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
     file.initWithPath(this.filename);
 
     if (!file.exists()) {
       return;
     }
 
     this.importFromFile(file, false, (aStatus, aContent) => {
@@ -1529,18 +1476,17 @@ var Scratchpad = {
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved. The callback
    *        receives three arguments:
    *          - aRevert (boolean) - tells if the file has been reverted.
    *          - status (number) - the file revert status result (if the file was
    *          saved).
    */
-  promptRevert: function SP_promptRervert(aCallback)
-  {
+  promptRevert: function SP_promptRervert(aCallback) {
     if (this.filename) {
       let ps = Services.prompt;
       let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_REVERT +
                   ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
 
       let button = ps.confirmEx(window,
                           this.strings.GetStringFromName("confirmRevert.title"),
                           this.strings.GetStringFromName("confirmRevert"),
@@ -1565,53 +1511,49 @@ var Scratchpad = {
     if (aCallback) {
       aCallback(false);
     }
   },
 
   /**
    * Open the Error Console.
    */
-  openErrorConsole: function SP_openErrorConsole()
-  {
+  openErrorConsole: function SP_openErrorConsole() {
     HUDService.toggleBrowserConsole();
   },
 
   /**
    * Open the Web Console.
    */
-  openWebConsole: function SP_openWebConsole()
-  {
+  openWebConsole: function SP_openWebConsole() {
     let target = TargetFactory.forTab(this.gBrowser.selectedTab);
     gDevTools.showToolbox(target, "webconsole");
     this.browserWindow.focus();
   },
 
   /**
    * Set the current execution context to be the active tab content window.
    */
-  setContentContext: function SP_setContentContext()
-  {
+  setContentContext: function SP_setContentContext() {
     if (this.executionContext == SCRATCHPAD_CONTEXT_CONTENT) {
       return;
     }
 
     let content = document.getElementById("sp-menu-content");
     document.getElementById("sp-menu-browser").removeAttribute("checked");
     document.getElementById("sp-cmd-reloadAndRun").removeAttribute("disabled");
     content.setAttribute("checked", true);
     this.executionContext = SCRATCHPAD_CONTEXT_CONTENT;
     this.notificationBox.removeAllNotifications(false);
   },
 
   /**
    * Set the current execution context to be the most recent chrome window.
    */
-  setBrowserContext: function SP_setBrowserContext()
-  {
+  setBrowserContext: function SP_setBrowserContext() {
     if (this.executionContext == SCRATCHPAD_CONTEXT_BROWSER) {
       return;
     }
 
     let browser = document.getElementById("sp-menu-browser");
     let reloadAndRun = document.getElementById("sp-cmd-reloadAndRun");
 
     document.getElementById("sp-menu-content").removeAttribute("checked");
@@ -1629,38 +1571,35 @@ var Scratchpad = {
 
   /**
    * Gets the ID of the inner window of the given DOM window object.
    *
    * @param nsIDOMWindow aWindow
    * @return integer
    *         the inner window ID
    */
-  getInnerWindowId: function SP_getInnerWindowId(aWindow)
-  {
-    return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
-           getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
+  getInnerWindowId: function SP_getInnerWindowId(aWindow) {
+    return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+           .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
   },
 
-  updateStatusBar: function SP_updateStatusBar(aEventType)
-  {
+  updateStatusBar: function SP_updateStatusBar(aEventType) {
     var statusBarField = document.getElementById("statusbar-line-col");
     let { line, ch } = this.editor.getCursor();
     statusBarField.textContent = this.strings.formatStringFromName(
       "scratchpad.statusBarLineCol", [ line + 1, ch + 1], 2);
   },
 
   /**
    * The Scratchpad window load event handler. This method
    * initializes the Scratchpad window and source editor.
    *
    * @param nsIDOMEvent aEvent
    */
-  onLoad: function SP_onLoad(aEvent)
-  {
+  onLoad: function SP_onLoad(aEvent) {
     if (aEvent.target != document) {
       return;
     }
 
     let chrome = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED);
     if (chrome) {
       let environmentMenu = document.getElementById("sp-environment-menu");
       let errorConsoleCommand = document.getElementById("sp-cmd-errorConsole");
@@ -1726,18 +1665,19 @@ var Scratchpad = {
       editorElement.addEventListener("drop", this._onPaste);
       this.editor.on("saveRequested", () => this.saveFile());
       this.editor.focus();
       this.editor.setCursor({ line: lines.length, ch: lines.pop().length });
 
       // Add the commands controller for the source-editor.
       this.editor.insertCommandsController();
 
-      if (state)
+      if (state) {
         this.dirty = !state.saved;
+      }
 
       this.initialized = true;
       this._triggerObservers("Ready");
       this.populateRecentFilesMenu();
       PreferenceObserver.init();
       CloseObserver.init();
     }).catch(console.error);
     this._setupCommandListeners();
@@ -1754,52 +1694,49 @@ var Scratchpad = {
   },
 
   /**
    * The Source Editor "change" event handler. This function updates the
    * Scratchpad window title to show an asterisk when there are unsaved changes.
    *
    * @private
    */
-  _onChanged: function SP__onChanged()
-  {
+  _onChanged: function SP__onChanged() {
     Scratchpad._updateTitle();
 
     if (Scratchpad.filename) {
-      if (Scratchpad.dirty)
+      if (Scratchpad.dirty) {
         document.getElementById("sp-cmd-revert").removeAttribute("disabled");
-      else
+      } else {
         document.getElementById("sp-cmd-revert").setAttribute("disabled", true);
+      }
     }
   },
 
   /**
    * Undo the last action of the user.
    */
-  undo: function SP_undo()
-  {
+  undo: function SP_undo() {
     this.editor.undo();
   },
 
   /**
    * Redo the previously undone action.
    */
-  redo: function SP_redo()
-  {
+  redo: function SP_redo() {
     this.editor.redo();
   },
 
   /**
    * The Scratchpad window unload event handler. This method unloads/destroys
    * the source editor.
    *
    * @param nsIDOMEvent aEvent
    */
-  onUnload: function SP_onUnload(aEvent)
-  {
+  onUnload: function SP_onUnload(aEvent) {
     if (aEvent.target != document) {
       return;
     }
 
     // This event is created only after user uses 'reload and run' feature.
     if (this._reloadAndRunEvent && this.gBrowser) {
       this.gBrowser.selectedBrowser.removeEventListener("load",
           this._reloadAndRunEvent, true);
@@ -1842,18 +1779,17 @@ var Scratchpad = {
    *        receives three arguments:
    *          - toClose (boolean) - tells if the window should be closed.
    *          - saved (boolen) - tells if the file has been saved.
    *          - status (number) - the file save status result (if the file was
    *          saved).
    * @return boolean
    *         Whether the window should be closed
    */
-  promptSave: function SP_promptSave(aCallback)
-  {
+  promptSave: function SP_promptSave(aCallback) {
     if (this.dirty) {
       let ps = Services.prompt;
       let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_SAVE +
                   ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL +
                   ps.BUTTON_POS_2 * ps.BUTTON_TITLE_DONT_SAVE;
 
       let button = ps.confirmEx(window,
                           this.strings.GetStringFromName("confirmClose.title"),
@@ -1887,31 +1823,29 @@ var Scratchpad = {
    * Handler for window close event. Prompts to save scratchpad if
    * there are unsaved changes.
    *
    * @param nsIDOMEvent aEvent
    * @param function aCallback
    *        Optional function you want to call when file is saved/closed.
    *        Used mainly for tests.
    */
-  onClose: function SP_onClose(aEvent, aCallback)
-  {
+  onClose: function SP_onClose(aEvent, aCallback) {
     aEvent.preventDefault();
     this.close(aCallback);
   },
 
   /**
    * Close the scratchpad window. Prompts before closing if the scratchpad
    * has unsaved changes.
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved
    */
-  close: function SP_close(aCallback)
-  {
+  close: function SP_close(aCallback) {
     let shouldClose;
 
     this.promptSave((aShouldClose, aSaved, aStatus) => {
       shouldClose = aShouldClose;
       if (aSaved && !Components.isSuccessCode(aStatus)) {
         shouldClose = false;
       }
 
@@ -1925,28 +1859,26 @@ var Scratchpad = {
     });
 
     return shouldClose;
   },
 
   /**
    * Toggle a editor's boolean option.
    */
-  toggleEditorOption: function SP_toggleEditorOption(optionName, optionPreference)
-  {
+  toggleEditorOption: function SP_toggleEditorOption(optionName, optionPreference) {
     let newOptionValue = !this.editor.getOption(optionName);
     this.editor.setOption(optionName, newOptionValue);
     Services.prefs.setBoolPref(optionPreference, newOptionValue);
   },
 
   /**
    * Increase the editor's font size by 1 px.
    */
-  increaseFontSize: function SP_increaseFontSize()
-  {
+  increaseFontSize: function SP_increaseFontSize() {
     let size = this.editor.getFontSize();
 
     if (size < MAXIMUM_FONT_SIZE) {
       let newFontSize = size + 1;
       this.editor.setFontSize(newFontSize);
       Services.prefs.setIntPref(EDITOR_FONT_SIZE, newFontSize);
 
       if (newFontSize === MAXIMUM_FONT_SIZE) {
@@ -1955,18 +1887,17 @@ var Scratchpad = {
 
       document.getElementById("sp-cmd-smaller-font").removeAttribute("disabled");
     }
   },
 
   /**
    * Decrease the editor's font size by 1 px.
    */
-  decreaseFontSize: function SP_decreaseFontSize()
-  {
+  decreaseFontSize: function SP_decreaseFontSize() {
     let size = this.editor.getFontSize();
 
     if (size > MINIMUM_FONT_SIZE) {
       let newFontSize = size - 1;
       this.editor.setFontSize(newFontSize);
       Services.prefs.setIntPref(EDITOR_FONT_SIZE, newFontSize);
 
       if (newFontSize === MINIMUM_FONT_SIZE) {
@@ -1975,18 +1906,17 @@ var Scratchpad = {
     }
 
     document.getElementById("sp-cmd-larger-font").removeAttribute("disabled");
   },
 
   /**
    * Restore the editor's original font size.
    */
-  normalFontSize: function SP_normalFontSize()
-  {
+  normalFontSize: function SP_normalFontSize() {
     this.editor.setFontSize(NORMAL_FONT_SIZE);
     Services.prefs.setIntPref(EDITOR_FONT_SIZE, NORMAL_FONT_SIZE);
 
     document.getElementById("sp-cmd-larger-font").removeAttribute("disabled");
     document.getElementById("sp-cmd-smaller-font").removeAttribute("disabled");
   },
 
   _observers: [],
@@ -1999,46 +1929,43 @@ var Scratchpad = {
    *                 Arguments: (Scratchpad aScratchpad)
    * }
    *
    * All observer handlers are optional.
    *
    * @param IScratchpadObserver aObserver
    * @see removeObserver
    */
-  addObserver: function SP_addObserver(aObserver)
-  {
+  addObserver: function SP_addObserver(aObserver) {
     this._observers.push(aObserver);
   },
 
   /**
    * Remove an observer for Scratchpad events.
    *
    * @param IScratchpadObserver aObserver
    * @see addObserver
    */
-  removeObserver: function SP_removeObserver(aObserver)
-  {
+  removeObserver: function SP_removeObserver(aObserver) {
     let index = this._observers.indexOf(aObserver);
     if (index != -1) {
       this._observers.splice(index, 1);
     }
   },
 
   /**
    * Trigger named handlers in Scratchpad observers.
    *
    * @param string aName
    *        Name of the handler to trigger.
    * @param Array aArgs
    *        Optional array of arguments to pass to the observer(s).
    * @see addObserver
    */
-  _triggerObservers: function SP_triggerObservers(aName, aArgs)
-  {
+  _triggerObservers: function SP_triggerObservers(aName, aArgs) {
     // insert this Scratchpad instance as the first argument
     if (!aArgs) {
       aArgs = [this];
     } else {
       aArgs.unshift(this);
     }
 
     // trigger all observers that implement this named handler
@@ -2049,73 +1976,67 @@ var Scratchpad = {
         handler.apply(observer, aArgs);
       }
     }
   },
 
   /**
    * Opens the MDN documentation page for Scratchpad.
    */
-  openDocumentationPage: function SP_openDocumentationPage()
-  {
+  openDocumentationPage: function SP_openDocumentationPage() {
     let url = this.strings.GetStringFromName("help.openDocumentationPage");
-    this.browserWindow.openUILinkIn(url,"tab");
+    this.browserWindow.openUILinkIn(url, "tab");
     this.browserWindow.focus();
   },
 };
 
-
 /**
  * Represents the DebuggerClient connection to a specific tab as used by the
  * Scratchpad.
  *
  * @param object aTab
  *              The tab to connect to.
  */
-function ScratchpadTab(aTab)
-{
+function ScratchpadTab(aTab) {
   this._tab = aTab;
 }
 
 var scratchpadTargets = new WeakMap();
 
 /**
  * Returns the object containing the DebuggerClient and WebConsoleClient for a
  * given tab or window.
  *
  * @param object aSubject
  *        The tab or window to obtain the connection for.
  * @return Promise
  *         The promise for the connection information.
  */
-ScratchpadTab.consoleFor = function consoleFor(aSubject)
-{
+ScratchpadTab.consoleFor = function consoleFor(aSubject) {
   if (!scratchpadTargets.has(aSubject)) {
     scratchpadTargets.set(aSubject, new this(aSubject));
   }
   return scratchpadTargets.get(aSubject).connect(aSubject);
 };
 
-
 ScratchpadTab.prototype = {
   /**
    * The promise for the connection.
    */
   _connector: null,
 
   /**
    * Initialize a debugger client and connect it to the debugger server.
    *
    * @param object aSubject
    *        The tab or window to obtain the connection for.
    * @return Promise
    *         The promise for the result of connecting to this tab or window.
    */
-  connect: function ST_connect(aSubject)
-  {
+  connect: function ST_connect(aSubject) {
     if (this._connector) {
       return this._connector;
     }
 
     let deferred = defer();
     this._connector = deferred.promise;
 
     let connectTimer = setTimeout(() => {
@@ -2129,18 +2050,17 @@ ScratchpadTab.prototype = {
 
     this._attach(aSubject).then(aTarget => {
       let consoleActor = aTarget.form.consoleActor;
       let client = aTarget.client;
       client.attachConsole(consoleActor, [], (aResponse, aWebConsoleClient) => {
         if (aResponse.error) {
           reportError("attachConsole", aResponse);
           deferred.reject(aResponse);
-        }
-        else {
+        } else {
           deferred.resolve({
             webConsoleClient: aWebConsoleClient,
             debuggerClient: client
           });
         }
       });
     });
 
@@ -2150,84 +2070,76 @@ ScratchpadTab.prototype = {
   /**
    * Attach to this tab.
    *
    * @param object aSubject
    *        The tab or window to obtain the connection for.
    * @return Promise
    *         The promise for the TabTarget for this tab.
    */
-  _attach: function ST__attach(aSubject)
-  {
+  _attach: function ST__attach(aSubject) {
     let target = TargetFactory.forTab(this._tab);
     target.once("close", () => {
       if (scratchpadTargets) {
         scratchpadTargets.delete(aSubject);
       }
     });
     return target.makeRemote().then(() => target);
   },
 };
 
-
 /**
  * Represents the DebuggerClient connection to a specific window as used by the
  * Scratchpad.
  */
 function ScratchpadWindow() {}
 
 ScratchpadWindow.consoleFor = ScratchpadTab.consoleFor;
 
 ScratchpadWindow.prototype = extend(ScratchpadTab.prototype, {
   /**
    * Attach to this window.
    *
    * @return Promise
    *         The promise for the target for this window.
    */
-  _attach: function SW__attach()
-  {
+  _attach: function SW__attach() {
     DebuggerServer.init();
     DebuggerServer.registerAllActors();
     DebuggerServer.allowChromeProcess = true;
 
     let client = new DebuggerClient(DebuggerServer.connectPipe());
     return client.connect()
       .then(() => client.getProcess())
       .then(aResponse => {
         return { form: aResponse.form, client: client };
       });
   }
 });
 
-
-function ScratchpadTarget(aTarget)
-{
+function ScratchpadTarget(aTarget) {
   this._target = aTarget;
 }
 
 ScratchpadTarget.consoleFor = ScratchpadTab.consoleFor;
 
 ScratchpadTarget.prototype = extend(ScratchpadTab.prototype, {
-  _attach: function ST__attach()
-  {
+  _attach: function ST__attach() {
     if (this._target.isRemote) {
       return promise.resolve(this._target);
     }
     return this._target.makeRemote().then(() => this._target);
   }
 });
 
-
 /**
  * Encapsulates management of the sidebar containing the VariablesView for
  * object inspection.
  */
-function ScratchpadSidebar(aScratchpad)
-{
+function ScratchpadSidebar(aScratchpad) {
   // Make sure to decorate this object. ToolSidebar requires the parent
   // panel to support event (emit) API.
   EventEmitter.decorate(this);
 
   let ToolSidebar = require("devtools/client/framework/sidebar").ToolSidebar;
   let tabbox = document.querySelector("#scratchpad-sidebar");
   this._sidebar = new ToolSidebar(tabbox, this, "scratchpad");
   this._scratchpad = aScratchpad;
@@ -2255,27 +2167,25 @@ ScratchpadSidebar.prototype = {
    *
    * @param string aString
    *        The string that was evaluated.
    * @param object aObject
    *        The object to inspect, which is the aEvalString evaluation result.
    * @return Promise
    *         A promise that will resolve once the sidebar is open.
    */
-  open: function SS_open(aEvalString, aObject)
-  {
+  open: function SS_open(aEvalString, aObject) {
     this.show();
 
     let deferred = defer();
 
     let onTabReady = () => {
       if (this.variablesView) {
         this.variablesView.controller.releaseActors();
-      }
-      else {
+      } else {
         let window = this._sidebar.getWindowForTab("variablesview");
         let container = window.document.querySelector("#variables");
 
         this.variablesView = new VariablesView(container, {
           searchEnabled: true,
           searchPlaceholder: this._scratchpad.strings
                              .GetStringFromName("propertiesFilterPlaceholder")
         });
@@ -2295,178 +2205,162 @@ ScratchpadSidebar.prototype = {
           }
         });
       }
       this._update(aObject).then(() => deferred.resolve());
     };
 
     if (this._sidebar.getCurrentTabID() == "variablesview") {
       onTabReady();
-    }
-    else {
+    } else {
       this._sidebar.once("variablesview-ready", onTabReady);
       this._sidebar.addTab("variablesview", VARIABLES_VIEW_URL, {selected: true});
     }
 
     return deferred.promise;
   },
 
   /**
    * Show the sidebar.
    */
-  show: function SS_show()
-  {
+  show: function SS_show() {
     if (!this.visible) {
       this.visible = true;
       this._sidebar.show();
     }
   },
 
   /**
    * Hide the sidebar.
    */
-  hide: function SS_hide()
-  {
+  hide: function SS_hide() {
     if (this.visible) {
       this.visible = false;
       this._sidebar.hide();
     }
   },
 
   /**
    * Destroy the sidebar.
    *
    * @return Promise
    *         The promise that resolves when the sidebar is destroyed.
    */
-  destroy: function SS_destroy()
-  {
+  destroy: function SS_destroy() {
     if (this.variablesView) {
       this.variablesView.controller.releaseActors();
       this.variablesView = null;
     }
     return this._sidebar.destroy();
   },
 
   /**
    * Update the object currently inspected by the sidebar.
    *
    * @param any aValue
    *        The JS value to inspect in the sidebar.
    * @return Promise
    *         A promise that resolves when the update completes.
    */
-  _update: function SS__update(aValue)
-  {
+  _update: function SS__update(aValue) {
     let options, onlyEnumVisible;
     if (VariablesView.isPrimitive({ value: aValue })) {
       options = { rawObject: { value: aValue } };
       onlyEnumVisible = true;
     } else {
       options = { objectActor: aValue };
       onlyEnumVisible = false;
     }
     let view = this.variablesView;
     view.onlyEnumVisible = onlyEnumVisible;
     view.empty();
     return view.controller.setSingleVariable(options).expanded;
   }
 };
 
-
 /**
  * Report an error coming over the remote debugger protocol.
  *
  * @param string aAction
  *        The name of the action or method that failed.
  * @param object aResponse
  *        The response packet that contains the error.
  */
-function reportError(aAction, aResponse)
-{
+function reportError(aAction, aResponse) {
   console.error(aAction + " failed: " + aResponse.error + " " +
                 aResponse.message);
 }
 
-
 /**
  * The PreferenceObserver listens for preference changes while Scratchpad is
  * running.
  */
 var PreferenceObserver = {
   _initialized: false,
 
-  init: function PO_init()
-  {
+  init: function PO_init() {
     if (this._initialized) {
       return;
     }
 
     this.branch = Services.prefs.getBranch("devtools.scratchpad.");
     this.branch.addObserver("", this);
     this._initialized = true;
   },
 
-  observe: function PO_observe(aMessage, aTopic, aData)
-  {
+  observe: function PO_observe(aMessage, aTopic, aData) {
     if (aTopic != "nsPref:changed") {
       return;
     }
 
     if (aData == "recentFilesMax") {
       Scratchpad.handleRecentFileMaxChange();
-    }
-    else if (aData == "recentFilePaths") {
+    } else if (aData == "recentFilePaths") {
       Scratchpad.populateRecentFilesMenu();
     }
   },
 
   uninit: function PO_uninit() {
     if (!this.branch) {
       return;
     }
 
     this.branch.removeObserver("", this);
     this.branch = null;
   }
 };
 
-
 /**
  * The CloseObserver listens for the last browser window closing and attempts to
  * close the Scratchpad.
  */
 var CloseObserver = {
-  init: function CO_init()
-  {
+  init: function CO_init() {
     Services.obs.addObserver(this, "browser-lastwindow-close-requested");
   },
 
-  observe: function CO_observe(aSubject)
-  {
+  observe: function CO_observe(aSubject) {
     if (Scratchpad.close()) {
       this.uninit();
-    }
-    else {
+    } else {
       aSubject.QueryInterface(Ci.nsISupportsPRBool);
       aSubject.data = true;
     }
   },
 
-  uninit: function CO_uninit()
-  {
+  uninit: function CO_uninit() {
     // Will throw exception if removeObserver is called twice.
     if (this._uninited) {
       return;
     }
 
     this._uninited = true;
     Services.obs.removeObserver(this, "browser-lastwindow-close-requested");
   },
 };
 
-XPCOMUtils.defineLazyGetter(Scratchpad, "strings", function () {
+XPCOMUtils.defineLazyGetter(Scratchpad, "strings", function() {
   return Services.strings.createBundle(SCRATCHPAD_L10N);
 });
 
 addEventListener("load", Scratchpad.onLoad.bind(Scratchpad), false);
 addEventListener("unload", Scratchpad.onUnload.bind(Scratchpad), false);
 addEventListener("close", Scratchpad.onClose.bind(Scratchpad), false);
--- a/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
@@ -9,17 +9,16 @@ const completions = ["toExponential", "t
 
 function test() {
   const options = { tabContent: "test scratchpad autocomplete" };
   openTabAndScratchpad(options)
     .then(Task.async(runTests))
     .then(finish, console.error);
 }
 
-
 async function runTests([win, sp]) {
   const {editor} = sp;
   const editorWin = editor.container.contentWindow;
 
   // Show the completions popup.
   sp.setText(source);
   sp.editor.setCursor({ line: 0, ch: source.length });
   await keyOnce("suggestion-entered", " ", { ctrlKey: true });
--- a/devtools/client/scratchpad/test/browser_scratchpad_browser_last_window_closing.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_browser_last_window_closing.js
@@ -1,44 +1,38 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const BUTTON_POSITION_CANCEL = 1;
 const BUTTON_POSITION_DONT_SAVE = 2;
 
-
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   // Observer must be attached *before* Scratchpad is opened.
   CloseObserver.init();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,<p>test browser last window closing</p>");
 }
 
-
-
-function runTests({ Scratchpad })
-{
+function runTests({ Scratchpad }) {
   let browser = Services.wm.getEnumerator("navigator:browser").getNext();
   let oldPrompt = Services.prompt;
   let button;
 
   Services.prompt = {
     confirmEx: () => button
   };
 
-
   Scratchpad.dirty = true;
 
   // Test canceling close.
   button = BUTTON_POSITION_CANCEL;
   CloseObserver.expectedValue = true;
   browser.BrowserTryToCloseWindow();
 
   // Test accepting close.
@@ -50,29 +44,25 @@ function runTests({ Scratchpad })
   Scratchpad.dirty = false;
   browser.BrowserTryToCloseWindow();
 
   Services.prompt = oldPrompt;
   CloseObserver.uninit();
   finish();
 }
 
-
 var CloseObserver = {
   expectedValue: null,
-  init: function ()
-  {
+  init: function() {
     Services.obs.addObserver(this, "browser-lastwindow-close-requested");
   },
 
-  observe: function (aSubject)
-  {
+  observe: function(aSubject) {
     aSubject.QueryInterface(Ci.nsISupportsPRBool);
     let message = this.expectedValue ? "close" : "stay open";
     ok(this.expectedValue === aSubject.data, "Expected browser to " + message);
     aSubject.data = true;
   },
 
-  uninit: function ()
-  {
+  uninit: function() {
     Services.obs.removeObserver(this, "browser-lastwindow-close-requested");
   },
 };
--- a/devtools/client/scratchpad/test/browser_scratchpad_chrome_context_pref.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_chrome_context_pref.js
@@ -1,48 +1,46 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 646070 */
 
 var DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,Scratchpad test for bug 646070 - chrome context preference");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
 
-  let environmentMenu = gScratchpadWindow.document.
-                          getElementById("sp-environment-menu");
+  let environmentMenu = gScratchpadWindow.document
+                          .getElementById("sp-environment-menu");
   ok(environmentMenu, "Environment menu element exists");
   ok(!environmentMenu.hasAttribute("hidden"),
      "Environment menu is visible");
 
-  let errorConsoleCommand = gScratchpadWindow.document.
-                            getElementById("sp-cmd-errorConsole");
+  let errorConsoleCommand = gScratchpadWindow.document
+                            .getElementById("sp-cmd-errorConsole");
   ok(errorConsoleCommand, "Error console command element exists");
   ok(!errorConsoleCommand.hasAttribute("disabled"),
      "Error console command is enabled");
 
-  let chromeContextCommand = gScratchpadWindow.document.
-                            getElementById("sp-cmd-browserContext");
+  let chromeContextCommand = gScratchpadWindow.document
+                            .getElementById("sp-cmd-browserContext");
   ok(chromeContextCommand, "Chrome context command element exists");
   ok(!chromeContextCommand.hasAttribute("disabled"),
      "Chrome context command is disabled");
 
   Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
 
   finish();
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_confirm_close.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_confirm_close.js
@@ -7,84 +7,79 @@ var tempScope = {};
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm", tempScope);
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm", tempScope);
 var NetUtil = tempScope.NetUtil;
 var FileUtils = tempScope.FileUtils;
 
 // only finish() when correct number of tests are done
 const expected = 9;
 var count = 0;
-function done()
-{
+function done() {
   if (++count == expected) {
     cleanup();
     finish();
   }
 }
 
 var gFile;
 
 var oldPrompt = Services.prompt;
 var promptButton = -1;
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gFile = createTempFile("fileForBug653427.tmp");
   writeFile(gFile, "text", testUnsaved.call(this));
 
   Services.prompt = {
-    confirmEx: function () {
+    confirmEx: function() {
       return promptButton;
     }
   };
 
   testNew();
   testSavedFile();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   content.location = "data:text/html,<p>test scratchpad save file prompt on closing";
 }
 
-function testNew()
-{
-  openScratchpad(function (win) {
-    win.Scratchpad.close(function () {
+function testNew() {
+  openScratchpad(function(win) {
+    win.Scratchpad.close(function() {
       ok(win.closed, "new scratchpad window should close without prompting");
       done();
     });
   }, {noFocus: true});
 }
 
-function testSavedFile()
-{
-  openScratchpad(function (win) {
+function testSavedFile() {
+  openScratchpad(function(win) {
     win.Scratchpad.filename = "test.js";
     win.Scratchpad.editor.dirty = false;
-    win.Scratchpad.close(function () {
+    win.Scratchpad.close(function() {
       ok(win.closed, "scratchpad from file with no changes should close");
       done();
     });
   }, {noFocus: true});
 }
 
-function testUnsaved()
-{
+function testUnsaved() {
   function setFilename(aScratchpad, aFile) {
     aScratchpad.setFilename(aFile);
   }
 
   testUnsavedFileCancel(setFilename);
   testUnsavedFileSave(setFilename);
   testUnsavedFileDontSave(setFilename);
   testCancelAfterLoad();
 
   function mockSaveFile(aScratchpad) {
-    let SaveFileStub = function (aCallback) {
+    let SaveFileStub = function(aCallback) {
       /*
        * An argument for aCallback must pass Components.isSuccessCode
        *
        * A version of isSuccessCode in JavaScript:
        *  function isSuccessCode(returnCode) {
        *    return (returnCode & 0x80000000) == 0;
        *  }
        */
@@ -96,135 +91,127 @@ function testUnsaved()
 
   // Run these tests again but this time without setting a filename to
   // test that Scratchpad always asks for confirmation on dirty editor.
   testUnsavedFileCancel(mockSaveFile);
   testUnsavedFileSave(mockSaveFile);
   testUnsavedFileDontSave();
 }
 
-function testUnsavedFileCancel(aCallback = function () {})
-{
-  openScratchpad(function (win) {
+function testUnsavedFileCancel(aCallback = function() {}) {
+  openScratchpad(function(win) {
     aCallback(win.Scratchpad, "test.js");
     win.Scratchpad.editor.dirty = true;
 
     promptButton = win.BUTTON_POSITION_CANCEL;
 
-    win.Scratchpad.close(function () {
+    win.Scratchpad.close(function() {
       ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
       win.close();
       done();
     });
   }, {noFocus: true});
 }
 
 // Test a regression where our confirmation dialog wasn't appearing
 // after openFile calls. See bug 801982.
-function testCancelAfterLoad()
-{
-  openScratchpad(function (win) {
+function testCancelAfterLoad() {
+  openScratchpad(function(win) {
     win.Scratchpad.setRecentFile(gFile);
     win.Scratchpad.openFile(0);
     win.Scratchpad.editor.dirty = true;
     promptButton = win.BUTTON_POSITION_CANCEL;
 
     let EventStub = {
       called: false,
-      preventDefault: function () {
+      preventDefault: function() {
         EventStub.called = true;
       }
     };
 
-    win.Scratchpad.onClose(EventStub, function () {
+    win.Scratchpad.onClose(EventStub, function() {
       ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
       ok(EventStub.called, "aEvent.preventDefault was called");
 
       win.Scratchpad.editor.dirty = false;
       win.close();
       done();
     });
   }, {noFocus: true});
 }
 
-function testUnsavedFileSave(aCallback = function () {})
-{
-  openScratchpad(function (win) {
-    win.Scratchpad.importFromFile(gFile, true, function (status, content) {
+function testUnsavedFileSave(aCallback = function() {}) {
+  openScratchpad(function(win) {
+    win.Scratchpad.importFromFile(gFile, true, function(status, content) {
       aCallback(win.Scratchpad, gFile.path);
 
       let text = "new text";
       win.Scratchpad.setText(text);
 
       promptButton = win.BUTTON_POSITION_SAVE;
 
-      win.Scratchpad.close(function () {
+      win.Scratchpad.close(function() {
         ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
-        readFile(gFile, function (savedContent) {
+        readFile(gFile, function(savedContent) {
           is(savedContent, text, 'prompted "Save" worked when closing scratchpad');
           done();
         });
       });
     });
   }, {noFocus: true});
 }
 
-function testUnsavedFileDontSave(aCallback = function () {})
-{
-  openScratchpad(function (win) {
+function testUnsavedFileDontSave(aCallback = function() {}) {
+  openScratchpad(function(win) {
     aCallback(win.Scratchpad, gFile.path);
     win.Scratchpad.editor.dirty = true;
 
     promptButton = win.BUTTON_POSITION_DONT_SAVE;
 
-    win.Scratchpad.close(function () {
+    win.Scratchpad.close(function() {
       ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
       done();
     });
   }, {noFocus: true});
 }
 
-function cleanup()
-{
+function cleanup() {
   Services.prompt = oldPrompt;
   gFile.remove(false);
   gFile = null;
 }
 
-function createTempFile(name)
-{
+function createTempFile(name) {
   let file = FileUtils.getFile("TmpD", [name]);
   file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
   file.QueryInterface(Ci.nsIFile);
   return file;
 }
 
-function writeFile(file, content, callback)
-{
-  let fout = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+function writeFile(file, content, callback) {
+  let fout = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   fout.init(file.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             0o644, fout.DEFER_OPEN);
 
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
-                  createInstance(Ci.nsIScriptableUnicodeConverter);
+  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                  .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   let fileContentStream = converter.convertToInputStream(content);
 
   NetUtil.asyncCopy(fileContentStream, fout, callback);
 }
 
-function readFile(file, callback)
-{
+function readFile(file, callback) {
   let channel = NetUtil.newChannel({
     uri: NetUtil.newURI(file),
     loadUsingSystemPrincipal: true});
   channel.contentType = "application/javascript";
 
-  NetUtil.asyncFetch(channel, function (inputStream, status) {
+  NetUtil.asyncFetch(channel, function(inputStream, status) {
     ok(Components.isSuccessCode(status),
        "file was read successfully");
 
     let content = NetUtil.readInputStreamToString(inputStream,
                                                   inputStream.available());
     callback(content);
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_contexts.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_contexts.js
@@ -2,17 +2,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,test context switch in Scratchpad");
 }
 
 function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
@@ -21,17 +21,17 @@ function runTests() {
   let notificationBox = sp.notificationBox;
 
   ok(contentMenu, "found #sp-menu-content");
   ok(chromeMenu, "found #sp-menu-browser");
   ok(notificationBox, "found Scratchpad.notificationBox");
 
   let tests = [{
     method: "run",
-    prepare: async function () {
+    prepare: async function() {
       sp.setContentContext();
 
       is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
          "executionContext is content");
 
       is(contentMenu.getAttribute("checked"), "true",
          "content menuitem is checked");
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
@@ -1,15 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test if the view menu items "Larger Font" and "Smaller Font" are disabled
 // when the font size reaches the maximum/minimum values.
 
-
 function test() {
   const options = {
     tabContent: 'test if view menu items "Larger Font" and "Smaller Font" are enabled/disabled.'
   };
   openTabAndScratchpad(options)
     .then(Task.async(runTests))
     .then(finish, console.error);
 }
@@ -19,17 +18,17 @@ async function runTests([win, sp]) {
 
   await testMinimumFontSize(win, sp);
 }
 
 const MAXIMUM_FONT_SIZE = 96;
 const MINIMUM_FONT_SIZE = 6;
 const NORMAL_FONT_SIZE = 12;
 
-var testMaximumFontSize = async function (win, sp) {
+var testMaximumFontSize = async function(win, sp) {
   let doc = win.document;
 
   Services.prefs.clearUserPref("devtools.scratchpad.editorFontSize");
 
   let menu = doc.getElementById("sp-menu-larger-font");
 
   for (let i = NORMAL_FONT_SIZE; i <= MAXIMUM_FONT_SIZE; i++) {
     menu.doCommand();
@@ -39,17 +38,17 @@ var testMaximumFontSize = async function
   ok(cmd.getAttribute("disabled") === "true", 'Command "sp-cmd-larger-font" is disabled.');
 
   menu = doc.getElementById("sp-menu-smaller-font");
   menu.doCommand();
 
   ok(cmd.hasAttribute("disabled") === false, 'Command "sp-cmd-larger-font" is enabled.');
 };
 
-var testMinimumFontSize = async function (win, sp) {
+var testMinimumFontSize = async function(win, sp) {
   let doc = win.document;
 
   let menu = doc.getElementById("sp-menu-smaller-font");
 
   for (let i = MAXIMUM_FONT_SIZE; i >= MINIMUM_FONT_SIZE; i--) {
     menu.doCommand();
   }
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_display_non_error_exceptions.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_display_non_error_exceptions.js
@@ -1,28 +1,26 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 756681 */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
-    openScratchpad(runTests, {"state":{"text":""}});
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
+    openScratchpad(runTests, {"state": {"text": ""}});
   });
 
   gBrowser.loadURI("data:text/html, test that exceptions are output as " +
                    "comments correctly in Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   var scratchpad = gScratchpadWindow.Scratchpad;
 
   var message = "\"Hello World!\"";
   var openComment = "\n/*\n";
   var closeComment = "\n*/";
   var error1 = "throw new Error(\"Ouch!\")";
   var error2 = "throw \"A thrown string\"";
   var error3 = "throw {}";
@@ -30,80 +28,80 @@ function runTests()
 
   let tests = [{
     // Display message
     method: "display",
     code: message,
     result: message + openComment + "Hello World!" + closeComment,
     label: "message display output"
   },
-    {
+  {
     // Display error1, throw new Error("Ouch")
       method: "display",
       code: error1,
       result: error1 + openComment +
             "Exception: Error: Ouch!\n@" + scratchpad.uniqueName + ":1:7" + closeComment,
       label: "error display output"
-    },
-    {
+  },
+  {
     // Display error2, throw "A thrown string"
       method: "display",
       code: error2,
       result: error2 + openComment + "Exception: A thrown string" + closeComment,
       label: "thrown string display output"
-    },
-    {
+  },
+  {
     // Display error3, throw {}
       method: "display",
       code: error3,
       result: error3 + openComment + "Exception: [object Object]" + closeComment,
       label: "thrown object display output"
-    },
-    {
+  },
+  {
     // Display error4, document.body.appendChild(document.body)
       method: "display",
       code: error4,
       result: error4 + openComment + "Exception: HierarchyRequestError: Node cannot be inserted " +
             "at the specified point in the hierarchy\n@" +
             scratchpad.uniqueName + ":1:0" + closeComment,
       label: "Alternative format error display output"
-    },
-    {
+  },
+  {
     // Run message
       method: "run",
       code: message,
       result: message,
       label: "message run output"
-    },
-    {
+  },
+  {
     // Run error1, throw new Error("Ouch")
       method: "run",
       code: error1,
       result: error1 + openComment +
             "Exception: Error: Ouch!\n@" + scratchpad.uniqueName + ":1:7" + closeComment,
       label: "error run output"
-    },
-    {
+  },
+  {
     // Run error2, throw "A thrown string"
       method: "run",
       code: error2,
       result: error2 + openComment + "Exception: A thrown string" + closeComment,
       label: "thrown string run output"
-    },
-    {
+  },
+  {
     // Run error3, throw {}
       method: "run",
       code: error3,
       result: error3 + openComment + "Exception: [object Object]" + closeComment,
       label: "thrown object run output"
-    },
-    {
+  },
+  {
     // Run error4, document.body.appendChild(document.body)
       method: "run",
       code: error4,
       result: error4 + openComment + "Exception: HierarchyRequestError: Node cannot be inserted " +
             "at the specified point in the hierarchy\n@" +
             scratchpad.uniqueName + ":1:0" + closeComment,
       label: "Alternative format error run output"
-    }];
+  }];
 
   runAsyncTests(scratchpad, tests).then(finish);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_display_outputs_errors.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_display_outputs_errors.js
@@ -1,71 +1,69 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 690552 */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
-    openScratchpad(runTests, {"state":{"text":""}});
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
+    openScratchpad(runTests, {"state": {"text": ""}});
   });
 
   gBrowser.loadURI("data:text/html,<p>test that exceptions are output as " +
                    "comments for 'display' and not sent to the console in Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   let scratchpad = gScratchpadWindow.Scratchpad;
 
   let message = "\"Hello World!\"";
   let openComment = "\n/*\n";
   let closeComment = "\n*/";
   let error = "throw new Error(\"Ouch!\")";
   let syntaxError = "(";
 
   let tests = [{
     method: "display",
     code: message,
     result: message + openComment + "Hello World!" + closeComment,
     label: "message display output"
   },
-    {
+  {
       method: "display",
       code: error,
       result: error + openComment + "Exception: Error: Ouch!\n@" +
             scratchpad.uniqueName + ":1:7" + closeComment,
       label: "error display output",
-    },
-    {
+  },
+  {
       method: "display",
       code: syntaxError,
       result: syntaxError + openComment + "Exception: SyntaxError: expected expression, got end of script\n@" +
             scratchpad.uniqueName + ":1" + closeComment,
       label: "syntaxError display output",
-    },
-    {
+  },
+  {
       method: "run",
       code: message,
       result: message,
       label: "message run output",
-    },
-    {
+  },
+  {
       method: "run",
       code: error,
       result: error + openComment + "Exception: Error: Ouch!\n@" +
             scratchpad.uniqueName + ":1:7" + closeComment,
       label: "error run output",
-    },
-    {
+  },
+  {
       method: "run",
       code: syntaxError,
       result: syntaxError + openComment + "Exception: SyntaxError: expected expression, got end of script\n@" +
             scratchpad.uniqueName + ":1" + closeComment,
       label: "syntaxError run output",
-    }];
+  }];
 
   runAsyncTests(scratchpad, tests).then(finish);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_edit_ui_updates.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_edit_ui_updates.js
@@ -3,34 +3,32 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 699130 */
 
 "use strict";
 
 var WebConsoleUtils = require("devtools/client/webconsole/utils").Utils;
 var DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,test Edit menu updates Scratchpad - bug 699130");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   let doc = gScratchpadWindow.document;
-  let winUtils = gScratchpadWindow.QueryInterface(Ci.nsIInterfaceRequestor).
-                 getInterface(Ci.nsIDOMWindowUtils);
+  let winUtils = gScratchpadWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+                 .getInterface(Ci.nsIDOMWindowUtils);
   let OS = Services.appinfo.OS;
 
   info("will test the Edit menu");
 
   let pass = 0;
 
   sp.setText("bug 699130: hello world! (edit menu)");
 
@@ -55,149 +53,149 @@ function runTests()
   let pasteItem = doc.getElementById("menu_paste");
   ok(pasteItem, "the Paste menuitem");
 
   let anchor = doc.documentElement;
   let isContextMenu = false;
 
   let oldVal = sp.editor.getText();
 
-  let testSelfXss = function (oldVal) {
+  let testSelfXss = function(oldVal) {
     // Self xss prevention tests (bug 994134)
     info("Self xss paste tests");
     is(WebConsoleUtils.usageCount, 0, "Test for usage count getter");
     let notificationbox = doc.getElementById("scratchpad-notificationbox");
     let notification = notificationbox.getNotificationWithValue("selfxss-notification");
     ok(notification, "Self-xss notification shown");
     is(oldVal, sp.editor.getText(), "Paste blocked by self-xss prevention");
     Services.prefs.setIntPref("devtools.selfxss.count", 10);
     notificationbox.removeAllNotifications(true);
     openMenu(10, 10, firstShow);
   };
 
-  let openMenu = function (aX, aY, aCallback) {
+  let openMenu = function(aX, aY, aCallback) {
     if (!editMenu || OS != "Darwin") {
-      menuPopup.addEventListener("popupshown", function () {
+      menuPopup.addEventListener("popupshown", function() {
         executeSoon(aCallback);
       }, {once: true});
     }
 
-    executeSoon(function () {
+    executeSoon(function() {
       if (editMenu) {
         if (OS == "Darwin") {
           winUtils.forceUpdateNativeMenuAt(editMenuIndex);
           executeSoon(aCallback);
         } else {
           editMenu.open = true;
         }
       } else {
         menuPopup.openPopup(anchor, "overlap", aX, aY, isContextMenu, false);
       }
     });
   };
 
-  let closeMenu = function (aCallback) {
+  let closeMenu = function(aCallback) {
     if (!editMenu || OS != "Darwin") {
-      menuPopup.addEventListener("popuphidden", function () {
+      menuPopup.addEventListener("popuphidden", function() {
         executeSoon(aCallback);
       }, {once: true});
     }
 
-    executeSoon(function () {
+    executeSoon(function() {
       if (editMenu) {
         if (OS == "Darwin") {
           winUtils.forceUpdateNativeMenuAt(editMenuIndex);
           executeSoon(aCallback);
         } else {
           editMenu.open = false;
         }
       } else {
         menuPopup.hidePopup();
       }
     });
   };
 
-  let firstShow = function () {
+  let firstShow = function() {
     ok(!cutItem.hasAttribute("disabled"), "cut menuitem is enabled");
     closeMenu(firstHide);
   };
 
-  let firstHide = function () {
+  let firstHide = function() {
     sp.editor.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 10 });
     openMenu(11, 11, showAfterSelect);
   };
 
-  let showAfterSelect = function () {
+  let showAfterSelect = function() {
     ok(!cutItem.hasAttribute("disabled"), "cut menuitem is enabled after select");
     closeMenu(hideAfterSelect);
   };
 
-  let hideAfterSelect = function () {
+  let hideAfterSelect = function() {
     sp.editor.on("change", onCut);
-    waitForFocus(function () {
+    waitForFocus(function() {
       let selectedText = sp.editor.getSelection();
       ok(selectedText.length > 0, "non-empty selected text will be cut");
 
       EventUtils.synthesizeKey("x", {accelKey: true}, gScratchpadWindow);
     }, gScratchpadWindow);
   };
 
-  let onCut = function () {
+  let onCut = function() {
     sp.editor.off("change", onCut);
     openMenu(12, 12, showAfterCut);
   };
 
-  let showAfterCut = function () {
+  let showAfterCut = function() {
     ok(!cutItem.hasAttribute("disabled"), "cut menuitem is enabled after cut");
     ok(!pasteItem.hasAttribute("disabled"), "paste menuitem is enabled after cut");
     closeMenu(hideAfterCut);
   };
 
-  let hideAfterCut = function () {
-    waitForFocus(function () {
+  let hideAfterCut = function() {
+    waitForFocus(function() {
       sp.editor.on("change", onPaste);
       EventUtils.synthesizeKey("v", {accelKey: true}, gScratchpadWindow);
     }, gScratchpadWindow);
   };
 
-  let onPaste = function () {
+  let onPaste = function() {
     sp.editor.off("change", onPaste);
     openMenu(13, 13, showAfterPaste);
   };
 
-  let showAfterPaste = function () {
+  let showAfterPaste = function() {
     ok(!cutItem.hasAttribute("disabled"), "cut menuitem is enabled after paste");
     ok(!pasteItem.hasAttribute("disabled"), "paste menuitem is enabled after paste");
     closeMenu(hideAfterPaste);
   };
 
-  let hideAfterPaste = function () {
+  let hideAfterPaste = function() {
     if (pass == 0) {
       pass++;
       testContextMenu();
     } else {
       Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
       finish();
     }
   };
 
-  let testContextMenu = function () {
+  let testContextMenu = function() {
     info("will test the context menu");
 
     editMenu = null;
     isContextMenu = true;
 
     menuPopup = doc.getElementById("scratchpad-text-popup");
     ok(menuPopup, "the context menupopup");
     cutItem = doc.getElementById("cMenu_cut");
     ok(cutItem, "the Cut menuitem");
     pasteItem = doc.getElementById("cMenu_paste");
     ok(pasteItem, "the Paste menuitem");
 
     sp.setText("bug 699130: hello world! (context menu)");
     openMenu(10, 10, firstShow);
   };
-  waitForFocus(function () {
+  waitForFocus(function() {
     WebConsoleUtils.usageCount = 0;
     EventUtils.synthesizeKey("v", {accelKey: true}, gScratchpadWindow);
     testSelfXss(oldVal);
   }, gScratchpadWindow);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_eval_func.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_eval_func.js
@@ -1,36 +1,38 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,test Scratchpad eval function.");
 }
 
 function reportErrorAndQuit(error) {
   DevToolsUtils.reportException("browser_scratchpad_eval_func.js", error);
   ok(false);
   finish();
 }
 
-function runTests(sw)
-{
+function runTests(sw) {
   const sp = sw.Scratchpad;
 
-  let foo = "" + function main() { console.log(1); };
-  let bar = "var bar = " + (() => { console.log(2); });
+  let foo = "" + function main() {
+    console.log(1);
+  };
+  let bar = "var bar = " + (() => {
+    console.log(2);
+  });
 
   const fullText =
     foo + "\n" +
     "\n" +
     bar + "\n";
 
   sp.setText(fullText);
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_execute_print.js
@@ -2,51 +2,51 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<p>test run() and display() in Scratchpad");
 }
 
 function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   let tests = [{
     method: "run",
-    prepare: async function () {
+    prepare: async function() {
       await inContent(function() {
         content.wrappedJSObject.foobarBug636725 = 1;
       });
       sp.editor.setText("++window.foobarBug636725");
     },
-    then: async function ([code, , result]) {
+    then: async function([code, , result]) {
       is(code, sp.getText(), "code is correct");
 
       let pageResult = await inContent(function() {
         return content.wrappedJSObject.foobarBug636725;
       });
       is(result, pageResult,
          "result is correct");
 
       is(sp.getText(), "++window.foobarBug636725",
          "run() does not change the editor content");
 
       is(pageResult, 2, "run() updated window.foobarBug636725");
     }
   }, {
     method: "display",
     prepare: function() {},
-    then: async function () {
+    then: async function() {
       let pageResult = await inContent(function() {
         return content.wrappedJSObject.foobarBug636725;
       });
       is(pageResult, 3, "display() updated window.foobarBug636725");
 
       is(sp.getText(), "++window.foobarBug636725\n/*\n3\n*/",
          "display() shows evaluation result in the textbox");
 
@@ -54,17 +54,17 @@ function runTests() {
     }
   }, {
     method: "run",
     prepare: function() {
       sp.editor.setText("window.foobarBug636725 = 'a';\n" +
         "window.foobarBug636725 = 'b';");
       sp.editor.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 29 });
     },
-    then: async function ([code, , result]) {
+    then: async function([code, , result]) {
       is(code, "window.foobarBug636725 = 'a';", "code is correct");
       is(result, "a", "result is correct");
 
       is(sp.getText(), "window.foobarBug636725 = 'a';\n" +
                        "window.foobarBug636725 = 'b';",
          "run() does not change the textbox value");
 
       let pageResult = await inContent(function() {
@@ -74,33 +74,33 @@ function runTests() {
     }
   }, {
     method: "display",
     prepare: function() {
       sp.editor.setText("window.foobarBug636725 = 'c';\n" +
                  "window.foobarBug636725 = 'b';");
       sp.editor.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 22 });
     },
-    then: async function () {
+    then: async function() {
       let pageResult = await inContent(function() {
         return content.wrappedJSObject.foobarBug636725;
       });
       is(pageResult, "a", "display() worked for the selected range");
 
       is(sp.getText(), "window.foobarBug636725" +
                        "\n/*\na\n*/" +
                        " = 'c';\n" +
                        "window.foobarBug636725 = 'b';",
          "display() shows evaluation result in the textbox");
 
       is(sp.editor.getSelection(), "\n/*\na\n*/", "getSelection is correct");
     }
   }];
 
-  runAsyncCallbackTests(sp, tests).then(function () {
+  runAsyncCallbackTests(sp, tests).then(function() {
     ok(sp.editor.somethingSelected(), "something is selected");
     sp.editor.dropSelection();
     ok(!sp.editor.somethingSelected(), "something is no longer selected");
     ok(!sp.editor.getSelection(), "getSelection is empty");
 
     // Test undo/redo.
     sp.editor.setText("foo1");
     sp.editor.setText("foo2");
--- a/devtools/client/scratchpad/test/browser_scratchpad_falsy.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_falsy.js
@@ -1,68 +1,64 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 679467 */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(testFalsy);
   });
 
   gBrowser.loadURI("data:text/html,<p>test falsy display() values in Scratchpad");
 }
 
-function testFalsy()
-{
+function testFalsy() {
   let scratchpad = gScratchpadWindow.Scratchpad;
-  verifyFalsies(scratchpad).then(function () {
+  verifyFalsies(scratchpad).then(function() {
     scratchpad.setBrowserContext();
     verifyFalsies(scratchpad).then(finish);
   });
 }
 
-
-function verifyFalsies(scratchpad)
-{
+function verifyFalsies(scratchpad) {
   let tests = [{
     method: "display",
     code: "undefined",
     result: "undefined\n/*\nundefined\n*/",
     label: "undefined is displayed"
   },
-    {
+  {
       method: "display",
       code: "false",
       result: "false\n/*\nfalse\n*/",
       label: "false is displayed"
-    },
-    {
+  },
+  {
       method: "display",
       code: "0",
       result: "0\n/*\n0\n*/",
       label: "0 is displayed"
-    },
-    {
+  },
+  {
       method: "display",
       code: "null",
       result: "null\n/*\nnull\n*/",
       label: "null is displayed"
-    },
-    {
+  },
+  {
       method: "display",
       code: "NaN",
       result: "NaN\n/*\nNaN\n*/",
       label: "NaN is displayed"
-    },
-    {
+  },
+  {
       method: "display",
       code: "''",
       result: "''\n/*\n\n*/",
       label: "the empty string is displayed"
-    }];
+  }];
 
   return runAsyncTests(scratchpad, tests);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_files.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_files.js
@@ -6,44 +6,41 @@
 var gScratchpad;
 
 // Reference to the temporary nsIFile we will work with.
 var gFile;
 
 // The temporary file content.
 var gFileContent = "hello.world('bug636725');";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<p>test file open and save in Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   gScratchpad = gScratchpadWindow.Scratchpad;
 
-  createTempFile("fileForBug636725.tmp", gFileContent, function (aStatus, aFile) {
+  createTempFile("fileForBug636725.tmp", gFileContent, function(aStatus, aFile) {
     ok(Components.isSuccessCode(aStatus),
       "The temporary file was saved successfully");
 
     gFile = aFile;
     gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true,
         fileImported);
   });
 }
 
-function fileImported(aStatus, aFileContent)
-{
+function fileImported(aStatus, aFileContent) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was imported successfully with Scratchpad");
 
   is(aFileContent, gFileContent,
      "received data is correct");
 
   is(gScratchpad.getText(), gFileContent,
      "the editor content is correct");
@@ -54,30 +51,29 @@ function fileImported(aStatus, aFileCont
   // Save the file after changes.
   gFileContent += "// omg, saved!";
   gScratchpad.editor.setText(gFileContent);
 
   gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsIFile), true, true,
                           fileExported);
 }
 
-function fileExported(aStatus)
-{
+function fileExported(aStatus) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was exported successfully with Scratchpad");
 
   let oldContent = gFileContent;
 
   // Attempt another file save, with confirmation which returns false.
   gFileContent += "// omg, saved twice!";
   gScratchpad.editor.setText(gFileContent);
 
   let oldConfirm = gScratchpadWindow.confirm;
   let askedConfirmation = false;
-  gScratchpadWindow.confirm = function () {
+  gScratchpadWindow.confirm = function() {
     askedConfirmation = true;
     return false;
   };
 
   gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsIFile), false, true,
                           fileExported2);
 
   gScratchpadWindow.confirm = oldConfirm;
@@ -90,23 +86,21 @@ function fileExported(aStatus)
     uri: NetUtil.newURI(gFile),
     loadUsingSystemPrincipal: true});
   channel.contentType = "application/javascript";
 
   // Read back the temporary file.
   NetUtil.asyncFetch(channel, fileRead);
 }
 
-function fileExported2()
-{
+function fileExported2() {
   ok(false, "exportToFile() did not cancel file overwrite");
 }
 
-function fileRead(aInputStream, aStatus)
-{
+function fileRead(aInputStream, aStatus) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was read back successfully");
 
   let updatedContent =
     NetUtil.readInputStreamToString(aInputStream, aInputStream.available());
 
   is(updatedContent, gFileContent, "file properly updated");
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_goto_line_ui.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_goto_line_ui.js
@@ -1,36 +1,34 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 714942 */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<p>test the 'Jump to line' feature in Scratchpad");
 }
 
-function runTests(aWindow, aScratchpad)
-{
+function runTests(aWindow, aScratchpad) {
   let editor = aScratchpad.editor;
   let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
   editor.setText(text);
   editor.setCursor({ line: 0, ch: 0 });
 
   let oldPrompt = editor.openDialog;
   let desiredValue;
 
-  editor.openDialog = function (text, cb) {
+  editor.openDialog = function(text, cb) {
     cb(desiredValue);
   };
 
   desiredValue = 3;
   EventUtils.synthesizeKey("J", {accelKey: true}, aWindow);
   is(editor.getCursor().line, 2, "line is correct");
 
   desiredValue = 2;
--- a/devtools/client/scratchpad/test/browser_scratchpad_help_key.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_help_key.js
@@ -1,57 +1,56 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 650760 */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   gBrowser.loadURI("data:text/html,Test keybindings for opening Scratchpad MDN Documentation, bug 650760");
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTest);
   });
 }
 
-function runTest()
-{
+function runTest() {
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
   ok(sp.editor.hasFocus(), "the editor has focus");
 
   let keyid = gScratchpadWindow.document.getElementById("key_openHelp");
   let modifiers = keyid.getAttribute("modifiers");
 
   let key = null;
-  if (keyid.getAttribute("keycode"))
+  if (keyid.getAttribute("keycode")) {
     key = keyid.getAttribute("keycode");
-
-  else if (keyid.getAttribute("key"))
+  } else if (keyid.getAttribute("key")) {
     key = keyid.getAttribute("key");
+  }
 
   isnot(key, null, "Successfully retrieved keycode/key");
 
   var aEvent = {
     shiftKey: modifiers.match("shift"),
     ctrlKey: modifiers.match("ctrl"),
     altKey: modifiers.match("alt"),
     metaKey: modifiers.match("meta"),
     accelKey: modifiers.match("accel")
   };
 
   info("check that the MDN page is opened on \"F1\"");
   let linkClicked = false;
-  sp.openDocumentationPage = function (event) { linkClicked = true; };
+  sp.openDocumentationPage = function(event) {
+    linkClicked = true;
+  };
 
   EventUtils.synthesizeKey(key, aEvent, gScratchpadWindow);
 
   is(linkClicked, true, "MDN page will open");
   finishTest();
 }
 
-function finishTest()
-{
+function finishTest() {
   gScratchpadWindow.close();
   finish();
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_initialization.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_initialization.js
@@ -1,48 +1,46 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,initialization test for Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
   is(typeof sp.run, "function", "Scratchpad.run() exists");
   is(typeof sp.inspect, "function", "Scratchpad.inspect() exists");
   is(typeof sp.display, "function", "Scratchpad.display() exists");
 
-  let environmentMenu = gScratchpadWindow.document.
-                          getElementById("sp-environment-menu");
+  let environmentMenu = gScratchpadWindow.document
+                          .getElementById("sp-environment-menu");
   ok(environmentMenu, "Environment menu element exists");
   ok(environmentMenu.hasAttribute("hidden"),
      "Environment menu is not visible");
 
-  let errorConsoleCommand = gScratchpadWindow.document.
-                            getElementById("sp-cmd-errorConsole");
+  let errorConsoleCommand = gScratchpadWindow.document
+                            .getElementById("sp-cmd-errorConsole");
   ok(errorConsoleCommand, "Error console command element exists");
   is(errorConsoleCommand.getAttribute("disabled"), "true",
      "Error console command is disabled");
 
-  let chromeContextCommand = gScratchpadWindow.document.
-                            getElementById("sp-cmd-browserContext");
+  let chromeContextCommand = gScratchpadWindow.document
+                            .getElementById("sp-cmd-browserContext");
   ok(chromeContextCommand, "Chrome context command element exists");
   is(chromeContextCommand.getAttribute("disabled"), "true",
      "Chrome context command is disabled");
 
   Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
   finish();
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_inspect.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_inspect.js
@@ -1,35 +1,32 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,<p>test inspect() in Scratchpad</p>");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
 
   sp.setText("({ a: 'foobarBug636725' })");
 
-  sp.inspect().then(function () {
+  sp.inspect().then(function() {
     let sidebar = sp.sidebar;
     ok(sidebar.visible, "sidebar is open");
 
-
     let found = false;
 
     outer: for (let scope of sidebar.variablesView) {
       for (let [, obj] of scope) {
         for (let [, prop] of obj) {
           if (prop.name == "a" && prop.value == "foobarBug636725") {
             found = true;
             break outer;
@@ -40,15 +37,15 @@ function runTests()
 
     ok(found, "found the property");
 
     let tabbox = sidebar._sidebar._tabbox;
     is(tabbox.width, 300, "Scratchpad sidebar width is correct");
     ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible");
     sidebar.hide();
     ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden");
-    sp.inspect().then(function () {
+    sp.inspect().then(function() {
       is(tabbox.width, 300, "Scratchpad sidebar width is still correct");
       ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible again");
       finish();
     });
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
@@ -1,15 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that inspecting primitive values uses the object inspector, not an
 // inline comment.
 
-
 function test() {
   const options = {
     tabContent: "test inspecting primitive values"
   };
   openTabAndScratchpad(options)
     .then(Task.async(runTests))
     .then(finish, console.error);
 }
@@ -21,17 +20,17 @@ async function runTests([win, sp]) {
   // Inspect a string.
   await checkResults(sp, "foobar", true);
 
   // Inspect a boolean.
   await checkResults(sp, true);
 }
 
 // Helper function that does the actual testing.
-var checkResults = async function (sp, value, isString = false) {
+var checkResults = async function(sp, value, isString = false) {
   let sourceValue = value;
   if (isString) {
     sourceValue = '"' + value + '"';
   }
   let source = "var foobar = " + sourceValue + "; foobar";
   sp.setText(source);
   await sp.inspect();
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_long_string.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_long_string.js
@@ -1,26 +1,24 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,<p>test long string in Scratchpad</p>");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
 
   sp.setText("'0'.repeat(10000)");
 
   sp.display().then(() => {
     is(sp.getText(), "'0'.repeat(10000)\n" +
                      "/*\n" + "0".repeat(10000) + "\n*/",
        "display()ing a long string works");
--- a/devtools/client/scratchpad/test/browser_scratchpad_modeline.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_modeline.js
@@ -10,26 +10,28 @@ var DEVTOOLS_CHROME_ENABLED = "devtools.
 // The temporary file content.
 var gFileContent = "function main() { return 0; }";
 
 function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<p>test file open and save in Scratchpad");
 }
 
 function runTests() {
   gScratchpad = gScratchpadWindow.Scratchpad;
-  function size(obj) { return Object.keys(obj).length; }
+  function size(obj) {
+    return Object.keys(obj).length;
+  }
 
   // Test Scratchpad._scanModeLine method.
   let obj = gScratchpad._scanModeLine();
   is(size(obj), 0, "Mode-line object has no properties");
 
   obj = gScratchpad._scanModeLine("/* This is not a mode-line comment */");
   is(size(obj), 0, "Mode-line object has no properties");
 
@@ -43,21 +45,21 @@ function runTests() {
 
   obj = gScratchpad._scanModeLine("// -sp-context: browser");
   is(size(obj), 1, "Mode-line object has one property");
   is(obj["-sp-context"], "browser");
 
   obj = gScratchpad._scanModeLine("/* -sp-context:browser, other:true */");
   is(size(obj), 2, "Mode-line object has two properties");
   is(obj["-sp-context"], "browser");
-  is(obj["other"], "true");
+  is(obj.other, "true");
 
   // Test importing files with a mode-line in them.
   let content = "/* -sp-context:browser */\n" + gFileContent;
-  createTempFile("fileForBug644413.tmp", content, function (aStatus, aFile) {
+  createTempFile("fileForBug644413.tmp", content, function(aStatus, aFile) {
     ok(Components.isSuccessCode(aStatus), "File was saved successfully");
 
     gFile = aFile;
     gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true, fileImported);
   });
 }
 
 function fileImported(status, content) {
@@ -65,22 +67,22 @@ function fileImported(status, content) {
 
   // Since devtools.chrome.enabled is off, Scratchpad should still be in
   // the content context.
   is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT);
 
   // Set the pref and try again.
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
 
-  gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true, function (status, content) {
+  gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true, function(status, content) {
     ok(Components.isSuccessCode(status), "File was imported successfully");
     is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER);
 
     gFile.remove(false);
     gFile = null;
     gScratchpad = null;
     finish();
   });
 }
 
-registerCleanupFunction(function () {
+registerCleanupFunction(function() {
   Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
 });
--- a/devtools/client/scratchpad/test/browser_scratchpad_open.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_open.js
@@ -2,94 +2,87 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // only finish() when correct number of tests are done
 const expected = 4;
 var count = 0;
 var lastUniqueName = null;
 
-function done()
-{
+function done() {
   if (++count == expected) {
     finish();
   }
 }
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
   testOpen();
   testOpenWithState();
   testOpenInvalidState();
   testOpenTestFile();
 }
 
-function testUniqueName(name)
-{
+function testUniqueName(name) {
   ok(name, "Scratchpad has a uniqueName");
 
   if (lastUniqueName === null) {
     lastUniqueName = name;
     return;
   }
 
   ok(name !== lastUniqueName,
       "Unique name for this instance differs from the last one.");
 }
 
-function testOpen()
-{
-  openScratchpad(function (win) {
+function testOpen() {
+  openScratchpad(function(win) {
     is(win.Scratchpad.filename, undefined, "Default filename is undefined");
     isnot(win.Scratchpad.getText(), null, "Default text should not be null");
     is(win.Scratchpad.executionContext, win.SCRATCHPAD_CONTEXT_CONTENT,
       "Default execution context is content");
     testUniqueName(win.Scratchpad.uniqueName);
 
     win.close();
     done();
   }, {noFocus: true});
 }
 
-function testOpenWithState()
-{
+function testOpenWithState() {
   let state = {
     filename: "testfile",
     executionContext: 2,
     text: "test text"
   };
 
-  openScratchpad(function (win) {
+  openScratchpad(function(win) {
     is(win.Scratchpad.filename, state.filename, "Filename loaded from state");
     is(win.Scratchpad.executionContext, state.executionContext, "Execution context loaded from state");
     is(win.Scratchpad.getText(), state.text, "Content loaded from state");
     testUniqueName(win.Scratchpad.uniqueName);
 
     win.close();
     done();
   }, {state: state, noFocus: true});
 }
 
-function testOpenInvalidState()
-{
+function testOpenInvalidState() {
   let win = openScratchpad(null, {state: 7});
   ok(!win, "no scratchpad opened if state is not an object");
   done();
 }
 
-function testOpenTestFile()
-{
-  let win = openScratchpad(function (win) {
+function testOpenTestFile() {
+  let win = openScratchpad(function(win) {
     ok(win, "scratchpad opened for file open");
     try {
       win.Scratchpad.importFromFile(
         "http://example.com/browser/devtools/client/scratchpad/test/NS_ERROR_ILLEGAL_INPUT.txt",
         "silent",
-        function (aStatus, content) {
+        function(aStatus, content) {
           let nb = win.document.querySelector("#scratchpad-notificationbox");
           is(nb.querySelectorAll("notification").length, 1, "There is just one notification");
           let cn = nb.currentNotification;
           is(cn.priority, nb.PRIORITY_WARNING_HIGH, "notification priority is correct");
           is(cn.value, "file-import-convert-failed", "notification value is corrent");
           is(cn.type, "warning", "notification type is correct");
           done();
         });
--- a/devtools/client/scratchpad/test/browser_scratchpad_open_error_console.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_open_error_console.js
@@ -1,29 +1,27 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const {HUDService} = require("devtools/client/webconsole/hudservice");
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,test Scratchpad." +
                    "openErrorConsole()");
 }
 
-function runTests()
-{
+function runTests() {
   Services.obs.addObserver(function observer(aSubject) {
     Services.obs.removeObserver(observer, "web-console-created");
     aSubject.QueryInterface(Ci.nsISupportsString);
 
     let hud = HUDService.getBrowserConsole();
     ok(hud, "browser console is open");
     is(aSubject.data, hud.hudId, "notification hudId is correct");
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_pprint-02.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_pprint-02.js
@@ -1,39 +1,37 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,test Scratchpad pretty print.");
 }
 
 var gTabsize;
 
-function runTests(sw)
-{
+function runTests(sw) {
   gTabsize = Services.prefs.getIntPref("devtools.editor.tabsize");
   Services.prefs.setIntPref("devtools.editor.tabsize", 6);
   const space = " ".repeat(6);
 
   const sp = sw.Scratchpad;
   sp.setText("function main() { console.log(5); }");
   sp.prettyPrint().then(() => {
     const prettyText = sp.getText();
     ok(prettyText.includes(space));
     finish();
   }).catch(error => {
     ok(false, error);
   });
 }
 
-registerCleanupFunction(function () {
+registerCleanupFunction(function() {
   Services.prefs.setIntPref("devtools.editor.tabsize", gTabsize);
   gTabsize = null;
 });
--- a/devtools/client/scratchpad/test/browser_scratchpad_pprint.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_pprint.js
@@ -1,26 +1,24 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,test Scratchpad pretty print.");
 }
 
-function runTests(sw)
-{
+function runTests(sw) {
   const sp = sw.Scratchpad;
   sp.setText("function main() { console.log(5); }");
   sp.prettyPrint().then(() => {
     const prettyText = sp.getText();
     ok(prettyText.includes("\n"));
     finish();
   }).catch(error => {
     ok(false, error);
--- a/devtools/client/scratchpad/test/browser_scratchpad_pprint_error_goto_line.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_pprint_error_goto_line.js
@@ -1,21 +1,20 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2; fill-column: 80 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,"
                    + "test Scratchpad pretty print error goto line.");
 }
 
 function testJumpToPrettyPrintError(sp, error, remark) {
@@ -43,18 +42,17 @@ function testJumpToPrettyPrintError(sp, 
 
   // CodeMirror lines and columns are 0-based, Scratchpad UI and error
   // stack are 1-based.
   const cursor = sp.editor.getCursor();
   is(inputLine, cursor.line + 1, "jumpToLine goto error location (line)");
   is(inputColumn, cursor.ch + 1, "jumpToLine goto error location (column)");
 }
 
-function runTests(sw, sp)
-{
+function runTests(sw, sp) {
   sp.setText([
     "// line 1",
     "// line 2",
     "var re = /a bad /regexp/; // line 3 is an obvious syntax error!",
     "// line 4",
     "// line 5",
     ""
   ].join("\n"));
--- a/devtools/client/scratchpad/test/browser_scratchpad_recent_files.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_recent_files.js
@@ -28,87 +28,81 @@ var gFileName04 = "file04_ForBug651942.t
 
 // Content for the temporary files.
 var gFileContent;
 var gFileContent01 = "hello.world.01('bug651942');";
 var gFileContent02 = "hello.world.02('bug651942');";
 var gFileContent03 = "hello.world.03('bug651942');";
 var gFileContent04 = "hello.world.04('bug651942');";
 
-function startTest()
-{
+function startTest() {
   gScratchpad = gScratchpadWindow.Scratchpad;
 
   gFile01 = createAndLoadTemporaryFile(gFile01, gFileName01, gFileContent01);
   gFile02 = createAndLoadTemporaryFile(gFile02, gFileName02, gFileContent02);
   gFile03 = createAndLoadTemporaryFile(gFile03, gFileName03, gFileContent03);
 }
 
 // Test to see if the three files we created in the 'startTest()'-method have
 // been added to the list of recent files.
-function testAddedToRecent()
-{
+function testAddedToRecent() {
   lists.recentFiles01 = gScratchpad.getRecentFiles();
 
   is(lists.recentFiles01.length, 3,
      "Temporary files created successfully and added to list of recent files.");
 
   // Create a 4th file, this should clear the oldest file.
   gFile04 = createAndLoadTemporaryFile(gFile04, gFileName04, gFileContent04);
 }
 
 // We have opened a 4th file. Test to see if the oldest recent file was removed,
 // and that the other files were reordered successfully.
-function testOverwriteRecent()
-{
+function testOverwriteRecent() {
   lists.recentFiles02 = gScratchpad.getRecentFiles();
 
   is(lists.recentFiles02[0], lists.recentFiles01[1],
      "File02 was reordered successfully in the 'recent files'-list.");
   is(lists.recentFiles02[1], lists.recentFiles01[2],
      "File03 was reordered successfully in the 'recent files'-list.");
   isnot(lists.recentFiles02[2], lists.recentFiles01[2],
         "File04: was added successfully.");
 
   // Open the oldest recent file.
   gScratchpad.openFile(0);
 }
 
 // We have opened the "oldest"-recent file. Test to see if it is now the most
 // recent file, and that the other files were reordered successfully.
-function testOpenOldestRecent()
-{
+function testOpenOldestRecent() {
   lists.recentFiles03 = gScratchpad.getRecentFiles();
 
   is(lists.recentFiles02[0], lists.recentFiles03[2],
      "File04 was reordered successfully in the 'recent files'-list.");
   is(lists.recentFiles02[1], lists.recentFiles03[0],
      "File03 was reordered successfully in the 'recent files'-list.");
   is(lists.recentFiles02[2], lists.recentFiles03[1],
      "File02 was reordered successfully in the 'recent files'-list.");
 
   Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 0);
 }
 
 // The "devtools.scratchpad.recentFilesMax"-preference was set to zero (0).
 // This should disable the "Open Recent"-menu by hiding it (this should not
 // remove any files from the list). Test to see if it's been hidden.
-function testHideMenu()
-{
+function testHideMenu() {
   let menu = gScratchpadWindow.document.getElementById("sp-open_recent-menu");
   ok(menu.hasAttribute("hidden"), "The menu was hidden successfully.");
 
   Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 2);
 }
 
 // We have set the recentFilesMax-pref to one (1), this enables the feature,
 // removes the two oldest files, rebuilds the menu and removes the
 // "hidden"-attribute from it. Test to see if this works.
-function testChangedMaxRecent()
-{
+function testChangedMaxRecent() {
   let menu = gScratchpadWindow.document.getElementById("sp-open_recent-menu");
   ok(!menu.hasAttribute("hidden"), "The menu is visible. \\o/");
 
   lists.recentFiles04 = gScratchpad.getRecentFiles();
 
   is(lists.recentFiles04.length, 2,
      "Two recent files were successfully removed from the 'recent files'-list");
 
@@ -163,70 +157,65 @@ function testOpenDeletedFile() {
      gScratchpad.strings.GetStringFromName("fileNoLongerExists.notification"),
      "The notification label is correct.");
 
   gScratchpad.clearRecentFiles();
 }
 
 // We have cleared the last file. Test to see if the last file was removed,
 // the menu is empty and was disabled successfully.
-function testClearedAll()
-{
+function testClearedAll() {
   let doc = gScratchpadWindow.document;
   let menu = doc.getElementById("sp-open_recent-menu");
   let popup = doc.getElementById("sp-menu-open_recentPopup");
 
   is(gScratchpad.getRecentFiles().length, 0,
      "All recent files removed successfully.");
   is(popup.children.length, 0, "All menuitems removed successfully.");
   ok(menu.hasAttribute("disabled"),
      "No files in the menu, it was disabled successfully.");
 
   finishTest();
 }
 
-function createAndLoadTemporaryFile(aFile, aFileName, aFileContent)
-{
+function createAndLoadTemporaryFile(aFile, aFileName, aFileContent) {
   // Create a temporary file.
   aFile = FileUtils.getFile("TmpD", [aFileName]);
   aFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
 
   // Write the temporary file.
-  let fout = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+  let fout = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   fout.init(aFile.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             0o644, fout.DEFER_OPEN);
 
   gScratchpad.setFilename(aFile.path);
   gScratchpad.importFromFile(aFile.QueryInterface(Ci.nsIFile), true,
                             fileImported);
   gScratchpad.saveFile(fileSaved);
 
   return aFile;
 }
 
-function fileImported(aStatus)
-{
+function fileImported(aStatus) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was imported successfully with Scratchpad");
 }
 
-function fileSaved(aStatus)
-{
+function fileSaved(aStatus) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was saved successfully with Scratchpad");
 
   checkIfMenuIsPopulated();
 }
 
-function checkIfMenuIsPopulated()
-{
+function checkIfMenuIsPopulated() {
   let doc = gScratchpadWindow.document;
-  let expectedMenuitemCount = doc.getElementById("sp-menu-open_recentPopup").
-                              children.length;
+  let expectedMenuitemCount = doc.getElementById("sp-menu-open_recentPopup")
+                              .children.length;
   // The number of recent files stored, plus the separator and the
   // clearRecentMenuItems-item.
   let recentFilesPlusExtra = gScratchpad.getRecentFiles().length + 2;
 
   if (expectedMenuitemCount > 2) {
     is(expectedMenuitemCount, recentFilesPlusExtra,
        "the recent files menu was populated successfully.");
   }
@@ -242,29 +231,27 @@ var PreferenceObserver = {
   _timesFired: 0,
   set timesFired(aNewValue) {
     this._timesFired = aNewValue;
   },
   get timesFired() {
     return this._timesFired;
   },
 
-  init: function PO_init()
-  {
+  init: function PO_init() {
     if (this._initialized) {
       return;
     }
 
     this.branch = Services.prefs.getBranch("devtools.scratchpad.");
     this.branch.addObserver("", this);
     this._initialized = true;
   },
 
-  observe: function PO_observe(aMessage, aTopic, aData)
-  {
+  observe: function PO_observe(aMessage, aTopic, aData) {
     if (aTopic != "nsPref:changed") {
       return;
     }
 
     switch (this.timesFired) {
       case 0:
         this.timesFired = 1;
         break;
@@ -302,21 +289,20 @@ var PreferenceObserver = {
     }
   },
 
   uninit: function PO_uninit() {
     this.branch.removeObserver("", this);
   }
 };
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
-  registerCleanupFunction(function () {
+  registerCleanupFunction(function() {
     gFile01.remove(false);
     gFile01 = null;
     gFile02.remove(false);
     gFile02 = null;
     gFile03.remove(false);
     gFile03 = null;
     // gFile04 was removed earlier.
     lists.recentFiles01 = null;
@@ -331,19 +317,18 @@ function test()
 
   Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 3);
 
   // Initiate the preference observer after we have set the temporary recent
   // files max for this test.
   PreferenceObserver.init();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(startTest);
   });
 
   gBrowser.loadURI("data:text/html,<p>test recent files in Scratchpad");
 }
 
-function finishTest()
-{
+function finishTest() {
   finish();
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_reload_and_run.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_reload_and_run.js
@@ -25,18 +25,18 @@ add_task(async function test() {
 
 async function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
 
   // Test that Reload And Run command is enabled in the content
   // context and disabled in the browser context.
 
-  let reloadAndRun = gScratchpadWindow.document.
-    getElementById("sp-cmd-reloadAndRun");
+  let reloadAndRun = gScratchpadWindow.document
+    .getElementById("sp-cmd-reloadAndRun");
   ok(reloadAndRun, "Reload And Run command exists");
   ok(!reloadAndRun.hasAttribute("disabled"),
       "Reload And Run command is enabled");
 
   sp.setBrowserContext();
   ok(reloadAndRun.hasAttribute("disabled"),
       "Reload And Run command is disabled in the browser context.");
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_remember_view_options.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_remember_view_options.js
@@ -1,64 +1,60 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 1140839 */
 
 // Test that view menu items are remembered across scratchpad invocations.
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   // To test for this bug we open a Scratchpad window and change all
   // view menu options. After each change we compare the correspondent
   // preference value with the expected value.
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<title>Bug 1140839</title>" +
                    "<p>test Scratchpad should remember View options");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   let doc = gScratchpadWindow.document;
 
   let testData = [
     {itemMenuId: "sp-menu-line-numbers", prefId: "devtools.scratchpad.lineNumbers", expectedVal: false},
     {itemMenuId: "sp-menu-word-wrap", prefId: "devtools.scratchpad.wrapText", expectedVal: true},
     {itemMenuId: "sp-menu-highlight-trailing-space", prefId: "devtools.scratchpad.showTrailingSpace", expectedVal: true},
     {itemMenuId: "sp-menu-larger-font", prefId: "devtools.scratchpad.editorFontSize", expectedVal: 13},
     {itemMenuId: "sp-menu-normal-size-font", prefId: "devtools.scratchpad.editorFontSize", expectedVal: 12},
     {itemMenuId: "sp-menu-smaller-font", prefId: "devtools.scratchpad.editorFontSize", expectedVal: 11},
   ];
 
-  testData.forEach(function (data) {
+  testData.forEach(function(data) {
     let getPref = getPrefFunction(data.prefId);
 
     try {
       let menu = doc.getElementById(data.itemMenuId);
       menu.doCommand();
       let newPreferenceValue = getPref(data.prefId);
       ok(newPreferenceValue === data.expectedVal, newPreferenceValue + " !== " + data.expectedVal);
       Services.prefs.clearUserPref(data.prefId);
-    }
-    catch (exception) {
+    } catch (exception) {
       ok(false, "Exception thrown while executing the command of menuitem #" + data.itemMenuId);
     }
   });
 
   finish();
 }
 
-function getPrefFunction(preferenceId)
-{
+function getPrefFunction(preferenceId) {
   let preferenceType = Services.prefs.getPrefType(preferenceId);
   if (preferenceType === Services.prefs.PREF_INT) {
     return Services.prefs.getIntPref;
   } else if (preferenceType === Services.prefs.PREF_BOOL) {
     return Services.prefs.getBoolPref;
   }
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_reset_undo.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_reset_undo.js
@@ -15,84 +15,78 @@ var gFileB;
 
 // The temporary file content.
 var gFileAContent = "// File A ** Hello World!";
 var gFileBContent = "// File B ** Goodbye All";
 
 // Help track if one or both files are saved
 var gFirstFileSaved = false;
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<p>test that undo get's reset after file load in Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   gScratchpad = gScratchpadWindow.Scratchpad;
 
   // Create a temporary file.
   gFileA = FileUtils.getFile("TmpD", ["fileAForBug684546.tmp"]);
   gFileA.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
 
   gFileB = FileUtils.getFile("TmpD", ["fileBForBug684546.tmp"]);
   gFileB.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
 
   // Write the temporary file.
-  let foutA = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+  let foutA = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   foutA.init(gFileA.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             0o644, foutA.DEFER_OPEN);
 
-  let foutB = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+  let foutB = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   foutB.init(gFileB.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             0o644, foutB.DEFER_OPEN);
 
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
-                  createInstance(Ci.nsIScriptableUnicodeConverter);
+  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                  .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   let fileContentStreamA = converter.convertToInputStream(gFileAContent);
   let fileContentStreamB = converter.convertToInputStream(gFileBContent);
 
   NetUtil.asyncCopy(fileContentStreamA, foutA, tempFileSaved);
   NetUtil.asyncCopy(fileContentStreamB, foutB, tempFileSaved);
 }
 
-function tempFileSaved(aStatus)
-{
+function tempFileSaved(aStatus) {
   let success = Components.isSuccessCode(aStatus);
 
   ok(success, "a temporary file was saved successfully");
 
-  if (!success)
-  {
+  if (!success) {
     finish();
     return;
   }
 
-  if (gFirstFileSaved && success)
-  {
+  if (gFirstFileSaved && success) {
     ok((gFirstFileSaved && success), "Both files loaded");
     // Import the file A into Scratchpad.
     gScratchpad.importFromFile(gFileA.QueryInterface(Ci.nsIFile), true,
                               fileAImported);
   }
   gFirstFileSaved = success;
 }
 
-function fileAImported(aStatus, aFileContent)
-{
+function fileAImported(aStatus, aFileContent) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file A was imported successfully with Scratchpad");
 
   is(aFileContent, gFileAContent, "received data is correct");
 
   is(gScratchpad.getText(), gFileAContent, "the editor content is correct");
 
   gScratchpad.editor.replaceText("new text",
@@ -104,18 +98,17 @@ function fileAImported(aStatus, aFileCon
   gScratchpad.redo();
   is(gScratchpad.getText(), gFileAContent + "new text", "redo works");
 
   // Import the file B into Scratchpad.
   gScratchpad.importFromFile(gFileB.QueryInterface(Ci.nsIFile), true,
                             fileBImported);
 }
 
-function fileBImported(aStatus, aFileContent)
-{
+function fileBImported(aStatus, aFileContent) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file B was imported successfully with Scratchpad");
 
   is(aFileContent, gFileBContent, "received data is correct");
 
   is(gScratchpad.getText(), gFileBContent, "the editor content is correct");
 
   ok(!gScratchpad.editor.canUndo(), "editor cannot undo after load");
@@ -134,21 +127,19 @@ function fileBImported(aStatus, aFileCon
 
   gScratchpad.redo();
   is(gScratchpad.getText(), gFileBContent + "new text", "redo works");
 
   // Done!
   finish();
 }
 
-registerCleanupFunction(function () {
-  if (gFileA && gFileA.exists())
-  {
+registerCleanupFunction(function() {
+  if (gFileA && gFileA.exists()) {
     gFileA.remove(false);
     gFileA = null;
   }
-  if (gFileB && gFileB.exists())
-  {
+  if (gFileB && gFileB.exists()) {
     gFileB.remove(false);
     gFileB = null;
   }
   gScratchpad = null;
 });
--- a/devtools/client/scratchpad/test/browser_scratchpad_restore.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_restore.js
@@ -1,96 +1,92 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /* Call the iterator for each item in the list,
    calling the final callback with all the results
    after every iterator call has sent its result */
-function asyncMap(items, iterator, callback)
-{
+function asyncMap(items, iterator, callback) {
   let expected = items.length;
   let results = [];
 
-  items.forEach(function (item) {
-    iterator(item, function (result) {
+  items.forEach(function(item) {
+    iterator(item, function(result) {
       results.push(result);
       if (results.length == expected) {
         callback(results);
       }
     });
   });
 }
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
   testRestore();
 }
 
-function testRestore()
-{
+function testRestore() {
   let states = [
     {
       filename: "testfile",
       text: "test1",
       executionContext: 2
     },
     {
       text: "text2",
       executionContext: 1
     },
     {
       text: "text3",
       executionContext: 1
     }
   ];
 
-  asyncMap(states, function (state, done) {
+  asyncMap(states, function(state, done) {
     // Open some scratchpad windows
     openScratchpad(done, {state: state, noFocus: true});
-  }, function (wins) {
+  }, function(wins) {
     // Then save the windows to session store
     ScratchpadManager.saveOpenWindows();
 
     // Then get their states
     let session = ScratchpadManager.getSessionState();
 
     // Then close them
-    wins.forEach(function (win) {
+    wins.forEach(function(win) {
       win.close();
     });
 
     // Clear out session state for next tests
     ScratchpadManager.saveOpenWindows();
 
     // Then restore them
     let restoredWins = ScratchpadManager.restoreSession(session);
 
     is(restoredWins.length, 3, "Three scratchad windows restored");
 
-    asyncMap(restoredWins, function (restoredWin, done) {
-      openScratchpad(function (aWin) {
+    asyncMap(restoredWins, function(restoredWin, done) {
+      openScratchpad(function(aWin) {
         let state = aWin.Scratchpad.getState();
         aWin.close();
         done(state);
       }, {window: restoredWin, noFocus: true});
-    }, function (restoredStates) {
+    }, function(restoredStates) {
       // Then make sure they were restored with the right states
       ok(statesMatch(restoredStates, states),
         "All scratchpad window states restored correctly");
 
       // Yay, we're done!
       finish();
     });
   });
 }
 
-function statesMatch(restoredStates, states)
-{
-  return states.every(function (state) {
-    return restoredStates.some(function (restoredState) {
+function statesMatch(restoredStates, states) {
+  return states.every(function(state) {
+    return restoredStates.some(function(restoredState) {
       return state.filename == restoredState.filename
         && state.text == restoredState.text
         && state.executionContext == restoredState.executionContext;
     });
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_revert_to_saved.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_revert_to_saved.js
@@ -7,27 +7,25 @@
 var gScratchpad;
 
 // Reference to the temporary nsIFiles.
 var gFile;
 
 // Temporary file name.
 var gFileName = "testFileForBug751744.tmp";
 
-
 // Content for the temporary file.
 var gFileContent = "/* this file is already saved */\n" +
                    "function foo() { alert('bar') }";
 var gLength = gFileContent.length;
 
 // Reference to the menu entry.
 var menu;
 
-function startTest()
-{
+function startTest() {
   gScratchpad = gScratchpadWindow.Scratchpad;
   menu = gScratchpadWindow.document.getElementById("sp-cmd-revert");
   createAndLoadTemporaryFile();
 }
 
 function testAfterSaved() {
   // Check if the revert menu is disabled as the file is at saved state.
   ok(menu.hasAttribute("disabled"), "The revert menu entry is disabled.");
@@ -83,51 +81,48 @@ function testAfterSecondRevert() {
   // The revert menu should be disabled again.
   ok(menu.hasAttribute("disabled"),
      "Revert menu entry is disabled after reverting to changed saved state.");
   gFile.remove(false);
   gFile = gScratchpad = menu = null;
   finish();
 }
 
-function createAndLoadTemporaryFile()
-{
+function createAndLoadTemporaryFile() {
   // Create a temporary file.
   gFile = FileUtils.getFile("TmpD", [gFileName]);
   gFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
 
   // Write the temporary file.
-  let fout = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+  let fout = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   fout.init(gFile.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             0o644, fout.DEFER_OPEN);
 
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
-                  createInstance(Ci.nsIScriptableUnicodeConverter);
+  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                  .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   let fileContentStream = converter.convertToInputStream(gFileContent);
 
   NetUtil.asyncCopy(fileContentStream, fout, tempFileSaved);
 }
 
-function tempFileSaved(aStatus)
-{
+function tempFileSaved(aStatus) {
   ok(Components.isSuccessCode(aStatus),
      "the temporary file was saved successfully");
 
   // Import the file into Scratchpad.
   gScratchpad.setFilename(gFile.path);
   gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true,
                              testAfterSaved);
 }
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(startTest);
   });
 
   gBrowser.loadURI("data:text/html,<p>test reverting to last saved state of" +
                    " a file </p>");
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_run_error_goto_line.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_run_error_goto_line.js
@@ -1,29 +1,27 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2; fill-column: 80 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,test Scratchpad pretty print.");
 }
 
-function runTests(sw)
-{
+function runTests(sw) {
   const sp = sw.Scratchpad;
   sp.setText([
     "// line 1",
     "// line 2",
     "var re = /a bad /regexp/; // line 3 is an obvious syntax error!",
     "// line 4",
     "// line 5",
     ""
--- a/devtools/client/scratchpad/test/browser_scratchpad_sessions.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_sessions.js
@@ -38,17 +38,17 @@ function test() {
   Services.ww.registerNotification(windowObserver);
 
   ss.setBrowserState(JSON.stringify(testState));
 }
 
 function windowObserver(subject, topic, data) {
   if (topic == "domwindowopened") {
     let win = subject.QueryInterface(Ci.nsIDOMWindow);
-    win.addEventListener("load", function () {
+    win.addEventListener("load", function() {
       if (win.Scratchpad) {
         win.Scratchpad.addObserver({
           onReady() {
             win.Scratchpad.removeObserver(this);
 
             let state = win.Scratchpad.getState();
             BrowserTestUtils.closeWindow(win).then(() => {
               addState(state);
@@ -56,16 +56,16 @@ function windowObserver(subject, topic, 
           },
         });
       }
     }, {once: true});
   }
 }
 
 function statesMatch(restored, states) {
-  return states.every(function (state) {
-    return restored.some(function (restoredState) {
+  return states.every(function(state) {
+    return restored.some(function(restoredState) {
       return state.filename == restoredState.filename &&
              state.text == restoredState.text &&
              state.executionContext == restoredState.executionContext;
     });
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_tab.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_tab.js
@@ -4,17 +4,17 @@
 /* Bug 660560 */
 
 "use strict";
 
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     Services.prefs.setIntPref("devtools.editor.tabsize", 5);
 
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,Scratchpad test for the Tab key, bug 660560");
 }
 
--- a/devtools/client/scratchpad/test/browser_scratchpad_tab_switch.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_tab_switch.js
@@ -1,26 +1,25 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var tab1;
 var tab2;
 var sp;
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   tab1 = BrowserTestUtils.addTab(gBrowser);
   gBrowser.selectedTab = tab1;
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     tab2 = BrowserTestUtils.addTab(gBrowser);
     gBrowser.selectedTab = tab2;
-    BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+    BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
       openScratchpad(runTests);
     });
     gBrowser.loadURI("data:text/html,test context switch in Scratchpad tab 2");
   });
 
   gBrowser.loadURI("data:text/html,test context switch in Scratchpad tab 1");
 }
 
@@ -85,17 +84,17 @@ async function runTests2() {
   BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(runTests3);
   gBrowser.loadURI("data:text/html,test context switch in Scratchpad location 2");
 }
 
 function runTests3() {
   // Check that the sandbox is not cached.
 
   sp.setText("typeof foosbug653108;");
-  sp.run().then(function ([, , result]) {
+  sp.run().then(function([, , result]) {
     is(result, "undefined", "global variable does not exist");
 
     tab1 = null;
     tab2 = null;
     sp = null;
     finish();
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_throw_output.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_throw_output.js
@@ -1,32 +1,29 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(testThrowOutput);
   });
 
   gBrowser.loadURI("data:text/html;charset=utf8,<p>Test throw outputs in Scratchpad</p>");
 }
 
-function testThrowOutput()
-{
+function testThrowOutput() {
   let scratchpad = gScratchpadWindow.Scratchpad, tests = [];
 
   let falsyValues = ["false", "0", "-0", "null", "undefined", "Infinity",
-                      "-Infinity", "NaN"];
-  falsyValues.forEach(function (value) {
+                     "-Infinity", "NaN"];
+  falsyValues.forEach(function(value) {
     tests.push({
       method: "display",
       code: "throw " + value + ";",
       result: "throw " + value + ";\n/*\nException: " + value + "\n*/",
       label: "Correct exception message for '" + value + "' is shown"
     });
   });
 
@@ -40,12 +37,12 @@ function testThrowOutput()
   tests.push({
     method: "display",
     code: "throw (new Array(" + longLength + ").join('a'));",
     result: "throw (new Array(" + longLength + ").join('a'));\n" +
             "/*\nException: " + shortedString + "\n*/",
     label: "Correct exception message for a longString is shown"
   });
 
-  runAsyncTests(scratchpad, tests).then(function () {
+  runAsyncTests(scratchpad, tests).then(function() {
     finish();
   });
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_ui.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_ui.js
@@ -1,27 +1,25 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
     openScratchpad(runTests);
   });
 
   gBrowser.loadURI("data:text/html,<title>foobarBug636725</title>" +
                    "<p>test inspect() in Scratchpad");
 }
 
-function runTests()
-{
+function runTests() {
   let sp = gScratchpadWindow.Scratchpad;
   let doc = gScratchpadWindow.document;
 
   let methodsAndItems = {
     "sp-menu-newscratchpad": "openScratchpad",
     "sp-menu-open": "openFile",
     "sp-menu-save": "saveFile",
     "sp-menu-saveas": "saveFileAs",
@@ -53,18 +51,17 @@ function runTests()
       lastMethodCalled = methodName;
     };
 
     let menu = doc.getElementById(id);
     ok(menu, "found menuitem #" + id);
 
     try {
       menu.doCommand();
-    }
-    catch (ex) {
+    } catch (ex) {
       ok(false, "exception thrown while executing the command of menuitem #" + id);
     }
 
     ok(lastMethodCalled == methodName,
        "method " + methodName + " invoked by the associated menuitem");
 
     sp[methodName] = oldMethod;
   }
--- a/devtools/client/scratchpad/test/browser_scratchpad_unsaved.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_unsaved.js
@@ -1,40 +1,36 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 669612 */
 
 // only finish() when correct number of tests are done
 const expected = 4;
 var count = 0;
-function done()
-{
+function done() {
   if (++count == expected) {
     finish();
   }
 }
 
-
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   testListeners();
   testRestoreNotFromFile();
   testRestoreFromFileSaved();
   testRestoreFromFileUnsaved();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   gBrowser.loadURI("data:text/html,<p>test star* UI for unsaved file changes");
 }
 
-function testListeners()
-{
-  openScratchpad(function (aWin, aScratchpad) {
+function testListeners() {
+  openScratchpad(function(aWin, aScratchpad) {
     aScratchpad.setText("new text");
     ok(isStar(aWin), "show star if scratchpad text changes");
 
     aScratchpad.dirty = false;
     ok(!isStar(aWin), "no star before changing text");
 
     aScratchpad.setFilename("foo.js");
     aScratchpad.setText("new text2");
@@ -52,68 +48,64 @@ function testListeners()
     aScratchpad.undo();
     ok(isStar(aWin), "star if scratchpad undo past save point");
 
     aWin.close();
     done();
   }, {noFocus: true});
 }
 
-function testRestoreNotFromFile()
-{
+function testRestoreNotFromFile() {
   let session = [{
     text: "test1",
     executionContext: 1
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  openScratchpad(function (aWin, aScratchpad) {
+  openScratchpad(function(aWin, aScratchpad) {
     aScratchpad.setText("new text");
     ok(isStar(win), "show star if restored scratchpad isn't from a file");
 
     win.close();
     done();
   }, {window: win, noFocus: true});
 }
 
-function testRestoreFromFileSaved()
-{
+function testRestoreFromFileSaved() {
   let session = [{
     filename: "test.js",
     text: "test1",
     executionContext: 1,
     saved: true
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  openScratchpad(function (aWin, aScratchpad) {
+  openScratchpad(function(aWin, aScratchpad) {
     ok(!isStar(win), "no star before changing text in scratchpad restored from file");
 
     aScratchpad.setText("new text");
     ok(isStar(win), "star when text changed from scratchpad restored from file");
 
     win.close();
     done();
   }, {window: win, noFocus: true});
 }
 
-function testRestoreFromFileUnsaved()
-{
+function testRestoreFromFileUnsaved() {
   let session = [{
     filename: "test.js",
     text: "test1",
     executionContext: 1,
     saved: false
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  openScratchpad(function () {
+  openScratchpad(function() {
     ok(isStar(win), "star with scratchpad restored with unsaved text");
 
     win.close();
     done();
   }, {window: win, noFocus: true});
 }
 
-function isStar(win)
-{
+function isStar(win) {
   return win.document.title.match(/^\*[^\*]/);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_wrong_window_focus.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_wrong_window_focus.js
@@ -4,40 +4,39 @@
 /* Bug 661762 */
 
 // Use the old webconsole since scratchpad focus isn't working on new one (Bug 1304794)
 Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
 registerCleanupFunction(function* () {
   Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
 });
 
-function test()
-{
+function test() {
   waitForExplicitFinish();
 
   // To test for this bug we open a Scratchpad window, save its
   // reference and then open another one. This way the first window
   // loses its focus.
   //
   // Then we open a web console and execute a console.log statement
   // from the first Scratch window (that's why we needed to save its
   // reference).
   //
   // Then we wait for our message to appear in the console and click
   // on the location link. After that we check which Scratchpad window
   // is currently active (it should be the older one).
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function () {
-    openScratchpad(function () {
+  BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(function() {
+    openScratchpad(function() {
       let sw = gScratchpadWindow;
       let {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
       let {TargetFactory} = require("devtools/client/framework/target");
 
-      openScratchpad(function () {
+      openScratchpad(function() {
         let target = TargetFactory.forTab(gBrowser.selectedTab);
         gDevTools.showToolbox(target, "webconsole").then((toolbox) => {
           let hud = toolbox.getCurrentPanel().hud;
           hud.jsterm.clearOutput(true);
           testFocus(sw, hud);
         });
       });
     });
@@ -54,17 +53,17 @@ function testFocus(sw, hud) {
     let node = msg.node;
 
     var loc = node.querySelector(".frame-link");
     ok(loc, "location element exists");
     is(loc.getAttribute("data-url"), sw.Scratchpad.uniqueName, "location value is correct");
     is(loc.getAttribute("data-line"), "1", "line value is correct");
     is(loc.getAttribute("data-column"), "1", "column value is correct");
 
-    sw.addEventListener("focus", function () {
+    sw.addEventListener("focus", function() {
       let win = Services.wm.getMostRecentWindow("devtools:scratchpad");
 
       ok(win, "there are active Scratchpad windows");
       is(win.Scratchpad.uniqueName, sw.Scratchpad.uniqueName,
           "correct window is in focus");
 
       // gScratchpadWindow will be closed automatically but we need to
       // close the second window ourselves.
@@ -76,14 +75,14 @@ function testFocus(sw, hud) {
     EventUtils.synthesizeMouse(loc, 2, 2, {}, hud.iframeWindow);
   }
 
   // Sending messages to web console is an asynchronous operation. That's
   // why we have to setup an observer here.
   hud.ui.once("new-messages", onMessage);
 
   sp.setText("console.log('foo');");
-  sp.run().then(function ([selection, error, result]) {
+  sp.run().then(function([selection, error, result]) {
     is(selection, "console.log('foo');", "selection is correct");
     is(error, undefined, "error is correct");
     is(result.type, "undefined", "result is correct");
   });
 }
--- a/devtools/client/scratchpad/test/head.js
+++ b/devtools/client/scratchpad/test/head.js
@@ -10,17 +10,16 @@ const {ScratchpadManager} = ChromeUtils.
 const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const {gDevTools} = require("devtools/client/framework/devtools");
 const Services = require("Services");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const flags = require("devtools/shared/flags");
 const promise = require("promise");
 const defer = require("devtools/shared/defer");
 
-
 var gScratchpadWindow; // Reference to the Scratchpad chrome window object
 
 flags.testing = true;
 registerCleanupFunction(() => {
   flags.testing = false;
 });
 
 /**
@@ -39,29 +38,28 @@ registerCleanupFunction(() => {
  *        - noFocus
  *          Boolean that tells you do not want the opened window to receive
  *          focus.
  * @return nsIDOMWindow
  *         The new window object that holds Scratchpad. Note that the
  *         gScratchpadWindow global is also updated to reference the new window
  *         object.
  */
-function openScratchpad(aReadyCallback, aOptions = {})
-{
+function openScratchpad(aReadyCallback, aOptions = {}) {
   let win = aOptions.window ||
             ScratchpadManager.openScratchpad(aOptions.state);
   if (!win) {
     return;
   }
 
-  let onLoad = function () {
+  let onLoad = function() {
     win.removeEventListener("load", onLoad);
 
     win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
+      onReady: function(aScratchpad) {
         aScratchpad.removeObserver(this);
 
         if (aOptions.noFocus) {
           aReadyCallback(win, aScratchpad);
         } else {
           waitForFocus(aReadyCallback.bind(null, win, aScratchpad), win);
         }
       }
@@ -81,23 +79,22 @@ function openScratchpad(aReadyCallback, 
  * @param object aOptions
  *        Optional. Options for opening the tab and scratchpad. In addition
  *        to the options supported by openScratchpad, the following options
  *        are supported:
  *        - tabContent
  *          A string providing the html content of the tab.
  * @return Promise
  */
-function openTabAndScratchpad(aOptions = {})
-{
+function openTabAndScratchpad(aOptions = {}) {
   waitForExplicitFinish();
   return new promise(resolve => {
     gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
     let {selectedBrowser} = gBrowser;
-    BrowserTestUtils.browserLoaded(selectedBrowser).then(function () {
+    BrowserTestUtils.browserLoaded(selectedBrowser).then(function() {
       openScratchpad((win, sp) => resolve([win, sp]), aOptions);
     });
     gBrowser.loadURI("data:text/html;charset=utf8," + (aOptions.tabContent || ""));
   });
 }
 
 /**
  * Create a temporary file, write to it and call a callback
@@ -107,34 +104,33 @@ function openTabAndScratchpad(aOptions =
  *        Name of your temporary file.
  * @param string aContent
  *        Temporary file's contents.
  * @param function aCallback
  *        Optional callback to be called when we're done writing
  *        to the file. It will receive two parameters: status code
  *        and a file object.
  */
-function createTempFile(aName, aContent, aCallback = function () {})
-{
+function createTempFile(aName, aContent, aCallback = function() {}) {
   // Create a temporary file.
   let file = FileUtils.getFile("TmpD", [aName]);
   file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8));
 
   // Write the temporary file.
-  let fout = Cc["@mozilla.org/network/file-output-stream;1"].
-             createInstance(Ci.nsIFileOutputStream);
+  let fout = Cc["@mozilla.org/network/file-output-stream;1"]
+             .createInstance(Ci.nsIFileOutputStream);
   fout.init(file.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
             parseInt("644", 8), fout.DEFER_OPEN);
 
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
-                  createInstance(Ci.nsIScriptableUnicodeConverter);
+  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                  .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   let fileContentStream = converter.convertToInputStream(aContent);
 
-  NetUtil.asyncCopy(fileContentStream, fout, function (aStatus) {
+  NetUtil.asyncCopy(fileContentStream, fout, function(aStatus) {
     aCallback(aStatus, file);
   });
 }
 
 /**
  * Run a set of asychronous tests sequentially defined by input and output.
  *
  * @param Scratchpad aScratchpad
@@ -147,18 +143,17 @@ function createTempFile(aName, aContent,
  *          Code to run in the scratchpad.
  *        - result
  *          Expected code that will be in the scratchpad upon completion.
  *        - label
  *          The tests label which will be logged in the test runner output.
  * @return Promise
  *         The promise that will be resolved when all tests are finished.
  */
-function runAsyncTests(aScratchpad, aTests)
-{
+function runAsyncTests(aScratchpad, aTests) {
   let deferred = defer();
 
   (function runTest() {
     if (aTests.length) {
       let test = aTests.shift();
       aScratchpad.setText(test.code);
       aScratchpad[test.method]().then(function success() {
         is(aScratchpad.getText(), test.result, test.label);
@@ -187,33 +182,32 @@ function runAsyncTests(aScratchpad, aTes
  *          Scratchpad method to use, one of "run", "display", or "inspect".
  *        - prepare
  *          The callback to run just prior to executing the scratchpad method.
  *        - then
  *          The callback to run when the scratchpad execution promise resolves.
  * @return Promise
  *         The promise that will be resolved when all tests are finished.
  */
-var runAsyncCallbackTests = async function (aScratchpad, aTests) {
+var runAsyncCallbackTests = async function(aScratchpad, aTests) {
   for (let {prepare, method, then} of aTests) {
     await prepare();
     let res = await aScratchpad[method]();
     await then(res);
   }
 };
 
 /**
  * A simple wrapper for ContentTask.spawn for more compact code.
  */
 function inContent(generator) {
   return ContentTask.spawn(gBrowser.selectedBrowser, {}, generator);
 }
 
-function cleanup()
-{
+function cleanup() {
   if (gScratchpadWindow) {
     gScratchpadWindow.close();
     gScratchpadWindow = null;
   }
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 }