Bug 1385815 - Enable more ESLint rules for mobile/android. r?sebastian draft
authorDan Banner <dbugs@thebanners.uk>
Tue, 01 Aug 2017 16:41:38 +0100
changeset 642774 8292610b784ba5d9d79a37fa64cacd6493568726
parent 642773 69b6bcc62e3d6e2e250e1c253686d964cefd7c09
child 642775 ecc22ca929252dd5049006a192823b44d3e4fe43
push id72856
push userbmo:dbugs@thebanners.uk
push dateTue, 08 Aug 2017 18:05:59 +0000
reviewerssebastian
bugs1385815
milestone57.0a1
Bug 1385815 - Enable more ESLint rules for mobile/android. r?sebastian MozReview-Commit-ID: aC7PX7xDok
mobile/android/.eslintrc.js
mobile/android/chrome/content/CastingApps.js
mobile/android/chrome/content/Linkify.js
mobile/android/chrome/content/PluginHelper.js
mobile/android/chrome/content/WebrtcUI.js
mobile/android/chrome/content/aboutAccounts.js
mobile/android/chrome/content/aboutCertError.xhtml
mobile/android/chrome/content/content.js
mobile/android/components/ImageBlockingPolicy.js
mobile/android/components/LoginManagerPrompter.js
mobile/android/components/PresentationRequestUIGlue.js
mobile/android/components/PromptService.js
mobile/android/components/extensions/ext-pageAction.js
mobile/android/modules/FxAccountsWebChannel.jsm
mobile/android/modules/HelperApps.jsm
mobile/android/modules/SharedPreferences.jsm
mobile/android/tests/browser/chrome/head.js
mobile/android/tests/browser/chrome/test_device_search_engine.html
mobile/android/tests/browser/chrome/test_get_last_visited.html
mobile/android/tests/browser/chrome/test_simple_discovery.html
mobile/android/tests/browser/chrome/test_video_discovery.html
mobile/android/tests/browser/robocop/robocop_head.js
mobile/android/tests/browser/robocop/testAndroidCastDeviceProvider.js
mobile/android/tests/browser/robocop/testHistoryService.js
--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -5,28 +5,22 @@ module.exports = {
     // XXX Bug 1358949 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", 31],
 
     // Rules enabled in mozilla/recommended, and disabled for now, we should
     // re-enable these over time.
     "brace-style": "off",
     "consistent-return": "off",
-    "no-else-return": "off",
     "no-empty": "off",
-    "no-extra-bind": "off",
-    "no-extra-semi": "off",
-    "no-lonely-if": "off",
-    "no-multi-spaces": "off",
     "no-native-reassign": "off",
     "no-nested-ternary": "off",
     "no-new-object": "off",
     "no-octal": "off",
     "no-redeclare": "off",
     "no-useless-call": "off",
     "no-useless-concat": "off",
-    "no-useless-return": "off",
     "no-undef": "off",
     "no-unused-vars": "off",
     "object-shorthand": "off",
     "quotes": "off", // [2, "double"]
   }
 };
--- a/mobile/android/chrome/content/CastingApps.js
+++ b/mobile/android/chrome/content/CastingApps.js
@@ -329,17 +329,17 @@ var CastingApps = {
             CastingApps._getContentTypeForURI(CastingApps.makeURI(location), aElement, aCallback);
             break;
           default:
             aCallback(channel.contentType);
             request.cancel(0);
             break;
         }
       },
-      onStopRequest: function(request, context, statusCode)  {},
+      onStopRequest: function(request, context, statusCode) {},
       onDataAvailable: function(request, context, stream, offset, count) {}
     };
 
     if (channel) {
       channel.asyncOpen2(listener);
     } else {
       aCallback(null);
     }
