Bug 1577835 - Rewrite atypical for loops in mailnews/ for Prettier. r=mkmelin
authorPaul Morris <paul@thunderbird.net>
Fri, 30 Aug 2019 22:21:29 -0400
changeset 35712 b53bee47da4e80abed1aaee62358fbeaeed5ee97
parent 35711 5b47088d84e77f42fd810d0c68c9518be20bc6f5
child 35713 77773ecb02ca0f76310211a3d5acc5317cd60083
push id2486
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:24:43 +0000
treeherdercomm-beta@1b30a9a6e7f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1577835
Bug 1577835 - Rewrite atypical for loops in mailnews/ for Prettier. r=mkmelin
mailnews/db/gloda/content/autocomplete-richlistitem.js
mailnews/local/test/unit/test_nsIMsgLocalMailFolder.js
mailnews/news/test/unit/head_server_setup.js
--- a/mailnews/db/gloda/content/autocomplete-richlistitem.js
+++ b/mailnews/db/gloda/content/autocomplete-richlistitem.js
@@ -105,17 +105,17 @@
     }
 
     _getSearchTokens(aSearch) {
       let search = aSearch.toLowerCase();
       return search.split(/\s+/);
     }
 
     _needsAlternateEmphasis(aText) {
-      for (let i = aText.length; --i >= 0;) {
+      for (let i = aText.length - 1; i >= 0; i--) {
         let charCode = aText.charCodeAt(i);
         // Arabic, Syriac, Indic languages are likely to have ligatures
         // that are broken when using the main emphasis styling.
         if (0x0600 <= charCode && charCode <= 0x109f) {
           return true;
         }
       }
 
--- a/mailnews/local/test/unit/test_nsIMsgLocalMailFolder.js
+++ b/mailnews/local/test/unit/test_nsIMsgLocalMailFolder.js
@@ -298,17 +298,18 @@ function run_all_tests(aHostName) {
   let root = server.rootMsgFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
   subtest_folder_operations(root);
   subtest_folder_deletion(root);
   test_store_rename(root);
 }
 
 function run_test() {
   let hostName = "Local Folders";
-  for (let index = 0; index < gPluggableStores.length;) {
+  let index = 0;
+  while (index < gPluggableStores.length) {
     Services.prefs.setCharPref(
       "mail.serverDefaultStoreContractID",
       gPluggableStores[index]
     );
     run_all_tests(hostName);
     hostName += "-" + ++index;
   }
 
--- a/mailnews/news/test/unit/head_server_setup.js
+++ b/mailnews/news/test/unit/head_server_setup.js
@@ -82,17 +82,18 @@ function setupNNTPDaemon() {
     );
     var sstream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
       Ci.nsIScriptableInputStream
     );
     fstream.init(file, -1, 0, 0);
     sstream.init(fstream);
 
     var post = "";
-    for (let part = sstream.read(4096); part.length > 0;) {
+    let part = sstream.read(4096);
+    while (part.length > 0) {
       post += part;
       part = sstream.read(4096);
     }
     sstream.close();
     fstream.close();
     daemon.addArticle(new newsArticle(post));
   });
 
@@ -228,17 +229,18 @@ function make_article(file) {
   );
   var sstream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
     Ci.nsIScriptableInputStream
   );
   fstream.init(file, -1, 0, 0);
   sstream.init(fstream);
 
   var post = "";
-  for (let part = sstream.read(4096); part.length > 0;) {
+  let part = sstream.read(4096);
+  while (part.length > 0) {
     post += part;
     part = sstream.read(4096);
   }
   sstream.close();
   fstream.close();
   return new newsArticle(post);
 }