Bug 1244245 - Enable eslint "curly" rule for PSM. r=keeler
authorCykesiopka <cykesiopka.bmo@gmail.com>
Tue, 16 Feb 2016 17:27:49 -0800
changeset 331592 62cb1e729937f049072f5117c1a5f7f9e8d9b310
parent 331591 6d28a05772dbde665c1ef59a0a4efa1011c1f021
child 331593 866193a135f81049116e8181cecafc010f6c61c4
push id11020
push userjolesen@mozilla.com
push dateWed, 17 Feb 2016 18:16:38 +0000
reviewerskeeler
bugs1244245
milestone47.0a1
Bug 1244245 - Enable eslint "curly" rule for PSM. r=keeler Also includes minor cleanup. MozReview-Commit-ID: CHgbTIa3s2O
security/manager/.eslintrc
security/manager/pki/resources/content/certManager.js
security/manager/pki/resources/content/device_manager.js
security/manager/pki/resources/content/downloadcert.js
security/manager/pki/resources/content/exceptionDialog.js
security/manager/pki/resources/content/password.js
security/manager/pki/resources/content/pippki.js
security/manager/pki/resources/content/viewCertDetails.js
security/manager/ssl/tests/mochitest/mixedcontent/mixedContentTest.js
security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
security/manager/ssl/tests/mochitest/stricttransportsecurity/test_stricttransportsecurity.html
security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
security/manager/ssl/tests/unit/test_signed_apps.js
security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js
security/manager/tools/genRootCAHashes.js
security/manager/tools/getHSTSPreloadList.js
--- a/security/manager/.eslintrc
+++ b/security/manager/.eslintrc
@@ -7,16 +7,19 @@
     "arrow-spacing": 2,
 
     // Commas at the end of the line not the start
     "comma-style": 2,
 
     // Functions must always return something or nothing
     "consistent-return": 2,
 
+    // Require braces around blocks that start a new line
+    "curly": [2, "multi-line"],
+
     // Always require a trailing EOL
     "eol-last": 2,
 
     // Require function* name()
     "generator-star-spacing": [2, {"before": false, "after": true}],
 
     // Space after colon not before in property declarations
     "key-spacing": [2, { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
--- a/security/manager/pki/resources/content/certManager.js
+++ b/security/manager/pki/resources/content/certManager.js
@@ -289,18 +289,20 @@ function orphan_enableButtons()
   ];
   enableButtonsForCertTree(orphanTreeView, idList);
 }
 
 function backupCerts()
 {
   getSelectedCerts();
   var numcerts = selected_certs.length;
-  if (!numcerts)
+  if (numcerts == 0) {
     return;
+  }
+
   var bundle = document.getElementById("pippki_bundle");
   var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker);
   fp.init(window,
           bundle.getString("chooseP12BackupFileDialog"),
           nsIFilePicker.modeSave);
   fp.appendFilter(bundle.getString("file_browse_PKCS12_spec"),
                   "*.p12");
   fp.appendFilters(nsIFilePicker.filterAll);
