Bug 1453381 - Fix lint violations in Marionette xpcshell tests. r?whimboo draft
authorAndreas Tolfsen <ato@sny.no>
Wed, 11 Apr 2018 20:26:53 +0100
changeset 781237 f670b58ed63729495057e82ae711a26b8d07db37
parent 781236 44feea3475df5142019e2d49b4a8b6f74c5ac985
child 781238 134e7c38f1e8cc56eac0caf3633fc62693bfb3fb
push id106250
push userbmo:ato@sny.no
push dateThu, 12 Apr 2018 19:02:29 +0000
reviewerswhimboo
bugs1453381
milestone61.0a1
Bug 1453381 - Fix lint violations in Marionette xpcshell tests. r?whimboo This patch is partly machine generated and partly massaged by hand to achieve a satisfactory result. MozReview-Commit-ID: IG46e93KoOb
testing/marionette/test/unit/test_action.js
testing/marionette/test/unit/test_assert.js
testing/marionette/test/unit/test_cookie.js
testing/marionette/test/unit/test_dom.js
testing/marionette/test/unit/test_error.js
testing/marionette/test/unit/test_evaluate.js
testing/marionette/test/unit/test_format.js
testing/marionette/test/unit/test_message.js
testing/marionette/test/unit/test_session.js
--- a/testing/marionette/test/unit/test_action.js
+++ b/testing/marionette/test/unit/test_action.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 ChromeUtils.import("chrome://marionette/content/action.js");
-const {ContentWebElement} = ChromeUtils.import("chrome://marionette/content/element.js", {});
-ChromeUtils.import("chrome://marionette/content/error.js");
+const {InvalidArgumentError} = ChromeUtils.import("chrome://marionette/content/error.js", {});
 
 const XHTMLNS = "http://www.w3.org/1999/xhtml";
 
 const domEl = {
   nodeType: 1,
   ELEMENT_NODE: 1,
   namespaceURI: XHTMLNS,
 };