@@ -411,24 +411,22 @@ var CastingApps = {
     // As soon as we find a good sourceURL, avoid firing the callback any further
     var _getContentTypeForURIs = (aURIs) => {
       // Do an async fetch to figure out the mimetype of the source video
       let sourceURI = aURIs.pop();
       this._getContentTypeForURI(sourceURI, aElement, (aType) => {
         if (this.allowableMimeType(aType, aTypes)) {
           // We found a supported mimetype.
           aCallback({ element: aElement, source: sourceURI.spec, poster: posterURL, sourceURI: sourceURI, type: aType });
-        } else {
+        } else if (aURIs.length > 0) {
           // This URI was not a supported mimetype, so let's try the next, if we have more.
-          if (aURIs.length > 0) {
-            _getContentTypeForURIs(aURIs);
-          } else {
-            // We were not able to find a supported mimetype.
-            aCallback(null);
-          }
+          _getContentTypeForURIs(aURIs);
+        } else {
+          // We were not able to find a supported mimetype.
+          aCallback(null);
         }
       });
     }
 
     // If we didn't find a good URI directly, let's look using async methods.
     if (asyncURIs.length > 0) {
       _getContentTypeForURIs(asyncURIs);
     }
--- a/mobile/android/chrome/content/Linkify.js
+++ b/mobile/android/chrome/content/Linkify.js
@@ -77,18 +77,17 @@ Linkifier.prototype = {
     let filterNode = function(node) {
       if (node.parentNode.tagName != 'A' &&
          node.parentNode.tagName != 'SCRIPT' &&
          node.parentNode.tagName != 'NOSCRIPT' &&
          node.parentNode.tagName != 'STYLE' &&
          node.parentNode.tagName != 'APPLET' &&
          node.parentNode.tagName != 'TEXTAREA')
         return NodeFilter.FILTER_ACCEPT;
-      else
-        return NodeFilter.FILTER_REJECT;
+      return NodeFilter.FILTER_REJECT;
     }
 
     let nodeWalker = aDoc.createTreeWalker(aDoc.body, NodeFilter.SHOW_TEXT, filterNode, false);
     let parseNode = () => {
       let node = nodeWalker.nextNode();
       if (!node) {
         this._linkifyTimer = null;
         return;
--- a/mobile/android/chrome/content/PluginHelper.js
+++ b/mobile/android/chrome/content/PluginHelper.js
@@ -151,17 +151,17 @@ var PluginHelper = {
     overlay._bindingHandled = true;
 
     let eventType = PluginHelper._getBindingType(plugin);
     if (!eventType) {
       // Not all bindings have handlers
       return;
     }
 
-    switch  (eventType) {
+    switch (eventType) {
       case "PluginClickToPlay": {
         // Check if plugins have already been activated for this page, or if
         // the user has set a permission to always play plugins on the site
         if (aTab.clickToPlayPluginsActivated ||
             Services.perms.testPermission(aTab.browser.currentURI, "plugins") ==
             Services.perms.ALLOW_ACTION) {
           PluginHelper.playPlugin(plugin);
           return;
--- a/mobile/android/chrome/content/WebrtcUI.js
+++ b/mobile/android/chrome/content/WebrtcUI.js
@@ -292,17 +292,17 @@ var WebrtcUI = {
       requestType = "Microphone";
     else if (videoDevices.length)
       requestType = "Camera";
     else
       return;
 
     let uri = aContentWindow.document.documentURIObject;
     let host = uri.host;
-    let requestor = BrowserApp.manifest ? "'" + BrowserApp.manifest.name  + "'" : host;
+    let requestor = BrowserApp.manifest ? "'" + BrowserApp.manifest.name + "'" : host;
     let message = Strings.browser.formatStringFromName("getUserMedia.share" + requestType + ".message", [ requestor ], 1);
 
     let options = { inputs: [] };
     if (videoDevices.length > 1 || audioDevices.length > 0) {
       // videoSource is both the string used for l10n lookup and the object that will be returned
       this._addDevicesToOptions(videoDevices, "videoSource", options);
     }
 
--- a/mobile/android/chrome/content/aboutAccounts.js
+++ b/mobile/android/chrome/content/aboutAccounts.js
@@ -76,17 +76,17 @@ function deferTransitionToRemoteAfterLoa
   })
   .catch((e) => {
     log.w('Did not get LOADED message: ' + e.toString());
   });
 }
 
 function handleLoadedMessage(message) {
   loadedDeferred.resolve();
-};
+}
 
 var wrapper = {
   iframe: null,
 
   url: null,
 
   init: function(url) {
     this.url = url;
--- a/mobile/android/chrome/content/aboutCertError.xhtml
+++ b/mobile/android/chrome/content/aboutCertError.xhtml
@@ -72,18 +72,18 @@
         // just find the right target text node.
         var intro = document.getElementById('introContentP1');
         function replaceWithHost(node) {
           if (node.textContent == "#1")
             node.textContent = location.host;
           else
             for (var i = 0; i < node.childNodes.length; i++)
               replaceWithHost(node.childNodes[i]);
-        };
-        replaceWithHost(intro);
+        }
+  replaceWithHost(intro);
 
         if (getCSSClass() == "expertBadCert") {
           toggle('technicalContent');
           toggle('expertContent');
         }
 
         // Disallow overrides if this is a Strict-Transport-Security
         // host and the cert is bad (STS Spec section 7.3) or if the
--- a/mobile/android/chrome/content/content.js
+++ b/mobile/android/chrome/content/content.js
@@ -161,17 +161,17 @@ var AboutReaderListener = {
   },
   updateReaderButton: function(forceNonArticle) {
     // Do not show Reader View icon on error pages (bug 1320900)
     if (this.isErrorPage) {
         sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
     } else if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader ||
         !(content.document instanceof content.HTMLDocument) ||
         content.document.mozSyntheticDocument) {
-      return;
+
     } else {
         this.scheduleReadabilityCheckPostPaint(forceNonArticle);
     }
   },
 
   cancelPotentialPendingReadabilityCheck: function() {
     if (this._pendingReadabilityCheck) {
       removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
--- a/mobile/android/components/ImageBlockingPolicy.js
+++ b/mobile/android/components/ImageBlockingPolicy.js
@@ -82,17 +82,17 @@ ImageBlockingPolicy.prototype = {
   shouldProcess: function(contentType, contentLocation, requestOrigin, node, mimeTypeGuess, extra) {
     return Ci.nsIContentPolicy.ACCEPT;
   },
 
   _usingCellular: function() {
     let network = Cc["@mozilla.org/network/network-link-service;1"].getService(Ci.nsINetworkLinkService);
     return !(network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN ||
         network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_ETHERNET ||
-        network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_USB  ||
+        network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_USB ||
         network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_WIFI);
   },
 
   _enabled: function() {
     return Services.prefs.getIntPref(PREF_IMAGEBLOCKING);
   },
 
   observe: function(subject, topic, data) {
--- a/mobile/android/components/LoginManagerPrompter.js
+++ b/mobile/android/components/LoginManagerPrompter.js
@@ -383,18 +383,17 @@ LoginManagerPrompter.prototype = {
    * Returns the localized string for the specified key,
    * formatted if required.
    *
    */
   _getLocalizedString: function(key, formatArgs) {
     if (formatArgs)
       return this._strBundle.pwmgr.formatStringFromName(
         key, formatArgs, formatArgs.length);
-    else
-      return this._strBundle.pwmgr.GetStringFromName(key);
+    return this._strBundle.pwmgr.GetStringFromName(key);
   },
 
   /*
    * _sanitizeUsername
    *
    * Sanitizes the specified username, by stripping quotes and truncating if
    * it's too long. This helps prevent an evil site from messing with the
    * "save password?" prompt too much.
--- a/mobile/android/components/PresentationRequestUIGlue.js
+++ b/mobile/android/components/PresentationRequestUIGlue.js
@@ -1,17 +1,17 @@
 /* -*- Mode: tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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"
 
-const { interfaces: Ci, utils: Cu, classes: Cc  } = Components;
+const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
 
 const TOPIC_PRESENTATION_RECEIVER_LAUNCH = "presentation-receiver:launch";
 const TOPIC_PRESENTATION_RECEIVER_LAUNCH_RESPONSE = "presentation-receiver:launch:response";
 
 // globals XPCOMUtils
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 // globals Services
 Cu.import("resource://gre/modules/Services.jsm");
@@ -56,17 +56,17 @@ PresentationRequestUIGlue.prototype = {
                                     TOPIC_PRESENTATION_RECEIVER_LAUNCH_RESPONSE);
         switch (data.result) {
           case "success":
             aResolve(aSubject);
             break;
           case "error":
             aReject();
             break;
-        };
+        }
       };
 
       Services.obs.addObserver(handleObserve,
                                TOPIC_PRESENTATION_RECEIVER_LAUNCH_RESPONSE);
 
       let data = {
         url: aURL,
         windowId: localDevice.windowId,
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -223,34 +223,31 @@ InternalPrompt.prototype = {
    */
   prompt: function prompt() {
     if (gPromptService.inContentProcess)
       return gPromptService.callProxy("prompt", [null].concat(Array.prototype.slice.call(arguments)));
 
     // also, the nsIPrompt flavor has 5 args instead of 6.
     if (typeof arguments[2] == "object")
       return this.nsIPrompt_prompt.apply(this, arguments);
-    else
-      return this.nsIAuthPrompt_prompt.apply(this, arguments);
+    return this.nsIAuthPrompt_prompt.apply(this, arguments);
   },
 
   promptUsernameAndPassword: function promptUsernameAndPassword() {
     // Both have 6 args, so use types.
     if (typeof arguments[2] == "object")
       return this.nsIPrompt_promptUsernameAndPassword.apply(this, arguments);
-    else
-      return this.nsIAuthPrompt_promptUsernameAndPassword.apply(this, arguments);
+    return this.nsIAuthPrompt_promptUsernameAndPassword.apply(this, arguments);
   },
 
   promptPassword: function promptPassword() {
     // Both have 5 args, so use types.
     if (typeof arguments[2] == "object")
       return this.nsIPrompt_promptPassword.apply(this, arguments);
-    else
-      return this.nsIAuthPrompt_promptPassword.apply(this, arguments);
+    return this.nsIAuthPrompt_promptPassword.apply(this, arguments);
   },
 
   /* ----------  nsIPrompt  ---------- */
 
   alert: function alert(aTitle, aText) {
     let p = this._getPrompt(aTitle, aText, [ PromptUtils.getLocaleString("OK") ]);
     p.setHint("alert");
     this.showPrompt(p);
--- a/mobile/android/components/extensions/ext-pageAction.js
+++ b/mobile/android/components/extensions/ext-pageAction.js
@@ -194,17 +194,17 @@ class PageAction {
       this.id = null;
     }
   }
 
   shutdown() {
     this.tabContext.shutdown();
     this.hide();
   }
-};
+}
 
 this.pageAction = class extends ExtensionAPI {
   onManifestEntry(entryName) {
     let {extension} = this;
     let {manifest} = extension;
 
     let pageAction = new PageAction(manifest.page_action, extension);
     pageActionMap.set(extension, pageAction);
--- a/mobile/android/modules/FxAccountsWebChannel.jsm
+++ b/mobile/android/modules/FxAccountsWebChannel.jsm
@@ -266,25 +266,25 @@ this.FxAccountsWebChannel.prototype = {
               if (!account) {
                 return Accounts.createFirefoxAccountFromJSON(data).then(success => {
                   if (!success) {
                     throw new Error("Could not create Firefox Account!");
                   }
                   UITelemetry.addEvent("action.1", "content", null, "fxaccount-create");
                   return success;
                 });
-              } else {
+              }
                 return Accounts.updateFirefoxAccountFromJSON(data).then(success => {
                   if (!success) {
                     throw new Error("Could not update Firefox Account!");
                   }
                   UITelemetry.addEvent("action.1", "content", null, "fxaccount-login");
                   return success;
                 });
-              }
+
             })
             .then(success => {
               if (!success) {
                 throw new Error("Could not create or update Firefox Account!");
               }
 
               // Remember who it is so we can show a relink warning when appropriate.
               this._helpers.setPreviousAccountNameHashPref(data.email);
--- a/mobile/android/modules/HelperApps.jsm
+++ b/mobile/android/modules/HelperApps.jsm
@@ -153,21 +153,21 @@ var HelperApps =  {
       EventDispatcher.instance.dispatch(msg.type, msg, {
         onSuccess: (result) => { data = result; },
         onError: () => { throw new Error("Intent:GetHandler callback failed"); },
       });
       if (data === null) {
         throw new Error("Intent:GetHandler did not return data");
       }
       return parseData(data);
-    } else {
+    }
       EventDispatcher.instance.sendRequestForResult(msg).then(function(data) {
         callback(parseData(data));
       });
-    }
+
   },
 
   launchUri: function launchUri(uri) {
     let msg = this._getMessage("Intent:Open", uri);
     EventDispatcher.instance.sendRequest(msg);
   },
 
   _parseApps: function _parseApps(appInfo) {
--- a/mobile/android/modules/SharedPreferences.jsm
+++ b/mobile/android/modules/SharedPreferences.jsm
@@ -225,17 +225,17 @@ SharedPreferencesImpl.prototype = Object
 
   onEvent: function _onEvent(event, msg, callback) {
     if (event !== "SharedPreferences:Changed") {
       return;
     }
 
     if (msg.scope !== this._scope ||
         ((this._scope === Scope.PROFILE) && (msg.profileName !== this._profileName)) ||
-        ((this._scope === Scope.GLOBAL)  && (msg.branch !== this._branch))) {
+        ((this._scope === Scope.GLOBAL) && (msg.branch !== this._branch))) {
       return;
     }
 
     if (!this._observers.hasOwnProperty(msg.key)) {
       return;
     }
 
     let observers = this._observers[msg.key];
--- a/mobile/android/tests/browser/chrome/head.js
+++ b/mobile/android/tests/browser/chrome/head.js
@@ -60,17 +60,17 @@ function promiseLinkVisit(url) {
       var uri = subject.QueryInterface(Ci.nsIURI);
       if (uri.spec != url) {
         info("Visited URL " + uri.spec + " is not desired URL " + url + "; ignoring.");
         return;
       }
       info("Visited URL " + uri.spec + " is desired URL " + url);
       Services.obs.removeObserver(observe, topic);
       resolve();
-    };
+    }
     Services.obs.addObserver(observe, linkVisitedTopic);
     info("Now waiting for " + linkVisitedTopic + " notification from Gecko with URL " + url);
   });
 }
 
 function makeObserver(observerId) {
   let deferred = Promise.defer();
 
@@ -83,10 +83,10 @@ function makeObserver(observerId) {
       let msg = { subject: subject,
                   topic: topic,
                   data: data };
       deferred.resolve(msg);
     },
   };
 
   return ret;
-};
+}
 
--- a/mobile/android/tests/browser/chrome/test_device_search_engine.html
+++ b/mobile/android/tests/browser/chrome/test_device_search_engine.html
@@ -45,19 +45,19 @@ Migrated from Robocop: https://bugzilla.
       info("Device: tablet");
       check_submission("/tablet?q=foo", "foo", null);
     } else {
       info("Device: phone");
       check_submission("/phone?q=foo", "foo", null);
     }
 
     SimpleTest.finish();
-  };
+  }
 
-  SimpleTest.registerCleanupFunction(function() {
+SimpleTest.registerCleanupFunction(function() {
     Services.obs.removeObserver(search_observer, "browser-search-engine-modified");
   });
   Services.obs.addObserver(search_observer, "browser-search-engine-modified");
   info("Loading search engine");
   Services.search.addEngine("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/devicesearch.xml", Ci.nsISearchEngine.DATA_XML, null, false);
 
   </script>
 </head>
--- a/mobile/android/tests/browser/chrome/test_get_last_visited.html
+++ b/mobile/android/tests/browser/chrome/test_get_last_visited.html
@@ -24,19 +24,19 @@ https://bugzilla.mozilla.org/show_bug.cg
   let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
   let BrowserApp = chromeWin.BrowserApp;
 
   function get_last_visited(prePath) {
     return EventDispatcher.instance.sendRequestForResult({
       type: "History:GetPrePathLastVisitedTimeMilliseconds",
       prePath: prePath,
     });
-  };
+  }
 
-  var browser = BrowserApp.addTab("about:blank").browser;
+var browser = BrowserApp.addTab("about:blank").browser;
 
   // It's useful to see *all* "link-visited" events in the face of intermittent failures.
   let observe = function(subject, topic, data) {
     var uri = subject.QueryInterface(Ci.nsIURI);
     info("Witnessed " + topic + " notification from Gecko with URI " + uri.spec);
   }
   Services.obs.addObserver(observe, "link-visited");
 
@@ -45,25 +45,25 @@ https://bugzilla.mozilla.org/show_bug.cg
     Services.obs.removeObserver(observe, "link-visited");
   });
 
   // N.b.: the write to the Fennec DB happens before the Gecko notification
   // is fired.  This is delicate.
   function add_history_visit(url) {
     browser.loadURI(url, null, null);
     return promiseLinkVisit(url);
-  };
+  }
 
