Bug 1521928 - Enable ESLint for widget (automatic changes). r=Standard8,jmathies
authorchampionshuttler <shivams2799@gmail.com>
Thu, 14 Feb 2019 20:20:20 +0000
changeset 459500 0e0638c8ef27dea641754aae390213e829eb71f3
parent 459499 3c9f0c796287636c7428d6a181a80632d397051a
child 459501 0176f4dc4345f1e7620f3984a7be294757616b2b
push id111964
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:54:44 +0000
treeherdermozilla-inbound@db3c4f905082 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, jmathies
bugs1521928
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521928 - Enable ESLint for widget (automatic changes). r=Standard8,jmathies Differential Revision: https://phabricator.services.mozilla.com/D18579
.eslintignore
widget/headless/tests/test_headless.js
widget/headless/tests/test_headless_clipboard.js
widget/tests/test_assign_event_data.html
widget/tests/test_bug1151186.html
widget/tests/test_bug413277.html
widget/tests/test_bug565392.html
widget/tests/test_imestate.html
widget/tests/test_keypress_event_with_alt_on_mac.html
widget/tests/test_native_key_bindings_mac.html
widget/tests/test_picker_no_crash.html
widget/tests/test_plugin_input_event.html
widget/tests/test_plugin_scroll_consistency.html
widget/tests/test_scrollbar_colors.html
widget/tests/test_secure_input.html
widget/tests/unit/test_macsharingservice.js
widget/tests/unit/test_macwebapputils.js
widget/tests/unit/test_taskbar_jumplistitems.js
widget/tests/window_imestate_iframes.html
widget/tests/window_mouse_scroll_win.html
--- a/.eslintignore
+++ b/.eslintignore
@@ -25,18 +25,16 @@ layout/**
 modules/**
 netwerk/cookie/test/browser/**
 netwerk/test/browser/**
 netwerk/test/mochitests/**
 netwerk/test/unit*/**
 tools/update-packaging/**
 uriloader/exthandler/**
 uriloader/exthandler/tests/mochitest/**
-widget/headless/tests/**
-widget/tests/**
 xpfe/**
 
 # We currently have no js files in these directories, so we ignore them by
 # default to aid ESLint's performance.
 build/**
 config/**
 db/**
 embedding/**
--- a/widget/headless/tests/test_headless.js
+++ b/widget/headless/tests/test_headless.js
@@ -6,50 +6,50 @@ const {HttpServer} = ChromeUtils.import(
 
 const server = new HttpServer();
 server.registerDirectory("/", do_get_cwd());
 server.start(-1);
 const ROOT = `http://localhost:${server.identity.primaryPort}`;
 const BASE = `${ROOT}/`;
 const HEADLESS_URL = `${BASE}/headless.html`;
 const HEADLESS_BUTTON_URL = `${BASE}/headless_button.html`;
-registerCleanupFunction(() => { server.stop(() => {})});
+registerCleanupFunction(() => { server.stop(() => {}); });
 
 // Refrences to the progress listeners to keep them from being gc'ed
 // before they are called.
 const progressListeners = new Map();
 
 function loadContentWindow(windowlessBrowser, uri) {
   return new Promise((resolve, reject) => {
     let loadURIOptions = {
       triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     };
     windowlessBrowser.loadURI(uri, loadURIOptions);
     let docShell = windowlessBrowser.docShell;
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                       .getInterface(Ci.nsIWebProgress);
     let progressListener = {
-      onLocationChange: function (progress, request, location, flags) {
+      onLocationChange(progress, request, location, flags) {
         // Ignore inner-frame events
         if (progress != webProgress) {
           return;
         }
         // Ignore events that don't change the document
         if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
           return;
         }
         let contentWindow = docShell.domWindow;
         webProgress.removeProgressListener(progressListener);
         progressListeners.delete(progressListener);
         contentWindow.addEventListener("load", (event) => {
           resolve(contentWindow);
         }, { once: true });
       },
       QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
-                                             "nsISupportsWeakReference"])
+                                             "nsISupportsWeakReference"]),
     };
     progressListeners.set(progressListener, progressListener);
     webProgress.addProgressListener(progressListener,
                                     Ci.nsIWebProgress.NOTIFY_LOCATION);
   });
 }
 
 add_task(async function test_snapshot() {
@@ -58,29 +58,29 @@ add_task(async function test_snapshot() 
   const contentWidth = 400;
   const contentHeight = 300;
   // Verify dimensions.
   contentWindow.resizeTo(contentWidth, contentHeight);
   equal(contentWindow.innerWidth, contentWidth);
   equal(contentWindow.innerHeight, contentHeight);
 
   // Snapshot the test page.
-  let canvas = contentWindow.document.createElementNS('http://www.w3.org/1999/xhtml', 'html:canvas');
-  let context = canvas.getContext('2d');
+  let canvas = contentWindow.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
+  let context = canvas.getContext("2d");
   let width = contentWindow.innerWidth;
   let height = contentWindow.innerHeight;
   canvas.width = width;
   canvas.height = height;
   context.drawWindow(
     contentWindow,
     0,
     0,
     width,
     height,
-    'rgb(255, 255, 255)'
+    "rgb(255, 255, 255)"
   );
   let imageData = context.getImageData(0, 0, width, height).data;
   ok(imageData[0] === 0 && imageData[1] === 255 && imageData[2] === 0 && imageData[3] === 255, "Page is green.");
 
   // Search for a blue pixel (a quick and dirty check to see if the blue text is
   // on the page)
   let found = false;
   for (let i = 0; i < imageData.length; i += 4) {
@@ -101,29 +101,29 @@ add_task(async function test_snapshot_wi
   const contentWidth = 1;
   const contentHeight = 2;
   // Verify dimensions.
   contentWindow.resizeTo(contentWidth, contentHeight);
   equal(contentWindow.innerWidth, contentWidth);
   equal(contentWindow.innerHeight, contentHeight);
 
   // Snapshot the test page.
-  let canvas = contentWindow.document.createElementNS('http://www.w3.org/1999/xhtml', 'html:canvas');
-  let context = canvas.getContext('2d');
+  let canvas = contentWindow.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
+  let context = canvas.getContext("2d");
   let width = contentWindow.innerWidth;
   let height = contentWindow.innerHeight;
   canvas.width = width;
   canvas.height = height;
   context.drawWindow(
     contentWindow,
     0,
     0,
     width,
     height,
-    'rgb(255, 255, 255)',
+    "rgb(255, 255, 255)",
     context.DRAWWINDOW_DRAW_CARET | context.DRAWWINDOW_DRAW_VIEW | context.DRAWWINDOW_USE_WIDGET_LAYERS
   );
   ok(true, "Snapshot with widget layers didn't crash.");
 
   windowlessBrowser.close();
 });
 
 // Ensure keydown events are triggered on the windowless browser.
@@ -131,17 +131,17 @@ add_task(async function test_keydown() {
   let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
   // nsIWindowlessBrowser inherits from nsIWebNavigation.
   let contentWindow = await loadContentWindow(windowlessBrowser, HEADLESS_URL);
 
   let keydown = new Promise((resolve) => {
     contentWindow.addEventListener("keydown", () => {
       resolve();
     }, { once: true });
-  })
+  });
 
   let tip = Cc["@mozilla.org/text-input-processor;1"]
             .createInstance(Ci.nsITextInputProcessor);
   let begun = tip.beginInputTransactionForTests(contentWindow);
   ok(begun, "nsITextInputProcessor.beginInputTransactionForTests() should succeed");
   tip.keydown(new contentWindow.KeyboardEvent("", {key: "a", code: "KeyA", keyCode: contentWindow.KeyboardEvent.DOM_VK_A}));
 
   await keydown;
@@ -153,25 +153,25 @@ add_task(async function test_keydown() {
 // Test dragging the mouse on a button to ensure the creation of the drag
 // service doesn't crash in headless.
 add_task(async function test_mouse_drag() {
   let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
   // nsIWindowlessBrowser inherits from nsIWebNavigation.
   let contentWindow = await loadContentWindow(windowlessBrowser, HEADLESS_BUTTON_URL);
   contentWindow.resizeTo(400, 400);
 
-  let target = contentWindow.document.getElementById('btn');
+  let target = contentWindow.document.getElementById("btn");
   let rect = target.getBoundingClientRect();
   let left = rect.left;
   let top = rect.top;
 
   let utils = contentWindow.windowUtils;
   utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
   utils.sendMouseEvent("mousemove", left, top, 0, 1, 0, false, 0, 0);
   // Wait for a turn of the event loop since the synthetic mouse event
   // that creates the drag service is processed during the refresh driver.
-  await new Promise((r) => {executeSoon(r)});
+  await new Promise((r) => { executeSoon(r); });
   utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
 
   ok(true, "Send mouse event didn't crash");
 
   windowlessBrowser.close();
 });
--- a/widget/headless/tests/test_headless_clipboard.js
+++ b/widget/headless/tests/test_headless_clipboard.js
@@ -24,21 +24,21 @@ function getString(clipboard) {
   } catch (ex) {
     // If the clipboard is empty getTransferData will throw.
   }
 
   return str;
 }
 
 add_task(async function test_clipboard() {
-  let clipboard = Cc['@mozilla.org/widget/clipboard;1']
+  let clipboard = Cc["@mozilla.org/widget/clipboard;1"]
                   .getService(Ci.nsIClipboard);
 
   // Test copy.
   const data = "random number: " + Math.random();
-  let helper = Cc['@mozilla.org/widget/clipboardhelper;1']
+  let helper = Cc["@mozilla.org/widget/clipboardhelper;1"]
                .getService(Ci.nsIClipboardHelper);
   helper.copyString(data);
-  equal(getString(clipboard), data, 'Data was successfully copied.');
+  equal(getString(clipboard), data, "Data was successfully copied.");
 
   clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
-  equal(getString(clipboard), '', 'Data was successfully cleared.');
+  equal(getString(clipboard), "", "Data was successfully cleared.");
 });
--- a/widget/tests/test_assign_event_data.html
+++ b/widget/tests/test_assign_event_data.html
@@ -83,584 +83,582 @@ const kIsMac = (navigator.platform.index
 const kIsWin = (navigator.platform.indexOf("Win") == 0);
 
 var gDescription = "";
 var gEvent = null;
 var gCopiedEvent = [];
 var gCallback = null;
 var gCallPreventDefault = false;
 
-function onEvent(aEvent)
-{
+function onEvent(aEvent) {
   if (gCallPreventDefault) {
     aEvent.preventDefault();
   }
   ok(gEvent === null, gDescription + `: We should receive only one event to check per test: already got: ${gEvent ? gEvent.type : "null"}, got: ${aEvent.type}`);
   gEvent = aEvent;
   for (var attr in aEvent) {
     if (!attr.match(/^[A-Z0-9_]+$/) && // ignore const attributes
         attr != "multipleActionsPrevented" && // multipleActionsPrevented isn't defined in any DOM event specs.
         typeof(aEvent[attr]) != "function") {
       gCopiedEvent.push({ name: attr, value: aEvent[attr]});
     }
   }
   setTimeout(gCallback, 0);
 }
 
-function observeKeyUpOnContent(aKeyCode, aCallback)
-{
+function observeKeyUpOnContent(aKeyCode, aCallback) {
   document.addEventListener("keyup", function keyUp(ev) {
     if (ev.keyCode == aKeyCode) {
       document.removeEventListener("keyup", keyUp);
       SimpleTest.executeSoon(aCallback);
     }
   });
 }
 
 const kTests = [
   { description: "InternalScrollPortEvent (overflow, vertical)",
     targetID: "scrollable-div", eventType: "overflow",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById("scrolled-div").style.height = "500px";
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalScrollPortEvent (overflow, horizontal)",
     targetID: "scrollable-div", eventType: "overflow",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById("scrolled-div").style.width = "500px";
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalScrollAreaEvent (MozScrolledAreaChanged, spreading)",
-    target: function () { return document; }, eventType: "MozScrolledAreaChanged",
-    dispatchEvent: function () {
+    target() { return document; }, eventType: "MozScrolledAreaChanged",
+    dispatchEvent() {
       document.getElementById("scrollable-div").style.width = "50000px";
       document.getElementById("scrollable-div").style.height = "50000px";
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalScrollAreaEvent (MozScrolledAreaChanged, shrinking)",
-    target: function () { return document; }, eventType: "MozScrolledAreaChanged",
-    dispatchEvent: function () {
+    target() { return document; }, eventType: "MozScrolledAreaChanged",
+    dispatchEvent() {
       document.getElementById("scrollable-div").style.width = "30px";
       document.getElementById("scrollable-div").style.height = "30px";
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keydown of 'a' key without modifiers)",
     targetID: "input-text", eventType: "keydown",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_A : MAC_VK_ANSI_A,
                           {}, "a", "a");
       observeKeyUpOnContent(KeyboardEvent.DOM_VK_A, runNextTest);
       return true;
     },
-    canRun: function () {
+    canRun() {
       return (kIsMac || kIsWin);
     },
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keyup of 'a' key without modifiers)",
     targetID: "input-text", eventType: "keydown",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_A : MAC_VK_ANSI_A,
                           {}, "a", "a");
       observeKeyUpOnContent(KeyboardEvent.DOM_VK_A, runNextTest);
       return true;
     },
-    canRun: function () {
+    canRun() {
       return (kIsMac || kIsWin);
     },
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keypress of 'b' key with Shift)",
     targetID: "input-text", eventType: "keypress",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_B : MAC_VK_ANSI_B,
                           { shiftKey: true }, "B", "B");
 
       // On Windows, synthesizeNativeKey will also fire keyup for shiftKey.
       // We have to wait for it to prevent the key event break the next test case.
       let waitKeyCode = _EU_isWin(window) ? KeyboardEvent.DOM_VK_SHIFT :
                                             KeyboardEvent.DOM_VK_B;
       observeKeyUpOnContent(waitKeyCode, runNextTest);
       return true;
     },
-    canRun: function () {
+    canRun() {
       return (kIsMac || kIsWin);
     },
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keypress of 'c' key with Accel)",
     targetID: "input-text", eventType: "keypress",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_C : MAC_VK_ANSI_C,
                           { accelKey: true }, kIsWin ? "\u0003" : "c", "c");
 
       // On Windows, synthesizeNativeKey will also fire keyup for accelKey
       // (control key on Windows). We have to wait for it to prevent the key
       // event break the next test case.
       let waitKeyCode = _EU_isWin(window) ? KeyboardEvent.DOM_VK_CONTROL :
                                             KeyboardEvent.DOM_VK_C;
       observeKeyUpOnContent(waitKeyCode, runNextTest);
       return true;
     },
-    canRun: function () {
+    canRun() {
       return !kStrictKeyPressEvents && (kIsMac || kIsWin);
     },
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keyup during composition)",
     targetID: "input-text", eventType: "keyup",
-    dispatchEvent: function () {
+    dispatchEvent() {
       setAndObserveCompositionPref(true, () => {
         document.getElementById(this.targetID).value = "";
         document.getElementById(this.targetID).focus();
         synthesizeCompositionChange({ "composition":
           { "string": "\u306D",
             "clauses":
             [
-              { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
-            ]
+              { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
+            ],
           },
           "caret": { "start": 1, "length": 0 },
           "key": { key: "a" },
         });
         synthesizeComposition({ type: "compositioncommitasis", key: {} });
         setAndObserveCompositionPref(null, runNextTest);
       });
       return true;
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetKeyboardEvent (keydown during composition)",
     targetID: "input-text", eventType: "keydown",
-    dispatchEvent: function () {
+    dispatchEvent() {
       setAndObserveCompositionPref(true, () => {
         document.getElementById(this.targetID).value = "";
         document.getElementById(this.targetID).focus();
         synthesizeCompositionChange({ "composition":
           { "string": "\u306D",
             "clauses":
             [
-              { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
-            ]
+              { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
+            ],
           },
           "caret": { "start": 1, "length": 0 },
           "key": {},
         });
         synthesizeComposition({ type: "compositioncommitasis",
           key: { key: "KEY_Enter" } });
         setAndObserveCompositionPref(null, runNextTest);
       });
       return true;
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetMouseEvent (mousedown of left button without modifier)",
     targetID: "button", eventType: "mousedown",
-    dispatchEvent: function () {
+    dispatchEvent() {
       synthesizeMouseAtCenter(document.getElementById(this.targetID),
                               { button: 0 });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "WidgetMouseEvent (click of middle button with Shift)",
     // XXX I'm not sure why middle click event isn't fired on button element.
     targetID: "input-text", eventType: "click",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeMouseAtCenter(document.getElementById(this.targetID),
                               { button: 1, shiftKey: true, pressure: 0.5 });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "WidgetMouseEvent (mouseup of right button with Alt)",
     targetID: "button", eventType: "mouseup",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeMouseAtCenter(document.getElementById(this.targetID),
                               { button: 2, altKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "WidgetDragEvent",
     targetID: "input-text", eventType: "dragstart",
-    dispatchEvent: function () {
-      return;
+    dispatchEvent() {
+
     },
-    canRun: function () {
+    canRun() {
       todo(false, "WidgetDragEvent isn't tested");
       return false;
     },
     todoMismatch: [],
   },
   { description: "WidgetTextEvent (text)",
     targetID: "input-text", eventType: "text",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeComposition({ type: "compositioncommit", data: "\u306D", key: { key: "," } });
     },
-    canRun: function () {
+    canRun() {
       return !SpecialPowers.getBoolPref("dom.compositionevent.text.dispatch_only_system_group_in_content");
     },
     todoMismatch: [ ],
   },
   { description: "WidgetCompositionEvent (compositionupdate)",
     targetID: "input-text", eventType: "compositionupdate",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeComposition({ type: "compositioncommit", data: "\u30E9\u30FC\u30E1\u30F3", key: { key: "KEY_Enter" } });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "InternalEditorInputEvent (input at key input)",
     targetID: "input-text", eventType: "input",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_B : MAC_VK_ANSI_B,
                           { shiftKey: true }, "B", "B");
       observeKeyUpOnContent(KeyboardEvent.DOM_VK_B, runNextTest);
       return true;
     },
-    canRun: function () {
+    canRun() {
       return (kIsMac || kIsWin);
     },
     todoMismatch: [],
   },
   { description: "InternalEditorInputEvent (input at composing)",
     targetID: "input-text", eventType: "input",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeCompositionChange({ "composition":
         { "string": "\u30E9\u30FC\u30E1\u30F3",
           "clauses":
           [
-            { "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
-          ]
+            { "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
+          ],
         },
         "caret": { "start": 4, "length": 0 },
         "key": { key: "y" },
       });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "InternalEditorInputEvent (input at committing)",
     targetID: "input-text", eventType: "input",
-    dispatchEvent: function () {
+    dispatchEvent() {
       synthesizeComposition({ type: "compositioncommitasis", key: { key: "KEY_Enter" } });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetMouseScrollEvent (DOMMouseScroll, vertical)",
     targetID: "input-text", eventType: "DOMMouseScroll",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 3, 4,
                       { deltaY: 30, lineOrPageDeltaY: 2 });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetMouseScrollEvent (DOMMouseScroll, horizontal)",
     targetID: "input-text", eventType: "DOMMouseScroll",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 4, 5,
                       { deltaX: 30, lineOrPageDeltaX: 2, shiftKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetMouseScrollEvent (MozMousePixelScroll, vertical)",
     targetID: "input-text", eventType: "MozMousePixelScroll",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 3, 4,
                       { deltaY: 20, lineOrPageDeltaY: 1, altKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetMouseScrollEvent (MozMousePixelScroll, horizontal)",
     targetID: "input-text", eventType: "MozMousePixelScroll",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 4, 5,
                       { deltaX: 20, lineOrPageDeltaX: 1, ctrlKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetWheelEvent (wheel, vertical)",
     targetID: "input-text", eventType: "wheel",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 3, 4,
                       { deltaY: 20, lineOrPageDeltaY: 1, altKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetWheelEvent (wheel, horizontal)",
     targetID: "input-text", eventType: "wheel",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 4, 5,
                       { deltaX: 20, lineOrPageDeltaX: 1, ctrlKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetWheelEvent (wheel, both)",
     targetID: "input-text", eventType: "wheel",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).value = "";
       synthesizeWheel(document.getElementById(this.targetID), 4, 5,
                       { deltaX: 20, deltaY: 10,
                         lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetTouchEvent (touchstart)",
-    target: function () { return document; }, eventType: "touchstart",
-    dispatchEvent: function () {
+    target() { return document; }, eventType: "touchstart",
+    dispatchEvent() {
       synthesizeTouchAtPoint(1, 2, { id: 10, rx: 4, ry: 3, angle: 0, force: 1, shiftKey: true});
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetTouchEvent (touchend)",
-    target: function () { return document; }, eventType: "touchend",
-    dispatchEvent: function () {
+    target() { return document; }, eventType: "touchend",
+    dispatchEvent() {
       synthesizeTouchAtPoint(4, 6, { id: 5, rx: 1, ry: 2, angle: 0.5, force: 0.8, ctrlKey: true});
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "InternalFormEvent (reset)",
     targetID: "form", eventType: "reset",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById("form").reset();
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetCommandEvent",
     targetID: "input-text", eventType: "",
-    dispatchEvent: function () {
-      return;
+    dispatchEvent() {
+
     },
-    canRun: function () {
+    canRun() {
       todo(false, "WidgetCommandEvent isn't tested");
       return false;
     },
     todoMismatch: [],
   },
   { description: "InternalClipboardEvent (copy)",
     targetID: "input-text", eventType: "copy",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById("input-text").value = "go to clipboard!";
       document.getElementById("input-text").focus();
       document.getElementById("input-text").select();
       synthesizeKey("c", { accelKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "InternalUIEvent (DOMActivate)",
     targetID: "button", eventType: "DOMActivate",
-    dispatchEvent: function () {
+    dispatchEvent() {
       synthesizeMouseAtCenter(document.getElementById(this.targetID),
                               { button: 0, shiftKey: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalFocusEvent (focus)",
     targetID: "input-text", eventType: "focus",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).focus();
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalFocusEvent (blur)",
     targetID: "input-text", eventType: "blur",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).blur();
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "WidgetSimpleGestureEvent",
     targetID: "", eventType: "",
-    dispatchEvent: function () {
-      return;
+    dispatchEvent() {
+
     },
-    canRun: function () {
+    canRun() {
       // Simple gesture event may be handled before it comes content.
       // So, we cannot test it in this test.
       todo(false, "WidgetSimpleGestureEvent isn't tested");
       return false;
     },
     todoMismatch: [],
   },
   { description: "InternalTransitionEvent (transitionend)",
     targetID: "a", eventType: "transitionend",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).focus();
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalAnimationEvent (animationend)",
     targetID: "animated-div", eventType: "animationend",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).className = "slidin";
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalMutationEvent (DOMAttrModified)",
     targetID: "animated-div", eventType: "DOMAttrModified",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById(this.targetID).setAttribute("x-data", "foo");
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalMutationEvent (DOMNodeInserted)",
     targetID: "animated-div", eventType: "DOMNodeInserted",
-    dispatchEvent: function () {
+    dispatchEvent() {
       var div = document.createElement("div");
       div.id = "inserted-div";
       document.getElementById("animated-div").appendChild(div);
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "InternalMutationEvent (DOMNodeRemoved)",
     targetID: "animated-div", eventType: "DOMNodeRemoved",
-    dispatchEvent: function () {
+    dispatchEvent() {
       document.getElementById("animated-div").removeChild(document.getElementById("inserted-div"));
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "PointerEvent (pointerdown)",
     targetID: "pointer-target", eventType: "mousedown",
-    dispatchEvent: function () {
+    dispatchEvent() {
       var elem = document.getElementById(this.targetID);
       var rect = elem.getBoundingClientRect();
-      synthesizeMouse(elem, rect.width/2, rect.height/2,
+      synthesizeMouse(elem, rect.width / 2, rect.height / 2,
                       { type: this.eventType, button: 1, clickCount: 1, inputSource: 2, pressure: 0.25, isPrimary: true });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
   { description: "PointerEvent (pointerup)",
     targetID: "pointer-target", eventType: "mouseup",
-    dispatchEvent: function () {
+    dispatchEvent() {
       var elem = document.getElementById(this.targetID);
       var rect = elem.getBoundingClientRect();
-      synthesizeMouse(elem, rect.width/2, rect.height/2,
+      synthesizeMouse(elem, rect.width / 2, rect.height / 2,
                       { type: this.eventType, button: -1, ctrlKey: true, shiftKey: true, altKey: true, isSynthesized: false });
     },
-    canRun: function () {
+    canRun() {
       return true;
     },
     todoMismatch: [],
   },
 ];
 
 /**
  * Sets or clears dom.keyboardevent.dispatch_during_composition and calls the
@@ -675,28 +673,27 @@ function setAndObserveCompositionPref(aV
   let pref = "dom.keyboardevent.dispatch_during_composition";
   if (aValue === null) {
     SpecialPowers.pushPrefEnv({"clear": [[pref]]}, aCallback);
   } else {
     SpecialPowers.pushPrefEnv({"set": [[pref, aValue]]}, aCallback);
   }
 }
 
-function doTest(aTest)
-{
+function doTest(aTest) {
   if (!aTest.canRun()) {
     SimpleTest.executeSoon(runNextTest);
     return;
   }
   gEvent = null;
   gCopiedEvent = [];
   gDescription = aTest.description + " (gCallPreventDefault=" + gCallPreventDefault + ")";
   var target = aTest.target ? aTest.target() : document.getElementById(aTest.targetID);
   target.addEventListener(aTest.eventType, onEvent, true);
-  gCallback = function () {
+  gCallback = function() {
     target.removeEventListener(aTest.eventType, onEvent, true);
     ok(gEvent !== null, gDescription + ": failed to get duplicated event");
     ok(gCopiedEvent.length > 0, gDescription + ": count of attribute of the event must be larger than 0");
     for (var i = 0; i < gCopiedEvent.length; ++i) {
       var name = gCopiedEvent[i].name;
       if (name == "rangeOffset") {
         todo(false, gDescription + ": " + name + " attribute value is never reset (" + gEvent[name] + ")");
       } else if (name == "eventPhase") {
@@ -715,18 +712,17 @@ function doTest(aTest)
     if (!testWillCallRunNextTest) {
       runNextTest();
     }
   };
   var testWillCallRunNextTest = aTest.dispatchEvent();
 }
 
 var gIndex = -1;
-function runNextTest()
-{
+function runNextTest() {
   if (++gIndex == kTests.length) {
     if (gCallPreventDefault) {
       finish();
       return;
     }
     // Test with a call of preventDefault() of the events.
     gCallPreventDefault = true;
     gIndex = -1;
@@ -736,43 +732,41 @@ function runNextTest()
     document.getElementById("scrolled-div").style.height = "10px";
     document.getElementById("scrolled-div").style.width = "10px";
     document.getElementById("input-text").value = "";
     document.getElementById("animated-div").className = "";
     document.getElementById("animated-div").removeAttribute("x-data");
     if (document.activeElement) {
       document.activeElement.blur();
     }
-    window.requestAnimationFrame(function () {
+    window.requestAnimationFrame(function() {
       setTimeout(runNextTest, 0);
     });
     return;
   }
   doTest(kTests[gIndex]);
 }
 
-function init()
-{
-  SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
+function init() {
+  SpecialPowers.pushPrefEnv({"set": [["middlemouse.contentLoadURL", false],
                                     ["middlemouse.paste", false],
                                     ["general.autoScroll", false],
                                     ["dom.w3c_pointer_events.enabled", true],
                                     ["mousewheel.default.action", 0],
                                     ["mousewheel.default.action.override_x", -1],
                                     ["mousewheel.with_shift.action", 0],
                                     ["mousewheel.with_shift.action.override_x", -1],
                                     ["mousewheel.with_control.action", 0],
                                     ["mousewheel.with_control.action.override_x", -1],
                                     ["mousewheel.with_alt.action", 0],
                                     ["mousewheel.with_alt.action.override_x", -1],
                                     ["mousewheel.with_meta.action", 0],
                                     ["mousewheel.with_meta.action.override_x", -1]]}, runNextTest);
 }
 
-function finish()
-{
+function finish() {
   SimpleTest.finish();
 }
 
 SimpleTest.waitForFocus(init);
 
 </script>
 </body>
--- a/widget/tests/test_bug1151186.html
+++ b/widget/tests/test_bug1151186.html
@@ -14,18 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 1151186 **/
   SimpleTest.waitForExplicitFinish();
 
   document.addEventListener("focus", () => {
     document.getElementById("editor").focus();
     SimpleTest.executeSoon(runTests);
   });
 