@@ -41,19 +40,19 @@ add_test(function test_processPointerPar
   let check = (regex, message, arg) => checkErrors(
       regex, action.PointerParameters.fromJSON, [arg], message);
   let parametersData;
   for (let d of ["foo", "", "get", "Get"]) {
     parametersData = {pointerType: d};
     let message = `parametersData: [pointerType: ${parametersData.pointerType}]`;
     check(/Unknown pointerType/, message, parametersData);
   }
-  parametersData.pointerType = "mouse"; //TODO "pen";
+  parametersData.pointerType = "mouse"; // TODO "pen";
   deepEqual(action.PointerParameters.fromJSON(parametersData),
-      {pointerType: "mouse"}); //TODO action.PointerType.Pen});
+      {pointerType: "mouse"}); // TODO action.PointerType.Pen});
 
   run_next_test();
 });
 
 add_test(function test_processPointerUpDownAction() {
   let actionItem = {type: "pointerDown"};
   let actionSequence = {type: "pointer", id: "some_id"};
   for (let d of [-1, "a"]) {
@@ -67,17 +66,17 @@ add_test(function test_processPointerUpD
   equal(act.button, actionItem.button);
 
   run_next_test();
 });
 
 add_test(function test_validateActionDurationAndCoordinates() {
   let actionItem = {};
   let actionSequence = {id: "some_id"};
-  let check = function (type, subtype, message = undefined) {
+  let check = function(type, subtype, message = undefined) {
     message = message || `duration: ${actionItem.duration}, subtype: ${subtype}`;
     actionItem.type = subtype;
     actionSequence.type = type;
     checkErrors(/Expected '.*' \(.*\) to be >= 0/,
         action.Action.fromJSON, [actionSequence, actionItem], message);
   };
   for (let d of [-1, "a"]) {
     actionItem.duration = d;
@@ -188,30 +187,30 @@ add_test(function test_processPointerMov
     }
     deepEqual(actual.origin, origin);
 
   }
   run_next_test();
 });
 
 add_test(function test_computePointerDestinationViewport() {
-  let act = { type: "pointerMove", x: 100, y: 200, origin: "viewport"};
+  let act = {type: "pointerMove", x: 100, y: 200, origin: "viewport"};
   let inputState = new action.InputState.Pointer(action.PointerType.Mouse);
   // these values should not affect the outcome
   inputState.x = "99";
   inputState.y = "10";
   let target = action.computePointerDestination(act, inputState);
   equal(act.x, target.x);
   equal(act.y, target.y);
 
   run_next_test();
 });
 
 add_test(function test_computePointerDestinationPointer() {
-  let act = { type: "pointerMove", x: 100, y: 200, origin: "pointer"};
+  let act = {type: "pointerMove", x: 100, y: 200, origin: "pointer"};
   let inputState = new action.InputState.Pointer(action.PointerType.Mouse);
   inputState.x = 10;
   inputState.y = 99;
   let target = action.computePointerDestination(act, inputState);
   equal(act.x + inputState.x, target.x);
   equal(act.y + inputState.y, target.y);
 
 
@@ -241,32 +240,32 @@ add_test(function test_computePointerDes
   run_next_test();
 });
 
 add_test(function test_processPointerAction() {
   let actionSequence = {
     type: "pointer",
     id: "some_id",
     parameters: {
-      pointerType: "mouse" //TODO "touch"
+      pointerType: "mouse", // TODO "touch"
     },
   };
   let actionItems = [
     {
       duration: 2000,
       type: "pause",
     },
     {
       type: "pointerMove",
       duration: 2000,
     },
     {
       type: "pointerUp",
       button: 1,
-    }
+    },
   ];
   for (let expected of actionItems) {
     let actual = action.Action.fromJSON(actionSequence, expected);
     equal(actual.type, actionSequence.type);
     equal(actual.subtype, expected.type);
     equal(actual.id, actionSequence.id);
     if (expected.type === "pointerUp") {
       equal(actual.button, expected.button);
@@ -298,17 +297,17 @@ add_test(function test_processPauseActio
   equal(act.duration, actionItem.duration);
 
   run_next_test();
 });
 
 add_test(function test_processActionSubtypeValidation() {
   let actionItem = {type: "dancing"};
   let actionSequence = {id: "some_id"};
-  let check = function (regex) {
+  let check = function(regex) {
     let message = `type: ${actionSequence.type}, subtype: ${actionItem.type}`;
     checkErrors(regex, action.Action.fromJSON, [actionSequence, actionItem], message);
   };
   for (let type of ["none", "key", "pointer"]) {
     actionSequence.type = type;
     check(new RegExp(`Unknown subtype for ${type} action`));
   }
   run_next_test();
@@ -361,17 +360,17 @@ add_test(function test_processInputSourc
   check(`actionSequence.actions: ${getTypeString(actionSequence.actions)}`,
       /Expected 'actionSequence.actions' to be an array/);
   action.inputStateMap.clear();
 
   run_next_test();
 });
 
 add_test(function test_processInputSourceActionSequence() {
-  let actionItem = { type: "pause", duration: 5};
+  let actionItem = {type: "pause", duration: 5};
   let actionSequence = {
     type: "none",
     id: "some id",
     actions: [actionItem],
   };
   let expectedAction = new action.Action(actionSequence.id, "none", actionItem.type);
   expectedAction.duration = actionItem.duration;
   let actions = action.Sequence.fromJSON(actionSequence);
@@ -383,17 +382,17 @@ add_test(function test_processInputSourc
 
 add_test(function test_processInputSourceActionSequencePointer() {
   let actionItem = {type: "pointerDown", button: 1};
   let actionSequence = {
     type: "pointer",
     id: "9",
     actions: [actionItem],
     parameters: {
-      pointerType: "mouse" // TODO "pen"
+      pointerType: "mouse", // TODO "pen"
     },
   };
   let expectedAction = new action.Action(
       actionSequence.id, actionSequence.type, actionItem.type);
   expectedAction.pointerType = actionSequence.parameters.pointerType;
   expectedAction.button = actionItem.button;
   let actions = action.Sequence.fromJSON(actionSequence);
   equal(actions.length, 1);
@@ -420,17 +419,17 @@ add_test(function test_processInputSourc
 });
 
 
 add_test(function test_processInputSourceActionSequenceInputStateMap() {
   let id = "1";
   let actionItem = {type: "pause", duration: 5000};
   let actionSequence = {
     type: "key",
-    id: id,
+    id,
     actions: [actionItem],
   };
   let wrongInputState = new action.InputState.Null();
   action.inputStateMap.set(actionSequence.id, wrongInputState);
   checkErrors(/to be mapped to/, action.Sequence.fromJSON, [actionSequence],
       `${actionSequence.type} using ${wrongInputState}`);
   action.inputStateMap.clear();
   let rightInputState = new action.InputState.Key();
@@ -450,23 +449,23 @@ add_test(function test_processPointerAct
   action.inputStateMap.set(id, wrongInputState);
   checkErrors(
       /to be mapped to InputState whose type is/, action.processPointerAction,
       [id, parameters, a],
       `type "pointer" with ${wrongInputState.type} in inputState`);
   action.inputStateMap.clear();
 
   // TODO - uncomment once pen is supported
-  //wrongInputState = new action.InputState.Pointer("pen");
-  //action.inputStateMap.set(id, wrongInputState);
-  //checkErrors(
+  // wrongInputState = new action.InputState.Pointer("pen");
+  // action.inputStateMap.set(id, wrongInputState);
+  // checkErrors(
   //    /to be mapped to InputState whose subtype is/, action.processPointerAction,
   //    [id, parameters, a],
   //    `subtype ${parameters.pointerType} with ${wrongInputState.subtype} in inputState`);
-  //action.inputStateMap.clear();
+  // action.inputStateMap.clear();
 
   let rightInputState = new action.InputState.Pointer("mouse");
   action.inputStateMap.set(id, rightInputState);
   action.processPointerAction(id, parameters, a);
   action.inputStateMap.clear();
   run_next_test();
 });
 
@@ -536,17 +535,17 @@ add_test(function test_extractActionChai
       button: 2,
     },
   ];
   let mouseActionSequence = {
     type: "pointer",
     id: "7",
     actions: mouseActionItems,
     parameters: {
-      pointerType: "mouse" //TODO "touch"
+      pointerType: "mouse", // TODO "touch"
     },
   };
   let keyActionItems = [
     {
       type: "keyDown",
       value: "a",
     },
     {
@@ -617,17 +616,17 @@ add_test(function test_computeTickDurati
   equal(0, action.computeTickDuration(tickActions));
   run_next_test();
 });
 
 
 // helpers
 function getTypeString(obj) {
   return Object.prototype.toString.call(obj);
-};
+}
 
 function checkErrors(regex, func, args, message) {
   if (typeof message == "undefined") {
     message = `actionFunc: ${func.name}; args: ${args}`;
   }
   Assert.throws(() => func.apply(this, args), InvalidArgumentError, message);
   Assert.throws(() => func.apply(this, args), regex, message);
-};
+}
--- a/testing/marionette/test/unit/test_assert.js
+++ b/testing/marionette/test/unit/test_assert.js
@@ -1,16 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
+/* eslint-disable no-array-constructor, no-new-object */
 
 ChromeUtils.import("chrome://marionette/content/assert.js");
-ChromeUtils.import("chrome://marionette/content/error.js");
+const {
+  InvalidArgumentError,
+  InvalidSessionIDError,
+  JavaScriptError,
+  NoSuchWindowError,
+  SessionNotCreatedError,
+  UnexpectedAlertOpenError,
+  UnsupportedOperationError,
+} = ChromeUtils.import("chrome://marionette/content/error.js", {});
 
 add_test(function test_acyclic() {
   assert.acyclic({});
   assert.acyclic(new Object());
   assert.acyclic([]);
   assert.acyclic(new Array());
 
   // object
@@ -106,17 +115,17 @@ add_test(function test_number() {
   }
 
   Assert.throws(() => assert.number("foo", "custom"), /custom/);
 
   run_next_test();
 });
 
 add_test(function test_callable() {
-  assert.callable(function () {});
+  assert.callable(function() {});
   assert.callable(() => {});
 
   for (let typ of [undefined, "", true, {}, []]) {
     Assert.throws(() => assert.callable(typ), InvalidArgumentError);
   }
 
   Assert.throws(() => assert.callable("foo", "custom"), /custom/);
 
@@ -219,8 +228,10 @@ add_test(function test_that() {
   Assert.throws(() => assert.that(val => val)(false));
   Assert.throws(() => assert.that(val => val, "foo", SessionNotCreatedError)(false),
       SessionNotCreatedError);
 
   Assert.throws(() => assert.that(() => false, "custom")(), /custom/);
 
   run_next_test();
 });
+
+/* eslint-enable no-array-constructor, no-new-object */
--- a/testing/marionette/test/unit/test_cookie.js
+++ b/testing/marionette/test/unit/test_cookie.js
@@ -2,57 +2,57 @@
  * 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/. */
 
 ChromeUtils.import("chrome://marionette/content/cookie.js");
 
 cookie.manager = {
   cookies: [],
 
-  add: function (domain, path, name, value, secure, httpOnly, session, expiry, originAttributes) {
+  add(domain, path, name, value, secure, httpOnly, session, expiry, originAttributes) {
     if (name === "fail") {
       throw new Error("An error occurred while adding cookie");
     }
     let newCookie = {
       host: domain,
-      path: path,
-      name: name,
-      value: value,
+      path,
+      name,
+      value,
       isSecure: secure,
       isHttpOnly: httpOnly,
       isSession: session,
-      expiry: expiry,
-      originAttributes: originAttributes,
+      expiry,
+      originAttributes,
     };
     cookie.manager.cookies.push(newCookie);
   },
 
-  remove: function (host, name, path, blocked, originAttributes) {
+  remove(host, name, path) {
     for (let i = 0; i < this.cookies.length; ++i) {
       let candidate = this.cookies[i];
       if (candidate.host === host &&
           candidate.name === name &&
           candidate.path === path) {
         return this.cookies.splice(i, 1);
       }
     }
     return false;
   },
 
-  getCookiesFromHost(host, originAttributes = {}) {
+  getCookiesFromHost(host) {
     let hostCookies = this.cookies.filter(cookie => cookie.host === host ||
        cookie.host === "." + host);
     let nextIndex = 0;
 
     return {
-      hasMoreElements () {
+      hasMoreElements() {
         return nextIndex < hostCookies.length;
       },
 
-      getNext () {
+      getNext() {
         return {
           QueryInterface() {
             return hostCookies[nextIndex++];
           },
         };
       },
     };
   },
@@ -67,69 +67,69 @@ add_test(function test_fromJSON() {
   // name and value
   for (let invalidType of [42, true, [], {}, null, undefined]) {
     Assert.throws(() => cookie.fromJSON({name: invalidType}), /Cookie name must be string/);
     Assert.throws(() => cookie.fromJSON({name: "foo", value: invalidType}), /Cookie value must be string/);
   }
 
   // domain
   for (let invalidType of [42, true, [], {}, null]) {
-    let test = {
+    let domainTest = {
       name: "foo",
       value: "bar",
-      domain: invalidType
+      domain: invalidType,
     };
-    Assert.throws(() => cookie.fromJSON(test), /Cookie domain must be string/);
+    Assert.throws(() => cookie.fromJSON(domainTest), /Cookie domain must be string/);
   }
-  let test = {
+  let domainTest = {
     name: "foo",
     value: "bar",
-    domain: "domain"
+    domain: "domain",
   };
-  let parsedCookie = cookie.fromJSON(test);
+  let parsedCookie = cookie.fromJSON(domainTest);
   equal(parsedCookie.domain, "domain");
 
   // path
   for (let invalidType of [42, true, [], {}, null]) {
-    let test = {
+    let pathTest = {
       name: "foo",
       value: "bar",
       path: invalidType,
     };
-    Assert.throws(() => cookie.fromJSON(test), /Cookie path must be string/);
+    Assert.throws(() => cookie.fromJSON(pathTest), /Cookie path must be string/);
   }
 
   // secure
   for (let invalidType of ["foo", 42, [], {}, null]) {
-    let test = {
+    let secureTest = {
       name: "foo",
       value: "bar",
       secure: invalidType,
     };
-    Assert.throws(() => cookie.fromJSON(test), /Cookie secure flag must be boolean/);
+    Assert.throws(() => cookie.fromJSON(secureTest), /Cookie secure flag must be boolean/);
   }
 
   // httpOnly
   for (let invalidType of ["foo", 42, [], {}, null]) {
-    let test = {
+    let httpOnlyTest = {
       name: "foo",
       value: "bar",
       httpOnly: invalidType,
     };
-    Assert.throws(() => cookie.fromJSON(test), /Cookie httpOnly flag must be boolean/);
+    Assert.throws(() => cookie.fromJSON(httpOnlyTest), /Cookie httpOnly flag must be boolean/);
   }
 
   // expiry
   for (let invalidType of [-1, Number.MAX_SAFE_INTEGER + 1, "foo", true, [], {}, null]) {
-    let test = {
+    let expiryTest = {
       name: "foo",
       value: "bar",
       expiry: invalidType,
     };
-    Assert.throws(() => cookie.fromJSON(test), /Cookie expiry must be a positive integer/);
+    Assert.throws(() => cookie.fromJSON(expiryTest), /Cookie expiry must be a positive integer/);
   }
 
   // bare requirements
   let bare = cookie.fromJSON({name: "name", value: "value"});
   equal("name", bare.name);
   equal("value", bare.value);
   for (let missing of ["path", "secure", "httpOnly", "session", "expiry"]) {
     ok(!bare.hasOwnProperty(missing));
@@ -208,35 +208,35 @@ add_test(function test_add() {
     domain: "domain5",
     path: "/foo/bar",
   });
   equal("/foo/bar", cookie.manager.cookies[3].path);
 
   cookie.add({
     name: "name6",
     value: "value",
-    domain: ".domain"
+    domain: ".domain",
   });
   equal(".domain", cookie.manager.cookies[4].host);
 
   Assert.throws(() => {
-    cookie.add({name: "fail", value: "value6", domain: "domain6"})
+    cookie.add({name: "fail", value: "value6", domain: "domain6"});
   }, /UnableToSetCookieError/);
 
   run_next_test();
 });
 
 add_test(function test_remove() {
   cookie.manager.cookies = [];
 
   let crumble = {
     name: "test_remove",
     value: "value",
     domain: "domain",
-    path: "/custom/path"
+    path: "/custom/path",
   };
 
   equal(0, cookie.manager.cookies.length);
   cookie.add(crumble);
   equal(1, cookie.manager.cookies.length);
 
   cookie.remove(crumble);
   equal(0, cookie.manager.cookies.length);
--- a/testing/marionette/test/unit/test_dom.js
+++ b/testing/marionette/test/unit/test_dom.js
@@ -18,21 +18,21 @@ class MessageSender {
   }
 }
 
 class Window {
   constructor() {
     this.events = [];
   }
 
-  addEventListener(type, listener) {
+  addEventListener(type) {
     this.events.push(type);
   }
 
-  removeEventListener(type, listener) {
+  removeEventListener(type) {
     for (let i = 0; i < this.events.length; ++i) {
       if (this.events[i] === type) {
         this.events.splice(i, 1);
         return;
       }
     }
   }
 }
@@ -51,18 +51,18 @@ add_test(function test_addEventListener(
   let eventTarget = new WebElementEventTarget(ipc);
 
   let listener = () => {};
   eventTarget.addEventListener("click", listener);
 
   // click listener was appended
   equal(Object.keys(eventTarget.listeners).length, 1);
   ok("click" in eventTarget.listeners);
-  equal(eventTarget.listeners["click"].length, 1);
-  equal(eventTarget.listeners["click"][0], listener);
+  equal(eventTarget.listeners.click.length, 1);
+  equal(eventTarget.listeners.click[0], listener);
 
   // should have sent a registration message
   deepEqual(
       ipc.sent[0], {
         name: "Marionette:DOM:AddEventListener",
         data: {type: "click"},
         objects: undefined,
       });
@@ -72,30 +72,30 @@ add_test(function test_addEventListener(
 
 add_test(function test_addEventListener_sameReference() {
   let ipc = new MessageSender();
   let eventTarget = new WebElementEventTarget(ipc);
 
   let listener = () => {};
   eventTarget.addEventListener("click", listener);
   eventTarget.addEventListener("click", listener);
-  equal(eventTarget.listeners["click"].length, 1);
+  equal(eventTarget.listeners.click.length, 1);
 
   run_next_test();
 });
 
 add_test(function test_WebElementEventTarget_addEventListener_once() {
   let ipc = new MessageSender();
   let eventTarget = new WebElementEventTarget(ipc);
 
   eventTarget.addEventListener("click", () => {}, {once: true});
-  equal(eventTarget.listeners["click"][0].once, true);
+  equal(eventTarget.listeners.click[0].once, true);
 
   eventTarget.dispatchEvent({type: "click"});
-  equal(eventTarget.listeners["click"].length, 0);
+  equal(eventTarget.listeners.click.length, 0);
   deepEqual(
       ipc.sent[1], {
         name: "Marionette:DOM:RemoveEventListener",
         data: {type: "click"},
         objects: undefined,
       });
 
   run_next_test();
@@ -106,36 +106,36 @@ add_test(function test_WebElementEventTa
   let eventTarget = new WebElementEventTarget(ipc);
 
   equal(Object.keys(eventTarget.listeners).length, 0);
   eventTarget.removeEventListener("click", () => {});
   equal(Object.keys(eventTarget.listeners).length, 0);
 
   let firstListener = () => {};
   eventTarget.addEventListener("click", firstListener);
-  equal(eventTarget.listeners["click"].length, 1);
-  ok(eventTarget.listeners["click"][0] === firstListener);
+  equal(eventTarget.listeners.click.length, 1);
+  ok(eventTarget.listeners.click[0] === firstListener);
 
   let secondListener = () => {};
   eventTarget.addEventListener("click", secondListener);
-  equal(eventTarget.listeners["click"].length, 2);
-  ok(eventTarget.listeners["click"][1] === secondListener);
+  equal(eventTarget.listeners.click.length, 2);
+  ok(eventTarget.listeners.click[1] === secondListener);
 
-  ok(eventTarget.listeners["click"][0] !== eventTarget.listeners["click"][1]);
+  ok(eventTarget.listeners.click[0] !== eventTarget.listeners.click[1]);
 
   eventTarget.removeEventListener("click", secondListener);
-  equal(eventTarget.listeners["click"].length, 1);
-  ok(eventTarget.listeners["click"][0] === firstListener);
+  equal(eventTarget.listeners.click.length, 1);
+  ok(eventTarget.listeners.click[0] === firstListener);
 
   // event should not have been unregistered
   // because there still exists another click event
   equal(ipc.sent[ipc.sent.length - 1].name, "Marionette:DOM:AddEventListener");
 
   eventTarget.removeEventListener("click", firstListener);
-  equal(eventTarget.listeners["click"].length, 0);
+  equal(eventTarget.listeners.click.length, 0);
   deepEqual(
       ipc.sent[ipc.sent.length - 1],
       {
         name: "Marionette:DOM:RemoveEventListener",
         data: {type: "click"},
         objects: undefined,
       });
 
--- a/testing/marionette/test/unit/test_error.js
+++ b/testing/marionette/test/unit/test_error.js
@@ -208,23 +208,23 @@ add_test(function test_ElementClickInter
     localName: "a",
   };
   let obscuredEl = {
     hasAttribute: attr => attr in obscuredEl,
     getAttribute: attr => attr in obscuredEl ? obscuredEl[attr] : null,
     nodeType: 1,
     localName: "b",
     ownerDocument: {
-      elementFromPoint: function (x, y) {
+      elementFromPoint() {
         return otherEl;
       },
     },
     style: {
       pointerEvents: "auto",
-    }
+    },
   };
 
   let err1 = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2});
   equal("ElementClickInterceptedError", err1.name);
   equal("Element <b> is not clickable at point (1,2) " +
       "because another element <a> obscures it",
       err1.message);
   equal("element click intercepted", err1.status);
@@ -255,16 +255,26 @@ add_test(function test_ElementNotInterac
   equal("ElementNotInteractableError", err.name);
   equal("foo", err.message);
   equal("element not interactable", err.status);
   ok(err instanceof WebDriverError);
 
   run_next_test();
 });
 
+add_test(function test_InsecureCertificateError() {
+  let err = new InsecureCertificateError("foo");
+  equal("InsecureCertificateError", err.name);
+  equal("foo", err.message);
+  equal("insecure certificate", err.status);
+  ok(err instanceof WebDriverError);
+
+  run_next_test();
+});
+
 add_test(function test_InvalidArgumentError() {
   let err = new InvalidArgumentError("foo");
   equal("InvalidArgumentError", err.name);
   equal("foo", err.message);
   equal("invalid argument", err.status);
   ok(err instanceof WebDriverError);
 
   run_next_test();
@@ -322,16 +332,26 @@ add_test(function test_JavaScriptError()
   let superErr = new RangeError("foo");
   let inheritedErr = new JavaScriptError(superErr);
   equal("RangeError: foo", inheritedErr.message);
   equal(superErr.stack, inheritedErr.stack);
 
   run_next_test();
 });
 
+add_test(function test_MoveTargetOutOfBoundsError() {
+  let err = new MoveTargetOutOfBoundsError("foo");
+  equal("MoveTargetOutOfBoundsError", err.name);
+  equal("foo", err.message);
+  equal("move target out of bounds", err.status);
+  ok(err instanceof WebDriverError);
+
+  run_next_test();
+});
+
 add_test(function test_NoSuchAlertError() {
   let err = new NoSuchAlertError("foo");
   equal("NoSuchAlertError", err.name);
   equal("foo", err.message);
   equal("no such alert", err.status);
   ok(err instanceof WebDriverError);
 
   run_next_test();
@@ -412,16 +432,26 @@ add_test(function test_UnableToSetCookie
   equal("UnableToSetCookieError", err.name);
   equal("foo", err.message);
   equal("unable to set cookie", err.status);
   ok(err instanceof WebDriverError);
 
   run_next_test();
 });
 
+add_test(function test_UnexpectedAlertOpenError() {
+  let err = new UnexpectedAlertOpenError("foo");
+  equal("UnexpectedAlertOpenError", err.name);
+  equal("foo", err.message);
+  equal("unexpected alert open", err.status);
+  ok(err instanceof WebDriverError);
+
+  run_next_test();
+});
+
 add_test(function test_UnknownCommandError() {
   let err = new UnknownCommandError("foo");
   equal("UnknownCommandError", err.name);
   equal("foo", err.message);
   equal("unknown command", err.status);
   ok(err instanceof WebDriverError);
 
   run_next_test();
--- a/testing/marionette/test/unit/test_evaluate.js
+++ b/testing/marionette/test/unit/test_evaluate.js
@@ -80,17 +80,17 @@ add_test(function test_toJSON_types() {
   // arbitrary object
   deepEqual({foo: "bar"}, evaluate.toJSON({foo: "bar"}));
 
   run_next_test();
 });
 
 
 add_test(function test_toJSON_sequences() {
-  let input = [null, true, [], domEl, {toJSON() { return "foo"}}, {bar: "baz"}];
+  let input = [null, true, [], domEl, {toJSON() { return "foo"; }}, {bar: "baz"}];
   let actual = evaluate.toJSON(input, seenEls);
 
   equal(null, actual[0]);
   equal(true, actual[1]);
   deepEqual([], actual[2]);
   ok(WebElement.isReference(actual[3]));
   equal("foo", actual[4]);
   deepEqual({bar: "baz"}, actual[5]);
--- a/testing/marionette/test/unit/test_format.js
+++ b/testing/marionette/test/unit/test_format.js
@@ -30,17 +30,17 @@ add_test(function test_pprint() {
     id: "foo",
     class: "a b",
     href: "#",
     name: "bar",
     src: "s",
     type: "t",
   };
   equal('<input id="foo" class="a b" href="#" name="bar" src="s" type="t">',
-        pprint`${el}`);
+      pprint`${el}`);
 
   run_next_test();
 });
 
 add_test(function test_truncate_empty() {
   equal(truncate``, "");
   run_next_test();
 });
@@ -83,19 +83,19 @@ add_test(function test_truncate_array() 
 add_test(function test_truncate_object() {
   equal(truncate`${{}}`, JSON.stringify({}));
   equal(truncate`${{foo: "bar"}}`, JSON.stringify({foo: "bar"}));
   equal(truncate`${{foo: "x".repeat(260)}}`, JSON.stringify({foo: `${HALF} ... ${HALF}`}));
   equal(truncate`${{foo: ["bar"]}}`, JSON.stringify({foo: ["bar"]}));
   equal(truncate`${{foo: ["bar", {baz: 42}]}}`, JSON.stringify({foo: ["bar", {baz: 42}]}));
 
   let complex = {
-    toString() { return "hello world"; }
+    toString() { return "hello world"; },
   };
   equal(truncate`${complex}`, "hello world");
 
   let longComplex = {
-    toString() { return "x".repeat(260); }
+    toString() { return "x".repeat(260); },
   };
   equal(truncate`${longComplex}`, `${HALF} ... ${HALF}`);
 
   run_next_test();
 });
--- a/testing/marionette/test/unit/test_message.js
+++ b/testing/marionette/test/unit/test_message.js
@@ -1,13 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-ChromeUtils.import("chrome://marionette/content/error.js");
+const {
+  InvalidArgumentError,
+  WebDriverError,
+} = ChromeUtils.import("chrome://marionette/content/error.js", {});
 ChromeUtils.import("chrome://marionette/content/message.js");
 
 add_test(function test_Message_Origin() {
   equal(0, Message.Origin.Client);
   equal(1, Message.Origin.Server);
 
   run_next_test();
 });
@@ -120,20 +123,20 @@ add_test(function test_Response_ctor() {
   equal(handler, resp.respHandler_);
 
   run_next_test();
 });
 
 add_test(function test_Response_sendConditionally() {
   let fired = false;
   let resp = new Response(42, () => fired = true);
-  resp.sendConditionally(r => false);
+  resp.sendConditionally(() => false);
   equal(false, resp.sent);
   equal(false, fired);
-  resp.sendConditionally(r => true);
+  resp.sendConditionally(() => true);
   equal(true, resp.sent);
   equal(true, fired);
 
   run_next_test();
 });
 
 add_test(function test_Response_send() {
   let fired = false;
--- a/testing/marionette/test/unit/test_session.js
+++ b/testing/marionette/test/unit/test_session.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-ChromeUtils.import("chrome://marionette/content/error.js");
+const {InvalidArgumentError} = ChromeUtils.import("chrome://marionette/content/error.js", {});
 ChromeUtils.import("chrome://marionette/content/session.js");
 
 add_test(function test_Timeouts_ctor() {
   let ts = new session.Timeouts();
   equal(ts.implicit, 0);
   equal(ts.pageLoad, 300000);
   equal(ts.script, 30000);
 
@@ -192,45 +192,45 @@ add_test(function test_Proxy_toJSON() {
   deepEqual(p.toJSON(), {proxyType: "pac", proxyAutoconfigUrl: "foo"});
 
   // manual proxy
   p = new session.Proxy();
   p.proxyType = "manual";
   deepEqual(p.toJSON(), {proxyType: "manual"});
 
   for (let proxy of ["ftpProxy", "httpProxy", "sslProxy", "socksProxy"]) {
-    let expected = {proxyType: "manual"}
+    let expected = {proxyType: "manual"};
 
     p = new session.Proxy();
     p.proxyType = "manual";
 
     if (proxy == "socksProxy") {
       p.socksVersion = 5;
       expected.socksVersion = 5;
     }
 
     // without port
     p[proxy] = "foo";
-    expected[proxy] = "foo"
+    expected[proxy] = "foo";
     deepEqual(p.toJSON(), expected);
 
     // with port
     p[proxy] = "foo";
     p[`${proxy}Port`] = 0;
     expected[proxy] = "foo:0";
     deepEqual(p.toJSON(), expected);
 
     p[`${proxy}Port`] = 42;
-    expected[proxy] = "foo:42"
+    expected[proxy] = "foo:42";
     deepEqual(p.toJSON(), expected);
 
     // add brackets for IPv6 address as proxy hostname
     p[proxy] = "2001:db8::1";
     p[`${proxy}Port`] = 42;
-    expected[proxy] = "foo:42"
+    expected[proxy] = "foo:42";
     expected[proxy] = "[2001:db8::1]:42";
     deepEqual(p.toJSON(), expected);
   }
 
   // noProxy: add brackets for IPv6 address
   p = new session.Proxy();
   p.proxyType = "manual";
   p.noProxy = ["2001:db8::1"];
@@ -271,18 +271,18 @@ add_test(function test_Proxy_fromJSON() 
   p.proxyType = "manual";
   deepEqual(p, session.Proxy.fromJSON({proxyType: "manual"}));
 
   for (let proxy of ["httpProxy", "sslProxy", "ftpProxy", "socksProxy"]) {
     let manual = {proxyType: "manual"};
 
     // invalid hosts
     for (let host of [true, 42, [], {}, null, "http://foo",
-        "foo:-1", "foo:65536", "foo/test", "foo#42", "foo?foo=bar",
-        "2001:db8::1"]) {
+      "foo:-1", "foo:65536", "foo/test", "foo#42", "foo?foo=bar",
+      "2001:db8::1"]) {
       manual[proxy] = host;
       Assert.throws(() => session.Proxy.fromJSON(manual),
           /InvalidArgumentError/);
     }
 
     p = new session.Proxy();
     p.proxyType = "manual";
     if (proxy == "socksProxy") {
@@ -299,33 +299,33 @@ add_test(function test_Proxy_fromJSON() 
       "127.0.0.1:42": {hostname: "127.0.0.1", port: 42},
       "[2001:db8::1]:42": {hostname: "2001:db8::1", port: "42"},
     };
 
     // valid proxy hosts with port
     for (let host in host_map) {
       manual[proxy] = host;
 
-      p[`${proxy}`] = host_map[host]["hostname"];
-      p[`${proxy}Port`] = host_map[host]["port"];
+      p[`${proxy}`] = host_map[host].hostname;
+      p[`${proxy}Port`] = host_map[host].port;
 
       deepEqual(p, session.Proxy.fromJSON(manual));
     }
 
     // Without a port the default port of the scheme is used
     for (let host of ["foo", "foo:"]) {
       manual[proxy] = host;
 
       // For socks no default port is available
       p[proxy] = `foo`;
       if (proxy === "socksProxy") {
         p[`${proxy}Port`] = null;
       } else {
         let default_ports = {"ftpProxy": 21, "httpProxy": 80,
-           "sslProxy": 443};
+          "sslProxy": 443};
 
         p[`${proxy}Port`] = default_ports[proxy];
       }
 
       deepEqual(p, session.Proxy.fromJSON(manual));
     }
   }
 
@@ -333,34 +333,34 @@ add_test(function test_Proxy_fromJSON() 
   Assert.throws(() => session.Proxy.fromJSON(
       {proxyType: "manual", socksProxy: "foo:1234"}),
       /InvalidArgumentError/);
 
   // noProxy: invalid settings
   for (let noProxy of [true, 42, {}, null, "foo",
       [true], [42], [{}], [null]]) {
     Assert.throws(() => session.Proxy.fromJSON(
-        {proxyType: "manual", noProxy: noProxy}),
+        {proxyType: "manual", noProxy}),
         /InvalidArgumentError/);
   }
 
   // noProxy: valid settings
   p = new session.Proxy();
   p.proxyType = "manual";
   for (let noProxy of [[], ["foo"], ["foo", "bar"], ["127.0.0.1"]]) {
-    let manual = {proxyType: "manual", "noProxy": noProxy}
+    let manual = {proxyType: "manual", "noProxy": noProxy};
     p.noProxy = noProxy;
     deepEqual(p, session.Proxy.fromJSON(manual));
   }
 
   // noProxy: IPv6 needs brackets removed
   p = new session.Proxy();
   p.proxyType = "manual";
   p.noProxy = ["2001:db8::1"];
-  let manual = {proxyType: "manual", "noProxy": ["[2001:db8::1]"]}
+  let manual = {proxyType: "manual", "noProxy": ["[2001:db8::1]"]};
   deepEqual(p, session.Proxy.fromJSON(manual));
 
   run_next_test();
 });
 
 add_test(function test_Capabilities_ctor() {
   let caps = new session.Capabilities();
   ok(caps.has("browserName"));
@@ -403,17 +403,17 @@ add_test(function test_Capabilities_toJS
   equal(undefined, json.proxy);
 
   equal(caps.get("rotatable"), json.rotatable);
 
   equal(caps.get("moz:accessibilityChecks"), json["moz:accessibilityChecks"]);
   equal(caps.get("moz:processID"), json["moz:processID"]);
   equal(caps.get("moz:profile"), json["moz:profile"]);
   equal(caps.get("moz:useNonSpecCompliantPointerOrigin"),
-        json["moz:useNonSpecCompliantPointerOrigin"]);
+      json["moz:useNonSpecCompliantPointerOrigin"]);
   equal(caps.get("moz:webdriverClick"), json["moz:webdriverClick"]);
 
   run_next_test();
 });
 
 add_test(function test_Capabilities_fromJSON() {
   const {fromJSON} = session.Capabilities;