@@ -391,18 +393,19 @@ function exportCerts()
     exportToFile(window, cert);
   }
 }
 
 function deleteCerts()
 {
   getSelectedTreeItems();
   var numcerts = selected_tree_items.length;
-  if (!numcerts)
+  if (numcerts == 0) {
     return;
+  }
 
   var params = Components.classes[nsDialogParamBlock].createInstance(nsIDialogParamBlock);
 
   var selTab = document.getElementById('certMgrTabbox').selectedItem;
   var selTabID = selTab.getAttribute('id');
 
   params.SetNumberStrings(numcerts + 1);
 
--- a/security/manager/pki/resources/content/device_manager.js
+++ b/security/manager/pki/resources/content/device_manager.js
@@ -91,22 +91,20 @@ function RefreshDeviceList()
         try {
           slot = slots.currentItem().QueryInterface(nsIPKCS11Slot);
         } catch (e) { slot = null; }
         // in the ongoing discussion of whether slot names or token names
         // are to be shown, I've gone with token names because NSS will
         // prefer lookup by token name.  However, the token may not be
         // present, so maybe slot names should be listed, while token names
         // are "remembered" for lookup?
-	if (slot != null) {
-          if (slot.tokenName)
-            slotnames[slotnames.length] = slot.tokenName;
-          else
-            slotnames[slotnames.length] = slot.name;
-	}
+        if (slot != null) {
+          slotnames[slotnames.length] = slot.tokenName ? slot.tokenName
+                                                       : slot.name;
+        }
         try {
           slots.next();
         } catch (e) { slots_done = true; }
       }
       AddModule(module.name, slotnames);
     }
     try {
       modules.next();
@@ -194,18 +192,19 @@ function getSelectedItem()
       module_name = cell.getAttribute("label");
       selected_module = secmoddb.findModuleByName(module_name);
     }
   }
 }
 
 function enableButtons()
 {
-  if (skip_enable_buttons)
+  if (skip_enable_buttons) {
     return;
+  }
 
   var login_toggle = "true";
   var logout_toggle = "true";
   var pw_toggle = "true";
   var unload_toggle = "true";
   getSelectedItem();
   if (selected_module) {
     unload_toggle = "false";
@@ -239,19 +238,20 @@ function enableButtons()
   // not implemented
   //thebutton = document.getElementById('change_slotname_button');
   //thebutton.setAttribute("disabled", toggle);
 }
 
 // clear the display of information for the slot
 function ClearInfoList()
 {
-  var info_list = document.getElementById("info_list");
-  while (info_list.firstChild)
-      info_list.removeChild(info_list.firstChild);
+  let infoList = document.getElementById("info_list");
+  while (infoList.hasChildNodes()) {
+    infoList.removeChild(infoList.firstChild);
+  }
 }
 
 function ClearDeviceList()
 {
   ClearInfoList();
 
   skip_enable_buttons = true;
   var tree = document.getElementById('device_tree');
@@ -464,22 +464,22 @@ function doBrowseFiles()
 }
 
 function doLoadDevice()
 {
   var name_box = document.getElementById("device_name");
   var path_box = document.getElementById("device_path");
   try {
     getPKCS11().addModule(name_box.value, path_box.value, 0,0);
-  }
-  catch (e) {
-    if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)
+  } catch (e) {
+    if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
       doPrompt(getNSSString("AddModuleDup"));
-    else
+    } else {
       doPrompt(getNSSString("AddModuleFailure"));
+    }
 
     return false;
   }
   return true;
 }
 
 // -------------------------------------   Old code
 
--- a/security/manager/pki/resources/content/downloadcert.js
+++ b/security/manager/pki/resources/content/downloadcert.js
@@ -27,32 +27,27 @@ function onLoad()
 
 function viewCert()
 {
   viewCertHelper(window, cert);
 }
 
 function doOK()
 {
-  var checkSSL = document.getElementById("trustSSL");
-  var checkEmail = document.getElementById("trustEmail");
-  var checkObjSign = document.getElementById("trustObjSign");
-  if (checkSSL.checked)
-    params.SetInt(2,1);
-  else
-    params.SetInt(2,0);
-  if (checkEmail.checked)
-    params.SetInt(3,1);
-  else
-    params.SetInt(3,0);
-  if (checkObjSign.checked)
-    params.SetInt(4,1);
-  else
-    params.SetInt(4,0);
-  params.SetInt(1,1);
+  let checkSSL = document.getElementById("trustSSL");
+  let checkEmail = document.getElementById("trustEmail");
+  let checkObjSign = document.getElementById("trustObjSign");
+
+  // Signal which trust bits the user wanted to enable.
+  params.SetInt(2, checkSSL.checked ? 1 : 0);
+  params.SetInt(3, checkEmail.checked ? 1 : 0);
+  params.SetInt(4, checkObjSign.checked ? 1 : 0);
+
+  // Signal that the user accepted.
+  params.SetInt(1, 1);
   return true;
 }
 
 function doCancel()
 {
   params.SetInt(1,0);
   return true;
 }