-  function runTests()
-  {
+  function runTests() {
     is(document.activeElement, document.getElementById("editor"),
        "The div element should be focused");
     var utils = SpecialPowers.getDOMWindowUtils(window);
     is(utils.IMEStatus, utils.IME_STATUS_ENABLED,
        "IME should be enabled");
     SimpleTest.finish();
   }
   </script>
--- a/widget/tests/test_bug413277.html
+++ b/widget/tests/test_bug413277.html
@@ -13,21 +13,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=413277">Mozilla Bug 413277</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript">
-  var atts='width=100, height=100, top=100, screenY=100';
-  atts += ', left=100, screenX=100, toolbar=no';
-  atts += ', location=no, directories=no, status=no';
-  atts += ', menubar=no, scrollbars=no, resizable=no';
-  var newWindow = window.open('_blank', 'win_name', atts);
+  var atts = "width=100, height=100, top=100, screenY=100";
+  atts += ", left=100, screenX=100, toolbar=no";
+  atts += ", location=no, directories=no, status=no";
+  atts += ", menubar=no, scrollbars=no, resizable=no";
+  var newWindow = window.open("_blank", "win_name", atts);
   
   newWindow.resizeBy(1000000, 1000000);
   SimpleTest.is(newWindow.outerWidth, newWindow.screen.availWidth, true);
   SimpleTest.is(newWindow.outerHeight, newWindow.screen.availHeight, true);
   SimpleTest.is(newWindow.screenY, newWindow.screen.availTop, true);
   SimpleTest.is(newWindow.screenX, newWindow.screen.availLeft, true);
   
   newWindow.close();
--- a/widget/tests/test_bug565392.html
+++ b/widget/tests/test_bug565392.html
@@ -19,46 +19,46 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 565392 **/
 
   var ds = Cc["@mozilla.org/file/directory_service;1"]
              .getService(Ci.nsIProperties);
   var dir1 = ds.get("ProfD", Ci.nsIFile);
   var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
                     .getService(Ci.nsIClipboard);
-  
+
   function getLoadContext() {
     return window.docShell.QueryInterface(Ci.nsILoadContext);
   }
 
   function getTransferableFile(file) {
-    var transferable = Cc['@mozilla.org/widget/transferable;1']
+    var transferable = Cc["@mozilla.org/widget/transferable;1"]
                          .createInstance(Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.setTransferData("application/x-moz-file", file);
     return transferable;
   }
 
   function setClipboardData(transferable) {
     clipboard.setData(transferable, null, 1);
   }
-  
+
   function getClipboardData(mime) {
-    var transferable = Cc['@mozilla.org/widget/transferable;1']
+    var transferable = Cc["@mozilla.org/widget/transferable;1"]
                          .createInstance(Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = {};
     transferable.getTransferData(mime, data);
     return data;
   }
 
-setClipboardData(getTransferableFile(dir1))
-is(clipboard.hasDataMatchingFlavors(["application/x-moz-file"], 1,1), true);
+setClipboardData(getTransferableFile(dir1));
+is(clipboard.hasDataMatchingFlavors(["application/x-moz-file"], 1, 1), true);
 var data = getClipboardData("application/x-moz-file");
 var file = data.value.QueryInterface(Ci.nsIFile);
 ok(file.isDirectory(), true);
 is(file.target, dir1.target, true);
 
 </script>
 </pre>
 </body>
--- a/widget/tests/test_imestate.html
+++ b/widget/tests/test_imestate.html
@@ -113,18 +113,17 @@ setTestPluginEnabledState(SpecialPowers.
 </div>
 <pre id="test">
 </pre>
 
 <script class="testbody" type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
-function hitEventLoop(aFunc, aTimes)
-{
+function hitEventLoop(aFunc, aTimes) {
   if (--aTimes) {
     setTimeout(hitEventLoop, 0, aFunc, aTimes);
   } else {
     setTimeout(aFunc, 20);
   }
 }
 
 var gUtils = window.windowUtils;
@@ -135,18 +134,17 @@ const kIMEEnabledSupported = navigator.p
                              navigator.platform.indexOf("Linux") == 0;
 
 // We support to control IME open state on Windows and Mac actually.  However,
 // we cannot test it on Mac if the current keyboard layout is not CJK. And also
 // we cannot test it on Win32 if the system didn't be installed IME. So,
 // currently we should not run the open state testing.
 const kIMEOpenSupported = false;
 
-function runBasicTest(aIsEditable, aInDesignMode, aDescription)
-{
+function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
   var onIMEFocusBlurHandler = null;
   var TIPCallback = function(aTIP, aNotification) {
     switch (aNotification.type) {
       case "request-to-commit":
         aTIP.commitComposition();
         break;
       case "request-to-cancel":
         aTIP.cancelComposition();
@@ -163,20 +161,18 @@ function runBasicTest(aIsEditable, aInDe
 
   var TIP = Cc["@mozilla.org/text-input-processor;1"]
               .createInstance(Ci.nsITextInputProcessor);
   if (!TIP.beginInputTransactionForTests(window, TIPCallback)) {
     ok(false, "runBasicTest(): failed to begin input transaction");
     return;
   }
 
-  function test(aTest)
-  {
-    function moveFocus(aTest, aFocusEventHandler)
-    {
+  function test(aTest) {
+    function moveFocus(aTest, aFocusEventHandler) {
       if (aInDesignMode) {
         if (document.activeElement) {
           document.activeElement.blur();
         }
       } else if (aIsEditable) {
         document.getElementById("display").focus();
       } else if (aTest.expectedEnabled == gUtils.IME_STATUS_ENABLED) {
         document.getElementById("password").focus();
@@ -213,18 +209,17 @@ function runBasicTest(aIsEditable, aInDe
            aDescription + ": " + aTest.description + ", focus didn't move");
         return (element == focusedElement);
       }
       is(focusedElement, previousFocusedElement,
          aDescription + ": " + aTest.description + ", focus moved as unexpected");
       return (previousFocusedElement == focusedElement);
     }
 
-    function testOpened(aTest, aOpened)
-    {
+    function testOpened(aTest, aOpened) {
       document.getElementById("text").focus();
       gUtils.IMEIsOpen = aOpened;
       if (!moveFocus(aTest)) {
         return;
       }
       var message = aDescription + ": " + aTest.description +
                                             ", wrong opened state";
       is(gUtils.IMEIsOpen,
@@ -234,18 +229,17 @@ function runBasicTest(aIsEditable, aInDe
     // IME Enabled state testing
     var enabled = gUtils.IME_STATUS_ENABLED;
     if (kIMEEnabledSupported) {
       var focusEventCount = 0;
       var IMEReceivesFocus = 0;
       var IMEReceivesBlur = 0;
       var IMEHasFocus = false;
 
-      function onFocus(aEvent)
-      {
+      function onFocus(aEvent) {
         switch (aEvent.type) {
           case "focus":
             focusEventCount++;
             is(gUtils.IMEStatus, aTest.expectedEnabled,
                aDescription + ": " + aTest.description + ", wrong enabled state at focus event");
             break;
           case "notify-focus":
             IMEReceivesFocus++;
@@ -326,17 +320,17 @@ function runBasicTest(aIsEditable, aInDe
       inputtype = gUtils.focusedInputType;
       is(enabled, aTest.expectedEnabled,
          aDescription + ": " + aTest.description + ", wrong enabled state");
       if (aTest.expectedType && !aInDesignMode) {
         is(inputtype, aTest.expectedType,
            aDescription + ": " + aTest.description + ", wrong input type");
       } else if (aInDesignMode) {
         is(inputtype, "",
-           aDescription + ": " + aTest.description + ", wrong input type")
+           aDescription + ": " + aTest.description + ", wrong input type");
       }
     }
 
     if (!kIMEOpenSupported || enabled != gUtils.IME_STATUS_ENABLED ||
         aTest.expectedEnabled != gUtils.IME_STATUS_ENABLED) {
       return;
     }
 
@@ -667,18 +661,17 @@ function runBasicTest(aIsEditable, aInDe
       expectedEnabled: gUtils.IME_STATUS_ENABLED },
   ];
 
   for (var i = 0; i < kTests.length; i++) {
     test(kTests[i]);
   }
 }
 
-function runPluginTest()
-{
+function runPluginTest() {
   if (!kIMEEnabledSupported) {
     return;
   }
 
   if (navigator.platform.indexOf("Mac") == 0) {
     // XXX on mac, currently, this test isn't passed because it doesn't return
     // IME_STATUS_PLUGIN by its bug.
     return;
@@ -707,18 +700,17 @@ function runPluginTest()
   is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
      "runPluginTest: unexpected enabled state when plugin is removed from tree");
 
   document.getElementById("text").focus();
   is(gUtils.IMEStatus, gUtils.IME_STATUS_ENABLED,
      "runPluginTest: unexpected enabled state when input[type=text] has focus");
 }
 
-function runTypeChangingTest()
-{
+function runTypeChangingTest() {
   if (!kIMEEnabledSupported)
     return;
 
   const kInputControls = [
     { id: "text",
       type: "text",     expected: gUtils.IME_STATUS_ENABLED,
       description: "[type=\"text\"]" },
     { id: "text_readonly",
@@ -871,17 +863,17 @@ function runTypeChangingTest()
     { id: "ime_mode_active_p",
       type: "password", expected: gUtils.IME_STATUS_ENABLED,  imeMode:  true,
       description: "[type=\"password\"][ime-mode: active;]" },
     { id: "ime_mode_inactive_p",
       type: "password", expected: gUtils.IME_STATUS_ENABLED,  imeMode:  true,
       description: "[type=\"password\"][ime-mode: inactive;]" },
     { id: "ime_mode_disabled_p",
       type: "password", expected: gUtils.IME_STATUS_PASSWORD, imeMode:  true,
-      description: "[type=\"password\"][ime-mode: disabled;]" }
+      description: "[type=\"password\"][ime-mode: disabled;]" },
   ];
 
   const kInputTypes = [
     { type: "",         expected: gUtils.IME_STATUS_ENABLED  },
     { type: "text",     expected: gUtils.IME_STATUS_ENABLED  },
     { type: "password", expected: gUtils.IME_STATUS_PASSWORD },
     { type: "checkbox", expected: gUtils.IME_STATUS_DISABLED },
     { type: "radio",    expected: gUtils.IME_STATUS_DISABLED },
@@ -889,21 +881,20 @@ function runTypeChangingTest()
     { type: "reset",    expected: gUtils.IME_STATUS_DISABLED },
     { type: "file",     expected: gUtils.IME_STATUS_DISABLED },
     { type: "button",   expected: gUtils.IME_STATUS_DISABLED },
     { type: "image",    expected: gUtils.IME_STATUS_DISABLED },
     { type: "url",      expected: gUtils.IME_STATUS_ENABLED  },
     { type: "email",    expected: gUtils.IME_STATUS_ENABLED  },
     { type: "search",   expected: gUtils.IME_STATUS_ENABLED  },
     { type: "tel",      expected: gUtils.IME_STATUS_ENABLED  },
-    { type: "number",   expected: gUtils.IME_STATUS_ENABLED  }
+    { type: "number",   expected: gUtils.IME_STATUS_ENABLED  },
   ];
 
-  function getExpectedIMEEnabled(aNewType, aInputControl)
-  {
+  function getExpectedIMEEnabled(aNewType, aInputControl) {
     if (aNewType.expected == gUtils.IME_STATUS_DISABLED ||
         aInputControl.isReadonly)
       return gUtils.IME_STATUS_DISABLED;
     return aInputControl.imeMode ? aInputControl.expected : aNewType.expected;
   }
 
   const kOpenedState = [ true, false ];
 
@@ -915,20 +906,20 @@ function runTypeChangingTest()
       e.focus();
       for (var k = 0; k < kInputTypes.length; k++) {
         const kType = kInputTypes[k];
         var typeChangingDescription =
           "\"" + e.getAttribute("type") + "\" to \"" + kInput.type + "\"";
         e.setAttribute("type", kInput.type);
         is(gUtils.IMEStatus, kInput.expected,
            "type attr changing test (IMEStatus): " + typeChangingDescription +
-             " (" +  kInput.description + ")");
+             " (" + kInput.description + ")");
         is(gUtils.focusedInputType, kInput.type,
            "type attr changing test (type): " + typeChangingDescription +
-             " (" +  kInput.description + ")");
+             " (" + kInput.description + ")");
 
         const kTestOpenState = kIMEOpenSupported &&
                 gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED &&
                 getExpectedIMEEnabled(kType, kInput) == gUtils.IME_STATUS_ENABLED;
         if (kTestOpenState) {
           gUtils.IMEIsOpen = kOpened;
         }
 
@@ -936,36 +927,35 @@ function runTypeChangingTest()
           "\"" + e.getAttribute("type") + "\" to \"" + kType.type + "\"";
         if (kType.type != "")
           e.setAttribute("type", kType.type);
         else
           e.removeAttribute("type");
 
         is(gUtils.IMEStatus, getExpectedIMEEnabled(kType, kInput),
            "type attr changing test (IMEStatus): " + typeChangingDescription +
-             " (" +  kInput.description + ")");
+             " (" + kInput.description + ")");
         is(gUtils.focusedInputType, kType.type,
            "type attr changing test (type): " + typeChangingDescription +
-             " (" +  kInput.description + ")");
+             " (" + kInput.description + ")");
         if (kTestOpenState && gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED) {
           is(gUtils.IMEIsOpen, kOpened,
              "type attr changing test (open state is changed): " +
-               typeChangingDescription + " (" +  kInput.description + ")");
+               typeChangingDescription + " (" + kInput.description + ")");
         }
       }
       // reset the type to default
       e.setAttribute("type", kInput.type);
     }
     if (!kIMEOpenSupported)
       break;
   }
 }
 
-function runReadonlyChangingTest()
-{
+function runReadonlyChangingTest() {
   if (!kIMEEnabledSupported)
     return;
 
   const kInputControls = [
     { id: "text",
       type: "text",     expected: gUtils.IME_STATUS_ENABLED  },
     { id: "password",
       type: "password", expected: gUtils.IME_STATUS_PASSWORD },
@@ -975,17 +965,17 @@ function runReadonlyChangingTest()
       type: "email",    expected: gUtils.IME_STATUS_ENABLED  },
     { id: "search",
       type: "search",   expected: gUtils.IME_STATUS_ENABLED  },
     { id: "tel",
       type: "tel",      expected: gUtils.IME_STATUS_ENABLED  },
     { id: "number",
       type: "number",   expected: gUtils.IME_STATUS_ENABLED  },
     { id: "textarea",
-      type: "textarea", expected: gUtils.IME_STATUS_ENABLED  }
+      type: "textarea", expected: gUtils.IME_STATUS_ENABLED  },
   ];
   const kOpenedState = [ true, false ];
 
   for (var i = 0; i < kOpenedState.length; i++) {
     const kOpened = kOpenedState[i];
     for (var j = 0; j < kInputControls.length; j++) {
       const kInput = kInputControls[j];
       var e = document.getElementById(kInput.id);
@@ -1005,18 +995,17 @@ function runReadonlyChangingTest()
            kInput.type);
       }
     }
     if (!kIMEOpenSupported)
       break;
   }
 }
 
-function runComplexContenteditableTests()
-{
+function runComplexContenteditableTests() {
   if (!kIMEEnabledSupported) {
     return;
   }
 
   var description = "runReadonlyChangingOnContenteditable: ";
 
   var container = document.getElementById("display");
   var button = document.getElementById("button");
@@ -1074,18 +1063,17 @@ function runComplexContenteditableTests(
      description + "IME is still disabled on the button, the container isn't readonly now");
   container.removeAttribute("contenteditable");
   is(gFM.focusedElement, button,
      description + "The button loses focus, the container has been no editable");
   todo_is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
           description + "IME is still enabled on the button, the container has been no editable");
 
   description = "testOnIndependentEditor: ";
-  function testOnIndependentEditor(aEditor, aEditorDescription)
-  {
+  function testOnIndependentEditor(aEditor, aEditorDescription) {
     var isReadonly = aEditor.readOnly;
     var expectedState =
       aEditor.readOnly ? gUtils.IME_STATUS_DISABLED : gUtils.IME_STATUS_ENABLED;
     var unexpectedStateDescription =
       expectedState != gUtils.IME_STATUS_ENABLED ? "enabled" : "disabled";
     aEditor.focus();
     is(gFM.focusedElement, aEditor,
        description + "The " + aEditorDescription + " doesn't get focus");
@@ -1133,18 +1121,17 @@ function runComplexContenteditableTests(
   // an input field which is in the editor has focus
   testOnIndependentEditor(document.getElementById("text"),
                           "input[type=\"text\"]");
   // a readonly input field which is in the editor has focus
   testOnIndependentEditor(document.getElementById("text_readonly"),
                           "input[type=\"text\"][readonly]");
 
   description = "testOnOutsideOfEditor: ";
-  function testOnOutsideOfEditor(aFocusNode, aFocusNodeDescription, aEditor)
-  {
+  function testOnOutsideOfEditor(aFocusNode, aFocusNodeDescription, aEditor) {
     if (aFocusNode) {
       aFocusNode.focus();
       is(gFM.focusedElement, aFocusNode,
          description + "The " + aFocusNodeDescription + " doesn't get focus");
     } else {
       if (document.activeElement) {
         document.activeElement.blur();
       }
@@ -1202,18 +1189,17 @@ function runComplexContenteditableTests(
   testOnOutsideOfEditor(document.getElementById("text_readonly"),
                         "input[type=\"text\"][readonly]", div);
   // a readonly input field which outside of the editor has focus
   testOnOutsideOfEditor(document.getElementById("button"), "button", div);
   // nobody has focus.
   testOnOutsideOfEditor(null, "nobody", div);
 }
 
-function runEditorFlagChangeTests()
-{
+function runEditorFlagChangeTests() {
   if (!kIMEEnabledSupported) {
     return;
   }
 
   var description = "runEditorFlagChangeTests: ";
 
   var container = document.getElementById("display");
 
@@ -1236,20 +1222,20 @@ function runEditorFlagChangeTests()
   var flags = editor.flags;
 
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3078\u3093\u3057\u3093",
         "clauses":
         [
-          { "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
-        ]
+          { "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
+        ],
       },
-      "caret": { "start": 4, "length": 0 }
+      "caret": { "start": 4, "length": 0 },
     });
 
   editor.flags &= ~kIMEStateChangeFlags;
   ok(editor.composing,
      description + "#1 IME composition was committed unexpectedly");
   is(gUtils.IMEStatus, gUtils.IME_STATUS_ENABLED,
      description + "#1 IME isn't enabled on HTML editor");
 
@@ -1266,96 +1252,83 @@ function runEditorFlagChangeTests()
      description + "#3 IME isn't enabled on HTML editor");
 
   // cancel the composition
   synthesizeComposition({ type: "compositioncommit", data: "" });
 
   container.removeAttribute("contenteditable");
 }
 
-function runEditableSubframeTests()
-{
+function runEditableSubframeTests() {
   window.open("window_imestate_iframes.html", "_blank",
               "width=600,height=600");
 }
 
-function runTestPasswordFieldOnDialog()
-{
+function runTestPasswordFieldOnDialog() {
   if (!kIMEEnabledSupported) {
     return;
   }
 
   if (document.activeElement) {
     document.activeElement.blur();
   }
 
   var dialog;
 
-  function WindowObserver()
-  {
+  function WindowObserver() {
     Cc["@mozilla.org/observer-service;1"].
        getService(Ci.nsIObserverService).
        addObserver(this, "domwindowopened");
   }
 
   WindowObserver.prototype = {
-    QueryInterface: function (iid)
-    {
-      if (iid.equals(Ci.nsIObserver) ||
-          iid.equals(Ci.nsISupports)) {
-        return this;
-      }
-    },
+    QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
 
-    observe: function (subject, topic, data)
-    {
+    observe(subject, topic, data) {
       if (topic === "domwindowopened") {
         ok(true, "dialog window is created");
         dialog = subject.QueryInterface(Ci.nsIDOMWindow);
         dialog.addEventListener("load", onPasswordDialogLoad);
       }
-    }
+    },
   };
 
   var observer = new WindowObserver();
   var arg1 = new Object(), arg2 = new Object();
   Cc["@mozilla.org/embedcomp/prompt-service;1"].
      getService(Ci.nsIPromptService).
      promptPassword(window, "title", "text", arg1, "msg", arg2);
 
   ok(true, "password dialog was closed");
 
   Cc["@mozilla.org/observer-service;1"].
      getService(Ci.nsIObserverService).
      removeObserver(observer, "domwindowopened");
 
   var passwordField;
 
-  function onPasswordDialogLoad()
-  {
+  function onPasswordDialogLoad() {
     ok(true, "onPasswordDialogLoad is called");
     dialog.removeEventListener("load", onPasswordDialogLoad);
     passwordField = dialog.document.getElementById("password1Textbox");
     passwordField.addEventListener("focus", onPasswordFieldFocus);
   }
 
-  function onPasswordFieldFocus()
-  {
+  function onPasswordFieldFocus() {
     ok(true, "onPasswordFieldFocus is called");
     passwordField.removeEventListener("focus", onPasswordFieldFocus);
     var utils = dialog.windowUtils;
     is(utils.IMEStatus, utils.IME_STATUS_PASSWORD,
        "IME isn't disabled on a password field of password dialog");
     synthesizeKey("VK_ESCAPE", { }, dialog);
   }
 }
 
 // Bug 580388 and bug 808287
-function runEditorReframeTests(aCallback)
-{
+function runEditorReframeTests(aCallback) {
   if (document.activeElement) {
     document.activeElement.blur();
   }
 
   var IMEFocus = 0;
   var IMEBlur = 0;
   var IMEHasFocus = false;
   var TIPCallback = function(aTIP, aNotification) {
@@ -1391,26 +1364,26 @@ function runEditorReframeTests(aCallback
   is(IMEFocus, 1, "runEditorReframeTests(): IME should receive a focus notification by a call of <input>.focus()");
   is(IMEBlur, 0, "runEditorReframeTests(): IME shouldn't receive a blur notification by a call of <input>.focus()");
   ok(IMEHasFocus, "runEditorReframeTests(): IME should have focus because <input>.focus() is called");
 
   IMEFocus = IMEBlur = 0;
 
   input.style.overflow = "visible";
 
-  var onInput = function (aEvent) {
+  var onInput = function(aEvent) {
     aEvent.target.style.overflow = "hidden";
-  }
+  };
   input.addEventListener("input", onInput, true);
 
   var AKey = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A });
   TIP.keydown(AKey);
   TIP.keyup(AKey);
 
-  hitEventLoop(function () {
+  hitEventLoop(function() {
     is(IMEFocus, 0, "runEditorReframeTests(): IME shouldn't receive a focus notification during reframing");
     is(IMEBlur, 0, "runEditorReframeTests(): IME shouldn't receive a blur notification during reframing");
     ok(IMEHasFocus, "runEditorReframeTests(): IME must have focus even after reframing");
 
     var onFocus = function(aEvent) {
       // Perform a style change and query during focus to trigger reframing
       input.style.overflow = "visible";
       synthesizeQuerySelectedText();
@@ -1436,18 +1409,17 @@ function runEditorReframeTests(aCallback
 
       TIP = null;
 
       hitEventLoop(aCallback, 20);
     }, 20);
   }, 20);
 }
 
-function runTests()
-{
+function runTests() {
   if (!kIMEEnabledSupported && !kIMEOpenSupported)
     return;
 
   // test for normal contents.
   runBasicTest(false, false, "Testing of normal contents");
 
   // test for plugin contents
   runPluginTest();
@@ -1483,26 +1455,25 @@ function runTests()
   // complex contenteditable editor's tests
   runComplexContenteditableTests();
 
   // test whether the IME state and composition are not changed unexpectedly
   runEditorFlagChangeTests();
 
   // test password field on dialog
   // XXX temporary disable against failure
-  //runTestPasswordFieldOnDialog();
+  // runTestPasswordFieldOnDialog();
 
   // Asynchronous tests
-  runEditorReframeTests(function () {
+  runEditorReframeTests(function() {
     // This will call onFinish(), so, this test must be the last.
     runEditableSubframeTests();
   });
 }
 
-function onFinish()
-{
+function onFinish() {
   SimpleTest.finish();
 }
 
 </script>
 </body>
 
 </html>
--- a/widget/tests/test_keypress_event_with_alt_on_mac.html
+++ b/widget/tests/test_keypress_event_with_alt_on_mac.html
@@ -20,34 +20,32 @@
 </div>
 <pre id="test">
 </pre>
 
 <script class="testbody" type="application/javascript">
 SimpleTest.waitForExplicitFinish();
 
 async function testNativeKey(aKeyboardLayout, aNativeKeyCode, aModifiers,
-                             aChars, aUnmodifiedChars)
-{
+                             aChars, aUnmodifiedChars) {
   // XXX Need to listen keyup event here because synthesizeNativeKey() does not
   //     guarantee that its callback will be called after "keypress" and "keyup".
   let waitForKeyUp = new Promise(resolve => {
     document.addEventListener("keyup", resolve, {once: true});
   });
   let keypress;
   document.addEventListener("keypress", (aKeyPressEvent) => {
     keypress = aKeyPressEvent;
   }, {once: true});
   synthesizeNativeKey(aKeyboardLayout, aNativeKeyCode, aModifiers, aChars, aUnmodifiedChars);
   await waitForKeyUp;
   return keypress;
 }
 
-async function runTests()
-{
+async function runTests() {
   await SpecialPowers.pushPrefEnv({"set": [
           ["dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", true],
         ]});
   const kTests =
     [ { target: "input", isEditable: true },
       { target: "password", isEditable: true },
       { target: "readonly-input", isEditable: false },
       { target: "textarea", isEditable: true },
--- a/widget/tests/test_native_key_bindings_mac.html
+++ b/widget/tests/test_native_key_bindings_mac.html
@@ -100,210 +100,207 @@
       let expectations = [];
 
       // Move to beginning of line
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_LeftArrow,
                             {ctrlKey: true}, "\uf702", "\uf702"]);
       expectations.push({
         editable: [0, 0],
         textarea: [0, 0],
-        input:    [0, 0]
+        input:    [0, 0],
       });
 
       // Move to end of line
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {ctrlKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [73, 73],
         textarea: [72, 72],
-        input:    [732, 732]
+        input:    [732, 732],
       });
 
       // Move down
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_N,
                             {ctrlKey: true}, "\u000e", "n"]);
       expectations.push({
         editable: [140, 140],
         textarea: [145, 145],
-        input:    [732, 732]
+        input:    [732, 732],
       });
 
       // Move to beginning of line
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_LeftArrow,
                             {ctrlKey: true}, "\uf702", "\uf702"]);
       expectations.push({
         editable: [73, 73],
         textarea: [73, 73],
-        input:    [0, 0]
+        input:    [0, 0],
       });
 
       // Move word right and modify selection
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {altKey: true, shiftKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [73, 84],
         textarea: [73, 90],
-        input:    [0, 10]
+        input:    [0, 10],
       });
 
       // Move word right
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {altKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [84, 84],
         textarea: [90, 90],
-        input:    [10, 10]
+        input:    [10, 10],
       });
 
       // Move word right
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {altKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [89, 89],
         textarea: [95, 95],
-        input:    [17, 17]
+        input:    [17, 17],
       });
 
       // Move down and modify selection
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_DownArrow,
                             {shiftKey: true}, "\uf701", "\uf701"]);
       expectations.push({
         editable: [89, 171],
         textarea: [95, 175],
-        input:    [17, 732]
+        input:    [17, 732],
       });
 
       // Move backward and modify selection
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_B,
                             {ctrlKey: true, shiftKey: true}, "\u0002", "B"]);
       expectations.push({
         editable: [89, 170],
         textarea: [95, 174],
-        input:    [17, 731]
+        input:    [17, 731],
       });
 
       // Delete forward
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_D,
                             {ctrlKey: true}, "\u0004", "d"]);
       expectations.push({
         editable: [89, 89],
         textarea: [95, 95],
-        input:    [17, 17]
+        input:    [17, 17],
       });
 
       // Delete backward
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_H,
                             {ctrlKey: true}, "\u0008", "h"]);
       expectations.push({
         editable: [88, 88],
         textarea: [94, 94],
-        input:    [16, 16]
+        input:    [16, 16],
       });
 
       // Move backward
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_B,
                             {ctrlKey: true}, "\u0002", "b"]);
       expectations.push({
         editable: [87, 87],
         textarea: [93, 93],
-        input:    [15, 15]
+        input:    [15, 15],
       });
 
       // Move to beginning of paragraph (line for now)
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_A,
                             {ctrlKey: true}, "\u0001", "a"]);
       expectations.push({
         editable: [73, 73],
         textarea: [73, 73],
-        input:    [0, 0]
+        input:    [0, 0],
       });
 
       // Move forward
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_F,
                             {ctrlKey: true}, "\u0006", "f"]);
       expectations.push({
         editable: [74, 74],
         textarea: [74, 74],
-        input:    [1, 1]
+        input:    [1, 1],
       });
 
       // Move word right
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {altKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [84, 84],
         textarea: [90, 90],
-        input:    [10, 10]
+        input:    [10, 10],
       });
 
       // Move word right
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_RightArrow,
                             {altKey: true}, "\uf703", "\uf703"]);
       expectations.push({
         editable: [88, 88],
         textarea: [94, 94],
-        input:    [17, 17]
+        input:    [17, 17],
       });
 
       // Delete to end of paragraph (line for now)
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_K,
                             {ctrlKey: true}, "\u000b", "k"]);
       expectations.push({
         editable: [88, 88],
         textarea: [94, 94],
-        input:    [17, 17]
+        input:    [17, 17],
       });
 
       // Move backward and modify selection
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_B,
                             {ctrlKey: true, shiftKey: true}, "\u0002", "B"]);
       expectations.push({
         editable: [88, 87],
         textarea: [93, 94],
-        input:    [16, 17]
+        input:    [16, 17],
       });
 
       // Move to end of paragraph (line for now)
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_E,
                             {ctrlKey: true}, "\u0005", "e"]);
       expectations.push({
         editable: [139, 139],
         textarea: [94, 94],
-        input:    [17, 17]
+        input:    [17, 17],
       });
 
       // Move up
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_P,
                             {ctrlKey: true}, "\u0010", "p"]);
       expectations.push({
         editable: [73, 73],
         textarea: [21, 21],
-        input:    [0, 0]
+        input:    [0, 0],
       });
 