-  // Be aware that some paths under mochi.test and example.org redirect.  The
-  // blank robocop pages appear to not.  Redirects can impact this test, since
-  // they can write to the history database.
+// Be aware that some paths under mochi.test and example.org redirect.  The
+// blank robocop pages appear to not.  Redirects can impact this test, since
+// they can write to the history database.
 
-  // The apparent mis-ordering here just uses simpler pages (01 and 03) for the
-  // real test, and a more complex page (02) for a final delay.  See comment below.
-  const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
+// The apparent mis-ordering here just uses simpler pages (01 and 03) for the
+// real test, and a more complex page (02) for a final delay.  See comment below.
+const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
   const url2 = "http://example.org/tests/robocop/robocop_blank_03.html";
   const url3 = "http://example.org/tests/robocop/robocop_blank_02.html";
 
   add_task(function* test_get_last_visited() {
     var v = yield get_last_visited("https://random.com/");
     is(v, 0, `Last visited timestamp is 0 for unknown prePath: ${v}`);
 
     let prePath = Services.io.newURI(url1).prePath + "/";
--- a/mobile/android/tests/browser/chrome/test_simple_discovery.html
+++ b/mobile/android/tests/browser/chrome/test_simple_discovery.html
@@ -29,22 +29,22 @@ Migrated from Robocop: https://bugzilla.
       return;
 
     is(service.friendlyName, "Pretend Device");
     is(service.uuid, "uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1");
     is(service.manufacturer, "Copy Cat Inc.");
     is(service.modelName, "Eureka Dongle");
 
     SimpleTest.finish();
-  };
+  }
 