--- a/security/manager/pki/resources/content/exceptionDialog.js
+++ b/security/manager/pki/resources/content/exceptionDialog.js
@@ -19,24 +19,26 @@ Components.utils.import("resource://gre/
 function badCertListener() {}
 badCertListener.prototype = {
   getInterface: function (aIID) {
     return this.QueryInterface(aIID);
   },
   QueryInterface: function(aIID) {
     if (aIID.equals(Components.interfaces.nsIBadCertListener2) ||
         aIID.equals(Components.interfaces.nsIInterfaceRequestor) ||
-        aIID.equals(Components.interfaces.nsISupports))
+        aIID.equals(Components.interfaces.nsISupports)) {
       return this;
+    }
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
   },
   handle_test_result: function () {
-    if (gSSLStatus)
+    if (gSSLStatus) {
       gCert = gSSLStatus.QueryInterface(Components.interfaces.nsISSLStatus).serverCert;
+    }
   },
   notifyCertProblem: function MSR_notifyCertProblem(socketInfo, sslStatus, targetHost) {
     gBroken = true;
     gSSLStatus = sslStatus;
     this.handle_test_result();
     return true; // suppress error UI
   }
 }
@@ -309,18 +311,19 @@ function viewCertButtonClick() {
     viewCertHelper(this, gCert);
   }
 }
 
 /**
  * Handle user request to add an exception for the specified cert
  */
 function addException() {
-  if(!gCert || !gSSLStatus)
+  if (!gCert || !gSSLStatus) {
     return;
+  }
 
   var overrideService = Components.classes["@mozilla.org/security/certoverride;1"]
                                   .getService(Components.interfaces.nsICertOverrideService);
   var flags = 0;
   let confirmBucketId = gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_BASE;
   if (gSSLStatus.isUntrusted) {
     flags |= overrideService.ERROR_UNTRUSTED;
     confirmBucketId += gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_UNTRUSTED;
@@ -331,18 +334,19 @@ function addException() {
   }
   if (gSSLStatus.isNotValidAtThisTime) {
     flags |= overrideService.ERROR_TIME;
     confirmBucketId += gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_TIME;
   }
 
   var permanentCheckbox = document.getElementById("permanent");
   var shouldStorePermanently = permanentCheckbox.checked && !inPrivateBrowsingMode();
-  if(!permanentCheckbox.checked)
-   gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_TOP_DONT_REMEMBER_EXCEPTION);
+  if (!permanentCheckbox.checked) {
+    gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_TOP_DONT_REMEMBER_EXCEPTION);
+  }
 
   gSecHistogram.add(confirmBucketId);
   var uri = getURI();
   overrideService.rememberValidityOverride(
     uri.asciiHost, uri.port,
     gCert,
     flags,
     !shouldStorePermanently);
--- a/security/manager/pki/resources/content/password.js
+++ b/security/manager/pki/resources/content/password.js
@@ -194,19 +194,20 @@ function setPassword()
     token.initPassword(pw1.value);
     if (pw1.value == "") {
       doPrompt(bundle.getString("pw_not_wanted") + " " +
                bundle.getString("pw_empty_warning"));
     }
     success = true;
   }
 
-  if (success && params)
+  if (success && params) {
     // Return value 1 means "successfully executed ok"
     params.SetInt(1, 1);
+  }
 
   // Terminate dialog
   return success;
 }
 
 function setP12Password()
 {
   // grab what was entered
--- a/security/manager/pki/resources/content/pippki.js
+++ b/security/manager/pki/resources/content/pippki.js
@@ -5,30 +5,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * These are helper functions to be included
  * pippki UI js files.
  */
 
 function setText(id, value) {
-  var element = document.getElementById(id);
-  if (!element) return;
-     if (element.hasChildNodes())
-       element.removeChild(element.firstChild);
-  var textNode = document.createTextNode(value);
-  element.appendChild(textNode);
+  let element = document.getElementById(id);
+  if (!element) {
+    return;
+  }
+  if (element.hasChildNodes()) {
+    element.removeChild(element.firstChild);
+  }
+  element.appendChild(document.createTextNode(value));
 }
 
 const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
 const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
 
 function viewCertHelper(parent, cert) {
-  if (!cert)
+  if (!cert) {
     return;
+  }
 
   var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
   cd.viewCert(parent, cert);
 }
 
 function getDERString(cert)
 {
   var length = {};
@@ -103,18 +106,19 @@ function exportToFile(parent, cert)
     return;
   }
 
   var content = '';
   switch (fp.filterIndex) {
     case 1:
       content = getPEMString(cert);
       var chain = cert.getChain();
-      for (var i = 1; i < chain.length; i++)
+      for (let i = 1; i < chain.length; i++) {
         content += getPEMString(chain.queryElementAt(i, Components.interfaces.nsIX509Cert));
+      }
       break;
     case 2:
       content = getDERString(cert);
       break;
     case 3:
       content = getPKCS7String(cert, Components.interfaces.nsIX509Cert.CMS_CHAIN_MODE_CertOnly);
       break;
     case 4:
@@ -151,15 +155,16 @@ function exportToFile(parent, cert)
         msg = bundle.getString("writeFileNoDeviceSpace");
         break;
       default:
         msg = e.message;
         break;
     }
   }
   if (written != content.length) {
-    if (!msg.length)
+    if (msg.length == 0) {
       msg = bundle.getString("writeFileUnknownError");
+    }
     alertPromptService(bundle.getString("writeFileFailure"),
                        bundle.getFormattedString("writeFileFailed",
                        [fp.file.path, msg]));
   }
 }
