Bug 1528751 - Add a custom eslint rule to check "consistent" if bracing. r=Standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 28 Feb 2019 08:39:33 +0000
changeset 461697 74ce5e253d22d38226b466ac175fc805acba8c4b
parent 461696 9a25f61c3ca39ba331fcf9810a6464fd14c78414
child 461698 fb0ffd7766a227b208ba3b2ac616a452eb4d1c4c
push id35627
push useropoprus@mozilla.com
push dateThu, 28 Feb 2019 21:44:07 +0000
treeherdermozilla-central@db533ea3d561 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1528751
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 1528751 - Add a custom eslint rule to check "consistent" if bracing. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D20753
browser/base/content/browser-ctrlTab.js
browser/base/content/browser-fullScreenAndPointerLock.js
browser/base/content/browser-places.js
browser/base/content/browser.js
browser/base/content/pageinfo/pageInfo.js
browser/base/content/pageinfo/permissions.js
browser/base/content/pageinfo/security.js
browser/base/content/test/general/contextmenu_common.js
browser/base/content/test/webrtc/browser_devices_get_user_media.js
browser/components/BrowserContentHandler.jsm
browser/components/places/PlacesUIUtils.jsm
browser/components/places/content/browserPlacesViews.js
browser/components/places/content/menu.xml
browser/components/places/content/places-tree.js
browser/components/places/content/treeView.js
browser/components/places/tests/browser/browser_bookmarksProperties.js
browser/components/pocket/content/pktApi.jsm
browser/components/preferences/in-content/main.js
browser/components/preferences/in-content/privacy.js
browser/components/preferences/languages.js
browser/components/search/content/searchbar.js
browser/components/search/test/browser/browser_addEngine.js
browser/components/sessionstore/content/aboutSessionRestore.js
browser/components/translation/LanguageDetector.jsm
browser/components/translation/content/translation-notification.js
browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
editor/libeditor/tests/test_CF_HTML_clipboard.html
editor/libeditor/tests/test_bug520189.html
js/src/builtin/Array.js
services/common/observers.js
services/sync/tps/extensions/tps/resource/tps.jsm
toolkit/actors/SelectionSourceChild.jsm
toolkit/components/aboutperformance/content/aboutPerformance.js
toolkit/components/contentprefs/ContentPrefService2.jsm
toolkit/components/places/Bookmarks.jsm
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/tests/queries/head_queries.js
toolkit/components/places/tests/queries/test_containersQueries_sorting.js
toolkit/components/places/tests/queries/test_querySerialization.js
toolkit/components/places/tests/queries/test_redirects.js
toolkit/components/places/tests/unit/test_000_frecency.js
toolkit/components/places/tests/unit/test_markpageas.js
toolkit/components/search/SearchService.jsm
toolkit/content/aboutSupport.js
toolkit/content/preferencesBindings.js
toolkit/content/tests/widgets/test_videocontrols_standalone.html
toolkit/content/widgets/menulist.js
toolkit/content/widgets/tree.js
toolkit/modules/InlineSpellChecker.jsm
toolkit/modules/PopupNotifications.jsm
toolkit/modules/Preferences.jsm
toolkit/mozapps/downloads/HelperAppDlg.jsm
toolkit/mozapps/extensions/Blocklist.jsm
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/test/browser/head.js
toolkit/mozapps/handling/content/dialog.js
toolkit/mozapps/preferences/fontbuilder.js
toolkit/mozapps/update/content/updates.js
tools/lint/docs/linters/eslint-plugin-mozilla.rst
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
tools/lint/eslint/eslint-plugin-mozilla/lib/rules/consistent-if-bracing.js
tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
tools/lint/eslint/eslint-plugin-mozilla/package.json
tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -88,18 +88,19 @@ var tabPreviewPanelHelper = {
   },
   _popuphiding(host) {
     if ("suspendGUI" in host)
       host.suspendGUI();
 
     if (host._prevFocus) {
       Services.focus.setFocus(host._prevFocus, Ci.nsIFocusManager.FLAG_NOSCROLL);
       host._prevFocus = null;
-    } else
+    } else {
       gBrowser.selectedBrowser.focus();
+    }
 
     if (host.tabToSelect) {
       gBrowser.selectedTab = host.tabToSelect;
       host.tabToSelect = null;
     }
   },
 };
 
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -512,19 +512,19 @@ var FullScreen = {
 
   _setPopupOpen(aEvent) {
     // Popups should only veto chrome collapsing if they were opened when the chrome was not collapsed.
     // Otherwise, they would not affect chrome and the user would expect the chrome to go away.
     // e.g. we wouldn't want the autoscroll icon firing this event, so when the user
     // toggles chrome when moving mouse to the top, it doesn't go away again.
     if (aEvent.type == "popupshown" && !FullScreen._isChromeCollapsed &&
         aEvent.target.localName != "tooltip" && aEvent.target.localName != "window" &&
-        aEvent.target.getAttribute("nopreventnavboxhide") != "true")
+        aEvent.target.getAttribute("nopreventnavboxhide") != "true") {
       FullScreen._isPopupOpen = true;
-    else if (aEvent.type == "popuphidden" && aEvent.target.localName != "tooltip" &&
+    } else if (aEvent.type == "popuphidden" && aEvent.target.localName != "tooltip" &&
              aEvent.target.localName != "window") {
       FullScreen._isPopupOpen = false;
       // Try again to hide toolbar when we close the popup.
       FullScreen.hideNavToolbox(true);
     }
   },
 
   get navToolboxHidden() {
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -789,19 +789,19 @@ var BookmarksEventHandler = {
       if (cell.row == -1)
         return false;
       node = tree.view.nodeForTreeIndex(cell.row);
       cropped = tree.isCellCropped(cell.row, cell.col);
     } else {
       // Check whether the tooltipNode is a Places node.
       // In such a case use it, otherwise check for targetURI attribute.
       var tooltipNode = aDocument.tooltipNode;
-      if (tooltipNode._placesNode)
+      if (tooltipNode._placesNode) {
         node = tooltipNode._placesNode;
-      else {
+      } else {
         // This is a static non-Places node.
         targetURI = tooltipNode.getAttribute("targetURI");
       }
     }
 
     if (!node && !targetURI)
       return false;
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2786,18 +2786,19 @@ function UpdateUrlbarSearchSplitterState
       splitter.id = "urlbar-search-splitter";
       splitter.setAttribute("resizebefore", "flex");
       splitter.setAttribute("resizeafter", "flex");
       splitter.setAttribute("skipintoolbarset", "true");
       splitter.setAttribute("overflows", "false");
       splitter.className = "chromeclass-toolbar-additional";
     }
     urlbar.parentNode.insertBefore(splitter, ibefore);
-  } else if (splitter)
+  } else if (splitter) {
     splitter.remove();
+  }
 }
 
 function UpdatePageProxyState() {
   if (gURLBar && gURLBar.value != gLastValidURLStr) {
     SetPageProxyState("invalid", true);
   }
 }
 