-      function checkWindowSelection(aElement, aSelection)
-      {
+      function checkWindowSelection(aElement, aSelection) {
         let selection = window.getSelection();
 
         is(selection.anchorOffset, aSelection[aElement.id][0],
            aElement.id + ": Incorrect anchor offset");
         is(selection.focusOffset, aSelection[aElement.id][1],
            aElement.id + ": Incorrect focus offset");
       }
 
-      function checkElementSelection(aElement, aSelection)
-      {
+      function checkElementSelection(aElement, aSelection) {
         is(aElement.selectionStart, aSelection[aElement.id][0],
            aElement.id + ": Incorrect selection start");
         is(aElement.selectionEnd, aSelection[aElement.id][1],
            aElement.id + ": Incorrect selection end");
       }
 
-      function* testRun(aElement, aSelectionCheck, aCallback)
-      {
+      function* testRun(aElement, aSelectionCheck, aCallback) {
         if (document.activeElement) {
           document.activeElement.blur();
         }
 
         aElement.focus();
 
         for (let i = 0; i < synthesizedKeys.length; i++) {
           synthesizedKeys[i].push(function() {
@@ -319,18 +316,17 @@
       function* doTest() {
         yield* testRun(document.getElementById("editable"), checkWindowSelection);
         yield* testRun(document.getElementById("textarea"), checkElementSelection);
         yield* testRun(document.getElementById("input"), checkElementSelection);
       }
 
       let gTestContinuation = null;
 
-      function continueTest()
-      {
+      function continueTest() {
         if (!gTestContinuation) {
           gTestContinuation = doTest();
         }
         var ret = gTestContinuation.next();
         if (ret.done) {
           SimpleTest.finish();
         } else {
           is(ret.value, true, "Successfully synthesized key");
--- a/widget/tests/test_picker_no_crash.html
+++ b/widget/tests/test_picker_no_crash.html
@@ -9,17 +9,17 @@
 <script type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 
 var childWindow;
 
 function testStepOne() {
-  childWindow = window.open('window_picker_no_crash_child.html', 'childWindow', 'width=300,height=150');
+  childWindow = window.open("window_picker_no_crash_child.html", "childWindow", "width=300,height=150");
   SimpleTest.waitForFocus(testStepTwo, childWindow);
 }
 
 function testStepTwo() {
   childWindow.document.form1.uploadbox.click();
   // This should not crash the browser
   childWindow.close();
   setTimeout("testStepThree();", 5000);
--- a/widget/tests/test_plugin_input_event.html
+++ b/widget/tests/test_plugin_input_event.html
@@ -42,17 +42,17 @@ function* doTest() {
   is(gPlugin.getLastKeyText(), "", "Must be empty before first key test");
 
   yield synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, WIN_VK_A, {}, "a", "a", continueTest);
   is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted");
 
   yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+", continueTest);
   is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
 
-  yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey:1}, "~", "+", continueTest);
+  yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey: 1}, "~", "+", continueTest);
   is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
 }
 
 var gTestContinuation = null;
 
 function continueTest() {
   if (!gTestContinuation) {
     gTestContinuation = doTest(continueTest);
--- a/widget/tests/test_plugin_scroll_consistency.html
+++ b/widget/tests/test_plugin_scroll_consistency.html
@@ -29,18 +29,17 @@ SimpleTest.waitForExplicitFinish();
 
 var plugin = document.getElementById("plugin");
 
 function consistencyCheck(state) {
   var s = plugin.doInternalConsistencyCheck();
   ok(s == "", "Consistency check: " + state + ": " + s);
 }
 
-function runTests()
-{
+function runTests() {
   consistencyCheck("Initial state");
 
   var scroll = document.getElementById("scroll");
   scroll.scrollTop = 10;
   consistencyCheck("Scrolled down a bit");
 
   setTimeout(function() {
     consistencyCheck("Before scrolling back to top");
--- a/widget/tests/test_scrollbar_colors.html
+++ b/widget/tests/test_scrollbar_colors.html
@@ -19,17 +19,17 @@
 <style id="style"></style>
 <div class="outer">
   <div class="inner">
   </div>
 </div>
 <script>
 function countPixels(canvas) {
   let result = new Map;
-  let ctx = canvas.getContext('2d');
+  let ctx = canvas.getContext("2d");
   let image = ctx.getImageData(0, 0, canvas.width, canvas.height);
   let data = image.data;
   let size = image.width * image.height;
   for (let i = 0; i < size; i++) {
     let key = data.subarray(i * 4, i * 4 + 3).toString();
     let value = result.get(key);
     value = value ? value : 0;
     result.set(key, value + 1);
@@ -59,27 +59,27 @@ const LINUX_REFERENCES = [
   // Yellow background
   ["255,255,0", 8100],
   // Blue scrollbar face
   ["0,0,255", 720],
   // Cyan scrollbar track
   ["0,255,255", 1180],
 ];
 
-let outer = document.querySelector('.outer');
+let outer = document.querySelector(".outer");
 let outerRect = outer.getBoundingClientRect();
 if (outerRect.width == outer.clientWidth &&
     outerRect.height == outer.clientHeight) {
   ok(true, "Using overlay scrollbar, skip this test");
 } else {
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.pushPrefEnv({
     "set": [["layout.css.scrollbar-color.enabled", true]],
   }, function() {
-    document.querySelector('#style').textContent = `
+    document.querySelector("#style").textContent = `
       .outer { scrollbar-color: blue cyan; }
     `;
 
     let canvas = snapshotRect(window, outerRect);
     let stats = countPixels(canvas);
     let references;
     if (navigator.platform.startsWith("Win")) {
       references = WIN_REFERENCES;
--- a/widget/tests/test_secure_input.html
+++ b/widget/tests/test_secure_input.html
@@ -27,28 +27,25 @@
   <textarea id="textarea"></textarea><br>
 </p>
 <div id="contenteditable" contenteditable style="min-height: 3em;"></div>
 
 <script class="testbody" type="application/javascript">
 
   SimpleTest.waitForExplicitFinish();
 
-  function sendAKeyEvent()
-  {
+  function sendAKeyEvent() {
     synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_A, {}, "a", "a");
   }
 
-  function isFocused(aElement)
-  {
+  function isFocused(aElement) {
     return (SpecialPowers.focusManager.focusedElement == aElement);
   }
 
-  function runTest()
-  {
+  function runTest() {
     sendAKeyEvent();
     ok(true, "Not crashed: input on the document");
     $("input_text").focus();
     sendAKeyEvent();
     ok(true, "Not crashed: input on <input type=\"text\">");
     $("input_password").focus();
     sendAKeyEvent();
     ok(true, "Not crashed: input on <input type=\"password\">");
@@ -87,17 +84,17 @@
     if (!otherWindow) {
       SimpleTest.finish();
       return;
     }
 
     $("input_text").focus();
     otherWindow.focus();
 
-    SimpleTest.waitForFocus(function () {
+    SimpleTest.waitForFocus(function() {
       window.focus();
       sendAKeyEvent();
       ok(isFocused($("input_text")), "focused element isn't <input type=\"text\">");
       ok(true, "Not crashed: input on <input type=\"text\"> after the other document has focus");
 
       $("input_password").focus();
       otherWindow.focus();
       window.focus();
@@ -133,16 +130,15 @@
       otherWindow.focus();
       otherWindow.document.getElementById("password").focus();
       window.focus();
       sendAKeyEvent();
       ok(isFocused($("input_password")), "focused element isn't <input type=\"password\">");
       ok(true, "Not crashed: input on <input type=\"password\"> after the other document's <input type=\"password\"> has focus");
 
       SimpleTest.finish();
-
     }, otherWindow);
   }
 
   SimpleTest.waitForFocus(runTest);
 </script>
 </body>
 </html>
--- a/widget/tests/unit/test_macsharingservice.js
+++ b/widget/tests/unit/test_macsharingservice.js
@@ -1,26 +1,24 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-//Basic tests to verify that MacSharingService returns expected data
+// Basic tests to verify that MacSharingService returns expected data
 
-function test_getSharingProviders()
-{
+function test_getSharingProviders() {
   let sharingService = Cc["@mozilla.org/widget/macsharingservice;1"].
       getService(Ci.nsIMacSharingService);
   let providers = sharingService.getSharingProviders("http://example.org");
   Assert.ok(providers.length > 1, "There are providers returned");
   providers.forEach(provider => {
     Assert.ok("name" in provider, "Provider has name");
     Assert.ok("menuItemTitle" in provider, "Provider has menuItemTitle");
     Assert.ok("image" in provider, "Provider has image");
 
     Assert.notEqual(provider.title, "Mail", "Known filtered provider not returned");
   });
 }
 
-function run_test()
-{
+function run_test() {
   test_getSharingProviders();
 }
--- a/widget/tests/unit/test_macwebapputils.js
+++ b/widget/tests/unit/test_macwebapputils.js
@@ -1,36 +1,33 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-//Basic tests to verify that MacWebAppUtils works
+// Basic tests to verify that MacWebAppUtils works
 
-function test_find_app()
-{
+function test_find_app() {
   var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
   createInstance(Ci.nsIMacWebAppUtils);
   let sig = "com.apple.TextEdit";
 
   let path;
   path = mwaUtils.pathForAppWithIdentifier(sig);
   info("TextEdit path: " + path + "\n");
   Assert.notEqual(path, "");
 }
 
-function test_dont_find_fake_app()
-{
+function test_dont_find_fake_app() {
   var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
   createInstance(Ci.nsIMacWebAppUtils);
   let sig = "calliope.penitentiary.dramamine";
 
   let path;
   path = mwaUtils.pathForAppWithIdentifier(sig);
   Assert.equal(path, "");
 }
 
 
-function run_test()
-{
+function run_test() {
   test_find_app();
   test_dont_find_fake_app();
 }
--- a/widget/tests/unit/test_taskbar_jumplistitems.js
+++ b/widget/tests/unit/test_taskbar_jumplistitems.js
@@ -1,17 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // This tests taskbar jump list functionality available on win7 and up.
 
-function test_basics()
-{
+function test_basics() {
   var item = Cc["@mozilla.org/windows-jumplistitem;1"].
   createInstance(Ci.nsIJumpListItem);
 
   var sep = Cc["@mozilla.org/windows-jumplistseparator;1"].
   createInstance(Ci.nsIJumpListSeparator);
 
   var shortcut = Cc["@mozilla.org/windows-jumplistshortcut;1"].
   createInstance(Ci.nsIJumpListShortcut);
@@ -36,80 +35,77 @@ function test_basics()
   Assert.ok(!link.equals(shortcut));
 
   Assert.ok(item.equals(item));
   Assert.ok(sep.equals(sep));
   Assert.ok(link.equals(link));
   Assert.ok(shortcut.equals(shortcut));
 }
 
-function test_separator()
-{
+function test_separator() {
   // separators:
 
   var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
   createInstance(Ci.nsIJumpListSeparator);
 
   Assert.ok(item.type == Ci.nsIJumpListItem.JUMPLIST_ITEM_SEPARATOR);
 }
 
-function test_hashes()
-{
+function test_hashes() {
   var link = Cc["@mozilla.org/windows-jumplistlink;1"]
              .createInstance(Ci.nsIJumpListLink);
   var uri1 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
                .createInstance(Ci.nsIURIMutator)
                .setSpec("http://www.123.com/")
                .finalize();
   var uri2 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
                .createInstance(Ci.nsIURIMutator)
                .setSpec("http://www.123.com/")
                .finalize();
 
   link.uri = uri1;
 
-  Assert.ok(link.compareHash(uri2))
+  Assert.ok(link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("http://www.456.com/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("http://www.123.com/").finalize();
-  Assert.ok(link.compareHash(uri2))
+  Assert.ok(link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("https://www.123.com/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("http://www.123.com/test/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
   uri1 = uri1.mutate().setSpec("http://www.123.com/test/").finalize();
   link.uri = uri1;
   uri2 = uri2.mutate().setSpec("http://www.123.com/test/").finalize();
-  Assert.ok(link.compareHash(uri2))
+  Assert.ok(link.compareHash(uri2));
   uri1 = uri1.mutate().setSpec("https://www.123.com/test/").finalize();
   link.uri = uri1;
   uri2 = uri2.mutate().setSpec("https://www.123.com/test/").finalize();
-  Assert.ok(link.compareHash(uri2))
+  Assert.ok(link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("ftp://www.123.com/test/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
   uri2 = uri2.mutate().setSpec("http://123.com/test/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
   uri1 = uri1.mutate().setSpec("https://www.123.com/test/").finalize();
   link.uri = uri1;
   uri2 = uri2.mutate().setSpec("https://www.123.com/Test/").finalize();
-  Assert.ok(!link.compareHash(uri2))
+  Assert.ok(!link.compareHash(uri2));
 
   uri1 = uri1.mutate().setSpec("http://www.123.com/").finalize();
   link.uri = uri1;
   Assert.equal(link.uriHash, "QGLmWuwuTozr3tOfXSf5mg==");
   uri1 = uri1.mutate().setSpec("http://www.123.com/test/").finalize();
   link.uri = uri1;
   Assert.equal(link.uriHash, "AG87Ls+GmaUYSUJFETRr3Q==");
   uri1 = uri1.mutate().setSpec("https://www.123.com/").finalize();
   link.uri = uri1;
   Assert.equal(link.uriHash, "iSx6UH1a9enVPzUA9JZ42g==");
 }
 
-function test_links()
-{
+function test_links() {
   // links:
   var link1 = Cc["@mozilla.org/windows-jumplistlink;1"]
              .createInstance(Ci.nsIJumpListLink);
   var link2 = Cc["@mozilla.org/windows-jumplistlink;1"]
               .createInstance(Ci.nsIJumpListLink);
 
   var uri1 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
                .createInstance(Ci.nsIURIMutator)
@@ -133,18 +129,17 @@ function test_links()
 
   link2.uriTitle = "Test";
   uri2 = uri2.mutate().setSpec("http://www.testing.com/").finalize();
   link2.uri = uri2;
 
   Assert.ok(!link1.equals(link2));
 }
 
-function test_shortcuts()
-{
+function test_shortcuts() {
   // shortcuts:
   var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"]
            .createInstance(Ci.nsIJumpListShortcut);
 
   var handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
                    .createInstance(Ci.nsILocalHandlerApp);
 
   handlerApp.name = "TestApp";
@@ -171,18 +166,17 @@ function test_shortcuts()
     sc.app = handlerApp;
     Assert.equal(sc.app.detailedDescription, "TestApp detailed description.");
     Assert.equal(sc.app.name, "TestApp");
     Assert.ok(sc.app.parameterExists("-test"));
     Assert.ok(!sc.app.parameterExists("-notset"));
   }
 }
 
-async function test_jumplist()
-{
+async function test_jumplist() {
   // Jump lists can't register links unless the application is the default
   // protocol handler for the protocol of the link, so we skip off testing
   // those in these tests. We'll init the jump list for the xpc shell harness,
   // add a task item, and commit it.
 
   // not compiled in
   if (Ci.nsIWinTaskbar == null)
     return;
@@ -254,18 +248,17 @@ async function test_jumplist()
       builder.commitListBuild(resolve);
     });
     Assert.ok(await rv);
 
     builder.deleteActiveList();
   }
 }
 
-function run_test()
-{
+function run_test() {
   if (mozinfo.os != "win") {
     return;
   }
   test_basics();
   test_separator();
   test_hashes();
   test_links();
   test_shortcuts();
--- a/widget/tests/window_imestate_iframes.html
+++ b/widget/tests/window_imestate_iframes.html
@@ -31,57 +31,51 @@
           src="data:text/html,&lt;body&gt;&lt;p id='editor' contenteditable='true'&gt;&lt;a href='about:blank'&gt;about:blank;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;"></iframe><br>
 
   <input id="next" readonly><br>
 </p>
 <script class="testbody" type="application/javascript">
 
 window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window);
 
-function ok(aCondition, aMessage)
-{
+function ok(aCondition, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage);
 }
 
-function is(aLeft, aRight, aMessage)
-{
+function is(aLeft, aRight, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage);
 }
 
-function onUnload()
-{
+function onUnload() {
   window.opener.wrappedJSObject.onFinish();
 }
 
 var gFocusObservingElement = null;
 var gBlurObservingElement = null;
 
-function onFocus(aEvent)
-{
+function onFocus(aEvent) {
   if (aEvent.target != gFocusObservingElement) {
     return;
   }
   ok(gFocusObservingElement.willFocus,
      "focus event is fired on unexpected element");
   gFocusObservingElement.willFocus = false;
 }
 
-function onBlur(aEvent)
-{
+function onBlur(aEvent) {
   if (aEvent.target != gBlurObservingElement) {
     return;
   }
   ok(gBlurObservingElement.willBlur,
      "blur event is fired on unexpected element");
   gBlurObservingElement.willBlur = false;
 }
 
 function observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
-                          aNextBlurredNode, aWillFireBlurEvent)
-{
+                          aNextBlurredNode, aWillFireBlurEvent) {
   if (gFocusObservingElement) {
     if (gFocusObservingElement.willFocus) {
       ok(false, "focus event was never fired on " + gFocusObservingElement);
     }
     gFocusObservingElement.removeEventListener("focus", onFocus, true);
     gFocusObservingElement.willFocus = NaN;
     gFocusObservingElement = null;
   }
@@ -100,53 +94,49 @@ function observeFocusBlur(aNextFocusedNo
   }
   if (aNextBlurredNode) {
     gBlurObservingElement = aNextBlurredNode;
     gBlurObservingElement.willBlur = aWillFireBlurEvent;
     gBlurObservingElement.addEventListener("blur", onBlur, true);
   }
 }
 
-function runTests()
-{
+function runTests() {
   var utils = window.windowUtils;
   var fm =
     Cc["@mozilla.org/focus-manager;1"]
       .getService(Ci.nsIFocusManager);
 
   var iframe, editor, root, input;
   var prev = document.getElementById("prev");
   var next = document.getElementById("next");
   var html = document.documentElement;
 
-  function resetFocusToInput(aDescription)
-  {
+  function resetFocusToInput(aDescription) {
     observeFocusBlur(null, false, null, false);
     prev.focus();
     is(fm.focusedElement, prev,
        "input#prev[readonly] element didn't get focus: " + aDescription);
     is(utils.IMEStatus, utils.IME_STATUS_DISABLED,
        "IME enabled on input#prev[readonly]: " + aDescription);
   }
 
-  function resetFocusToParentHTML(aDescription)
-  {
+  function resetFocusToParentHTML(aDescription) {
     observeFocusBlur(null, false, null, false);
     html.focus();
     is(fm.focusedElement, html,
        "Parent html element didn't get focus: " + aDescription);
     is(utils.IMEStatus, utils.IME_STATUS_DISABLED,
        "IME enabled on parent html element: " + aDescription);
   }
 
   function testTabKey(aForward,
                       aNextFocusedNode, aWillFireFocusEvent,
                       aNextBlurredNode, aWillFireBlurEvent,
-                      aIMEShouldBeEnabled, aTestingCaseDescription)
-  {
+                      aIMEShouldBeEnabled, aTestingCaseDescription) {
     observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
                      aNextBlurredNode, aWillFireBlurEvent);
     synthesizeKey("VK_TAB", { shiftKey: !aForward });
     var description = "Tab key test: ";
     if (!aForward) {
       description = "Shift-" + description;
     }
     description += aTestingCaseDescription + ": ";
@@ -156,34 +146,32 @@ function runTests()
        aIMEShouldBeEnabled ?
          utils.IME_STATUS_ENABLED : utils.IME_STATUS_DISABLED,
        description + "didn't set IME state as expected");
   }
 
   function testMouseClick(aNextFocusedNode, aWillFireFocusEvent,
                           aWillAllNodeLostFocus,
                           aNextBlurredNode, aWillFireBlurEvent,
-                          aIMEShouldBeEnabled, aTestingCaseDescription)
-  {
+                          aIMEShouldBeEnabled, aTestingCaseDescription) {
     observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
                      aNextBlurredNode, aWillFireBlurEvent);
     // We're relying on layout inside the iframe being up to date, so make it so
     iframe.contentDocument.documentElement.getBoundingClientRect();
     synthesizeMouse(iframe, 10, 80, { });
     var description = "Click test: " + aTestingCaseDescription + ": ";
     is(fm.focusedElement, !aWillAllNodeLostFocus ? aNextFocusedNode : null,
        description + "didn't move focus as expected");
     is(utils.IMEStatus,
        aIMEShouldBeEnabled ?
          utils.IME_STATUS_ENABLED : utils.IME_STATUS_DISABLED,
        description + "didn't set IME state as expected");
   }
 
-  function testOnEditorFlagChange(aDescription, aIsInDesignMode)
-  {
+  function testOnEditorFlagChange(aDescription, aIsInDesignMode) {
     const kReadonly =
       Ci.nsIPlaintextEditor.eEditorReadonlyMask;
     var description = "testOnEditorFlagChange: " + aDescription;
     resetFocusToParentHTML(description);
     var htmlEditor = iframe.contentWindow.docShell.editor;
     var e = aIsInDesignMode ? root : editor;
     e.focus();
     is(fm.focusedElement, e,
--- a/widget/tests/window_mouse_scroll_win.html
+++ b/widget/tests/window_mouse_scroll_win.html
@@ -77,38 +77,33 @@ var gCharWidth  = 0;
 var gPageHeight = 0;
 var gPageWidth  = 0;
 
 var gP1 = document.getElementById("p1");
 var gP2 = document.getElementById("p2");
 
 var gOtherWindow;
 
-function ok(aCondition, aMessage)
-{
+function ok(aCondition, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage);
 }
 
-function is(aLeft, aRight, aMessage)
-{
+function is(aLeft, aRight, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage);
 }
 
-function isnot(aLeft, aRight, aMessage)
-{
+function isnot(aLeft, aRight, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage);
 }
 
-function todo_is(aLeft, aRight, aMessage)
-{
+function todo_is(aLeft, aRight, aMessage) {
   window.opener.wrappedJSObject.SimpleTest.todo_is(aLeft, aRight, aMessage);
 }
 
-function onUnload()
-{
+function onUnload() {
   SpecialPowers.clearUserPref(kAltKeyActionPref);
   SpecialPowers.clearUserPref(kCtrlKeyActionPref);
   SpecialPowers.clearUserPref(kShiftKeyActionPref);
   SpecialPowers.clearUserPref(kWinKeyActionPref);
 
   SpecialPowers.clearUserPref(kAltKeyDeltaMultiplierXPref);
   SpecialPowers.clearUserPref(kAltKeyDeltaMultiplierYPref);
   SpecialPowers.clearUserPref(kCtrlKeyDeltaMultiplierXPref);
@@ -121,36 +116,33 @@ function onUnload()
   SpecialPowers.clearUserPref(kSystemScrollSpeedOverridePref);
   SpecialPowers.clearUserPref(kEmulateWheelByWMSCROLLPref);
   SpecialPowers.clearUserPref(kVAmountPref);
   SpecialPowers.clearUserPref(kHAmountPref);
   SpecialPowers.clearUserPref(kTimeoutPref);
   window.opener.wrappedJSObject.SimpleTest.finish();
 }
 
-function getWindowUtils(aWindow)
-{
+function getWindowUtils(aWindow) {
   if (!aWindow) {
     aWindow = window;
   }
   return aWindow.windowUtils;
 }
 
-function getPointInScreen(aElement, aWindow)
-{
+function getPointInScreen(aElement, aWindow) {
   if (!aWindow) {
     aWindow = window;
   }
   var bounds = aElement.getBoundingClientRect();
   return { x: bounds.left + aWindow.mozInnerScreenX,
            y: bounds.top + aWindow.mozInnerScreenY };
 }
 
-function cut(aNum)
-{
+function cut(aNum) {
   return (aNum >= 0) ? Math.floor(aNum) : Math.ceil(aNum);
 }
 
 /**
  * Make each steps for the tests in following arrays in global scope. Each item
  * of the arrays will be executed after previous test is finished.
  *
  * description:
@@ -216,1183 +208,1181 @@ function cut(aNum)
  *   Must be a function or null.  If this value is a function, it's called
  *   after received all expected events or timeout if no events are expected.
  */
 
 // First, get the computed line height, char width, page height and page width.
 var gPreparingSteps = [
   { description: "Preparing gLineHeight",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
-    onLineScrollEvent: function (aEvent) {
+    onLineScrollEvent(aEvent) {
       return true;
     },
-    onPixelScrollEvent: function (aEvent) {
+    onPixelScrollEvent(aEvent) {
       gLineHeight = aEvent.detail;
       return true;
     },
     expected: {
       axis: kVAxis, lines: 1, pixels: 1,
     },
-    init: function () {
+    init() {
       SpecialPowers.setIntPref(kVAmountPref, 1);
       SpecialPowers.setIntPref(kHAmountPref, 1);
     },
   },
   { description: "Preparing gCharWidth",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
-    onLineScrollEvent: function (aEvent) {
+    onLineScrollEvent(aEvent) {
       return true;
     },
-    onPixelScrollEvent: function (aEvent) {
+    onPixelScrollEvent(aEvent) {
       gCharWidth = aEvent.detail;
       return true;
     },
     expected: {
       axis: kVAxis, lines: 1, pixels: 1,
     },
   },
   { description: "Preparing gPageHeight",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
-    onLineScrollEvent: function (aEvent) {
+    onLineScrollEvent(aEvent) {
       return true;
     },
-    onPixelScrollEvent: function (aEvent) {
+    onPixelScrollEvent(aEvent) {
       gPageHeight = aEvent.detail;
       return true;
     },
     expected: {
       axis: kHAxis, lines: 1, pixels: 1,
     },
-    init: function () {
+    init() {
       SpecialPowers.setIntPref(kVAmountPref, 0xFFFF);
       SpecialPowers.setIntPref(kHAmountPref, 0xFFFF);
     },
   },
   { description: "Preparing gPageWidth",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
-    onLineScrollEvent: function (aEvent) {
+    onLineScrollEvent(aEvent) {
       return true;
     },
-    onPixelScrollEvent: function (aEvent) {
+    onPixelScrollEvent(aEvent) {
       gPageWidth = aEvent.detail;
       return true;
     },
     expected: {
       axis: kHAxis, lines: 1, pixels: 1,
     },
-    finish: function () {
+    finish() {
       ok(gLineHeight > 0, "gLineHeight isn't positive got " + gLineHeight);
       ok(gCharWidth > 0, "gCharWidth isn't positive got " + gCharWidth);
       ok(gPageHeight > 0, "gPageHeight isn't positive got " + gPageHeight);
       ok(gPageWidth > 0, "gPageWidth isn't positive got " + gPageWidth);
 
       ok(gPageHeight > gLineHeight,
          "gPageHeight must be larger than gLineHeight");
       ok(gPageWidth > gCharWidth,
          "gPageWidth must be larger than gCharWidth");
-      runNextTest(gBasicTests, 0)
-    }
+      runNextTest(gBasicTests, 0);
+    },
   },
 ];
 
 var gBasicTests = [
   // Widget shouldn't dispatch a pixel event if the delta can be devided by
   // lines to be scrolled.  However, pixel events should be fired by ESM.
   { description: "WM_MOUSEWHEEL, -120, 3 lines",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 3, pixels: function () { return gLineHeight * 3; },
+      axis: kVAxis, lines: 3, pixels() { return gLineHeight * 3; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setIntPref(kVAmountPref, 3);
       SpecialPowers.setIntPref(kHAmountPref, 3);
     },
   },
 
   { description: "WM_MOUSEWHEEL, 120, -3 lines",
     message: WM_MOUSEWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -3, pixels: function () { return gLineHeight * -3; },
+      axis: kVAxis, lines: -3, pixels() { return gLineHeight * -3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 120, 3 chars",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 3, pixels: function () { return gCharWidth * 3; },
+      axis: kHAxis, lines: 3, pixels() { return gCharWidth * 3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -120, -3 chars",
     message: WM_MOUSEHWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -3, pixels: function () { return gCharWidth * -3; },
+      axis: kHAxis, lines: -3, pixels() { return gCharWidth * -3; },
     },
   },
 
   // Pixel scroll event should be fired always but line scroll event should be
   // fired only when accumulated delta value is over a line.
   { description: "WM_MOUSEWHEEL, -20, 0.5 lines",
     message: WM_MOUSEWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gLineHeight / 2; },
+      axis: kVAxis, lines: 0, pixels() { return gLineHeight / 2; },
     },
   },
   { description: "WM_MOUSEWHEEL, -20, 0.5 lines (pending: 0.5 lines)",
     message: WM_MOUSEWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight / 2; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight / 2; },
     },
   },
   { description: "WM_MOUSEWHEEL, -20, 0.5 lines",
     message: WM_MOUSEWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gLineHeight / 2; },
+      axis: kVAxis, lines: 0, pixels() { return gLineHeight / 2; },
     },
   },
 
   { description: "WM_MOUSEWHEEL, 20, -0.5 lines (pending: 0.5 lines)",
     message: WM_MOUSEWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gLineHeight / -2; },
+      axis: kVAxis, lines: 0, pixels() { return gLineHeight / -2; },
     },
   },
   { description: "WM_MOUSEWHEEL, 20, -0.5 lines (pending: -0.5 lines)",
     message: WM_MOUSEWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight / 2; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight / 2; },
     },
   },
   { description: "WM_MOUSEWHEEL, 20, -0.5 lines",
     message: WM_MOUSEWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gLineHeight / -2; },
+      axis: kVAxis, lines: 0, pixels() { return gLineHeight / -2; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 20, 0.5 chars",
     message: WM_MOUSEHWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / 2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / 2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 20, 0.5 chars (pending: 0.5 chars)",
     message: WM_MOUSEHWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth / 2; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth / 2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 20, 0.5 chars",
     message: WM_MOUSEHWHEEL, delta: 20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / 2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / 2; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -20, -0.5 chars (pending: 0.5 chars)",
     message: WM_MOUSEHWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / -2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / -2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, -20, -0.5 chars (pending: -0.5 chars)",
     message: WM_MOUSEHWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth / 2; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth / 2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, -20, -0.5 chars",
     message: WM_MOUSEHWHEEL, delta: -20,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / -2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / -2; },
     },
   },
 
   // Even if the mouse cursor is an element whose font-size is different than
   // the scrollable element, the pixel scroll amount shouldn't be changed.
   // Widget shouldn't dispatch a pixel event if the delta can be devided by
   // lines to be scrolled.  However, pixel events should be fired by ESM.
   { description: "WM_MOUSEWHEEL, -120, 3 lines, on the other div whose font-size is larger",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP2, x: 10, y: 10, window: window,
+    target: gP2, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 3, pixels: function () { return gLineHeight * 3; },
+      axis: kVAxis, lines: 3, pixels() { return gLineHeight * 3; },
     },
   },
 
   { description: "WM_MOUSEWHEEL, 120, -3 lines, on the other div whose font-size is larger",
     message: WM_MOUSEWHEEL, delta: 120,
-    target: gP2, x: 10, y: 10, window: window,
+    target: gP2, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -3, pixels: function () { return gLineHeight * -3; },
+      axis: kVAxis, lines: -3, pixels() { return gLineHeight * -3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 120, 3 chars, on the other div whose font-size is larger",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP2, x: 10, y: 10, window: window,
+    target: gP2, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 3, pixels: function () { return gCharWidth * 3; },
+      axis: kHAxis, lines: 3, pixels() { return gCharWidth * 3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -120, -3 chars, on the other div whose font-size is larger",
     message: WM_MOUSEHWHEEL, delta: -120,
-    target: gP2, x: 10, y: 10, window: window,
+    target: gP2, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -3, pixels: function () { return gCharWidth * -3; },
+      axis: kHAxis, lines: -3, pixels() { return gCharWidth * -3; },
     },
   },
 
   // Modifier key tests
   { description: "WM_MOUSEWHEEL, -40, 1 line with left Shift",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_L,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_MOUSEWHEEL, -40, 1 line with right Shift",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_R,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_MOUSEWHEEL, -40, 1 line with left Ctrl",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_MOUSEWHEEL, -40, 1 line with right Ctrl",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_R,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_MOUSEWHEEL, -40, 1 line with left Alt",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_L,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_MOUSEWHEEL, -40, 1 line with right Alt",
     message: WM_MOUSEWHEEL, delta: -40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_R,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 40, 1 character with left Shift",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_L,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 40, 1 character with right Shift",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_R,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 40, 1 character with left Ctrl",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 40, 1 character with right Ctrl",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_R,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 40, 1 character with left Alt",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_L,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 40, 1 character with right Alt",
     message: WM_MOUSEHWHEEL, delta: 40,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_R,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
 
-    finish: function () {
+    finish() {
       runNextTest(gScrollMessageTests, 0);
-    }
+    },
   },
 ];
 
 var gPageScrllTests = [
   // Pixel scroll event should be fired always but line scroll event should be
   // fired only when accumulated delta value is over a line.
   { description: "WM_MOUSEWHEEL, -60, 0.5 pages",
     message: WM_MOUSEWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gPageHeight / 2; },
+      axis: kVAxis, lines: 0, pixels() { return gPageHeight / 2; },
     },
   },
   { description: "WM_MOUSEWHEEL, -60, 0.5 pages (pending: 0.5 pages)",
     message: WM_MOUSEWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return ((gPageHeight / 2) + (gPageHeight % 2)); },
+      pixels() { return ((gPageHeight / 2) + (gPageHeight % 2)); },
     },
   },
   { description: "WM_MOUSEWHEEL, -60, 0.5 pages",
     message: WM_MOUSEWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gPageHeight / 2; },
+      axis: kVAxis, lines: 0, pixels() { return gPageHeight / 2; },
     },
   },
 
   { description: "WM_MOUSEWHEEL, 60, -0.5 pages (pending: 0.5 pages)",
     message: WM_MOUSEWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gPageHeight / -2; },
+      axis: kVAxis, lines: 0, pixels() { return gPageHeight / -2; },
     },
   },
   { description: "WM_MOUSEWHEEL, 60, -0.5 pages (pending: -0.5 pages)",
     message: WM_MOUSEWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -((gPageHeight / 2) + (gPageHeight % 2)); },
+      pixels() { return -((gPageHeight / 2) + (gPageHeight % 2)); },
     },
   },
   { description: "WM_MOUSEWHEEL, 60, -0.5 pages",
     message: WM_MOUSEWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 0, pixels: function () { return gPageHeight / -2; },
+      axis: kVAxis, lines: 0, pixels() { return gPageHeight / -2; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 60, 0.5 pages",
     message: WM_MOUSEHWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gPageWidth / 2; },
+      axis: kHAxis, lines: 0, pixels() { return gPageWidth / 2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, 60, 0.5 pages (pending: 0.5 pages)",
     message: WM_MOUSEHWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return ((gPageWidth / 2) + (gPageWidth % 2)); },
+      pixels() { return ((gPageWidth / 2) + (gPageWidth % 2)); },
     },
   },
   { description: "WM_MOUSEHWHEEL, 60, 0.5 pages",
     message: WM_MOUSEHWHEEL, delta: 60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gPageWidth / 2; },
+      axis: kHAxis, lines: 0, pixels() { return gPageWidth / 2; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -60, -0.5 pages (pending: 0.5 pages)",
     message: WM_MOUSEHWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / -2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / -2; },
     },
   },
   { description: "WM_MOUSEHWHEEL, -60, -0.5 pages (pending: -0.5 pages)",
     message: WM_MOUSEHWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -((gCharWidth / 2) + (gCharWidth % 2)); },
+      pixels() { return -((gCharWidth / 2) + (gCharWidth % 2)); },
     },
   },
   { description: "WM_MOUSEHWHEEL, -60, -0.5 pages",
     message: WM_MOUSEHWHEEL, delta: -60,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 0, pixels: function () { return gCharWidth / -2; },
+      axis: kHAxis, lines: 0, pixels() { return gCharWidth / -2; },
     },
   },
 ];
 
 var gScrollMessageTests = [
   // Widget should dispatch neither line scroll event nor pixel scroll event if
   // the WM_*SCROLL's lParam is NULL and mouse wheel emulation is disabled.
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: 0, pixels: 0,
     },
-    init: function () {
+    init() {
       SpecialPowers.setIntPref(kVAmountPref, 3);
       SpecialPowers.setIntPref(kHAmountPref, 3);
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, false);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEUP, lParam is NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: 0, pixels: 0,
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: 0, pixels: 0,
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: 0, pixels: 0,
     },
   },
 
   // Widget should emulate mouse wheel behavior for WM_*SCROLL even if the
   // kEmulateWheelByWMSCROLLPref is disabled but the message's lParam is not
   // NULL. Then, widget doesn't dispatch a pixel event for WM_*SCROLL messages,
   // but ESM dispatches it instead.
   { description: "WM_VSCROLL, SB_LINEUP, lParam is not NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, false);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is not NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
 
   { description: "WM_VSCROLL, SB_PAGEUP, lParam is not NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_PAGEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
       axis: kVAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -gPageHeight; },
+      pixels() { return -gPageHeight; },
     },
   },
 
   { description: "WM_VSCROLL, SB_PAGEDOWN, lParam is not NULL, emulation disabled",
     message: WM_VSCROLL, delta: SB_PAGEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
       axis: kVAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return gPageHeight; },
+      pixels() { return gPageHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_PAGELEFT, lParam is not NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_PAGELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
       axis: kHAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -gPageWidth; },
+      pixels() { return -gPageWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_PAGERIGHT, lParam is not NULL, emulation disabled",
     message: WM_HSCROLL, delta: SB_PAGERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
       axis: kHAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return gPageWidth; },
+      pixels() { return gPageWidth; },
     },
   },
 
   // Widget should emulate mouse wheel behavior for WM_*SCROLL when the
   // kEmulateWheelByWMSCROLLPref is enabled even if the message's lParam is
   // NULL. Then, widget doesn't dispatch a pixel event for WM_*SCROLL messages,
   // but ESM dispatches it instead.
   { description: "WM_VSCROLL, SB_LINEUP, lParam is NULL, emulation enabled",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, true);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is NULL, emulation enabled",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is NULL, emulation enabled",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is NULL, emulation enabled",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
 
   { description: "WM_VSCROLL, SB_PAGEUP, lParam is NULL, emulation enabled",
     message: WM_VSCROLL, delta: SB_PAGEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -gPageHeight; },
+      pixels() { return -gPageHeight; },
     },
   },
 
   { description: "WM_VSCROLL, SB_PAGEDOWN, lParam is NULL, emulation enabled",
     message: WM_VSCROLL, delta: SB_PAGEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kVAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return gPageHeight; },
+      pixels() { return gPageHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_PAGELEFT, lParam is NULL, emulation enabled",
     message: WM_HSCROLL, delta: SB_PAGELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: -DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return -gPageWidth; },
+      pixels() { return -gPageWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_PAGERIGHT, lParam is NULL, emulation enabled",
     message: WM_HSCROLL, delta: SB_PAGERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
       axis: kHAxis, lines: DOM_PAGE_SCROLL_DELTA,
-      pixels: function () { return gPageWidth; },
+      pixels() { return gPageWidth; },
     },
   },
 
   // Modifier key tests for WM_*SCROLL
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with left Shift",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, false);
     },
   },
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with right Shift",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_R,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with left Ctrl",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with right Ctrl",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with left Alt",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, with right Alt",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_R,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with left Shift",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with right Shift",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: SHIFT_R,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with left Ctrl",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with right Ctrl",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: CTRL_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with left Alt",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_L,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, with right Alt",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: ALT_R,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
 
-    finish: function () {
+    finish() {
       runDeactiveWindowTests();
-    }
+    },
   },
 ];
 
 var gDeactiveWindowTests = [
   // Typically, mouse drivers send wheel messages to focused window.
   // However, we prefer to scroll a scrollable element under the mouse cursor.
   { description: "WM_MOUSEWHEEL, -120, 3 lines, window is deactive",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 3, pixels: function () { return gLineHeight * 3; },
+      axis: kVAxis, lines: 3, pixels() { return gLineHeight * 3; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setIntPref(kVAmountPref, 3);
       SpecialPowers.setIntPref(kHAmountPref, 3);
     },
-    onLineScrollEvent: function (aEvent) {
+    onLineScrollEvent(aEvent) {
       var fm = Cc["@mozilla.org/focus-manager;1"].
             getService(Ci.nsIFocusManager);
       is(fm.activeWindow, gOtherWindow, "The other window isn't activated");
     },
   },
 
   { description: "WM_MOUSEWHEEL, 120, -3 lines, window is deactive",
     message: WM_MOUSEWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -3, pixels: function () { return gLineHeight * -3; },
+      axis: kVAxis, lines: -3, pixels() { return gLineHeight * -3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 120, 3 chars, window is deactive",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 3, pixels: function () { return gCharWidth * 3; },
+      axis: kHAxis, lines: 3, pixels() { return gCharWidth * 3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -120, -3 chars, window is deactive",
     message: WM_MOUSEHWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -3, pixels: function () { return gCharWidth * -3; },
+      axis: kHAxis, lines: -3, pixels() { return gCharWidth * -3; },
     },
   },
 
   // Of course, even if some drivers prefer the cursor position, we don't need
   // to change anything.
   { description: "WM_MOUSEWHEEL, -120, 3 lines, window is deactive (receive the message directly)",
     message: WM_MOUSEWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: 3, pixels: function () { return gLineHeight * 3; },
+      axis: kVAxis, lines: 3, pixels() { return gLineHeight * 3; },
     },
   },
 
   { description: "WM_MOUSEWHEEL, 120, -3 lines, window is deactive (receive the message directly)",
     message: WM_MOUSEWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: -3, pixels: function () { return gLineHeight * -3; },
+      axis: kVAxis, lines: -3, pixels() { return gLineHeight * -3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, 120, 3 chars, window is deactive (receive the message directly)",
     message: WM_MOUSEHWHEEL, delta: 120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: 3, pixels: function () { return gCharWidth * 3; },
+      axis: kHAxis, lines: 3, pixels() { return gCharWidth * 3; },
     },
   },
 
   { description: "WM_MOUSEHWHEEL, -120, -3 chars, window is deactive (receive the message directly)",
     message: WM_MOUSEHWHEEL, delta: -120,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: -3, pixels: function () { return gCharWidth * -3; },
+      axis: kHAxis, lines: -3, pixels() { return gCharWidth * -3; },
     },
   },
 
   // Same for WM_*SCROLL if lParam is not NULL
   { description: "WM_VSCROLL, SB_LINEUP, lParam is not NULL, emulation disabled, window is deactive",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, false);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, window is deactive",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is not NULL, emulation disabled, window is deactive",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, window is deactive",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
 
   // Same for WM_*SCROLL if lParam is NULL but emulation is enabled
   { description: "WM_VSCROLL, SB_LINEUP, lParam is NULL, emulation enabled, window is deactive",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, true);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is NULL, emulation enabled, window is deactive",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is NULL, emulation enabled, window is deactive",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is NULL, emulation enabled, window is deactive",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: 0,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
 
   // Same for WM_*SCROLL if lParam is not NULL and message sent to the deactive window directly
   { description: "WM_VSCROLL, SB_LINEUP, lParam is not NULL, emulation disabled, window is deactive (receive the message directly)",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL |
                      nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, false);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is not NULL, emulation disabled, window is deactive (receive the message directly)",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL |
                      nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is not NULL, emulation disabled, window is deactive (receive the message directly)",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL |
                      nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is not NULL, emulation disabled, window is deactive (receive the message directly)",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL |
                      nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
   },
 
   // Same for WM_*SCROLL if lParam is NULL but emulation is enabled, and message sent to the deactive window directly
   { description: "WM_VSCROLL, SB_LINEUP, lParam is NULL, emulation enabled, window is deactive (receive the message directly)",
     message: WM_VSCROLL, delta: SB_LINEUP,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: -1, pixels: function () { return -gLineHeight; },
+      axis: kVAxis, lines: -1, pixels() { return -gLineHeight; },
     },
-    init: function () {
+    init() {
       SpecialPowers.setBoolPref(kEmulateWheelByWMSCROLLPref, true);
     },
   },
 
   { description: "WM_VSCROLL, SB_LINEDOWN, lParam is NULL, emulation enabled, window is deactive (receive the message directly)",
     message: WM_VSCROLL, delta: SB_LINEDOWN,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kVAxis, lines: 1, pixels: function () { return gLineHeight; },
+      axis: kVAxis, lines: 1, pixels() { return gLineHeight; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINELEFT, lParam is NULL, emulation enabled, window is deactive (receive the message directly)",
     message: WM_HSCROLL, delta: SB_LINELEFT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: -1, pixels: function () { return -gCharWidth; },
+      axis: kHAxis, lines: -1, pixels() { return -gCharWidth; },
     },
   },
 
   { description: "WM_HSCROLL, SB_LINERIGHT, lParam is NULL, emulation enabled, window is deactive (receive the message directly)",
     message: WM_HSCROLL, delta: SB_LINERIGHT,
-    target: gP1, x: 10, y: 10, window: window,
+    target: gP1, x: 10, y: 10, window,
     modifiers: 0,
     additionalFlags: nsIDOMWindowUtils.MOUSESCROLL_PREFER_WIDGET_AT_POINT,
     expected: {
-      axis: kHAxis, lines: 1, pixels: function () { return gCharWidth; },
+      axis: kHAxis, lines: 1, pixels() { return gCharWidth; },
     },
 
-    finish: function () {
+    finish() {
       gOtherWindow.close();
       gOtherWindow = null;
       window.close();
-    }
+    },
   },
 ];
 
-function runDeactiveWindowTests()
-{
+function runDeactiveWindowTests() {
   gOtherWindow = window.open("data:text/html,", "_blank",
                              "chrome,width=100,height=100,top=700,left=700");
 
-  window.opener.wrappedJSObject.SimpleTest.waitForFocus(function () {
+  window.opener.wrappedJSObject.SimpleTest.waitForFocus(function() {
     runNextTest(gDeactiveWindowTests, 0);
   }, gOtherWindow);
 }
 
-function runNextTest(aTests, aIndex)
-{
+function runNextTest(aTests, aIndex) {
   if (aIndex > 0 && aTests[aIndex - 1] && aTests[aIndex - 1].finish) {
     aTests[aIndex - 1].finish();
   }
 
   if (aTests.length == aIndex) {
     return;
   }
 
@@ -1406,17 +1396,17 @@ function runNextTest(aTests, aIndex)
     case WM_MOUSEWHEEL:
     case WM_MOUSEHWHEEL:
     case WM_VSCROLL:
     case WM_HSCROLL:
       var expectedLines = test.expected.lines;
       var expectedPixels =
         cut((typeof test.expected.pixels == "function") ?
                test.expected.pixels() : test.expected.pixels);
-      var handler = function (aEvent) {
+      var handler = function(aEvent) {
         var doCommonTests = true;
 
         if (!aEvent) {
           ok(!test.handled.lines,
              test.description + ", line scroll event has been handled");
           ok(!test.handled.pixels,
              test.description + ", pixel scroll event has been handled");
           doCommonTests = false;
@@ -1482,32 +1472,31 @@ function runNextTest(aTests, aIndex)
         setTimeout(handler, 500);
       }
 
       var utils = getWindowUtils(test.window);
       var ptInScreen = getPointInScreen(test.target, test.window);
       var isVertical =
         ((test.message == WM_MOUSEWHEEL) || (test.message == WM_VSCROLL));
       var deltaX = !isVertical ? test.delta : 0;
-      var deltaY = isVertical  ? test.delta : 0;
+      var deltaY = isVertical ? test.delta : 0;
       utils.sendNativeMouseScrollEvent(ptInScreen.x + test.x,
                                        ptInScreen.y + test.y,
                                        test.message, deltaX, deltaY, 0,
                                        test.modifiers,
                                        test.additionalFlags,
                                        test.target);
       break;
     default:
       ok(false, test.description + ": invalid message");
       // Let's timeout.
   }
 }
 
-function prepareTests()
-{
+function prepareTests() {
   // Disable special action with modifier key
   SpecialPowers.setIntPref(kAltKeyActionPref, 1);
   SpecialPowers.setIntPref(kCtrlKeyActionPref, 1);
   SpecialPowers.setIntPref(kShiftKeyActionPref, 1);
   SpecialPowers.setIntPref(kWinKeyActionPref, 1);
 
   SpecialPowers.setIntPref(kAltKeyDeltaMultiplierXPref, 100);
   SpecialPowers.setIntPref(kAltKeyDeltaMultiplierYPref, 100);