--- a/security/manager/pki/resources/content/viewCertDetails.js
+++ b/security/manager/pki/resources/content/viewCertDetails.js
@@ -106,18 +106,19 @@ function addTreeItemToTreeChild(treeChil
   var treeElem1 = document.createElement("treeitem");
   if (addTwistie) {
     treeElem1.setAttribute("container","true");
     treeElem1.setAttribute("open","true");
   }
   var treeRow = document.createElement("treerow");
   var treeCell = document.createElement("treecell");
   treeCell.setAttribute("label",label);
-  if (value)
+  if (value) {
     treeCell.setAttribute("display",value);
+  }
   treeRow.appendChild(treeCell);
   treeElem1.appendChild(treeRow);
   treeChild.appendChild(treeElem1);
   return treeElem1;
 }
 
 function displaySelected() {
   var asn1Tree = document.getElementById('prettyDumpTree')
@@ -152,45 +153,49 @@ function addAttributeFromCert(nodeName, 
 
 
 function listener() {
 }
 
 listener.prototype.QueryInterface =
   function(iid) {
     if (iid.equals(Components.interfaces.nsISupports) ||
-        iid.equals(Components.interfaces.nsICertVerificationListener))
-        return this;
+        iid.equals(Components.interfaces.nsICertVerificationListener)) {
+      return this;
+    }
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
   }
 
 listener.prototype.notify =
   function(cert, result) {
     DisplayVerificationData(cert, result);
   }
 
 function DisplayVerificationData(cert, result)
 {
   document.getElementById("verify_pending").setAttribute("hidden", "true");
 
-  if (!result || !cert)
+  if (!result || !cert) {
     return; // no results could be produced
+  }
 
-  if (!(cert instanceof Components.interfaces.nsIX509Cert))
+  if (!(cert instanceof Components.interfaces.nsIX509Cert)) {
     return;
+  }
 
   //  Verification and usage
   var verifystr = "";
   var o1 = {};
   var o2 = {};
   var o3 = {};
 
-  if (!(result instanceof Components.interfaces.nsICertVerificationResult))
+  if (!(result instanceof Components.interfaces.nsICertVerificationResult)) {
     return;
+  }
 
   result.getUsagesArrayResult(o1, o2, o3);
 
   var verifystate = o1.value;
   var count = o2.value;
   var usageList = o3.value;
   if (verifystate == cert.VERIFIED_OK) {
     verifystr = bundle.getString('certVerified');
--- a/security/manager/ssl/tests/mochitest/mixedcontent/mixedContentTest.js
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/mixedContentTest.js
@@ -25,98 +25,78 @@ var testPage = "";
 var testCleanUp = null;
 // Contains mixed active content that needs to load to run the test
 var hasMixedActiveContent = false;
 
 
 // Internal variables
 var _windowCount = 0;
 
-window.onload = function onLoad()
-{
-  if (location.search == "?runtest")
-  {
-    try
-    {
-      if (history.length == 1)
+window.onload = function onLoad() {
+  if (location.search == "?runtest") {
+    try {
+      if (history.length == 1) {
         runTest();
-      else
+      } else {
         afterNavigationTest();
-    }
-    catch (ex)
-    {
+      }
+    } catch (ex) {
       ok(false, "Exception thrown during test: " + ex);
       finish();
     }
-  }
-  else
-  {
+  } else {
     window.addEventListener("message", onMessageReceived, false);
 
-    var secureTestLocation;
-    if (loadAsInsecure)
-      secureTestLocation = "http://example.com";
-    else
-      secureTestLocation = "https://example.com";
+    let secureTestLocation = loadAsInsecure ? "http://example.com"
+                                            : "https://example.com";
     secureTestLocation += location.pathname
-    if (testPage != "")
-    {
+    if (testPage != "") {
       array = secureTestLocation.split("/");
       array.pop();
       array.push(testPage);
       secureTestLocation = array.join("/");
     }
     secureTestLocation += "?runtest";
 
-    if (hasMixedActiveContent)
-    {
+    if (hasMixedActiveContent) {
       SpecialPowers.pushPrefEnv(
         {"set": [["security.mixed_content.block_active_content", false]]},
         null);
     }
-    if (openTwoWindows)
-    {
+    if (openTwoWindows) {
       _windowCount = 2;
       window.open(secureTestLocation, "_new1", "");
       window.open(secureTestLocation, "_new2", "");
-    }
-    else
-    {
+    } else {
       _windowCount = 1;
       window.open(secureTestLocation);
     }
   }
 }
 
 function onMessageReceived(event)
 {
-  switch (event.data)
-  {
+  switch (event.data) {
     // Indication of all test parts finish (from any of the frames)
     case "done":
-      if (--_windowCount == 0)
-      {
-        if (testCleanUp)
+      if (--_windowCount == 0) {
+        if (testCleanUp) {
           testCleanUp();
+        }
         if (hasMixedActiveContent) {
           SpecialPowers.popPrefEnv(null);
         }
 
         SimpleTest.finish();
       }
       break;
 
-    // Any other message indicates error or succes message of a test
+    // Any other message is an error or success message of a test.
     default:
-      var failureRegExp = new RegExp("^FAILURE");
-      var todoRegExp = new RegExp("^TODO");
-      if (event.data.match(todoRegExp))
-        SimpleTest.todo(false, event.data);
-      else
-        SimpleTest.ok(!event.data.match(failureRegExp), event.data);
+      SimpleTest.ok(!event.data.match(/^FAILURE/), event.data);
       break;
   }
 }
 
 function postMsg(message)
 {
   opener.postMessage(message, "http://mochi.test:8888");
 }
@@ -136,72 +116,66 @@ function finish()
   {
     postMsg("done");
     window.close();
   }
 }
 
 function ok(a, message)
 {
-  if (!a)
+  if (!a) {
     postMsg("FAILURE: " + message);
-  else
+  } else {
     postMsg(message);
+  }
 }
 
 function is(a, b, message)
 {
   if (a != b) {
     postMsg(`FAILURE: ${message}, expected ${b} got ${a}`);
   } else {
     postMsg(`${message}, expected ${b} got ${a}`);
   }
 }
 
-function todo(a, message)
-{
-  if (a)
-    postMsg("FAILURE: TODO works? " + message);
-  else
-    postMsg("TODO: " + message);
-}
-
 function isSecurityState(expectedState, message, test)
 {
-  if (!test)
+  if (!test) {
     test = ok;
+  }
 
   // Quit nasty but working :)
   var ui = SpecialPowers.wrap(window)
     .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
     .getInterface(SpecialPowers.Ci.nsIWebNavigation)
     .QueryInterface(SpecialPowers.Ci.nsIDocShell)
     .securityUI;
 
   var isInsecure = !ui ||
     (ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_IS_INSECURE);
   var isBroken = ui &&
     (ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_IS_BROKEN);
   var isEV = ui &&
     (ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL);
 
   var gotState;
-  if (isInsecure)
+  if (isInsecure) {
     gotState = "insecure";
-  else if (isBroken)
+  } else if (isBroken) {
     gotState = "broken";
-  else if (isEV)
+  } else if (isEV) {
     gotState = "EV";
-  else
+  } else {
     gotState = "secure";
+  }
 
   test(gotState == expectedState, (message || "") + ", " + "expected " + expectedState + " got " + gotState);
 
-  switch (expectedState)
-  {
+  switch (expectedState) {
     case "insecure":
       test(isInsecure && !isBroken && !isEV, "for 'insecure' excpected flags [1,0,0], " + (message || ""));
       break;
     case "broken":
       test(ui && !isInsecure && isBroken && !isEV, "for 'broken' expected  flags [0,1,0], " + (message || ""));
       break;
     case "secure":
       test(ui && !isInsecure && !isBroken && !isEV, "for 'secure' expected flags [0,0,0], " + (message || ""));
--- a/security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
@@ -75,19 +75,21 @@
     handlerSvc.remove(handlerInfo);
 
     var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
       .getService(SpecialPowers.Ci.nsIPrefService);
     prefs = prefs.getBranch("browser.download.");
 
     var prefKeys = ["dir", "useDownloadDir", "folderList",
                     "manager.closeWhenDone", "manager.showWhenStarting"];
-    for (var i = 0; i < prefKeys.length; i++)
-      if (prefs.prefHasUserValue(prefKeys[i]))
-        prefs.clearUserPref(prefKeys[i]);
+    for (let prefKey of prefKeys) {
+      if (prefs.prefHasUserValue(prefKey)) {
+        prefs.clearUserPref(prefKey);
+      }
+    }
   }
 
   </script>
 </head>
 
 <body>
 </body>
 </html>
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_stricttransportsecurity.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_stricttransportsecurity.html
@@ -38,18 +38,19 @@
     frame.setAttribute('id', 'ifr_bootstrap');
     frame.setAttribute('src', "https://example.com" + STSPATH + "/" + round + "_bootstrap.html");
     document.body.appendChild(frame);
   }
 
   function endRound(round) {
     // remove all the iframes in the document
     document.body.removeChild(document.getElementById('ifr_bootstrap'));
-    for (var test in testframes)
+    for (let test in testframes) {
       document.body.removeChild(document.getElementById('ifr_' + test));
+    }
 
     // clean up the STS state
     SpecialPowers.cleanUpSTSData("http://example.com");
   }
 
   function loadVerifyFrames(round) {
     for (var test in testframes) {
       var frame = document.createElement("iframe");
@@ -88,20 +89,21 @@
 
     // check if there are more tests to run.
     if (testsleft[round] < 1) {
       // if not, advance to next round
       endRound(round);
       roundsLeft--;
 
       // defer this so it doesn't muck with the stack too much.
-      if (roundsLeft == 1)
+      if (roundsLeft == 1) {
         setTimeout(function () {
           startRound("subdom");
         }, 0);
+      }
     }
 
     if (roundsLeft < 1) {
       SimpleTest.finish();
     }
   }
 
   // listen for calls back from the sts-setting iframe and then
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
@@ -106,18 +106,19 @@
     frame.setAttribute('id', 'ifr_' + testName);
     frame.setAttribute('src', test.url + '?id=' + testName);
     frame.addEventListener("load", function() {
       if (frame.contentDocument.location.protocol === 'https:') {
         onMessageReceived(win, isPrivate, "SECURE " + testName);
       } else {
         onMessageReceived(win, isPrivate, "INSECURE " + testName);
       }
-      if (aCallback)
+      if (aCallback) {
         aCallback();
+      }
     });
     win.content.document.body.appendChild(frame);
   }
 
   /**
    * Messages received are in this format:
    *  (BOOTSTRAP|SECURE|INSECURE) testid
    * For example: "BOOTSTRAP subdom"
@@ -145,23 +146,25 @@
     testsleftinround--;
 
     // if this round is complete...
     if (testsleftinround < 1) {
       SimpleTest.info("DONE WITH ROUND " + currentround);
       // remove all the iframes in the document
       win.content.document.body.removeChild(
         win.content.document.getElementById('ifr_bootstrap'));
-      for (var test in testframes)
+      for (let test in testframes) {
         win.content.document.body.removeChild(
           win.content.document.getElementById('ifr_' + test));
+      }
       currentround = "";
 
-      if (!isPrivate)
+      if (!isPrivate) {
         clean_up_sts_state(isPrivate);
+      }
       // Close test window.
       win.close();
       // And advance to the next test.
       // Defer this so it doesn't muck with the stack too much.
       SimpleTest.executeSoon(nextTest);
     }
   }
 
--- a/security/manager/ssl/tests/unit/test_signed_apps.js
+++ b/security/manager/ssl/tests/unit/test_signed_apps.js
@@ -52,18 +52,19 @@ function tamper(inFilePath, outFilePath,
           if (outEntryInput) {
             try {
               writer.addEntryStream(entryName,
                                     outEntry.lastModifiedTime,
                                     outEntry.compression,
                                     outEntryInput,
                                     false);
             } finally {
-              if (entryInput != outEntryInput)
+              if (entryInput != outEntryInput) {
                 outEntryInput.close();
+              }
             }
           }
         } finally {
           entryInput.close();
         }
       }
     } finally {
       reader.close();
@@ -95,18 +96,19 @@ function tamper(inFilePath, outFilePath,
   } finally {
     writer.close();
   }
 }
 
 function removeEntry(entry, entryInput) { return [null, null]; }
 
 function truncateEntry(entry, entryInput) {
-  if (entryInput.available() == 0)
+  if (entryInput.available() == 0) {
     throw "Truncating already-zero length entry will result in identical entry.";
+  }
 
   var content = Cc["@mozilla.org/io/string-input-stream;1"]
                   .createInstance(Ci.nsIStringInputStream);
   content.data = "";
 
   return [entry, content]
 }
 
--- a/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js
+++ b/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js
@@ -5,18 +5,19 @@
 // continue to use HSTS.
 
 var gSSService = Cc["@mozilla.org/ssservice;1"]
                    .getService(Ci.nsISiteSecurityService);
 
 function Observer() {}
 Observer.prototype = {
   observe: function(subject, topic, data) {
-    if (topic == "last-pb-context-exited")
+    if (topic == "last-pb-context-exited") {
       run_next_test();
+    }
   }
 };
 
 var gObserver = new Observer();
 var sslStatus = new FakeSSLStatus();
 
 function cleanup() {
   Services.obs.removeObserver(gObserver, "last-pb-context-exited");
--- a/security/manager/tools/genRootCAHashes.js
+++ b/security/manager/tools/genRootCAHashes.js
@@ -235,20 +235,21 @@ writeTrustAnchors(trustAnchorsFile);
 
 // Sort all trust anchors before writing, as AccumulateRootCA.cpp
 // will perform binary searches
 gTrustAnchors.roots.sort(function(a, b) {
   // We need to work from the binary values, not the base64 values.
   let aBin = atob(a.sha256Fingerprint);
   let bBin = atob(b.sha256Fingerprint)
 
-  if (aBin < bBin)
-     return -1;
-  else if (aBin > bBin)
-     return 1;
-   else
-     return 0;
+  if (aBin < bBin) {
+    return -1;
+  }
+  if (aBin > bBin) {
+    return 1;
+  }
+  return 0;
 });
 
 // Write the output file.
 var rootHashesFileOutputStream = FileUtils.openSafeFileOutputStream(rootHashesFile);
 writeRootHashes(rootHashesFileOutputStream);
 FileUtils.closeSafeFileOutputStream(rootHashesFileOutputStream);
--- a/security/manager/tools/getHSTSPreloadList.js
+++ b/security/manager/tools/getHSTSPreloadList.js
@@ -299,20 +299,21 @@ function getHSTSStatuses(inHosts, outSta
          host.retries + ")\n");
     getHSTSStatus(host, tmpOutput);
   }
 
   while (outStatuses.length != expectedOutputLength) {
     waitForAResponse(tmpOutput);
     var response = tmpOutput.shift();
     dump("request to '" + response.name + "' finished\n");
-    if (shouldRetry(response))
+    if (shouldRetry(response)) {
       inHosts.push(response);
-    else
+    } else {
       outStatuses.push(response);
+    }
 
     if (inHosts.length > 0) {
       var host = inHosts.shift();
       dump("spinning off request to '" + host.name + "' (remaining retries: " +
            host.retries + ")\n");
       getHSTSStatus(host, tmpOutput);
     }
   }