@@ -3965,19 +3966,19 @@ const BrowserSearch = {
 
     var engines = (hidden ? browser.hiddenEngines : browser.engines) || [];
 
     engines.push({ uri: engine.href,
                    title: engine.title,
                    get icon() { return browser.mIconURL; },
                  });
 
-    if (hidden)
+    if (hidden) {
       browser.hiddenEngines = engines;
-    else {
+    } else {
       browser.engines = engines;
       if (browser == gBrowser.selectedBrowser)
         this.updateOpenSearchBadge();
     }
   },
 
   /**
    * Update the browser UI to show whether or not additional engines are
@@ -5401,19 +5402,19 @@ nsBrowserAccess.prototype = {
   _openURIInNewTab(aURI, aReferrer, aReferrerPolicy, aIsPrivate,
                    aIsExternal, aForceNotRemote = false,
                    aUserContextId = Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID,
                    aOpenerWindow = null, aOpenerBrowser = null,
                    aTriggeringPrincipal = null, aNextTabParentId = 0, aName = "", aCsp = null) {
     let win, needToFocusWin;
 
     // try the current window.  if we're in a popup, fall back on the most recent browser window
-    if (window.toolbar.visible)
+    if (window.toolbar.visible) {
       win = window;
-    else {
+    } else {
       win = BrowserWindowTracker.getTopWindow({private: aIsPrivate});
       needToFocusWin = true;
     }
 
     if (!win) {
       // we couldn't find a suitable window, a new one needs to be opened.
       return null;
     }
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -474,19 +474,19 @@ async function makeGeneralTab(metaViewRo
 
   // get the document characterset
   var encoding = docInfo.characterSet;
   document.getElementById("encodingtext").value = encoding;
 
   let length = metaViewRows.length;
 
   var metaGroup = document.getElementById("metaTags");
-  if (!length)
+  if (!length) {
     metaGroup.style.visibility = "hidden";
-  else {
+  } else {
     document.l10n.setAttributes(document.getElementById("metaTagsCaption"),
                                 "general-meta-tags", {"tags": length});
 
     var metaTree = document.getElementById("metatree");
     metaTree.view = gMetaView;
 
     // Add the metaViewRows onto the general tab's meta info tree.
     gMetaView.addRows(metaViewRows);
@@ -911,29 +911,30 @@ function makePreview(row) {
 }
 
 function makeBlockImage(url) {
   var permissionManager = Cc[PERMISSION_CONTRACTID]
                             .getService(nsIPermissionManager);
 
   var checkbox = document.getElementById("blockImage");
   var imagePref = Services.prefs.getIntPref("permissions.default.image");
-  if (!(/^https?:/.test(url)) || imagePref == 2)
+  if (!(/^https?:/.test(url)) || imagePref == 2) {
     // We can't block the images from this host because either is is not
     // for http(s) or we don't load images at all
     checkbox.hidden = true;
-  else {
+  } else {
     var uri = Services.io.newURI(url);
     if (uri.host) {
       checkbox.hidden = false;
       document.l10n.setAttributes(checkbox, "media-block-image", {"website": uri.host});
       var perm = permissionManager.testPermission(uri, "image");
       checkbox.checked = perm == nsIPermissionManager.DENY_ACTION;
-    } else
+    } else {
       checkbox.hidden = true;
+    }
   }
 }
 
 var imagePermissionObserver = {
   observe(aSubject, aTopic, aData) {
     if (document.getElementById("mediaPreviewBox").collapsed)
       return;
 
@@ -960,18 +961,19 @@ function getContentTypeFromHeaders(cache
   return type && type[1];
 }
 
 function setItemValue(id, value) {
   var item = document.getElementById(id);
   if (value) {
     item.parentNode.collapsed = false;
     item.value = value;
-  } else
+  } else {
     item.parentNode.collapsed = true;
+  }
 }
 
 function formatNumber(number) {
   return (+number).toLocaleString(); // coerce number to a numeric value before calling toLocaleString()
 }
 
 function formatDate(datestr, unknown) {
   var date = new Date(datestr);
--- a/browser/base/content/pageinfo/permissions.js
+++ b/browser/base/content/pageinfo/permissions.js
@@ -33,23 +33,25 @@ var permissionObserver = {
 function onLoadPermission(uri, principal) {
   var permTab = document.getElementById("permTab");
   if (SitePermissions.isSupportedURI(uri)) {
     gPermURI = uri;
     gPermPrincipal = principal;
     var hostText = document.getElementById("hostText");
     hostText.value = gPermURI.displayPrePath;
 
-    for (var i of gPermissions)
+    for (var i of gPermissions) {
       initRow(i);
+    }
     Services.obs.addObserver(permissionObserver, "perm-changed");
     onUnloadRegistry.push(onUnloadPermission);
     permTab.hidden = false;
-  } else
+  } else {
     permTab.hidden = true;
+  }
 }
 
 function onUnloadPermission() {
   Services.obs.removeObserver(permissionObserver, "perm-changed");
 
   if (gUsageRequest) {
     gUsageRequest.cancel();
     gUsageRequest = null;
--- a/browser/base/content/pageinfo/security.js
+++ b/browser/base/content/pageinfo/security.js
@@ -233,18 +233,19 @@ function securityOnLoad(uri, windowInfo)
     document.getElementById("security-identity-validity-row").hidden = true;
   }
 
   /* Manage the View Cert button*/
   var viewCert = document.getElementById("security-view-cert");
   if (info.cert) {
     security._cert = info.cert;
     viewCert.collapsed = false;
-  } else
+  } else {
     viewCert.collapsed = true;
+  }
 
   /* Set Privacy & History section text */
 
   // Only show quota usage data for websites, not internal sites.
   if (uri.scheme == "http" || uri.scheme == "https") {
     SiteDataManager.updateSites().then(() => security._updateSiteDataInfo());
   } else {
     document.getElementById("security-privacy-sitedata-row").hidden = true;
@@ -311,19 +312,18 @@ function securityOnLoad(uri, windowInfo)
 }
 
 function setText(id, value) {
   var element = document.getElementById(id);
   if (!element)
     return;
   if (element.localName == "textbox" || element.localName == "label")
     element.value = value;
-  else {
+  else
     element.textContent = value;
-  }
 }
 
 function viewCertHelper(parent, cert) {
   if (!cert)
     return;
 
   Services.ww.openWindow(parent, "chrome://pippki/content/certViewer.xul",
                          "_blank", "centerscreen,chrome", cert);
--- a/browser/base/content/test/general/contextmenu_common.js
+++ b/browser/base/content/test/general/contextmenu_common.js
@@ -167,19 +167,20 @@ function checkMenuItem(actualItem, actua
           icon = tmp;
         }
         is(icon, expectedEnabled.icon,
            "checking item #" + index / 2 + " (" + expectedItem + ") icon attr value");
         is(actualEnabled.checked, expectedEnabled.checked,
            "checking item #" + index / 2 + " (" + expectedItem + ") has checked attr");
         is(actualEnabled.disabled, expectedEnabled.disabled,
            "checking item #" + index / 2 + " (" + expectedItem + ") has disabled attr");
-    } else if (expectedEnabled != null)
+    } else if (expectedEnabled != null) {
         is(actualEnabled, expectedEnabled,
            "checking item #" + index / 2 + " (" + expectedItem + ") enabled state");
+    }
 }
 
 /*
  * checkMenu - checks to see if the specified <menupopup> contains the
  * expected items and state.
  * expectedItems is a array of (1) item IDs and (2) a boolean specifying if
  * the item is enabled or not (or null to ignore it). Submenus can be checked
  * by providing a nested array entry after the expected <menu> ID.
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media.js
@@ -272,19 +272,19 @@ var gTests = [
       Assert.deepEqual((await getMediaCaptureState()), expected,
                        "expected " + Object.keys(expected).join(" and ") +
                        " to be shared");
 
       function checkDevicePermissions(aDevice, aExpected) {
         let Perms = Services.perms;
         let uri = gBrowser.selectedBrowser.documentURI;
         let devicePerms = Perms.testExactPermission(uri, aDevice);
-        if (aExpected === undefined)
+        if (aExpected === undefined) {
           is(devicePerms, Perms.UNKNOWN_ACTION, "no " + aDevice + " persistent permissions");
-        else {
+        } else {
           is(devicePerms, aExpected ? Perms.ALLOW_ACTION : Perms.DENY_ACTION,
              aDevice + " persistently " + (aExpected ? "allowed" : "denied"));
         }
         Perms.remove(uri, aDevice);
       }
       checkDevicePermissions("microphone", aExpectedAudioPerm);
       checkDevicePermissions("camera", aExpectedVideoPerm);
 
--- a/browser/components/BrowserContentHandler.jsm
+++ b/browser/components/BrowserContentHandler.jsm
@@ -384,41 +384,43 @@ nsBrowserContentHandler.prototype = {
 
     var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
     if (chromeParam) {
       // Handle old preference dialog URLs.
       if (chromeParam == "chrome://browser/content/pref/pref.xul" ||
           chromeParam == "chrome://browser/content/preferences/preferences.xul") {
         openPreferences(cmdLine, {origin: "commandLineLegacy"});
         cmdLine.preventDefault = true;
-      } else try {
-        let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
-        let isLocal = uri => {
-          let localSchemes = new Set(["chrome", "file", "resource"]);
-          if (uri instanceof Ci.nsINestedURI) {
-            uri = uri.QueryInterface(Ci.nsINestedURI).innerMostURI;
+      } else {
+        try {
+          let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
+          let isLocal = uri => {
+            let localSchemes = new Set(["chrome", "file", "resource"]);
+            if (uri instanceof Ci.nsINestedURI) {
+              uri = uri.QueryInterface(Ci.nsINestedURI).innerMostURI;
+            }
+            return localSchemes.has(uri.scheme);
+          };
+          if (isLocal(resolvedURI)) {
+            // If the URI is local, we are sure it won't wrongly inherit chrome privs
+            let features = "chrome,dialog=no,all" + this.getFeatures(cmdLine);
+            // Provide 1 null argument, as openWindow has a different behavior
+            // when the arg count is 0.
+            let argArray = Cc["@mozilla.org/array;1"]
+                            .createInstance(Ci.nsIMutableArray);
+            argArray.appendElement(null);
+            Services.ww.openWindow(null, resolvedURI.spec, "_blank", features, argArray);
+            cmdLine.preventDefault = true;
+          } else {
+            dump("*** Preventing load of web URI as chrome\n");
+            dump("    If you're trying to load a webpage, do not pass --chrome.\n");
           }
-          return localSchemes.has(uri.scheme);
-        };
-        if (isLocal(resolvedURI)) {
-          // If the URI is local, we are sure it won't wrongly inherit chrome privs
-          let features = "chrome,dialog=no,all" + this.getFeatures(cmdLine);
-          // Provide 1 null argument, as openWindow has a different behavior
-          // when the arg count is 0.
-          let argArray = Cc["@mozilla.org/array;1"]
-                           .createInstance(Ci.nsIMutableArray);
-          argArray.appendElement(null);
-          Services.ww.openWindow(null, resolvedURI.spec, "_blank", features, argArray);
-          cmdLine.preventDefault = true;
-        } else {
-          dump("*** Preventing load of web URI as chrome\n");
-          dump("    If you're trying to load a webpage, do not pass --chrome.\n");
+        } catch (e) {
+          Cu.reportError(e);
         }
-      } catch (e) {
-        Cu.reportError(e);
       }
     }
     if (cmdLine.handleFlag("preferences", false)) {
       openPreferences(cmdLine, {origin: "commandLineLegacy"});
       cmdLine.preventDefault = true;
     }
     if (cmdLine.handleFlag("silent", false))
       cmdLine.preventDefault = true;
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -746,18 +746,19 @@ var PlacesUIUtils = {
           title = host + (fileName ?
                            (host ? "/" + this.ellipsis + "/" : "") + fileName :
                            uri.pathQueryRef);
         }
       } catch (e) {
         // Use (no title) for non-standard URIs (data:, javascript:, ...)
         title = "";
       }
-    } else
+    } else {
       title = aNode.title;
+    }
 
     return title || this.getString("noTitle");
   },
 
   shouldShowTabsFromOtherComputersMenuitem() {
     let weaveOK = Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED &&
                   Weave.Svc.Prefs.get("firstSync", "") != "notReady";
     return weaveOK;
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -364,18 +364,19 @@ PlacesViewBase.prototype = {
 
         element.appendChild(popup);
         element.className = "menu-iconic bookmark-item";
         if (typeof this.options.extraClasses.entry == "string") {
           element.classList.add(this.options.extraClasses.entry);
         }
 
         this._domNodes.set(aPlacesNode, popup);
-      } else
+      } else {
         throw "Unexpected node";
+      }
 
       element.setAttribute("label", PlacesUIUtils.getBestTitle(aPlacesNode));
 
       let icon = aPlacesNode.icon;
       if (icon)
         element.setAttribute("image", icon);
     }
 
@@ -1568,31 +1569,31 @@ PlacesToolbar.prototype = {
       let ind = this._dropIndicator;
       ind.parentNode.collapsed = false;
       let halfInd = ind.clientWidth / 2;
       let translateX;
       if (this.isRTL) {
         halfInd = Math.ceil(halfInd);
         translateX = 0 - this._rootElt.getBoundingClientRect().right - halfInd;
         if (this._rootElt.firstElementChild) {
-          if (dropPoint.beforeIndex == -1)
+          if (dropPoint.beforeIndex == -1) {
             translateX += this._rootElt.lastElementChild.getBoundingClientRect().left;
-          else {
+          } else {
             translateX += this._rootElt.children[dropPoint.beforeIndex]
                               .getBoundingClientRect().right;
           }
         }
       } else {
         halfInd = Math.floor(halfInd);
         translateX = 0 - this._rootElt.getBoundingClientRect().left +
                      halfInd;
         if (this._rootElt.firstElementChild) {
-          if (dropPoint.beforeIndex == -1)
+          if (dropPoint.beforeIndex == -1) {
             translateX += this._rootElt.lastElementChild.getBoundingClientRect().right;
-          else {
+          } else {
             translateX += this._rootElt.children[dropPoint.beforeIndex]
                               .getBoundingClientRect().left;
           }
         }
       }
 
       ind.style.transform = "translate(" + Math.round(translateX) + "px)";
       ind.style.marginInlineStart = (-ind.clientWidth) + "px";
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -438,18 +438,19 @@
         let newMarginTop = 0;
         if (scrollDir == 0) {
           let elt = this.firstElementChild;
           while (elt && event.screenY > elt.screenY +
                                         elt.boxObject.height / 2)
             elt = elt.nextElementSibling;
           newMarginTop = elt ? elt.screenY - this._scrollBox.screenY :
                                scrollbox.height;
-        } else if (scrollDir == 1)
+        } else if (scrollDir == 1) {
           newMarginTop = scrollbox.height;
+        }
 
         // Set the new marginTop based on arrowscrollbox.
         newMarginTop += scrollbox.y - this._scrollBox.boxObject.y;
         this._indicatorBar.firstElementChild.style.marginTop = newMarginTop + "px";
         this._indicatorBar.hidden = false;
 
         event.preventDefault();
         event.stopPropagation();
--- a/browser/components/places/content/places-tree.js
+++ b/browser/components/places/content/places-tree.js
@@ -455,19 +455,19 @@
         nodesURIChecked.push(containerURI);
 
         var wasOpen = container.containerOpen;
         if (!wasOpen)
           container.containerOpen = true;
         for (var i = 0; i < container.childCount; ++i) {
           var child = container.getChild(i);
           var childURI = child.uri;
-          if (childURI == placeURI)
+          if (childURI == placeURI) {
             return child;
-          else if (PlacesUtils.nodeIsContainer(child)) {
+          } else if (PlacesUtils.nodeIsContainer(child)) {
             var nested = findNode(PlacesUtils.asContainer(child), nodesURIChecked);
             if (nested)
               return nested;
           }
         }
 
         if (!wasOpen)
           container.containerOpen = false;
@@ -476,19 +476,19 @@
       }
 
       var container = this.result.root;
       console.assert(container, "No result, cannot select place URI!");
       if (!container)
         return;
 
       var child = findNode(container, []);
-      if (child)
+      if (child) {
         this.selectNode(child);
-      else {
+      } else {
         // If the specified child could not be located, clear the selection
         var selection = this.view.selection;
         selection.clearSelection();
       }
     }
 
     /**
      * Causes a particular node to be selected in the tree, resulting in all
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -61,18 +61,19 @@ PlacesTreeView.prototype = {
     let selection = this.selection;
     if (selection)
       selection.selectEventsSuppressed = true;
 
     if (!this._rootNode.containerOpen) {
       // This triggers containerStateChanged which then builds the visible
       // section.
       this._rootNode.containerOpen = true;
-    } else
+    } else {
       this.invalidateContainer(this._rootNode);
+    }
 
     // "Activate" the sorting column and update commands.
     this.sortingChanged(this._result.sortingMode);
 
     if (selection)
       selection.selectEventsSuppressed = false;
   },
 
@@ -1186,19 +1187,19 @@ PlacesTreeView.prototype = {
           case PlacesUtils.virtualAllBookmarksGuid:
           case PlacesUtils.virtualHistoryGuid:
           case PlacesUtils.virtualDownloadsGuid:
           case PlacesUtils.virtualTagsGuid:
             properties += ` OrganizerQuery_${node.bookmarkGuid}`;
             break;
           }
         }
-      } else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
+      } else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
         properties += " separator";
-      else if (PlacesUtils.nodeIsURI(node)) {
+      } else if (PlacesUtils.nodeIsURI(node)) {
         properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
       }
 
       this._cellProperties.set(node, properties);
     }
 
     return props + " " + properties;
   },
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -431,18 +431,19 @@ function open_properties_dialog(test) {
       case ACTION_ADD:
         if (test.sidebar == SIDEBAR_BOOKMARKS_ID) {
           if (test.itemType == TYPE_FOLDER)
             command = "placesCmd_new:folder";
           else if (test.itemType == TYPE_BOOKMARK)
             command = "placesCmd_new:bookmark";
           else
             Assert.ok(false, "You didn't set a valid itemType for adding an item");
-        } else
+        } else {
           command = "placesCmd_createBookmark";
+        }
         break;
       default:
         Assert.ok(false, "You didn't set a valid action for this test");
     }
     // Ensure command is enabled for this node.
     Assert.ok(tree.controller.isCommandEnabled(command),
        " command '" + command + "' on current selected node is enabled");
 
--- a/browser/components/pocket/content/pktApi.jsm
+++ b/browser/components/pocket/content/pktApi.jsm
@@ -133,19 +133,19 @@ var pktApi = (function() {
       *                         to create/update.
       * @param {string} value   String containing the value you want to give
       *                         the key you are creating/updating.
       */
     function setSetting(key, value) {
         // TODO : Move this to sqlite or a local file so it's not editable (and is safer)
         // https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
 
-        if (!value)
+        if (!value) {
             prefBranch.clearUserPref(key);
-        else {
+        } else {
             // We use complexValue as tags can have utf-8 characters in them
             prefBranch.setStringPref(key, value);
         }
     }
 
     /**
      * Auth
      */
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -1547,19 +1547,19 @@ var gMainPane = {
   /**
    * Load the set of handlers defined by the application datastore.
    */
   _loadApplicationHandlers() {
     for (let wrappedHandlerInfo of gHandlerService.enumerate()) {
       let type = wrappedHandlerInfo.type;
 
       let handlerInfoWrapper;
-      if (type in this._handledTypes)
+      if (type in this._handledTypes) {
         handlerInfoWrapper = this._handledTypes[type];
-      else {
+      } else {
         handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
         this._handledTypes[type] = handlerInfoWrapper;
       }
 
       handlerInfoWrapper.handledOnlyByPlugin = false;
     }
   },
 
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -655,25 +655,26 @@ var gPrivacyPane = {
 
   /**
    * Initialize the history mode menulist based on the privacy preferences
    */
   initializeHistoryMode() {
     let mode;
     let getVal = aPref => Preferences.get(aPref).value;
 
-    if (getVal("privacy.history.custom"))
+    if (getVal("privacy.history.custom")) {
       mode = "custom";
-    else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
+    } else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
       if (getVal("browser.privatebrowsing.autostart"))
         mode = "dontremember";
       else
         mode = "remember";
-    } else
+    } else {
       mode = "custom";
+    }
 
     document.getElementById("historyMode").value = mode;
   },
 
   /**
    * Update the selected pane based on the history mode menulist
    */
   updateHistoryModePane() {
--- a/browser/components/preferences/languages.js
+++ b/browser/components/preferences/languages.js
@@ -181,19 +181,19 @@ var gLanguagesDialog = {
     var arrayOfPrefs = preference.value.toLowerCase().split(/\s*,\s*/);
     for (var i = 0; i < arrayOfPrefs.length; ++i ) {
       if (arrayOfPrefs[i] == selectedID)
         return;
     }
 
     this._selectedItemID = selectedID;
 
-    if (preference.value == "")
+    if (preference.value == "") {
       preference.value = selectedID;
-    else {
+    } else {
       arrayOfPrefs.unshift(selectedID);
       preference.value = arrayOfPrefs.join(",");
     }
 
     this._acceptLanguages[selectedID] = true;
     this._availableLanguages.selectedItem = null;
 
     // Rebuild the available list with the added item removed...
--- a/browser/components/search/content/searchbar.js
+++ b/browser/components/search/content/searchbar.js
@@ -352,18 +352,19 @@ class MozSearchbar extends MozXULElement
     this.addEventListener("command", (event) => {
       const target = event.originalTarget;
       if (target.engine) {
         this.currentEngine = target.engine;
       } else if (target.classList.contains("addengine-item")) {
         // Select the installed engine if the installation succeeds.
         Services.search.addEngine(target.getAttribute("uri"), null,
           target.getAttribute("src"), false).then(engine => this.currentEngine = engine);
-      } else
+      } else {
         return;
+      }
 
       this.focus();
       this.select();
     });
 
     this.addEventListener("DOMMouseScroll", (event) => {
       if (event.getModifierState("Accel")) {
         this.selectEngine(event, event.detail > 0);
--- a/browser/components/search/test/browser/browser_addEngine.js
+++ b/browser/components/search/test/browser/browser_addEngine.js
@@ -90,16 +90,17 @@ var gTests = [
 ];
 
 var gCurrentTest = null;
 function nextTest() {
   if (gTests.length) {
     gCurrentTest = gTests.shift();
     info("Running " + gCurrentTest.name);
     gCurrentTest.run();
-  } else
+  } else {
     executeSoon(finish);
+  }
 }
 
 function test() {
   waitForExplicitFinish();
   gSS.init().then(nextTest);
 }
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -202,18 +202,19 @@ function onListClick(aEvent) {
     let accelKey = AppConstants.platform == "macosx" ?
                    aEvent.metaKey :
                    aEvent.ctrlKey;
     if ((aEvent.button == 1 || aEvent.button == 0 && aEvent.detail == 2 || accelKey) &&
         cell.col.id == "title" &&
         !treeView.isContainer(cell.row)) {
       restoreSingleTab(cell.row, aEvent.shiftKey);
       aEvent.stopPropagation();
-    } else if (cell.col.id == "restore")
+    } else if (cell.col.id == "restore") {
       toggleRowChecked(cell.row);
+    }
   }
 }
 
 function onListKeyDown(aEvent) {
   switch (aEvent.keyCode) {
   case KeyEvent.DOM_VK_SPACE:
     toggleRowChecked(document.getElementById("tabList").currentIndex);
     // Prevent page from scrolling on the space key.
--- a/browser/components/translation/LanguageDetector.jsm
+++ b/browser/components/translation/LanguageDetector.jsm
@@ -76,19 +76,19 @@ var workerManager = {
 
     this._idleTimeout = setTimeout(this._flushWorker.bind(this), IDLE_TIMEOUT);
   },
 
   // Immediately terminate the worker, as long as there no pending
   // results. Otherwise, reschedule termination until after the next
   // idle timeout.
   _flushWorker() {
-    if (this.detectionQueue.length)
+    if (this.detectionQueue.length) {
       this.flushWorker();
-    else {
+    } else {
       if (this._worker)
         this._worker.terminate();
 
       this._worker = null;
       this._workerReadyPromise = null;
       this._idleTimeout = null;
     }
   },
--- a/browser/components/translation/content/translation-notification.js
+++ b/browser/components/translation/content/translation-notification.js
@@ -276,19 +276,19 @@ class MozTranslationNotification extends
   showTranslation() {
     this.translation.showTranslatedContent();
     this._handleButtonHiding();
   }
 
   optionsShowing() {
     // Get the source language name.
     let lang;
-    if (this.state == Translation.STATE_OFFER)
+    if (this.state == Translation.STATE_OFFER) {
       lang = this._getAnonElt("detectedLanguage").value;
-    else {
+    } else {
       lang = this._getAnonElt("fromLanguage").value;
 
       // If we have never attempted to translate the page before the
       // service became unavailable, "fromLanguage" isn't set.
       if (!lang && this.state == Translation.STATE_UNAVAILABLE)
         lang = this.translation.detectedLanguage;
     }
 
--- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
@@ -39,19 +39,19 @@ async function clickURLBarSuggestion(res
   await UrlbarTestUtils.promiseSearchComplete(window);
 
   const count = UrlbarTestUtils.getResultCount(window);
   for (let i = 0; i < count; i++) {
     let result = await UrlbarTestUtils.getDetailsOfResultAt(window, i);
     if (result.displayed.title == resultTitle) {
       // This entry is the search suggestion we're looking for.
       let element = await UrlbarTestUtils.waitForAutocompleteResultAt(window, i);
-      if (button == 1)
+      if (button == 1) {
         EventUtils.synthesizeMouseAtCenter(element, {});
-      else if (button == 2) {
+      } else if (button == 2) {
         EventUtils.synthesizeMouseAtCenter(element, {type: "mousedown", button: 2});
       }
       return;
     }
   }
 }
 
 /**
--- a/editor/libeditor/tests/test_CF_HTML_clipboard.html
+++ b/editor/libeditor/tests/test_CF_HTML_clipboard.html
@@ -137,19 +137,19 @@ function runTest() {
         win.focus();
       }, 0);
     }, {once: true});
     iframe.srcdoc = "foo";
   }, SimpleTest.finish);
 }
 
 var isMac = ("nsILocalFileMac" in SpecialPowers.Ci);
-if (isMac)
+if (isMac) {
   SimpleTest.waitForFocus(runTest);
-else {
+} else {
   // This test is not yet supported on non-Mac platforms, see bug 574005.
   todo(false, "Test not supported on this platform");
   SimpleTest.finish();
 }
 
 </script>
 </pre>
 </body>
--- a/editor/libeditor/tests/test_bug520189.html
+++ b/editor/libeditor/tests/test_bug520189.html
@@ -534,19 +534,19 @@ var tests = [
     payload: microdataPayload,
     rootElement() { return document.getElementById("yyyy").contentDocument.documentElement; },
     checkResult(html) { is(html.indexOf("name"), -1, "Should have dropped name."); is(html.indexOf("rel"), -1, "Should have dropped rel."); isnot(html.indexOf("itemprop"), -1, "Should not have dropped itemprop."); },
   },
 ];
 
 function doNextTest() {
   /* global testCounter:true */
-  if (typeof testCounter == "undefined")
+  if (typeof testCounter == "undefined") {
     testCounter = 0;
-  else if (++testCounter == tests.length) {
+  } else if (++testCounter == tests.length) {
     SimpleTest.finish();
     return;
   }
 
   runTest(tests[testCounter]);
 
   doNextTest();
 }
@@ -556,18 +556,19 @@ function getLoadContext() {
   return SpecialPowers.wrap(window).docShell.QueryInterface(Ci.nsILoadContext);
 }
 
 function runTest(test) {
   var elem = document.getElementById(test.id);
   if ("isIFrame" in test) {
     elem.contentDocument.designMode = "on";
     elem.contentWindow.focus();
-  } else
+  } else {
     elem.focus();
+  }
 
   var trans = SpecialPowers.Cc["@mozilla.org/widget/transferable;1"]
                            .createInstance(SpecialPowers.Ci.nsITransferable);
   trans.init(getLoadContext());
   var data = SpecialPowers.Cc["@mozilla.org/supports-string;1"]
                           .createInstance(SpecialPowers.Ci.nsISupportsString);
   data.data = test.payload;
   trans.addDataFlavor("text/html");
--- a/js/src/builtin/Array.js
+++ b/js/src/builtin/Array.js
@@ -18,20 +18,20 @@ function ArrayIndexOf(searchElement/*, f
     var n = arguments.length > 1 ? ToInteger(arguments[1]) + 0 : 0;
 
     /* Step 6. */
     if (n >= len)
         return -1;
 
     var k;
     /* Step 7. */
-    if (n >= 0)
+    if (n >= 0) {
         k = n;
     /* Step 8. */
-    else {
+    } else {
         /* Step a. */
         k = len + n;
         /* Step b. */
         if (k < 0)
             k = 0;
     }
 
     /* Step 9. */
--- a/services/common/observers.js
+++ b/services/common/observers.js
@@ -117,18 +117,19 @@ Observer.prototype = {
         ("observersModuleSubjectWrapper" in subject.wrappedJSObject))
       subject = subject.wrappedJSObject.object;
 
     if (typeof this.callback == "function") {
       if (this.thisObject)
         this.callback.call(this.thisObject, subject, data);
       else
         this.callback(subject, data);
-    } else // typeof this.callback == "object" (nsIObserver)
+    } else { // typeof this.callback == "object" (nsIObserver)
       this.callback.observe(subject, topic, data);
+    }
   },
 };
 
 
 function Subject(object) {
   // Double-wrap the object and set a property identifying the wrappedJSObject
   // as one of our wrappers to distinguish between subjects that are one of our
   // wrappers (which we should unwrap when notifying our observers) and those
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -502,18 +502,19 @@ var TPS = {
           if (action == ACTION_ADD) {
             itemGuid = await placesItem.Create();
           } else {
             itemGuid = await placesItem.Find();
             if (action == ACTION_VERIFY_NOT) {
               Logger.AssertTrue(itemGuid == null,
                 "places item exists but it shouldn't: " +
                 JSON.stringify(bookmark));
-            } else
+            } else {
               Logger.AssertTrue(itemGuid, "places item not found", true);
+            }
           }
 
           last_item_pos = await placesItem.GetItemIndex();
           items.push(placesItem);
         }
       }
 
       if (action == ACTION_DELETE || action == ACTION_MODIFY) {
--- a/toolkit/actors/SelectionSourceChild.jsm
+++ b/toolkit/actors/SelectionSourceChild.jsm
@@ -124,19 +124,19 @@ class SelectionSourceChild extends Actor
       if (endContainer.nodeType == Node.TEXT_NODE ||
           endContainer.nodeType == Node.CDATA_SECTION_NODE) {
         // do some extra tweaks to try to avoid the view-source output to look like
         // ...<tag>]... or ...]</tag>... (where ']' marks the end of the selection).
         // To get a neat output, the idea here is to remap the end point from:
         // 1. ...<tag>]...   to   ...]<tag>...
         // 2. ...]</tag>...  to   ...</tag>]...
         if ((endOffset > 0 && endOffset < endContainer.data.length) ||
-            !endContainer.parentNode || !endContainer.parentNode.parentNode)
+            !endContainer.parentNode || !endContainer.parentNode.parentNode) {
           endContainer.insertData(endOffset, MARK_SELECTION_END);
-        else {
+        } else {
           tmpNode = dataDoc.createTextNode(MARK_SELECTION_END);
           endContainer = endContainer.parentNode;
           if (endOffset === 0)
             endContainer.parentNode.insertBefore(tmpNode, endContainer);
           else
             endContainer.parentNode.insertBefore(tmpNode, endContainer.nextSibling);
         }
       } else {
@@ -148,19 +148,19 @@ class SelectionSourceChild extends Actor
           startContainer.nodeType == Node.CDATA_SECTION_NODE) {
         // do some extra tweaks to try to avoid the view-source output to look like
         // ...<tag>[... or ...[</tag>... (where '[' marks the start of the selection).
         // To get a neat output, the idea here is to remap the start point from:
         // 1. ...<tag>[...   to   ...[<tag>...
         // 2. ...[</tag>...  to   ...</tag>[...
         if ((startOffset > 0 && startOffset < startContainer.data.length) ||
             !startContainer.parentNode || !startContainer.parentNode.parentNode ||
-            startContainer != startContainer.parentNode.lastChild)
+            startContainer != startContainer.parentNode.lastChild) {
           startContainer.insertData(startOffset, MARK_SELECTION_START);
-        else {
+        } else {
           tmpNode = dataDoc.createTextNode(MARK_SELECTION_START);
           startContainer = startContainer.parentNode;
           if (startOffset === 0)
             startContainer.parentNode.insertBefore(tmpNode, startContainer);
           else
             startContainer.parentNode.insertBefore(tmpNode, startContainer.nextSibling);
         }
       } else {
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -403,19 +403,19 @@ var View = {
     tbody.appendChild(this._fragment);
     this._fragment = document.createDocumentFragment();
   },
   insertAfterRow(row) {
     row.parentNode.insertBefore(this._fragment, row.nextSibling);
     this._fragment = document.createDocumentFragment();
   },
   displayEnergyImpact(elt, energyImpact) {
-    if (!energyImpact)
+    if (!energyImpact) {
       elt.textContent = "–";
-    else {
+    } else {
       let impact = "high";
       if (energyImpact < 1)
         impact = "low";
       else if (energyImpact < 25)
         impact = "medium";
       document.l10n.setAttributes(elt, "energy-impact-" + impact,
                                   {value: energyImpact});
     }
--- a/toolkit/components/contentprefs/ContentPrefService2.jsm
+++ b/toolkit/components/contentprefs/ContentPrefService2.jsm
@@ -883,31 +883,33 @@ ContentPrefService2.prototype = {
   _genericObservers: [],
 
   addObserverForName: function CPS2_addObserverForName(aName, aObserver) {
     var observers;
     if (aName) {
       if (!this._observers[aName])
         this._observers[aName] = [];
       observers = this._observers[aName];
-    } else
+    } else {
       observers = this._genericObservers;
+    }
 
     if (!observers.includes(aObserver))
       observers.push(aObserver);
   },
 
   removeObserverForName: function CPS2_removeObserverForName(aName, aObserver) {
     var observers;
     if (aName) {
       if (!this._observers[aName])
         return;
       observers = this._observers[aName];
-    } else
+    } else {
       observers = this._genericObservers;
+    }
 
     if (observers.includes(aObserver))
       observers.splice(observers.indexOf(aObserver), 1);
   },
 
   /**
    * Construct a list of observers to notify about a change to some setting,
    * putting setting-specific observers before before generic ones, so observers
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -1256,25 +1256,25 @@ var Bookmarks = Object.freeze({
 
     // Even if we ignore any other unneeded property, we still validate any
     // known property to reduce likelihood of hidden bugs.
     let fetchInfo = validateBookmarkObject("Bookmarks.jsm: fetch", info,
                                            behavior);
 
     return (async function() {
       let results;
-      if (fetchInfo.hasOwnProperty("url"))
+      if (fetchInfo.hasOwnProperty("url")) {
         results = await fetchBookmarksByURL(fetchInfo, options && options.concurrent);
-      else if (fetchInfo.hasOwnProperty("guid"))
+      } else if (fetchInfo.hasOwnProperty("guid")) {
         results = await fetchBookmark(fetchInfo, options && options.concurrent);
-      else if (fetchInfo.hasOwnProperty("parentGuid") && fetchInfo.hasOwnProperty("index"))
+      } else if (fetchInfo.hasOwnProperty("parentGuid") && fetchInfo.hasOwnProperty("index")) {
         results = await fetchBookmarkByPosition(fetchInfo, options && options.concurrent);
-      else if (fetchInfo.hasOwnProperty("guidPrefix"))
+      } else if (fetchInfo.hasOwnProperty("guidPrefix")) {
         results = await fetchBookmarksByGUIDPrefix(fetchInfo, options && options.concurrent);
-      else if (fetchInfo.hasOwnProperty("tags")) {
+      } else if (fetchInfo.hasOwnProperty("tags")) {
         results = await fetchBookmarksByTags(fetchInfo, options && options.concurrent);
       }
 
       if (!results)
         return null;
 
       if (!Array.isArray(results))
         results = [results];
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1064,19 +1064,19 @@ var PlacesUtils = {
         // data in this type has 2 parts per entry, so if there are fewer
         // than 2 parts left, the blob is malformed and we should stop
         // but drag and drop of files from the shell has parts.length = 1
         if (parts.length != 1 && parts.length % 2)
           break;
         for (let i = 0; i < parts.length; i = i + 2) {
           let uriString = parts[i];
           let titleString = "";
-          if (parts.length > i + 1)
+          if (parts.length > i + 1) {
             titleString = parts[i + 1];
-          else {
+          } else {
             // for drag and drop of files, try to use the leafName as title
             try {
               titleString = Services.io.newURI(uriString).QueryInterface(Ci.nsIURL)
                                 .fileName;
             } catch (ex) {}
           }
           // note:  Services.io.newURI() will throw if uriString is not a valid URI
           if (Services.io.newURI(uriString)) {
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -101,20 +101,20 @@ async function task_populateDB(aArray) {
           annotations: new Map([[
             qdata.annoName,
             qdata.removeAnnotation ? null : qdata.annoVal,
           ]]),
         });
       }
 
       if (qdata.isItemAnnotation) {
-        if (qdata.removeAnnotation)
+        if (qdata.removeAnnotation) {
           PlacesUtils.annotations.removeItemAnnotation(qdata.itemId,
                                                        qdata.annoName);
-        else {
+        } else {
           PlacesUtils.annotations.setItemAnnotation(qdata.itemId,
                                                     qdata.annoName,
                                                     qdata.annoVal,
                                                     0,
                                                     PlacesUtils.annotations.EXPIRE_NEVER);
         }
       }
 
--- a/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
+++ b/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
@@ -116,17 +116,19 @@ function cartProd(aSequences, aCallback)
       // The rightmost element pointer is past the end of its sequence.
       if (seqEltPtrs[seqPtr] >= aSequences[seqPtr].length) {
         seqEltPtrs[seqPtr] = 0;
         seqPtr--;
 
         // All element pointers are past the ends of their sequences.
         if (seqPtr < 0)
           done = true;
-      } else break;
+      } else {
+        break;
+      }
     }
   }
   return numProds;
 }
 
 /**
  * Test a query based on passed-in options.
  *
@@ -166,18 +168,19 @@ function test_query_callback(aSequence) 
   var root = result.root;
   root.containerOpen = true;
 
   if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY ||
       resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY) {
     // Date containers are always sorted by date descending.
     check_children_sorting(root,
                            Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
-  } else
+  } else {
     check_children_sorting(root, sortingMode.value);
+  }
 
   // Now Check sorting of the first child container.
   var container = root.getChild(0)
                       .QueryInterface(Ci.nsINavHistoryContainerResultNode);
   container.containerOpen = true;
 
   if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY) {
     // Has more than one level of containers, first we check the sorting of
@@ -193,18 +196,19 @@ function test_query_callback(aSequence) 
     check_children_sorting(innerContainer,
                            Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING);
     innerContainer.containerOpen = false;
   } else if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT) {
     // Sorting mode for tag contents is hardcoded for now, to allow for faster
     // duplicates filtering.
     check_children_sorting(container,
                            Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
-  } else
+  } else {
     check_children_sorting(container, sortingMode.value);
+  }
 
   container.containerOpen = false;
   root.containerOpen = false;
 
   test_result_sortingMode_change(result, resultType, sortingMode);
 }
 
 /**
@@ -236,18 +240,19 @@ function test_result_sortingMode_change(
       check_children_sorting(root,
                              Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
     } else if (aResultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY &&
              (aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING ||
               aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
       // Site containers don't have a good time property to sort by.
       check_children_sorting(root,
                              Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
-    } else
+    } else {
       check_children_sorting(root, aOriginalSortingMode.value);
+    }
 
     // Now Check sorting of the first child container.
     var container = root.getChild(0)
                         .QueryInterface(Ci.nsINavHistoryContainerResultNode);
     container.containerOpen = true;
 
     if (aResultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY) {
       // Has more than one level of containers, first we check the sorting of
@@ -267,18 +272,19 @@ function test_result_sortingMode_change(
           aResultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY) {
         // Date containers are always sorted by date descending.
         check_children_sorting(root, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
       } else if (aResultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY &&
              (aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING ||
               aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
         // Site containers don't have a good time property to sort by.
         check_children_sorting(root, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
-      } else
+      } else {
         check_children_sorting(root, aOriginalSortingMode.value);
+      }
 
       // Children should always be sorted.
       check_children_sorting(container, aForcedSortingMode.value);
     }
 
     container.containerOpen = false;
     root.containerOpen = false;
   });
--- a/toolkit/components/places/tests/queries/test_querySerialization.js
+++ b/toolkit/components/places/tests/queries/test_querySerialization.js
@@ -499,17 +499,19 @@ function cartProd(aSequences, aCallback)
       // The rightmost element pointer is past the end of its sequence.
       if (seqEltPtrs[seqPtr] >= aSequences[seqPtr].length) {
         seqEltPtrs[seqPtr] = 0;
         seqPtr--;
 
         // All element pointers are past the ends of their sequences.
         if (seqPtr < 0)
           done = true;
-      } else break;
+      } else {
+        break;
+      }
     }
   }
   return numProds;
 }
 
 /**
  * Enumerates all the subsets in aSet of size aHowMany.  There are
  * C(aSet.length, aHowMany) such subsets.  aCallback will be passed each subset
@@ -556,19 +558,19 @@ function choose(aSet, aHowMany, aCallbac
       let si = aSet.length - 2; // aSet index
       let pi = ptrs.length - 2; // ptrs index
       while (pi >= 0 && ptrs[pi] === si) {
         pi--;
         si--;
       }
 
       // All pointers are adjacent and clustered all the way to the right.
-      if (pi < 0)
+      if (pi < 0) {
         done = true;
-      else {
+      } else {
         // pi = index of rightmost pointer with a gap between it and its
         // succeeding pointer.  Move it right and reset all succeeding pointers
         // so that they're adjacent to it.
         ptrs[pi]++;
         for (let i = 0; i < ptrs.length - pi - 1; i++) {
           ptrs[i + pi + 1] = ptrs[pi] + i + 1;
         }
       }
@@ -589,22 +591,24 @@ function choose(aSet, aHowMany, aCallbac
  */
 function flagSwitchMatches(aQuery1, aQuery2) {
   if (aQuery1[this.flag] && aQuery2[this.flag]) {
     for (let p in this.subswitches) {
       if (p in aQuery1 && p in aQuery2) {
         if (aQuery1[p] instanceof Ci.nsIURI) {
           if (!aQuery1[p].equals(aQuery2[p]))
             return false;
-        } else if (aQuery1[p] !== aQuery2[p])
+        } else if (aQuery1[p] !== aQuery2[p]) {
           return false;
+        }
       }
     }
-  } else if (aQuery1[this.flag] || aQuery2[this.flag])
+  } else if (aQuery1[this.flag] || aQuery2[this.flag]) {
     return false;
+  }
 
   return true;
 }
 
 /**
  * Tests if aObj1 and aObj2 are equal.  This function is general and may be used
  * for either nsINavHistoryQuery or nsINavHistoryQueryOptions objects.  aSwitches
  * determines which set of switches is used for comparison.  Pass in either
--- a/toolkit/components/places/tests/queries/test_redirects.js
+++ b/toolkit/components/places/tests/queries/test_redirects.js
@@ -164,17 +164,19 @@ function cartProd(aSequences, aCallback)
       // The rightmost element pointer is past the end of its sequence.
       if (seqEltPtrs[seqPtr] >= aSequences[seqPtr].length) {
         seqEltPtrs[seqPtr] = 0;
         seqPtr--;
 
         // All element pointers are past the ends of their sequences.
         if (seqPtr < 0)
           done = true;
-      } else break;
+      } else {
+        break;
+      }
     }
   }
   return numProds;
 }
 
 /**
  * Populate the visits array and add visits to the database.
  * We will generate visit-chains like:
--- a/toolkit/components/places/tests/unit/test_000_frecency.js
+++ b/toolkit/components/places/tests/unit/test_000_frecency.js
@@ -102,30 +102,32 @@ async function task_initializeBucket(buc
         if (visitType == Ci.nsINavHistoryService.TRANSITION_EMBED ||
             visitType == Ci.nsINavHistoryService.TRANSITION_FRAMED_LINK ||
             visitType == Ci.nsINavHistoryService.TRANSITION_DOWNLOAD ||
             visitType == Ci.nsINavHistoryService.TRANSITION_RELOAD ||
             bonusName == "defaultVisitBonus")
           frecency = 0;
         else
           frecency = -1;
-      } else
+      } else {
         frecency = points;
+      }
       calculatedURI = uri("http://" + searchTerm + ".com/" +
         bonusName + ":" + bonusValue + "/cutoff:" + cutoff +
         "/weight:" + weight + "/frecency:" + frecency);
       if (visitType == Ci.nsINavHistoryService.TRANSITION_BOOKMARK) {
         matchTitle = searchTerm + "Bookmarked";
         await PlacesUtils.bookmarks.insert({
           parentGuid: PlacesUtils.bookmarks.unfiledGuid,
           url: calculatedURI,
           title: matchTitle,
         });
-      } else
+      } else {
         matchTitle = calculatedURI.spec.substr(calculatedURI.spec.lastIndexOf("/") + 1);
+      }
       await PlacesTestUtils.addVisits({
         uri: calculatedURI,
         transition: visitType,
         visitDate: dateInPeriod,
       });
     }
 
     if (calculatedURI && frecency) {
--- a/toolkit/components/places/tests/unit/test_markpageas.js
+++ b/toolkit/components/places/tests/unit/test_markpageas.js
@@ -27,21 +27,21 @@ add_task(async function test_execute() {
         PlacesObservers.removeListener(["page-visited"], listener);
       }
     }
     PlacesObservers.addListener(["page-visited"], listener);
   });
 
 
   for (var visit of gVisits) {
-    if (visit.transition == TRANSITION_TYPED)
+    if (visit.transition == TRANSITION_TYPED) {
       PlacesUtils.history.markPageAsTyped(uri(visit.url));
-    else if (visit.transition == TRANSITION_BOOKMARK)
+    } else if (visit.transition == TRANSITION_BOOKMARK) {
       PlacesUtils.history.markPageAsFollowedBookmark(uri(visit.url));
-    else {
+    } else {
      // because it is a top level visit with no referrer,
      // it will result in TRANSITION_LINK
     }
     await PlacesTestUtils.addVisits({
       uri: uri(visit.url),
       transition: visit.transition,
     });
   }
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -1080,18 +1080,19 @@ EngineURL.prototype = {
     for (let i = 0; i < aJson.params.length; ++i) {
       let param = aJson.params[i];
       if (param.mozparam) {
         if (param.condition == "pref") {
           let value = getMozParamPref(param.pref);
           this.addParam(param.name, value);
         }
         this._addMozParam(param);
-      } else
+      } else {
         this.addParam(param.name, param.value, param.purpose || undefined);
+      }
     }
   },
 
   /**
    * Creates a JavaScript object that represents this URL.
    * @returns An object suitable for serialization as JSON.
    **/
   toJSON: function SRCH_EURL_toJSON() {
@@ -1143,19 +1144,20 @@ function Engine(aLocation, aIsReadOnly) 
       case "resource":
       case "chrome":
         uri = aLocation;
         break;
       default:
         ERROR("Invalid URI passed to the nsISearchEngine constructor",
               Cr.NS_ERROR_INVALID_ARG);
     }
-  } else
+  } else {
     ERROR("Engine location is neither a File nor a URI object",
           Cr.NS_ERROR_INVALID_ARG);
+  }
 
   if (!this._shortName) {
     // If we don't have a shortName at this point, it's the first time we load
     // this engine, so let's generate the shortName, id and loadPath values.
     let shortName;
     if (file) {
       shortName = file.leafName;
     } else if (uri && uri instanceof Ci.nsIURL) {
@@ -3994,23 +3996,23 @@ SearchService.prototype = {
       result.name = "NONE";
     } else {
       if (engine.name)
         result.name = engine.name;
 
       result.loadPath = engine._loadPath;
 
       let origin;
-      if (engine._isDefault)
+      if (engine._isDefault) {
         origin = "default";
-      else {
+      } else {
         let currentHash = engine.getAttr("loadPathHash");
-        if (!currentHash)
+        if (!currentHash) {
           origin = "unverified";
-        else {
+        } else {
           let loadPathHash = getVerificationHash(engine._loadPath);
           origin = currentHash == loadPathHash ? "verified" : "invalid";
         }
       }
       result.origin = origin;
 
       // For privacy, we only collect the submission URL for default engines...
       let sendSubmissionURL = engine._isDefault;
@@ -4475,18 +4477,19 @@ var engineUpdateService = {
         ULOG("Invalid scheme for default engine update");
         return;
       }
 
       ULOG("updating " + engine.name + " from " + updateURI.spec);
       testEngine = new Engine(updateURI, false);
       testEngine._engineToUpdate = engine;
       testEngine._initFromURIAndLoad(updateURI);
-    } else
+    } else {
       ULOG("invalid updateURI");
+    }
 
     if (engine._iconUpdateURL) {
       // If we're updating the engine too, use the new engine object,
       // otherwise use the existing engine object.
       (testEngine || engine)._setIcon(engine._iconUpdateURL, true);
     }
   },
 };
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -1034,18 +1034,19 @@ Serializer.prototype = {
     // all other elements
 
     let hasText = false;
     for (let child of elem.childNodes) {
       if (child.nodeType == Node.TEXT_NODE) {
         let text = this._nodeText(child);
         this._appendText(text);
         hasText = hasText || !!text.trim();
-      } else if (child.nodeType == Node.ELEMENT_NODE)
+      } else if (child.nodeType == Node.ELEMENT_NODE) {
         this._serializeElement(child);
+      }
     }
 
     // For headings, draw a "line" underneath them so they stand out.
     if (/^h[0-9]+$/.test(elem.localName)) {
       let headerText = (this._currentLine || "").trim();
       if (headerText) {
         this._startNewLine();
         this._appendText("-".repeat(headerText.length));
--- a/toolkit/content/preferencesBindings.js
+++ b/toolkit/content/preferencesBindings.js
@@ -314,18 +314,19 @@ const Preferences = window.Preferences =
           window.opener.Preferences &&
           Services.scriptSecurityManager.isSystemPrincipal(window.opener.document.nodePrincipal)) {
         // Try to find the preference in the parent window.
         const preference = window.opener.Preferences.get(this.name);
 
         // Don't use the value setter here, we don't want updateElements to be
         // prematurely fired.
         this._value = preference ? preference.value : this.valueFromPreferences;
-      } else
+      } else {
         this._value = this.valueFromPreferences;
+      }
     }
 
     reset() {
       // defer reset until preference update
       this.value = undefined;
     }
 
     _reportUnknownType() {
@@ -380,26 +381,27 @@ const Preferences = window.Preferences =
             element.setAttribute(attribute, "true");
           } else {
             element.removeAttribute(attribute);
           }
         } else {
           element.setAttribute(attribute, value);
         }
       }
-      if (aElement.localName == "checkbox")
+      if (aElement.localName == "checkbox") {
         setValue(aElement, "checked", val);
-      else if (aElement.localName == "textbox") {
+      } else if (aElement.localName == "textbox") {
         // XXXmano Bug 303998: Avoid a caret placement issue if either the
         // preference observer or its setter calls updateElements as a result
         // of the input event handler.
         if (aElement.value !== val)
           setValue(aElement, "value", val);
-      } else
+      } else {
         setValue(aElement, "value", val);
+      }
     }
 
     getElementValue(aElement) {
       if (aElement.hasAttribute("onsynctopreference")) {
         // Value changed, synthesize an event
         try {
           const event = document.createEvent("Events");
           event.initEvent("synctopreference", true, true);
@@ -604,18 +606,19 @@ const Preferences = window.Preferences =
         break;
       case "file": {
         let lf;
         if (typeof(val) == "string") {
           lf = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
           lf.persistentDescriptor = val;
           if (!lf.exists())
             lf.initWithPath(val);
-        } else
+        } else {
           lf = val.QueryInterface(Ci.nsIFile);
+        }
         Services.prefs
             .setComplexValue(this.name, Ci.nsIFile, lf);
         break;
       }
       default:
         this._reportUnknownType();
       }
       if (!this.batching) {
--- a/toolkit/content/tests/widgets/test_videocontrols_standalone.html
+++ b/toolkit/content/tests/widgets/test_videocontrols_standalone.html
@@ -22,19 +22,19 @@ function getMediaElement(aWindow) {
 }
 
 var popup = window.open("seek_with_sound.ogg");
 popup.addEventListener("load", function() {
   var video = getMediaElement(popup);
 
   is(popup.document.activeElement, video, "Document should load with focus moved to the video element.");
 
-  if (!video.paused)
+  if (!video.paused) {
     runTestVideo(video);
-  else {
+  } else {
     video.addEventListener("play", function() {
       runTestVideo(video);
     }, {once: true});
   }
 }, {once: true});
 
 function runTestVideo(aVideo) {
   var condition = function() {
@@ -53,19 +53,19 @@ function runTestVideo(aVideo) {
 
 function runTestAudioPre() {
   popup = window.open("audio.ogg");
   popup.addEventListener("load", function() {
     var audio = getMediaElement(popup);
 
     is(popup.document.activeElement, audio, "Document should load with focus moved to the video element.");
 
-    if (!audio.paused)
+    if (!audio.paused) {
       runTestAudio(audio);
-    else {
+    } else {
       audio.addEventListener("play", function() {
         runTestAudio(audio);
       }, {once: true});
     }
   }, {once: true});
 }
 
 function runTestAudio(aAudio) {
--- a/toolkit/content/widgets/menulist.js
+++ b/toolkit/content/widgets/menulist.js
@@ -105,19 +105,19 @@ class MozMenuList extends MenuBaseContro
     if (val == null)
       return this.selectedItem = val;
 
     var arr = null;
     var popup = this.menupopup;
     if (popup)
       arr = popup.getElementsByAttribute("value", val);
 
-    if (arr && arr.item(0))
+    if (arr && arr.item(0)) {
       this.selectedItem = arr[0];
-    else {
+    } else {
       this.selectedItem = null;
       this.setAttribute("value", val);
     }
 
     return val;
   }
 
   // nsIDOMXULSelectControlElement
@@ -184,18 +184,19 @@ class MozMenuList extends MenuBaseContro
   }
 
   // nsIDOMXULSelectControlElement
   set selectedIndex(val) {
     var popup = this.menupopup;
     if (popup && 0 <= val) {
       if (val < popup.children.length)
         this.selectedItem = popup.children[val];
-    } else
+    } else {
       this.selectedItem = null;
+    }
     return val;
   }
 
   // nsIDOMXULSelectControlElement
   get selectedIndex() {
     // Quick and dirty. We won't deal with hierarchical menulists yet.
     if (!this.selectedItem ||
       !this.mSelectedInternal.parentNode ||
--- a/toolkit/content/widgets/tree.js
+++ b/toolkit/content/widgets/tree.js
@@ -439,18 +439,19 @@
             col.parentNode.parentNode._reorderColumn(col, col.mTargetCol, before);
           }
 
           // repaint to remove lines
           col.parentNode.parentNode.invalidate();
 
           col.mTargetCol = null;
         }
-      } else
+      } else {
         col.mDragGesturing = false;
+      }
 
       document.treecolDragging = null;
       col.removeAttribute("dragging");
 
       window.removeEventListener("mousemove", col._onDragMouseMove, true);
       window.removeEventListener("mouseup", col._onDragMouseUp, true);
       // we have to wait for the click event to fire before removing
       // cancelling handler
--- a/toolkit/modules/InlineSpellChecker.jsm
+++ b/toolkit/modules/InlineSpellChecker.jsm
@@ -284,19 +284,18 @@ InlineSpellChecker.prototype = {
   addToDictionary() {
     // Prevent the undo stack from growing over the max depth
     if (this.mAddedWordStack.length == MAX_UNDO_STACK_DEPTH)
       this.mAddedWordStack.shift();
 
     this.mAddedWordStack.push(this.mMisspelling);
     if (this.mRemote)
       this.mRemote.addToDictionary();
-    else {
+    else
       this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling);
-    }
   },
   // callback for removing the last added word to the dictionary LIFO fashion
   undoAddToDictionary() {
     if (this.mAddedWordStack.length > 0) {
       var word = this.mAddedWordStack.pop();
       if (this.mRemote)
         this.mRemote.undoAddToDictionary(word);
       else
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -870,18 +870,19 @@ PopupNotifications.prototype = {
               uri = n.options.displayURI.spec;
             }
           }
           popupnotification.setAttribute("origin", uri);
         } catch (e) {
           Cu.reportError(e);
           popupnotification.removeAttribute("origin");
         }
-      } else
+      } else {
         popupnotification.removeAttribute("origin");
+      }
 
       if (n.options.hideClose)
         popupnotification.setAttribute("closebuttonhidden", "true");
 
       popupnotification.notification = n;
       let menuitems = [];
 
       if (n.mainAction && n.secondaryActions && n.secondaryActions.length > 0) {
--- a/toolkit/modules/Preferences.jsm
+++ b/toolkit/modules/Preferences.jsm
@@ -17,18 +17,19 @@ function Preferences(args) {
   this._cachedPrefBranch = null;
   if (isObject(args)) {
     if (args.branch)
       this._branchStr = args.branch;
     if (args.defaultBranch)
       this._defaultBranch = args.defaultBranch;
     if (args.privacyContext)
       this._privacyContext = args.privacyContext;
-  } else if (args)
+  } else if (args) {
     this._branchStr = args;
+  }
 }
 
 /**
  * Get the value of a pref, if any; otherwise return the default value.
  *
  * @param   prefName  {String|Array}
  *          the pref to get, or an array of prefs to get
  *
@@ -401,18 +402,19 @@ PrefObserver.prototype = {
 
     if (typeof this.callback == "function") {
       let prefValue = Preferences.get(this.prefName);
 
       if (this.thisObject)
         this.callback.call(this.thisObject, prefValue);
       else
         this.callback(prefValue);
-    } else // typeof this.callback == "object" (nsIObserver)
+    } else { // typeof this.callback == "object" (nsIObserver)
       this.callback.observe(subject, topic, data);
+    }
   },
 };
 
 function isObject(val) {
   // We can't check for |val.constructor == Object| here, since the value
   // might be from a different context whose Object constructor is not the same
   // as ours, so instead we match based on the name of the constructor.
   return (typeof val != "undefined" && val != null && typeof val == "object" &&
--- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
+++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
@@ -898,18 +898,19 @@ nsUnknownContentTypeDialog.prototype = {
         */
 
         // see @notify
         // we cannot use opener's setTimeout, see bug 420405
         this._saveToDiskTimer = Cc["@mozilla.org/timer;1"]
                                   .createInstance(nsITimer);
         this._saveToDiskTimer.initWithCallback(this, 0,
                                                nsITimer.TYPE_ONE_SHOT);
-      } else
+      } else {
         this.mLauncher.launchWithApplication(null, false);
+      }
 
       // Update user pref for this mime type (if necessary). We do not
       // store anything in the mime type preferences for the ambiguous
       // type application/octet-stream. We do NOT do this for
       // application/x-msdownload since we want users to be able to
       // autodownload these to disk.
       if (needUpdate && this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream")
         this.updateHelperAppPref();
--- a/toolkit/mozapps/extensions/Blocklist.jsm
+++ b/toolkit/mozapps/extensions/Blocklist.jsm
@@ -1364,19 +1364,19 @@ var Blocklist = {
       Some tests run without UI, so the async code listens to a message
       that can be sent programatically
     */
     let applyBlocklistChanges = () => {
       for (let addon of addonList) {
         if (!addon.disable)
           continue;
 
-        if (addon.item instanceof Ci.nsIPluginTag)
+        if (addon.item instanceof Ci.nsIPluginTag) {
           addon.item.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
-        else {
+        } else {
           // This add-on is softblocked.
           addon.item.softDisabled = true;
           // We must revert certain prefs.
           let prefs = this._getAddonPrefs(addon.item);
           resetPrefs(prefs);
         }
       }
 
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -2125,19 +2125,20 @@ var DownloadAddonInstall = class extends
     XPIInstall.installs.delete(this);
     this._callInstallListeners("onDownloadFailed");
 
     // If the listener hasn't restarted the download then remove any temporary
     // file
     if (this.state == AddonManager.STATE_DOWNLOAD_FAILED) {
       logger.debug("downloadFailed: removing temp file for " + this.sourceURI.spec);
       this.removeTemporaryFile();
-    } else
+    } else {
       logger.debug("downloadFailed: listener changed AddonInstall state for " +
           this.sourceURI.spec + " to " + this.state);
+    }
   }
 
   /**
    * Notify listeners that the download completed.
    */
   async downloadCompleted() {
     let aAddon = await XPIDatabase.getVisibleAddonForID(this.addon.id);
     if (aAddon)
@@ -2477,18 +2478,19 @@ UpdateChecker.prototype = {
           continue;
 
         // If the existing install has not yet started downloading then send an
         // available update notification. If it is already downloading then
         // don't send any available update notification
         if (currentInstall.state == AddonManager.STATE_AVAILABLE) {
           logger.debug("Found an existing AddonInstall for " + this.addon.id);
           sendUpdateAvailableMessages(this, currentInstall);
-        } else
+        } else {
           sendUpdateAvailableMessages(this, null);
+        }
         return;
       }
 
       createUpdate(aInstall => {
         sendUpdateAvailableMessages(this, aInstall);
       }, this.addon, update, this.isUserRequested);
     } else {
       sendUpdateAvailableMessages(this, null);
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1217,19 +1217,19 @@ MockInstall.prototype = {
           this.state = AddonManager.STATE_CANCELLED;
           this.callListeners("onDownloadCancelled");
           return;
         }
 
         this.type = this._type;
 
         // Adding addon to MockProvider to be implemented when needed
-        if (this._addonToInstall)
+        if (this._addonToInstall) {
           this.addon = this._addonToInstall;
-        else {
+        } else {
           this.addon = new MockAddon("", this.name, this.type);
           this.addon.version = this.version;
           this.addon.pendingOperations = AddonManager.PENDING_INSTALL;
         }
         this.addon.install = this;
         if (this.existingAddon) {
           if (!this.addon.id)
             this.addon.id = this.existingAddon.id;
--- a/toolkit/mozapps/handling/content/dialog.js
+++ b/toolkit/mozapps/handling/content/dialog.js
@@ -263,18 +263,19 @@ var dialog = {
   onAccept: function onAccept() {
     var checkbox = document.getElementById("remember");
     if (!checkbox.hidden) {
       // We need to make sure that the default is properly set now
       if (this.selectedItem.obj) {
         // default OS handler doesn't have this property
         this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;
         this._handlerInfo.preferredApplicationHandler = this.selectedItem.obj;
-      } else
+      } else {
         this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useSystemDefault;
+      }
     }
     this._handlerInfo.alwaysAskBeforeHandling = !checkbox.checked;
 
     var hs = Cc["@mozilla.org/uriloader/handler-service;1"].
              getService(Ci.nsIHandlerService);
     hs.store(this._handlerInfo);
 
     this._handlerInfo.launchWithURI(this._URI, this._windowCtxt);
--- a/toolkit/mozapps/preferences/fontbuilder.js
+++ b/toolkit/mozapps/preferences/fontbuilder.js
@@ -22,19 +22,19 @@ var FontBuilder = {
     // Remove the original <menupopup>
     if (aMenuList.menupopup) {
       aMenuList.menupopup.remove();
     }
 
     let defaultFont = null;
     // Load Font Lists
     let fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, aFontType);
-    if (fonts.length > 0)
+    if (fonts.length > 0) {
       defaultFont = this.enumerator.getDefaultFont(aLanguage, aFontType);
-    else {
+    } else {
       fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, "");
       if (fonts.length > 0)
         defaultFont = this.enumerator.getDefaultFont(aLanguage, "");
     }
 
     if (!this._allFonts)
       this._allFonts = await this.enumerator.EnumerateAllFontsAsync({});
 
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -859,19 +859,19 @@ var gDownloadingPage = {
       this._updateApplyingObserver = false;
     }
   },
 
   /**
    * When the user clicks the Pause/Resume button
    */
   onPause() {
-    if (this._paused)
+    if (this._paused) {
       gAUS.downloadUpdate(gUpdates.update, false);
-    else {
+    } else {
       var patch = gUpdates.update.selectedPatch;
       patch.QueryInterface(Ci.nsIWritablePropertyBag);
       patch.setProperty("status", this._pausedStatus);
       gAUS.pauseDownload();
     }
     this._paused = !this._paused;
 
     // Update the UI
--- a/tools/lint/docs/linters/eslint-plugin-mozilla.rst
+++ b/tools/lint/docs/linters/eslint-plugin-mozilla.rst
@@ -62,16 +62,22 @@ Rejects using element.parentNode.removeC
 can be used instead.
 
 balanced-listeners
 ------------------
 
 Checks that for every occurrence of 'addEventListener' or 'on' there is an
 occurrence of 'removeEventListener' or 'off' with the same event name.
 
+consistent-if-bracing
+---------------------
+
+Checks that if/elseif/else bodies are braced consistently, so either all bodies
+are braced or unbraced. Doesn't enforce either of those styles though.
+
 import-browser-window-globals
 -----------------------------
 
 For scripts included in browser-window, this will automatically inject the
 browser-window global scopes into the file.
 
 import-content-task-globals
 ---------------------------
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -163,16 +163,17 @@ module.exports = {
     // Don't enforce the maximum depth that blocks can be nested. The complexity
     // rule is a better rule to check this.
     "max-depth": "off",
 
     // Maximum depth callbacks can be nested.
     "max-nested-callbacks": ["error", 10],
 
     "mozilla/avoid-removeChild": "error",
+    "mozilla/consistent-if-bracing": "error",
     "mozilla/import-browser-window-globals": "error",
     "mozilla/import-globals": "error",
     "mozilla/no-compare-against-boolean-literals": "error",
     "mozilla/no-define-cc-etc": "error",
     "mozilla/no-useless-parameters": "error",
     "mozilla/no-useless-removeEventListener": "error",
     "mozilla/reject-importGlobalProperties": ["error", "allownonwebidl"],
     "mozilla/rejects-requires-await": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
@@ -29,16 +29,17 @@ module.exports = {
   },
   processors: {
     ".xml": require("../lib/processors/xbl-bindings"),
   },
   rules: {
     "avoid-Date-timing": require("../lib/rules/avoid-Date-timing"),
     "avoid-removeChild": require("../lib/rules/avoid-removeChild"),
     "balanced-listeners": require("../lib/rules/balanced-listeners"),
+    "consistent-if-bracing": require("../lib/rules/consistent-if-bracing"),
     "import-browser-window-globals":
       require("../lib/rules/import-browser-window-globals"),
     "import-content-task-globals":
       require("../lib/rules/import-content-task-globals"),
     "import-globals": require("../lib/rules/import-globals"),
     "import-headjs-globals": require("../lib/rules/import-headjs-globals"),
     "mark-exported-symbols-as-used": require("../lib/rules/mark-exported-symbols-as-used"),
     "mark-test-function-used": require("../lib/rules/mark-test-function-used"),
new file mode 100644
--- /dev/null
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/consistent-if-bracing.js
@@ -0,0 +1,42 @@
+/**
+ * @fileoverview checks if/else if/else bracing is consistent
+ *
+ * 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";
+
+module.exports = {
+  meta: {
+    messages: {
+      consistentIfBracing: "Bracing of if..else bodies should be consistent.",
+    },
+  },
+
+  create(context) {
+    return {
+      IfStatement(node) {
+        if (node.parent.type !== "IfStatement") {
+          let types = new Set();
+          for (let currentNode = node; currentNode; currentNode = currentNode.alternate) {
+            let type = currentNode.consequent.type;
+            types.add(type == "BlockStatement" ? "Block" : "NotBlock");
+            if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") {
+              type = currentNode.alternate.type;
+              types.add(type == "BlockStatement" ? "Block" : "NotBlock");
+              break;
+            }
+          }
+          if (types.size > 1) {
+            context.report({
+              node,
+              messageId: "consistentIfBracing",
+            });
+          }
+        }
+      },
+    };
+  },
+};
--- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "1.1.1",
+  "version": "1.1.2",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "@babel/code-frame": {
       "version": "7.0.0",
       "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
       "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
       "dev": true,
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "1.1.1",
+  "version": "1.1.2",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],
new file mode 100644
--- /dev/null
+++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js
@@ -0,0 +1,40 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// ------------------------------------------------------------------------------
+// Requirements
+// ------------------------------------------------------------------------------
+
+var rule = require("../lib/rules/consistent-if-bracing");
+var RuleTester = require("eslint/lib/testers/rule-tester");
+
+const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } });
+
+// ------------------------------------------------------------------------------
+// Tests
+// ------------------------------------------------------------------------------
+
+function invalidCode(code) {
+  return {code, errors: [{messageId: "consistentIfBracing"}]};
+}
+
+ruleTester.run("consistent-if-bracing", rule, {
+  valid: [
+    "if (true) {1} else {0}",
+    "if (false) 1; else 0",
+    "if (true) {1} else if (true) {2} else {0}",
+    "if (true) {1} else if (true) {2} else if (true) {3} else {0}",
+  ],
+  invalid: [
+    invalidCode(`if (true) {1} else 0`),
+    invalidCode("if (true) 1; else {0}"),
+    invalidCode("if (true) {1} else if (true) 2; else {0}"),
+    invalidCode("if (true) 1; else if (true) {2} else {0}"),
+    invalidCode("if (true) {1} else if (true) 2; else {0}"),
+    invalidCode("if (true) {1} else if (true) {2} else 0"),
+    invalidCode("if (true) {1} else if (true) {2} else if (true) 3; else {0}"),
+    invalidCode("if (true) {if (true) 1; else {0}} else {0}"),
+  ],
+});