-  var testDevice = {
+var testDevice = {
     id: "test:dummy",
     target: "test:service",
-    factory: function(service) { /* dummy */  },
+    factory: function(service) { },
     types: ["video/mp4"],
     extensions: ["mp4"]
   };
 
   function test_default() {
     SimpleTest.registerCleanupFunction(function cleanup() {
       SimpleServiceDiscovery.unregisterDevice(testDevice);
       Services.obs.removeObserver(discovery_observer, "ssdp-service-found");
--- a/mobile/android/tests/browser/chrome/test_video_discovery.html
+++ b/mobile/android/tests/browser/chrome/test_video_discovery.html
@@ -33,17 +33,17 @@ Migrated from Robocop: https://bugzilla.
     let y = (rect.bottom - rect.top) / 2 + rect.top;
     return [x, y];
   }
 
   // We must register a device and make a "mock" service for the device
   var testDevice = {
     id: "test:dummy",
     target: "test:service",
-    factory: function(service) { /* dummy */  },
+    factory: function(service) { },
     types: ["video/mp4", "video/webm"],
     extensions: ["mp4", "webm"]
   };
 
   function setup_browser() {
     chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
     let BrowserApp = chromeWin.BrowserApp;
 
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -288,24 +288,22 @@ function _do_check_neq(left, right, stac
   var text = left + " != " + right;
   if (left == right) {
     if (!todo) {
       do_throw(text, stack);
     } else {
       _dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
             " : " + stack.lineNumber + "] " + text + "\n");
     }
-  } else {
-    if (!todo) {
+  } else if (!todo) {
       _dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
             stack.lineNumber + "] " + text + "\n");
     } else {
       do_throw_todo(text, stack);
     }
-  }
 }
 
 function do_check_neq(left, right, stack) {
   if (!stack)
     stack = Components.stack.caller;
 
   _do_check_neq(left, right, stack, false);
 }
@@ -320,24 +318,22 @@ function todo_check_neq(left, right, sta
 function do_report_result(passed, text, stack, todo) {
   if (passed) {
     if (todo) {
       do_throw_todo(text, stack);
     } else {
       _dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
             stack.lineNumber + "] " + text + "\n");
     }
-  } else {
-    if (todo) {
+  } else if (todo) {
       _dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
             " : " + stack.lineNumber + "] " + text + "\n");
     } else {
       do_throw(text, stack);
     }
-  }
 }
 
 /**
  * Checks for a true condition, with a success message.
  */
 function ok(condition, msg) {
   do_report_result(condition, msg, Components.stack.caller, false);
 }
@@ -532,24 +528,24 @@ function pattern_matcher(pattern) {
           return explain(diagnosis, { property: p,
                                       diagnosis: element_diagnosis[0] });
         }
       }
       return true;
     };
   } else if (pattern === undefined) {
     return function(value) { return true; };
-  } else {
+  }
     return function(value, diagnosis) {
       if (value !== pattern) {
         return explain(diagnosis, "pattern " + uneval(pattern) + " not === to value " + uneval(value));
       }
       return true;
     };
-  }
+
 }
 
 // Format an explanation for a pattern match failure, as stored in the
 // second argument to a matching function.
 function format_pattern_match_failure(diagnosis, indent = "") {
   var a;
   if (!diagnosis) {
     a = "Matcher did not explain reason for mismatch.";
@@ -770,17 +766,17 @@ function JavaBridge(obj) {
   this._EVENT_TYPE = "Robocop:JS";
   this._JAVA_EVENT_TYPE = "Robocop:Java";
   this._target = obj;
   // The number of replies needed to answer all outstanding sync calls.
   this._repliesNeeded = 0;
   this._EventDispatcher.registerListener(this, this._EVENT_TYPE);
 
   this._sendMessage("notify-loaded", []);
-};
+}
 
 JavaBridge.prototype = {
 
   _Services: Components.utils.import(
     "resource://gre/modules/Services.jsm", {}).Services,
 
   _EventDispatcher: Components.utils.import(
     "resource://gre/modules/Messaging.jsm", {}).EventDispatcher.instance,
--- a/mobile/android/tests/browser/robocop/testAndroidCastDeviceProvider.js
+++ b/mobile/android/tests/browser/robocop/testAndroidCastDeviceProvider.js
@@ -3,17 +3,17 @@
 /* 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/. */
 /* jshint esnext:true, globalstrict:true, moz:true, undef:true, unused:true */
 /* globals Components */
 
 "use strict";
 
-const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu  } = Components;
+const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Messaging.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 // event name
 const TOPIC_ANDROID_CAST_DEVICE_ADDED   = "AndroidCastDevice:Added";
 const TOPIC_ANDROID_CAST_DEVICE_REMOVED = "AndroidCastDevice:Removed";
 const TOPIC_ANDROID_CAST_DEVICE_START   = "AndroidCastDevice:Start";
--- a/mobile/android/tests/browser/robocop/testHistoryService.js
+++ b/mobile/android/tests/browser/robocop/testHistoryService.js
@@ -54,17 +54,17 @@ const PENDING_VISIT_WAIT = 6000;
 const PENDING_VISIT_WAIT_LONG = 20000;
 
 // Manage the saved history visits so we can compare in the tests
 var gVisitURLs = [];
 function visitObserver(subject, topic, data) {
   let uri = subject.QueryInterface(Ci.nsIURI);
   do_print("Observer: " + uri.spec);
   gVisitURLs.push(uri.spec);
-};
+}
 
 // Track the <browser> where the tests are happening
 var gBrowser;
 
 add_test(function setup_browser() {
   let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
   let BrowserApp = chromeWin.BrowserApp;