Bug 1515877 - Turn on ESLint in mailnews/extensions draft
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 08 May 2019 14:20:52 +1200
changeset 73477 03240e408d6702390e63f456110895988c99b77e
parent 73476 3f031bdf4db347e9b0fb7f98d3fd327231cdaa69
child 73478 b9faaabd7de921dd304e5f7efd8a9b02cc98c786
push id8409
push usergeoff@darktrojan.net
push dateWed, 08 May 2019 02:22:29 +0000
treeherdertry-comm-central@f8d9091c9d1c [default view] [failures only]
bugs1515877
Bug 1515877 - Turn on ESLint in mailnews/extensions
.eslintignore
mailnews/extensions/bayesian-spam-filter/test/unit/.eslintrc.js
mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
mailnews/extensions/bayesian-spam-filter/test/unit/resources/trainingfile.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_customTokenization.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_junkAsTraits.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_msgCorpus.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_traitAliases.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_traits.js
mailnews/extensions/dsn/content/am-dsn.js
mailnews/extensions/dsn/src/dsn-service.js
mailnews/extensions/mdn/content/am-mdn.js
mailnews/extensions/mdn/src/mdn-service.js
mailnews/extensions/mdn/test/unit/.eslintrc.js
mailnews/extensions/mdn/test/unit/test_askuser.js
mailnews/extensions/mdn/test/unit/test_mdnFlags.js
mailnews/extensions/offline-startup/js/offlineStartup.js
mailnews/extensions/smime/content/am-smime.js
mailnews/extensions/smime/content/certFetchingStatus.js
mailnews/extensions/smime/content/certpicker.js
mailnews/extensions/smime/content/msgCompSecurityInfo.js
mailnews/extensions/smime/content/msgReadSMIMEOverlay.js
mailnews/extensions/smime/content/msgReadSecurityInfo.js
mailnews/extensions/smime/content/smime.js
mailnews/extensions/smime/src/smime-service.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -56,26 +56,25 @@ editor/ui/dialogs/content/EditorSaveAsCh
 editor/ui/dialogs/content/EdLinkChecker.js
 editor/ui/dialogs/content/EdLinkChecker.xul
 editor/ui/dialogs/content/EdSnapToGrid.js
 editor/ui/dialogs/content/EdSnapToGrid.xul
 editor/ui/texzilla/**
 
 # mailnews exclusions
 mailnews/mailnews.js
+mailnews/extensions/dsn/content/dsn.js
+mailnews/extensions/mdn/content/mdn.js
+mailnews/extensions/smime/content/smime.js
 mailnews/imap/*
 mailnews/import/*
 mailnews/intl/*
 mailnews/jsaccount/*
 mailnews/mime/*
 
-# mailnews/extensions exclusions
-mailnews/extensions/*
-!mailnews/extensions/newsblog
-
 # mail exclusions
 mail/app/profile/all-thunderbird.js
 mail/app/profile/channel-prefs.js
 mail/app/profile/prefs.js
 mail/base/content/protovis-r2.6-modded.js
 mail/branding/nightly/thunderbird-branding.js
 mail/branding/thunderbird/thunderbird-branding.js
 mail/components/im/all-im.js
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/.eslintrc.js
@@ -0,0 +1,14 @@
+"use strict";
+
+module.exports = {
+  "extends": "plugin:mozilla/xpcshell-test",
+
+  "rules": {
+    "func-names": "off",
+    "mozilla/import-headjs-globals": "error",
+    "no-unused-vars": ["error", {
+      "args": "none",
+      "vars": "all",
+    }],
+  },
+};
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
@@ -4,20 +4,17 @@ var {XPCOMUtils} = ChromeUtils.import("r
 var {mailTestUtils} = ChromeUtils.import("resource://testing-common/mailnews/mailTestUtils.js");
 var {localAccountUtils} = ChromeUtils.import("resource://testing-common/mailnews/localAccountUtils.js");
 
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
-var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-function getSpec(aFileName)
-{
+function getSpec(aFileName) {
   var file = do_get_file("resources/" + aFileName);
   var uri = Services.io.newFileURI(file).QueryInterface(Ci.nsIURL);
   uri = uri.mutate().setQuery("type=application/x-message-display").finalize();
   return uri.spec;
 }
 
 registerCleanupFunction(function() {
   load("../../../../resources/mailShutdown.js");
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/resources/trainingfile.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/resources/trainingfile.js
@@ -2,49 +2,47 @@
  * 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/. */
 
 // service class to manipulate the junk training.dat file
 //  code is adapted from Mnehy Thunderbird Extension
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
+/* exported TrainingData */
 function TrainingData() {
-
   // local constants
 
   const CC = Components.Constructor;
 
   // public methods
 
   this.read = read;
 
   // public variables
 
   this.mGoodTokens = 0;
   this.mJunkTokens = 0;
   this.mGoodMessages = 0;
   this.mJunkMessages = 0;
-  this.mGoodCounts = new Object;
-  this.mJunkCounts = new Object;
+  this.mGoodCounts = {};
+  this.mJunkCounts = {};
 
   // helper functions
 
   function getJunkStatFile() {
     var sBaseDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
     var CFileByFile = new CC("@mozilla.org/file/local;1", "nsIFile", "initWithFile");
     var oFile = new CFileByFile(sBaseDir);
     oFile.append("training.dat");
     return oFile;
   }
 
   function getBinStream(oFile) {
-
-    if (oFile && oFile.exists())
-    {
+    if (oFile && oFile.exists()) {
       var oUri = Services.io.newFileURI(oFile);
       // open stream (channel)
       let channel = Services.io.newChannelFromURI(oUri,
                                                   null,
                                                   Services.scriptSecurityManager.getSystemPrincipal(),
                                                   null,
                                                   Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                                   Ci.nsIContentPolicy.TYPE_OTHER);
@@ -79,27 +77,25 @@ function TrainingData() {
 
     // get ham'n'spam numbers
     this.mGoodMessages = fileStream.read32();
     this.mJunkMessages = fileStream.read32();
 
     // Read good tokens
     this.mGoodTokens = fileStream.read32();
     var iRefCount, iTokenLen, sToken;
-    for (var i = 0; i < this.mGoodTokens; ++i)
-    {
+    for (let i = 0; i < this.mGoodTokens; ++i) {
       iRefCount  = fileStream.read32();
       iTokenLen  = fileStream.read32();
       sToken     = fileStream.readBytes(iTokenLen);
       this.mGoodCounts[sToken] = iRefCount;
     }
 
     // we have no further good tokens, so read junk tokens
     this.mJunkTokens = fileStream.read32();
-    for (i = 0; i < this.mJunkTokens; i++)
-    { // read token data
+    for (let i = 0; i < this.mJunkTokens; i++) { // read token data
       iRefCount  = fileStream.read32();
       iTokenLen  = fileStream.read32();
       sToken     = fileStream.readBytes(iTokenLen);
       this.mJunkCounts[sToken] = iRefCount;
     }
   }
 }
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // tests reduction in size of training.dat
 
 // main setup
 
+/* import-globals-from resources/trainingfile.js */
 load("resources/trainingfile.js");
 
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 // before shrink, the trained messages have 76 tokens. Force shrink.
 Services.prefs.setIntPref("mailnews.bayesian_spam_filter.junk_maxtokens", 75);
 
 // local constants
@@ -20,40 +21,36 @@ var kGood = MailServices.junk.GOOD;
 
 var emails =          [ "ham1.eml",  "ham2.eml",  "spam1.eml",
                         "spam2.eml", "spam3.eml", "spam4.eml" ];
 var classifications = [ kGood,       kGood,       kJunk,
                         kJunk,       kJunk,       kJunk ];
 var trainingData;
 
 // main test
-function run_test()
-{
+function run_test() {
   localAccountUtils.loadLocalMailAccount();
   MailServices.junk.resetTrainingData();
 
   do_test_pending();
 
   var email = emails.shift();
   var classification = classifications.shift();
   // additional calls to setMessageClassifiaction are done in the callback
   MailServices.junk.setMessageClassification(getSpec(email),
     kUnclassified, classification, null, doTestingListener);
 }
 
-var doTestingListener =
-{
-  onMessageClassified: function(aMsgURI, aClassification, aJunkPercent)
-  {
+var doTestingListener = {
+  onMessageClassified(aMsgURI, aClassification, aJunkPercent) {
     if (!aMsgURI)
       return; // ignore end-of-batch signal
     var email = emails.shift();
     var classification = classifications.shift();
-    if (email)
-    {
+    if (email) {
       MailServices.junk.setMessageClassification(getSpec(email),
           kUnclassified, classification, null, doTestingListener);
       return;
     }
 
     // all done classifying, time to test
     MailServices.junk.shutdown(); // just flushes training.dat
     trainingData = new TrainingData();
@@ -95,23 +92,22 @@ var doTestingListener =
     Assert.equal(trainingData.mJunkMessages, 2); //  4/2
     checkToken("money", 0, 2);  // (0/2, 4/2)
     checkToken("subject:report", 0, 0);  // (1/2, 0/2)
     checkToken("to:careful reader <reader@example.org>", 1, 2); // (2/2, 4/2)
     checkToken("make", 0, 1); // (0/2, 3/2)
     checkToken("important", 1, 0); // (2/2, 0/2)
 
     do_test_finished();
-  }
+  },
 };
 
 // helper functions
 
-function checkToken(aToken, aGoodCount, aJunkCount)
-{
+function checkToken(aToken, aGoodCount, aJunkCount) {
   print(" checking " + aToken);
   var goodCount = trainingData.mGoodCounts[aToken];
   var junkCount = trainingData.mJunkCounts[aToken];
   if (!goodCount) goodCount = 0;
   if (!junkCount) junkCount = 0;
   Assert.equal(goodCount, aGoodCount);
   Assert.equal(junkCount, aJunkCount);
 }
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_customTokenization.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_customTokenization.js
@@ -14,137 +14,148 @@ var kSetup = 2;  // run a setup function
 // trait ids
 var kProArray = [3];
 var kAntiArray = [4];
 
 var gTest; // currently active test
 
 // The tests array defines the tests to attempt.
 
-var tests =
-[
+var tests = [
   // test a few tokens using defaults
-  {command: kTrain,
-   fileName: "tokenTest.eml"
-  },
-  {command: kTest,
-   fileName: "tokenTest.eml",
-   tokens: ["important",
-            "subject:eat",
-            "message-id:14159",
-            "http://www"],
-   nottokens: ["idonotexist", "subject:to"]
+  {
+    command: kTrain,
+    fileName: "tokenTest.eml",
+  }, {
+    command: kTest,
+    fileName: "tokenTest.eml",
+    tokens: [
+      "important",
+      "subject:eat",
+      "message-id:14159",
+      "http://www",
+    ],
+    nottokens: [
+      "idonotexist",
+      "subject:to",
+    ],
   },
 
   // enable received, disable message-id
   // switch tokenization of body to catch full urls (no "." delimiter)
   // enable sender, keeping full value
-  {command: kSetup,
-   operation: function()
-     {
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.received", "standard");
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.message-id", "false");
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.body_delimiters", " \t\r\n\v");
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.sender", "full");
-     }
-  },
-  {command: kTrain,
-   fileName: "tokenTest.eml"
-  },
-  {command: kTest,
-   fileName: "tokenTest.eml",
-   tokens: ["important", "subject:eat", "received:reader@example", "skip:h 20",
-            "sender:bugzilla test setup <noreply@example.org>", "received:<someone@example"],
-   nottokens: ["message-id:14159",
-               "http://www"]
+  {
+    command: kSetup,
+    operation() {
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.received", "standard");
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.message-id", "false");
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.body_delimiters", " \t\r\n\v");
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.sender", "full");
+    },
+  }, {
+    command: kTrain,
+    fileName: "tokenTest.eml",
+  }, {
+    command: kTest,
+    fileName: "tokenTest.eml",
+    tokens: [
+      "important",
+      "subject:eat",
+      "received:reader@example",
+      "skip:h 20",
+      "sender:bugzilla test setup <noreply@example.org>",
+      "received:<someone@example",
+    ],
+    nottokens: [
+      "message-id:14159",
+      "http://www",
+    ],
   },
 
   // increase the length of the maximum token to catch full URLs in the body
   // add <>;, remove . from standard header delimiters to better capture emails
   // use custom delimiters on sender, without "." or "<>"
-  {command: kSetup,
-   operation: function()
-     {
-       Services.prefs.setIntPref("mailnews.bayesian_spam_filter.maxlengthfortoken", 50);
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.header_delimiters", " ;<>\t\r\n\v");
-       Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.sender", " \t\r\n\v");
-     }
+  {
+    command: kSetup,
+    operation() {
+      Services.prefs.setIntPref("mailnews.bayesian_spam_filter.maxlengthfortoken", 50);
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.header_delimiters", " ;<>\t\r\n\v");
+      Services.prefs.setCharPref("mailnews.bayesian_spam_filter.tokenizeheader.sender", " \t\r\n\v");
+    },
+  }, {
+    command: kTrain,
+    fileName: "tokenTest.eml",
+  }, {
+    command: kTest,
+    fileName: "tokenTest.eml",
+    tokens: [
+      "received:someone@example.com",
+      "http://www.example.org",
+      "received:reader@example.org",
+      "sender:<noreply@example.org>",
+    ],
+    nottokens: [
+      "skip:h 20",
+      "received:<someone@example",
+    ],
   },
-  {command: kTrain,
-   fileName: "tokenTest.eml"
-  },
-  {command: kTest,
-   fileName: "tokenTest.eml",
-   tokens: ["received:someone@example.com", "http://www.example.org", "received:reader@example.org",
-            "sender:<noreply@example.org>"],
-   nottokens: ["skip:h 20", "received:<someone@example"]
-  }
-
-]
+];
 
 // main test
-function run_test()
-{
+function run_test() {
   localAccountUtils.loadLocalMailAccount();
   do_test_pending();
 
   startCommand();
 }
 
-var listener =
-{
-  //nsIMsgTraitClassificationListener implementation
-  onMessageTraitsClassified: function(aMsgURI, {}, aTraits, aPercents)
-  {
+var listener = {
+  // nsIMsgTraitClassificationListener implementation
+  onMessageTraitsClassified(aMsgURI, aTraitCount, aTraits, aPercents) {
     startCommand();
   },
 
-  onMessageTraitDetails: function(aMsgURI, aProTrait, {}, aTokenString,
-                                  aTokenPercents, aRunningPercents)
-  {
+  onMessageTraitDetails(aMsgURI, aProTrait, aTokenCount, aTokenString,
+                        aTokenPercents, aRunningPercents) {
     print("Details for " + aMsgURI);
-    for (var i = 0; i < aTokenString.length; i++)
+    for (let i = 0; i < aTokenString.length; i++) {
       print("Token " + aTokenString[i]);
+    }
 
     // we should have these tokens
-    for (var value of gTest.tokens)
-    {
+    for (let value of gTest.tokens) {
       print("We should have '" + value + "'? ");
-      Assert.ok(aTokenString.indexOf(value) >= 0);
+      Assert.ok(aTokenString.includes(value));
     }
 
     // should not have these tokens
-    for (var value of gTest.nottokens)
-    {
+    for (let value of gTest.nottokens) {
       print("We should not have '" + value + "'? ");
-      Assert.ok(aTokenString.indexOf(value) < 0);
+      Assert.ok(!aTokenString.includes(value));
     }
     startCommand();
-  }
+  },
 };
 
 // start the next test command
-function startCommand()
-{
-  if (!tests.length)       // Do we have more commands?
-  {
+function startCommand() {
+  if (!tests.length) { // Do we have more commands?
     // no, all done
     do_test_finished();
     return;
   }
 
   gTest = tests.shift();
-  //print("StartCommand command = " + gTest.command + ", remaining tests " + tests.length);
-  switch (gTest.command)
-  {
+  // print("StartCommand command = " + gTest.command + ", remaining tests " + tests.length);
+  switch (gTest.command) {
     case kTrain:
       // train message
 
       MailServices.junk.setMsgTraitClassification(
-        getSpec(gTest.fileName), //in string aMsgURI
+        getSpec(gTest.fileName), // in string aMsgURI
         0,
         null,         // in nsIArray aOldTraits
         kProArray.length,
         kProArray,     // in nsIArray aNewTraits
         listener);    // [optional] in nsIMsgTraitClassificationListener aTraitListener
         // null,      // [optional] in nsIMsgWindow aMsgWindow
         // null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
       break;
@@ -157,11 +168,10 @@ function startCommand()
         kAntiArray[0],   // antiTrait
         listener);   // in nsIMsgTraitDetailListener aDetailListener
       break;
 
     case kSetup:
       gTest.operation();
       startCommand();
       break;
-
   }
 }
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_junkAsTraits.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_junkAsTraits.js
@@ -39,277 +39,289 @@ var gTest; // currently active test
 //   test.junkPercent: sets the classification (for Class or Forget commands)
 //                     tests the classification (for Class commands)
 //                     As a special case for the no-training tests, if
 //                     junkPercent is negative, test its absolute value
 //                     for percents, but reverse the junk/good classification
 //   test.traitListener: should we use the trait listener call?
 //   test.junkListener: should we use the junk listener call?
 
-var tests =
-[
-
+var tests = [
   // test the trait-based calls. We mix trait listeners, junk listeners,
   // and both
 
-  // with no training, percents is 50 - but classifies as junk
-  {command: kClassT,
-   fileName: "ham1.eml",
-   junkPercent: -50,  // negative means classifies as junk
-   traitListener: false,
-   junkListener: true},
-  // train 1 ham message
-  {command: kTrainT,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  // with ham but no spam training, percents are 0 and classifies as ham
-  {command: kClassT,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  // train 1 spam message
-  {command: kTrainT,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: false},
-  // the trained messages will classify at 0 and 100
-  {command: kClassT,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: false},
-  // ham2, spam2, spam4 give partial percents, but still ham
-  {command: kClassT,
-   fileName: "ham2.eml",
-   junkPercent: 8,
-   traitListener: true,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "spam2.eml",
-   junkPercent: 81,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "spam4.eml",
-   junkPercent: 81,
-   traitListener: true,
-   junkListener: false},
-  // spam3 evaluates to spam
-  {command: kClassT,
-   fileName: "spam3.eml",
-   junkPercent: 98,
-   traitListener: true,
-   junkListener: true},
-  // train ham2, then test percents of 0 (clearly good)
-  {command: kTrainT,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: true,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: true,
-   junkListener: true},
-   // forget ham2, percents should return to partial value
-  {command: kForgetT,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "ham2.eml",
-   junkPercent: 8,
-   traitListener: true,
-   junkListener: true},
-  // train, classify, forget, reclassify spam4
-  {command: kTrainT,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: true},
-  {command: kClassT,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: true},
-  {command: kCounts,
-   tokenCount: 66,  // count of tokens in the corpus
-   junkCount: 2,    // count of junk messages in the corpus
-   goodCount: 1},   // count of good messages in the corpus
-  {command: kForgetT,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: false},
-  {command: kClassT,
-   fileName: "spam4.eml",
-   junkPercent: 81,
-   traitListener: true,
-   junkListener: true},
-  // forget ham1 and spam1 to empty training
-  {command: kForgetT,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: true,
-   junkListener: true},
-  {command: kForgetT,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: true,
-   junkListener: true},
-
+  { // with no training, percents is 50 - but classifies as junk
+    command: kClassT,
+    fileName: "ham1.eml",
+    junkPercent: -50,  // negative means classifies as junk
+    traitListener: false,
+    junkListener: true,
+  }, { // train 1 ham message
+    command: kTrainT,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, { // with ham but no spam training, percents are 0 and classifies as ham
+    command: kClassT,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, { // train 1 spam message
+    command: kTrainT,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: false,
+  }, { // the trained messages will classify at 0 and 100
+    command: kClassT,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: false,
+  }, { // ham2, spam2, spam4 give partial percents, but still ham
+    command: kClassT,
+    fileName: "ham2.eml",
+    junkPercent: 8,
+    traitListener: true,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "spam2.eml",
+    junkPercent: 81,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "spam4.eml",
+    junkPercent: 81,
+    traitListener: true,
+    junkListener: false,
+  }, { // spam3 evaluates to spam
+    command: kClassT,
+    fileName: "spam3.eml",
+    junkPercent: 98,
+    traitListener: true,
+    junkListener: true,
+  }, { // train ham2, then test percents of 0 (clearly good)
+    command: kTrainT,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: true,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: true,
+    junkListener: true,
+  }, { // forget ham2, percents should return to partial value
+    command: kForgetT,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "ham2.eml",
+    junkPercent: 8,
+    traitListener: true,
+    junkListener: true,
+  }, { // train, classify, forget, reclassify spam4
+    command: kTrainT,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: true,
+  }, {
+    command: kClassT,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: true,
+  }, {
+    command: kCounts,
+    tokenCount: 66,  // count of tokens in the corpus
+    junkCount: 2,    // count of junk messages in the corpus
+    goodCount: 1,    // count of good messages in the corpus
+  }, {
+    command: kForgetT,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: false,
+  }, {
+    command: kClassT,
+    fileName: "spam4.eml",
+    junkPercent: 81,
+    traitListener: true,
+    junkListener: true,
+  }, { // forget ham1 and spam1 to empty training
+    command: kForgetT,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: true,
+    junkListener: true,
+  }, {
+    command: kForgetT,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: true,
+    junkListener: true,
+  },
   // repeat the whole sequence using the junk calls
-
-  // train 1 ham and 1 spam message
-  {command: kTrainJ,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kTrainJ,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-  // the trained messages will classify at 0 and 100
-  {command: kClassJ,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-  // ham2, spam2, spam4 give partial percents, but still ham
-  {command: kClassJ,
-   fileName: "ham2.eml",
-   junkPercent: 8,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "spam2.eml",
-   junkPercent: 81,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "spam4.eml",
-   junkPercent: 81,
-   traitListener: false,
-   junkListener: true},
-  // spam3 evaluates to spam
-  {command: kClassJ,
-   fileName: "spam3.eml",
-   junkPercent: 98,
-   traitListener: false,
-   junkListener: true},
-  // train ham2, then test percents of 0 (clearly good)
-  {command: kTrainJ,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-   // forget ham2, percents should return to partial value
-  {command: kForgetJ,
-   fileName: "ham2.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "ham2.eml",
-   junkPercent: 8,
-   traitListener: false,
-   junkListener: true},
-  // train, classify, forget, reclassify spam4
-  {command: kTrainJ,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-  {command: kForgetJ,
-   fileName: "spam4.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-  {command: kClassJ,
-   fileName: "spam4.eml",
-   junkPercent: 81,
-   traitListener: false,
-   junkListener: true},
-  // forget ham1 and spam1 to be empty
-  {command: kForgetJ,
-   fileName: "ham1.eml",
-   junkPercent: 0,
-   traitListener: false,
-   junkListener: true},
-  {command: kForgetJ,
-   fileName: "spam1.eml",
-   junkPercent: 100,
-   traitListener: false,
-   junkListener: true},
-
-]
+  { // train 1 ham and 1 spam message
+    command: kTrainJ,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kTrainJ,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  }, { // the trained messages will classify at 0 and 100
+    command: kClassJ,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  }, { // ham2, spam2, spam4 give partial percents, but still ham
+    command: kClassJ,
+    fileName: "ham2.eml",
+    junkPercent: 8,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "spam2.eml",
+    junkPercent: 81,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "spam4.eml",
+    junkPercent: 81,
+    traitListener: false,
+    junkListener: true,
+  }, {// spam3 evaluates to spam
+    command: kClassJ,
+    fileName: "spam3.eml",
+    junkPercent: 98,
+    traitListener: false,
+    junkListener: true,
+  }, { // train ham2, then test percents of 0 (clearly good)
+    command: kTrainJ,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, { // forget ham2, percents should return to partial value
+    command: kForgetJ,
+    fileName: "ham2.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "ham2.eml",
+    junkPercent: 8,
+    traitListener: false,
+    junkListener: true,
+  }, { // train, classify, forget, reclassify spam4
+    command: kTrainJ,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kForgetJ,
+    fileName: "spam4.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kClassJ,
+    fileName: "spam4.eml",
+    junkPercent: 81,
+    traitListener: false,
+    junkListener: true,
+  }, { // forget ham1 and spam1 to be empty
+    command: kForgetJ,
+    fileName: "ham1.eml",
+    junkPercent: 0,
+    traitListener: false,
+    junkListener: true,
+  }, {
+    command: kForgetJ,
+    fileName: "spam1.eml",
+    junkPercent: 100,
+    traitListener: false,
+    junkListener: true,
+  },
+];
 
 // main test
-function run_test()
-{
+function run_test() {
   localAccountUtils.loadLocalMailAccount();
   do_test_pending();
 
   // setup pro/anti arrays as junk/good
   gProArray.push(kJunkTrait);
   gAntiArray.push(kGoodTrait);
 
   startCommand();
 }
 
-var junkListener =
-{
-// nsIJunkMailClassificationListener implementation
-  onMessageClassified: function(aMsgURI, aClassification, aJunkPercent)
-  {
+var junkListener = {
+  // nsIJunkMailClassificationListener implementation
+  onMessageClassified(aMsgURI, aClassification, aJunkPercent) {
     if (!aMsgURI)
       return; // ignore end-of-batch signal
-    //print("Message URI is " + aMsgURI);
-    //print("Junk percent is " + aJunkPercent);
-    //print("Classification is " + aClassification);
+    // print("Message URI is " + aMsgURI);
+    // print("Junk percent is " + aJunkPercent);
+    // print("Classification is " + aClassification);
     var command = gTest.command;
     var junkPercent = gTest.junkPercent;
     // file returned correctly
     Assert.equal(getSpec(gTest.fileName), aMsgURI);
 
     // checks of aClassification
 
     // forget returns unclassified
-    if (command == kForgetJ || command == kForgetT)
+    if (command == kForgetJ || command == kForgetT) {
       Assert.equal(aClassification, kUnclassified);
-    // classification or train should return an actual classification
-    else
-    {
+    } else { // classification or train should return an actual classification
       // check junk classification set by default cutoff of 90
       var isGood = Math.abs(junkPercent) < 90;
       if (junkPercent < 0)
         isGood = !isGood;
       Assert.equal(aClassification, isGood ? kGood : kJunk);
     }
 
     // checks of aJunkPercent
@@ -324,94 +336,85 @@ var junkListener =
       // forget always returns 0
       Assert.equal(aJunkPercent, 0);
 
     // if the current test includes a trait listener, it will
     // run next, so we defer to it for starting the next command
     if (gTest.traitListener)
       return;
     startCommand();
-  }
+  },
 };
 
-var traitListener =
-{
-  //nsIMsgTraitClassificationListener implementation
-  onMessageTraitsClassified: function(aMsgURI, {}, aTraits, aPercents)
-  {
+var traitListener = {
+  // nsIMsgTraitClassificationListener implementation
+  onMessageTraitsClassified(aMsgURI, aTraitCount, aTraits, aPercents) {
     if (!aMsgURI)
-      return; //ignore end-of-batch signal
-    //print("(Trait Listener)Message URI is " + aMsgURI);
-    //print("(Trait Listener)Junk percent is " + aPercents);
+      return; // ignore end-of-batch signal
+    // print("(Trait Listener)Message URI is " + aMsgURI);
+    // print("(Trait Listener)Junk percent is " + aPercents);
     var command = gTest.command;
     var junkPercent = gTest.junkPercent;
-    //print("command, junkPercent is " + command + " , " + junkPercent);
+    // print("command, junkPercent is " + command + " , " + junkPercent);
 
     Assert.equal(getSpec(gTest.fileName), aMsgURI);
 
     // checks of aPercents
 
-    if (command == kForgetJ || command == kForgetT)
+    if (command == kForgetJ || command == kForgetT) {
       // "forgets" with null newClassifications does not return a percent
       Assert.equal(aPercents.length, 0);
-    else
-    {
+    } else {
       var percent = aPercents[0];
-      //print("Percent is " + percent);
+      // print("Percent is " + percent);
       if (command == kClassJ || command == kClassT)
       // Classify returns actual percents
         Assert.equal(percent, junkPercent);
       else
       // Train simply returns 100
         Assert.equal(percent, 100);
     }
 
     // checks of aTraits
 
-    if (command == kForgetJ || command == kForgetT)
+    if (command == kForgetJ || command == kForgetT) {
       // "forgets" with null newClassifications does not return a
       // classification
       Assert.equal(aTraits.length, 0);
-    else if (command == kClassJ || command == kClassT)
-    {
+    } else if (command == kClassJ || command == kClassT) {
       // classification just returns the tested "Pro" trait (junk)
-      var trait = aTraits[0];
+      let trait = aTraits[0];
       Assert.equal(trait, kJunkTrait);
-    }
-    else
-    {
+    } else {
       // training returns the actual trait trained
-      var trait = aTraits[0];
+      let trait = aTraits[0];
       Assert.equal(trait, junkPercent < 90 ? kGoodTrait : kJunkTrait);
     }
 
     // All done, start the next test
     startCommand();
-  }
+  },
 };
 
 // start the next test command
-function startCommand()
-{
-  if (!tests.length)       // Do we have more commands?
-  {
+function startCommand() {
+  if (!tests.length) { // Do we have more commands?
     // no, all done
     do_test_finished();
     return;
   }
 
   gTest = tests.shift();
   print("StartCommand command = " + gTest.command + ", remaining tests " + tests.length);
   var command = gTest.command;
   var junkPercent = gTest.junkPercent;
   var fileName = gTest.fileName;
   var tListener = gTest.traitListener;
   var jListener = gTest.junkListener;
-  switch (command)
-  {
+  switch (command) {
     case kTrainJ:
       // train message using junk call
       MailServices.junk.setMessageClassification(
         getSpec(fileName),   // in string aMsgURI
         null,                // in nsMsgJunkStatus aOldUserClassification
         junkPercent == kIsHamScore ?
           kGood : kJunk,     // in nsMsgJunkStatus aNewClassification
         null,                // in nsIMsgWindow aMsgWindow
@@ -440,17 +443,17 @@ function startCommand()
         getSpec(fileName), // in string aMsgURI
         null,              // in nsIMsgWindow aMsgWindow
         junkListener);     // in nsIJunkMailClassificationListener aListener
       break;
 
     case kClassT:
       // classify message using trait call
       MailServices.junk.classifyTraitsInMessage(
-        getSpec(fileName), //in string aMsgURI
+        getSpec(fileName), // in string aMsgURI
         gProArray.length, // length of traits arrays
         gProArray,   // in array aProTraits,
         gAntiArray,  // in array aAntiTraits
         tListener ? traitListener :
           null,      // in nsIMsgTraitClassificationListener aTraitListener
         null,        // in nsIMsgWindow aMsgWindow
         jListener ? junkListener :
           null);     // in nsIJunkMailClassificationListener aJunkListener
@@ -465,17 +468,17 @@ function startCommand()
         null,               // in nsMsgJunkStatus aNewClassification,
         null,               // in nsIMsgWindow aMsgWindow,
         junkListener);      // in nsIJunkMailClassificationListener aListener
       break;
 
     case kForgetT:
       // forget message using trait call
       MailServices.junk.setMsgTraitClassification(
-        getSpec(fileName), //in string aMsgURI
+        getSpec(fileName), // in string aMsgURI
         gProArray.length,  // length of aOldTraits array (1 in this test)
         junkPercent == kIsSpamScore ? gProArray :
           gAntiArray,  // in array aOldTraits
         0,           // length of aNewTraits array
         null,        // in array aNewTraits
         tListener ? traitListener :
           null,      // in nsIMsgTraitClassificationListener aTraitListener
         null,        // in nsIMsgWindow aMsgWindow
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_msgCorpus.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_msgCorpus.js
@@ -16,22 +16,21 @@ var tokenData = [
   [1001, 0, "iDoNotExist"],
   [1001, 1, "linecount"],
   [1001, 2, "envelope-to:kenttest@caspia.com"],
   [1003, 0, "iAlsoDoNotExist"],
   [1003, 0, "isjunk"], // in 1001 but not 1003
   [1003, 1, "linecount"],
   [1003, 1, "subject:test"],
   [1003, 1, "envelope-to:kenttest@caspia.com"],
-]
+];
 
 // list of tests
 
-var gTests =
-[
+var gTests = [
   // train two different combinations of messages
   function checkLoadOnce() {
     let fileName = "msgCorpus.dat";
     let file = do_get_file("resources/" + fileName);
     msgCorpus.updateData(file, true);
 
     // check message counts
     let messageCount = {};
@@ -119,27 +118,23 @@ var gTests =
     // check that token count was cleared
     for (let i = 0; i < tokenData.length; i++) {
       let id = tokenData[i][0];
       let count = tokenData[i][1];
       let word = tokenData[i][2];
       Assert.equal(id == 1001 ? 0 : count, msgCorpus.getTokenCount(word, id));
     }
   },
-
-]
+];
 
 // main test
-function run_test()
-{
+function run_test() {
   do_test_pending();
-  while(1)
-  {
-    if (!gTests.length)       // Do we have more commands?
-    {
+  while (true) {
+    if (!gTests.length) { // Do we have more commands?
       // no, all done
       do_test_finished();
       return;
     }
 
     let test = gTests.shift();
     test();
   }
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_traitAliases.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_traitAliases.js
@@ -51,83 +51,78 @@ var gTest; // currently active test
 // The tests array defines the tests to attempt. Format of
 // an element "test" of this array:
 //
 //   test.fileName: file containing message to test
 //   test.proAliases: array of aliases for the pro trait
 //   test.antiAliases: array of aliases for the anti trait
 //   test.percent: expected results from the classifier
 
-var tests =
-[
-  {fileName: "aliases1.eml",
-   proAliases: [],
-   antiAliases: [],
-   percent: 92
-  },
-  {fileName: "aliases2.eml",
-   proAliases: [],
-   antiAliases: [],
-   percent: 8
-  },
-  {fileName: "aliases3.eml",
-   proAliases: [],
-   antiAliases: [],
-   percent: 50
+var tests = [
+  {
+    fileName: "aliases1.eml",
+    proAliases: [],
+    antiAliases: [],
+    percent: 92,
+  }, {
+    fileName: "aliases2.eml",
+    proAliases: [],
+    antiAliases: [],
+    percent: 8,
+  }, {
+    fileName: "aliases3.eml",
+    proAliases: [],
+    antiAliases: [],
+    percent: 50,
+  }, {
+    fileName: "aliases1.eml",
+    proAliases: [kProAlias],
+    antiAliases: [kAntiAlias],
+    percent: 98,
+  }, {
+    fileName: "aliases2.eml",
+    proAliases: [kProAlias],
+    antiAliases: [kAntiAlias],
+    percent: 3,
+  }, {
+    fileName: "aliases3.eml",
+    proAliases: [kProAlias],
+    antiAliases: [kAntiAlias],
+    percent: 53,
   },
-  {fileName: "aliases1.eml",
-   proAliases: [kProAlias],
-   antiAliases: [kAntiAlias],
-   percent: 98
-  },
-  {fileName: "aliases2.eml",
-   proAliases: [kProAlias],
-   antiAliases: [kAntiAlias],
-   percent: 3
-  },
-  {fileName: "aliases3.eml",
-   proAliases: [kProAlias],
-   antiAliases: [kAntiAlias],
-   percent: 53
-  },
-]
+];
 
 // main test
-function run_test()
-{
+function run_test() {
   localAccountUtils.loadLocalMailAccount();
 
   // load in the aliases trait testing file
   MailServices.junk.QueryInterface(Ci.nsIMsgCorpus)
                    .updateData(do_get_file("resources/aliases.dat"), true);
   do_test_pending();
 
   startCommand();
 }
 
-var listener =
-{
-  //nsIMsgTraitClassificationListener implementation
-  onMessageTraitsClassified: function(aMsgURI, {}, aTraits, aPercents)
-  {
-    //print("Message URI is " + aMsgURI);
+var listener = {
+  // nsIMsgTraitClassificationListener implementation
+  onMessageTraitsClassified(aMsgURI, aTraitCount, aTraits, aPercents) {
+    // print("Message URI is " + aMsgURI);
     if (!aMsgURI)
-      return; //ignore end-of-batch signal
+      return; // ignore end-of-batch signal
 
-    Assert.equal(aPercents[0], gTest.percent)
+    Assert.equal(aPercents[0], gTest.percent);
     // All done, start the next test
     startCommand();
   },
 };
 
 // start the next test command
-function startCommand()
-{
-  if (!tests.length)       // Do we have more commands?
-  {
+function startCommand() {
+  if (!tests.length) { // Do we have more commands?
     // no, all done
     do_test_finished();
     return;
   }
 
   gTest = tests.shift();
 
   // classify message
@@ -151,11 +146,11 @@ function startCommand()
     traitService.addAlias(kAntiTrait, antiAlias);
 
   MailServices.junk.classifyTraitsInMessage(
     getSpec(gTest.fileName), // in string aMsgURI
     proArray.length, // length of traits arrays
     proArray,    // in array aProTraits,
     antiArray,   // in array aAntiTraits
     listener);   // in nsIMsgTraitClassificationListener aTraitListener
-    //null,      // [optional] in nsIMsgWindow aMsgWindow
-    //null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
+    // null,      // [optional] in nsIMsgWindow aMsgWindow
+    // null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
 }
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_traits.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_traits.js
@@ -23,223 +23,215 @@ var gTest; // currently active test
 //
 //   test.command: function to perform, see definitions above
 //   test.fileName: file(s) containing message(s) to test
 //   test.traitIds: Array of traits to train (kTrain) or pro trait (kClass)
 //   test.traitAntiIds: Array of anti traits to classify
 //   test.percents: array of arrays (1 per message, 1 per trait) of
 //                  expected results from the classifier
 
-var tests =
-[
+var tests = [
   // train two different combinations of messages
-  {command: kTrain,
-   fileName: "ham1.eml",
-   traitIds: [3,6]
-  },
-  {command: kTrain,
-   fileName: "spam1.eml",
-   traitIds: [4]
-  },
-  {command: kTrain,
-   fileName: "spam4.eml",
-   traitIds: [5]
-  },
-
-  // test the message classifications using both singular and plural classifier
-  {command: kClass,
-   fileName: "ham1.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   // ham1 is trained "anti" for first test, "pro" for second
-   percents: [[0, 100]]
+  {
+    command: kTrain,
+    fileName: "ham1.eml",
+    traitIds: [3, 6],
+  }, {
+    command: kTrain,
+    fileName: "spam1.eml",
+    traitIds: [4],
+  }, {
+    command: kTrain,
+    fileName: "spam4.eml",
+    traitIds: [5],
   },
-  {command: kClass,
-   fileName: "ham2.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   // these are partial percents for an untrained message. ham2 is similar to ham1
-   percents: [[8,95]]
-  },
-  {command: kDetail,
-   fileName: "spam2.eml",
-   traitIds: [4],
-   traitAntiIds: [3],
-   percents: { lots: 84,
-               money: 84,
-               make: 84,
-               your: 16 },
-   runnings: [84, 92, 95, 81]
-  },
-  {command: kClass,
-   fileName: "spam1.eml,spam2.eml,spam3.eml,spam4.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   // spam1 trained as "pro" for first pro/anti pair
-   // spam4 trained as "anti" for second pro/anti pair
-   // others are partials
-   percents: [ [100,50] , [81,0] , [98,50] , [81,0]]
+  // test the message classifications using both singular and plural classifier
+  {
+    command: kClass,
+    fileName: "ham1.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    // ham1 is trained "anti" for first test, "pro" for second
+    percents: [[0, 100]],
+  }, {
+    command: kClass,
+    fileName: "ham2.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    // these are partial percents for an untrained message. ham2 is similar to ham1
+    percents: [[8, 95]],
+  }, {
+    command: kDetail,
+    fileName: "spam2.eml",
+    traitIds: [4],
+    traitAntiIds: [3],
+    percents: {
+      lots: 84,
+      money: 84,
+      make: 84,
+      your: 16,
+    },
+    runnings: [84, 92, 95, 81],
+  }, {
+    command: kClass,
+    fileName: "spam1.eml,spam2.eml,spam3.eml,spam4.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    // spam1 trained as "pro" for first pro/anti pair
+    // spam4 trained as "anti" for second pro/anti pair
+    // others are partials
+    percents: [[100, 50], [81, 0], [98, 50], [81, 0]],
   },
   // reset the plugin, read in data, and retest the classification
   // this tests the trait file writing
-  {command: kReset},
-  {command: kClass,
-   fileName: "ham1.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   percents: [[0, 100]]
+  {
+    command: kReset,
+  }, {
+    command: kClass,
+    fileName: "ham1.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    percents: [[0, 100]],
+  }, {
+    command: kClass,
+    fileName: "ham2.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    percents: [[8, 95]],
+  }, {
+    command: kClass,
+    fileName: "spam1.eml,spam2.eml,spam3.eml,spam4.eml",
+    traitIds: [4, 6],
+    traitAntiIds: [3, 5],
+    percents: [[100, 50], [81, 0], [98, 50], [81, 0]],
   },
-  {command: kClass,
-   fileName: "ham2.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   percents: [[8,95]]
-  },
-  {command: kClass,
-   fileName: "spam1.eml,spam2.eml,spam3.eml,spam4.eml",
-   traitIds: [4,6],
-   traitAntiIds: [3,5],
-   percents: [ [100,50] , [81,0] , [98,50] , [81,0]]
-  },
-]
+];
 
 // main test
-function run_test()
-{
+function run_test() {
   localAccountUtils.loadLocalMailAccount();
   do_test_pending();
 
   startCommand();
 }
 
-var listener =
-{
-  //nsIMsgTraitClassificationListener implementation
-  onMessageTraitsClassified: function(aMsgURI, {}, aTraits, aPercents)
-  {
-    //print("Message URI is " + aMsgURI);
+var listener = {
+  // nsIMsgTraitClassificationListener implementation
+  onMessageTraitsClassified(aMsgURI, aTraitCount, aTraits, aPercents) {
+    // print("Message URI is " + aMsgURI);
     if (!aMsgURI)
-      return; //ignore end-of-batch signal
+      return; // ignore end-of-batch signal
 
-    switch (gTest.command)
-    {
+    switch (gTest.command) {
       case kClass:
         Assert.equal(gTest.files[gTest.currentIndex], aMsgURI);
         var currentPercents = gTest.percents[gTest.currentIndex];
-        for (var i = 0; i < currentPercents.length; i++)
-        {
-          //print("expecting score " + currentPercents[i] +
+        for (let i = 0; i < currentPercents.length; i++) {
+          // print("expecting score " + currentPercents[i] +
           //      " got score " + aPercents[i]);
           Assert.equal(currentPercents[i], aPercents[i]);
         }
         gTest.currentIndex++;
         break;
 
       case kTrain:
         // We tested this some in test_junkAsTraits.js, so let's not bother
       default:
         break;
     }
     if (!--gTest.callbacks)
       // All done, start the next test
       startCommand();
   },
-  onMessageTraitDetails: function(aMsgURI, aProTrait, {}, aTokenString,
-                                  aTokenPercents, aRunningPercents)
-  {
+  onMessageTraitDetails(aMsgURI, aProTrait, aTokenCount, aTokenString,
+                        aTokenPercents, aRunningPercents) {
     print("Details for " + aMsgURI);
-    for (var i = 0; i < aTokenString.length; i++)
-    {
+    for (let i = 0; i < aTokenString.length; i++) {
       print("Percent " + aTokenPercents[i] +
             " Running " + aRunningPercents[i] +
             " Token " + aTokenString[i]);
       Assert.ok(aTokenString[i] in gTest.percents);
 
       Assert.equal(gTest.percents[aTokenString[i]], aTokenPercents[i]);
       Assert.equal(gTest.runnings[i], aRunningPercents[i]);
       delete gTest.percents[aTokenString[i]];
     }
     Assert.equal(Object.keys(gTest.percents).length, 0);
     if (gTest.command == kClass)
       gTest.currentIndex++;
     startCommand();
-  }
+  },
 };
 
 // start the next test command
-function startCommand()
-{
-  if (!tests.length)       // Do we have more commands?
-  {
+function startCommand() {
+  if (!tests.length) { // Do we have more commands?
     // no, all done
     do_test_finished();
     return;
   }
 
   gTest = tests.shift();
   print("StartCommand command = " + gTest.command + ", remaining tests " + tests.length);
-  switch (gTest.command)
-  {
-    case kTrain:
+  switch (gTest.command) {
+    case kTrain: {
       // train message
-      var proArray = [];
-      for (var i = 0; i < gTest.traitIds.length; i++)
+      let proArray = [];
+      for (let i = 0; i < gTest.traitIds.length; i++)
         proArray.push(gTest.traitIds[i]);
       gTest.callbacks = 1;
 
       nsIJunkMailPlugin.setMsgTraitClassification(
-        getSpec(gTest.fileName), //in string aMsgURI
+        getSpec(gTest.fileName), // in string aMsgURI
         0,
         null,         // in nsIArray aOldTraits
         proArray.length,
         proArray,     // in nsIArray aNewTraits
         listener);    // [optional] in nsIMsgTraitClassificationListener aTraitListener
         // null,      // [optional] in nsIMsgWindow aMsgWindow
         // null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
       break;
-
-    case kClass:
+    }
+    case kClass: {
       // classify message
       var antiArray = [];
-      var proArray = [];
-      for (var i = 0; i < gTest.traitIds.length; i++)
-      {
+      let proArray = [];
+      for (let i = 0; i < gTest.traitIds.length; i++) {
         antiArray.push(gTest.traitAntiIds[i]);
         proArray.push(gTest.traitIds[i]);
       }
       gTest.files = gTest.fileName.split(",");
       gTest.callbacks = gTest.files.length;
       gTest.currentIndex = 0;
-      for (var i = 0; i < gTest.files.length; i++)
+      for (let i = 0; i < gTest.files.length; i++)
         gTest.files[i] = getSpec(gTest.files[i]);
-      if (gTest.files.length == 1)
+      if (gTest.files.length == 1) {
         // use the singular classifier
         nsIJunkMailPlugin.classifyTraitsInMessage(
           getSpec(gTest.fileName), // in string aMsgURI
           proArray.length, // length of traits arrays
           proArray,    // in array aProTraits,
           antiArray,   // in array aAntiTraits
           listener);   // in nsIMsgTraitClassificationListener aTraitListener
-          //null,      // [optional] in nsIMsgWindow aMsgWindow
-          //null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
-      else
-      {
+          // null,      // [optional] in nsIMsgWindow aMsgWindow
+          // null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
+      } else {
         // use the plural classifier
         nsIJunkMailPlugin.classifyTraitsInMessages(
           gTest.files.length, // in unsigned long aCount,
           gTest.files, // [array, size_is(aCount)] in string aMsgURIs,
           proArray.length, // length of traits arrays
           proArray,    // in array aProTraits,
           antiArray,   // in array aAntiTraits
           listener);   // in nsIMsgTraitClassificationListener aTraitListener
-          //null,      // [optional] in nsIMsgWindow aMsgWindow
-          //null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
+          // null,      // [optional] in nsIMsgWindow aMsgWindow
+          // null,      // [optional] in nsIJunkMailClassificationListener aJunkListener
       }
       break;
-
+    }
     case kDetail:
       // detail message
       nsIJunkMailPlugin.detailMessage(
         getSpec(gTest.fileName), // in string aMsgURI
         gTest.traitIds[0], // proTrait
         gTest.traitAntiIds[0],   // antiTrait
         listener);   // in nsIMsgTraitDetailListener aDetailListener
       break;
@@ -248,11 +240,10 @@ function startCommand()
       nsIJunkMailPlugin.shutdown(); // writes files
       nsIJunkMailPlugin = null;
       nsIJunkMailPlugin =
         Cc["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
           .createInstance(Ci.nsIJunkMailPlugin);
       // does not do a callback, so we must restart next command
       startCommand();
       break;
-
   }
 }
--- a/mailnews/extensions/dsn/content/am-dsn.js
+++ b/mailnews/extensions/dsn/content/am-dsn.js
@@ -2,35 +2,32 @@
  * 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/. */
 
 var useCustomPrefs;
 var requestAlways;
 var gIdentity;
 
-function onInit()
-{
+function onInit() {
   useCustomPrefs = document.getElementById("identity.dsn_use_custom_prefs");
   requestAlways = document.getElementById("identity.dsn_always_request_on");
 
   EnableDisableCustomSettings();
 
   return true;
 }
 
-function onSave()
-{
+function onSave() {
 }
 
 function EnableDisableCustomSettings() {
   if (useCustomPrefs && (useCustomPrefs.getAttribute("value") == "false"))
     requestAlways.setAttribute("disabled", "true");
   else
     requestAlways.removeAttribute("disabled");
 
   return true;
 }
 
-function onPreInit(account, accountValues)
-{
+function onPreInit(account, accountValues) {
   gIdentity = account.defaultIdentity;
 }
--- a/mailnews/extensions/dsn/src/dsn-service.js
+++ b/mailnews/extensions/dsn/src/dsn-service.js
@@ -5,17 +5,17 @@
 
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function DSNService() {}
 
 DSNService.prototype = {
   name: "dsn",
   chromePackageName: "messenger",
-  showPanel: function(server) {
+  showPanel(server) {
     // don't show the panel for news, rss, or local accounts
     return (server.type != "nntp" && server.type != "rss" &&
             server.type != "none");
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
   classID: Components.ID("{849dab91-9bc9-4508-a0ee-c2453e7c092d}"),
 };
--- a/mailnews/extensions/mdn/content/am-mdn.js
+++ b/mailnews/extensions/mdn/content/am-mdn.js
@@ -1,13 +1,17 @@
 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
+/* import-globals-from ../../../base/prefs/content/amUtils.js */
+
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 var useCustomPrefs;
 var requestReceipt;
 var leaveInInbox;
 var moveToSent;
 var receiptSend;
 var neverReturn;
 var returnSome;
 var notInToCcPref;
@@ -17,18 +21,17 @@ var outsideDomainLabel;
 var otherCasesPref;
 var otherCasesLabel;
 var receiptArriveLabel;
 var receiptRequestLabel;
 var gIdentity;
 var gIncomingServer;
 var gMdnPrefBranch;
 
-function onInit()
-{
+function onInit() {
   useCustomPrefs = document.getElementById("identity.use_custom_prefs");
   requestReceipt = document.getElementById("identity.request_return_receipt_on");
   leaveInInbox = document.getElementById("leave_in_inbox");
   moveToSent = document.getElementById("move_to_sent");
   receiptSend = document.getElementById("server.mdn_report_enabled");
   neverReturn = document.getElementById("never_return");
   returnSome = document.getElementById("return_some");
   notInToCcPref = document.getElementById("server.mdn_not_in_to_cc");
@@ -40,32 +43,29 @@ function onInit()
   receiptArriveLabel = document.getElementById("receiptArriveLabel");
   receiptRequestLabel = document.getElementById("receiptRequestLabel");
 
   EnableDisableCustomSettings();
 
   return true;
 }
 
-function onSave()
-{
-
+function onSave() {
 }
 
 function EnableDisableCustomSettings() {
   if (useCustomPrefs && (useCustomPrefs.getAttribute("value") == "false")) {
     requestReceipt.setAttribute("disabled", "true");
     leaveInInbox.setAttribute("disabled", "true");
     moveToSent.setAttribute("disabled", "true");
     neverReturn.setAttribute("disabled", "true");
     returnSome.setAttribute("disabled", "true");
     receiptArriveLabel.setAttribute("disabled", "true");
     receiptRequestLabel.setAttribute("disabled", "true");
-  }
-  else {
+  } else {
     requestReceipt.removeAttribute("disabled");
     leaveInInbox.removeAttribute("disabled");
     moveToSent.removeAttribute("disabled");
     neverReturn.removeAttribute("disabled");
     returnSome.removeAttribute("disabled");
     receiptArriveLabel.removeAttribute("disabled");
     receiptRequestLabel.removeAttribute("disabled");
   }
@@ -81,71 +81,64 @@ function EnableDisableAllowedReceipts() 
   if (receiptSend) {
     if (!neverReturn.getAttribute("disabled") && (receiptSend.getAttribute("value") != "false")) {
       notInToCcPref.removeAttribute("disabled");
       notInToCcLabel.removeAttribute("disabled");
       outsideDomainPref.removeAttribute("disabled");
       outsideDomainLabel.removeAttribute("disabled");
       otherCasesPref.removeAttribute("disabled");
       otherCasesLabel.removeAttribute("disabled");
-    }
-    else {
+    } else {
       notInToCcPref.setAttribute("disabled", "true");
       notInToCcLabel.setAttribute("disabled", "true");
       outsideDomainPref.setAttribute("disabled", "true");
       outsideDomainLabel.setAttribute("disabled", "true");
       otherCasesPref.setAttribute("disabled", "true");
       otherCasesLabel.setAttribute("disabled", "true");
     }
   }
   return true;
 }
 
-function onPreInit(account, accountValues)
-{
+function onPreInit(account, accountValues) {
   gIdentity = account.defaultIdentity;
   gIncomingServer = account.incomingServer;
 }
 
 // Disables xul elements that have associated preferences locked.
-function onLockPreference(initPrefString, keyString)
-{
-    var finalPrefString;
+function onLockPreference(initPrefString, keyString) {
+  var allPrefElements = [
+    { prefstring: "request_return_receipt_on", id: "identity.request_return_receipt_on"},
+    { prefstring: "select_custom_prefs", id: "identity.select_custom_prefs"},
+    { prefstring: "select_global_prefs", id: "identity.select_global_prefs"},
+    { prefstring: "incorporate_return_receipt", id: "server.incorporate_return_receipt"},
+    { prefstring: "never_return", id: "never_return"},
+    { prefstring: "return_some", id: "return_some"},
+    { prefstring: "mdn_not_in_to_cc", id: "server.mdn_not_in_to_cc"},
+    { prefstring: "mdn_outside_domain", id: "server.mdn_outside_domain"},
+    { prefstring: "mdn_other", id: "server.mdn_other"},
+  ];
 
-    var allPrefElements = [
-      { prefstring:"request_return_receipt_on", id:"identity.request_return_receipt_on"},
-      { prefstring:"select_custom_prefs", id:"identity.select_custom_prefs"},
-      { prefstring:"select_global_prefs", id:"identity.select_global_prefs"},
-      { prefstring:"incorporate_return_receipt", id:"server.incorporate_return_receipt"},
-      { prefstring:"never_return", id:"never_return"},
-      { prefstring:"return_some", id:"return_some"},
-      { prefstring:"mdn_not_in_to_cc", id:"server.mdn_not_in_to_cc"},
-      { prefstring:"mdn_outside_domain", id:"server.mdn_outside_domain"},
-      { prefstring:"mdn_other", id:"server.mdn_other"},
-    ];
+  var finalPrefString = initPrefString + "." + keyString + ".";
+  gMdnPrefBranch = Services.prefs.getBranch(finalPrefString);
 
-    finalPrefString = initPrefString + "." + keyString + ".";
-    gMdnPrefBranch = Services.prefs.getBranch(finalPrefString);
-
-    disableIfLocked( allPrefElements );
+  disableIfLocked(allPrefElements);
 }
 
-function disableIfLocked( prefstrArray )
-{
-  for (var i=0; i<prefstrArray.length; i++) {
+function disableIfLocked(prefstrArray) {
+  for (let i = 0; i < prefstrArray.length; i++) {
     var id = prefstrArray[i].id;
     var element = document.getElementById(id);
     if (gMdnPrefBranch.prefIsLocked(prefstrArray[i].prefstring)) {
-      if (id == "server.incorporate_return_receipt")
-      {
+      if (id == "server.incorporate_return_receipt") {
         document.getElementById("leave_in_inbox").setAttribute("disabled", "true");
         document.getElementById("move_to_sent").setAttribute("disabled", "true");
+      } else {
+        element.setAttribute("disabled", "true");
       }
-      else
-        element.setAttribute("disabled", "true");
     }
   }
 }
 
 /**
  * Opens Preferences (Options) dialog on the pane and tab where
  * the global receipts settings can be found.
  */
--- a/mailnews/extensions/mdn/src/mdn-service.js
+++ b/mailnews/extensions/mdn/src/mdn-service.js
@@ -5,17 +5,17 @@
 
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function MDNService() {}
 
 MDNService.prototype = {
   name: "mdn",
   chromePackageName: "messenger",
-  showPanel: function(server) {
+  showPanel(server) {
     // don't show the panel for news, rss, im or local accounts
     return (server.type != "nntp" && server.type != "rss" &&
             server.type != "im" && server.type != "none");
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
   classID: Components.ID("{e007d92e-1dd1-11b2-a61e-dc962c9b8571}"),
 };
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mdn/test/unit/.eslintrc.js
@@ -0,0 +1,14 @@
+"use strict";
+
+module.exports = {
+  "extends": "plugin:mozilla/xpcshell-test",
+
+  "rules": {
+    "func-names": "off",
+    "mozilla/import-headjs-globals": "error",
+    "no-unused-vars": ["error", {
+      "args": "none",
+      "vars": "all",
+    }],
+  },
+};
--- a/mailnews/extensions/mdn/test/unit/test_askuser.js
+++ b/mailnews/extensions/mdn/test/unit/test_askuser.js
@@ -3,32 +3,31 @@ localAccountUtils.loadLocalMailAccount()
 
 var localAccount = MailServices.accounts
                                .FindAccountForServer(localAccountUtils.incomingServer);
 var identity = MailServices.accounts.createIdentity();
 identity.email = "bob@t2.example.net";
 localAccount.addIdentity(identity);
 localAccount.defaultIdentity = identity;
 
-function run_test()
-{
+function run_test() {
   var headers =
     "from: alice@t1.example.com\r\n" +
     "to: bob@t2.example.net\r\n" +
     "return-path: alice@t1.example.com\r\n" +
     "Disposition-Notification-To: alice@t1.example.com\r\n";
 
   let mimeHdr = Cc["@mozilla.org/messenger/mimeheaders;1"]
                   .createInstance(Ci.nsIMimeHeaders);
   mimeHdr.initialize(headers);
   let receivedHeader = mimeHdr.extractHeader("To", false);
-  dump(receivedHeader+"\n");
+  dump(receivedHeader + "\n");
 
-  let localFolder = localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
-  localAccountUtils.inboxFolder.addMessage("From \r\n"+ headers + "\r\nhello\r\n");
+  localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
+  localAccountUtils.inboxFolder.addMessage("From \r\n" + headers + "\r\nhello\r\n");
   // Need to setup some prefs
   Services.prefs.setBoolPref("mail.mdn.report.enabled", true);
   Services.prefs.setIntPref("mail.mdn.report.not_in_to_cc", 2);
   Services.prefs.setIntPref("mail.mdn.report.other", 2);
   Services.prefs.setIntPref("mail.mdn.report.outside_domain", 2);
 
   var msgFolder = localAccountUtils.inboxFolder;
 
@@ -41,12 +40,12 @@ function run_test()
                        .createInstance(Ci.nsIMsgMdnGenerator);
 
   Services.prefs.setIntPref("mail.mdn.report.outside_domain", 1);
   var askUser = mdnGenerator.process(Ci.nsIMsgMdnGenerator.eDisplayed, msgWindow, msgFolder,
                                      msgHdr.messageKey, mimeHdr, false);
   Assert.ok(!askUser);
 
   Services.prefs.setIntPref("mail.mdn.report.outside_domain", 2);
-  var askUser = mdnGenerator.process(Ci.nsIMsgMdnGenerator.eDisplayed, msgWindow, msgFolder,
-                                     msgHdr.messageKey, mimeHdr, false);
+  askUser = mdnGenerator.process(Ci.nsIMsgMdnGenerator.eDisplayed, msgWindow, msgFolder,
+                                 msgHdr.messageKey, mimeHdr, false);
   Assert.ok(askUser);
 }
--- a/mailnews/extensions/mdn/test/unit/test_mdnFlags.js
+++ b/mailnews/extensions/mdn/test/unit/test_mdnFlags.js
@@ -7,33 +7,30 @@ localAccountUtils.loadLocalMailAccount()
 
 var localAccount = MailServices.accounts
                                .FindAccountForServer(localAccountUtils.incomingServer);
 var identity = MailServices.accounts.createIdentity();
 identity.email = "bob@t2.example.net";
 localAccount.addIdentity(identity);
 localAccount.defaultIdentity = identity;
 
-
-
-function run_test()
-{
+function run_test() {
   var headers =
     "from: alice@t1.example.com\r\n" +
     "to: bob@t2.example.net\r\n" +
     "return-path: alice@t1.example.com\r\n" +
     "Disposition-Notification-To: alice@t1.example.com\r\n";
 
   let mimeHdr = Cc["@mozilla.org/messenger/mimeheaders;1"]
                   .createInstance(Ci.nsIMimeHeaders);
   mimeHdr.initialize(headers);
-  let receivedHeader = mimeHdr.extractHeader("To", false);
+  mimeHdr.extractHeader("To", false);
 
-  let localFolder = localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
-  localAccountUtils.inboxFolder.addMessage("From \r\n"+ headers + "\r\nhello\r\n");
+  localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
+  localAccountUtils.inboxFolder.addMessage("From \r\n" + headers + "\r\nhello\r\n");
   // Need to setup some prefs
   Services.prefs.setBoolPref("mail.mdn.report.enabled", true);
   Services.prefs.setIntPref("mail.mdn.report.not_in_to_cc", 2);
   Services.prefs.setIntPref("mail.mdn.report.other", 2);
   Services.prefs.setIntPref("mail.mdn.report.outside_domain", 2);
 
   var msgFolder = localAccountUtils.inboxFolder;
 
--- a/mailnews/extensions/offline-startup/js/offlineStartup.js
+++ b/mailnews/extensions/offline-startup/js/offlineStartup.js
@@ -9,155 +9,124 @@ var {XPCOMUtils} = ChromeUtils.import("r
 var kDebug              = false;
 var kOfflineStartupPref = "offline.startup_state";
 var kRememberLastState  = 0;
 var kAskForOnlineState  = 1;
 var kAlwaysOnline       = 2;
 var kAlwaysOffline      = 3;
 var kAutomatic          = 4;
 var gStartingUp         = true;
-var gOfflineStartupMode;  //0 = remember last state, 1 = ask me, 2 == online, 3 == offline, 4 = automatic
+var gOfflineStartupMode;  // 0 = remember last state, 1 = ask me, 2 == online, 3 == offline, 4 = automatic
 var gDebugLog;
 
-////////////////////////////////////////////////////////////////////////
-//
-//   Debug helper
-//
-////////////////////////////////////////////////////////////////////////
+// Debug helper
+
 if (!kDebug)
   gDebugLog = function(m) {};
 else
-  gDebugLog = function(m) {dump("\t *** nsOfflineStartup: " + m + "\n");};
+  gDebugLog = function(m) { dump("\t *** nsOfflineStartup: " + m + "\n"); };
 
-////////////////////////////////////////////////////////////////////////
-//
-//   nsOfflineStartup : nsIObserver
+// nsOfflineStartup : nsIObserver
 //
-//   Check if the user has set the pref to be prompted for
-//   online/offline startup mode. If so, prompt the user. Also,
-//   check if the user wants to remember their offline state
-//   the next time they start up.
-//   If the user shutdown offline, and is now starting up in online
-//   mode, we will set the boolean pref "mailnews.playback_offline" to true.
-//
-////////////////////////////////////////////////////////////////////////
+// Check if the user has set the pref to be prompted for
+// online/offline startup mode. If so, prompt the user. Also,
+// check if the user wants to remember their offline state
+// the next time they start up.
+// If the user shutdown offline, and is now starting up in online
+// mode, we will set the boolean pref "mailnews.playback_offline" to true.
 
-var nsOfflineStartup =
-{
-  onProfileStartup: function()
-  {
+var nsOfflineStartup = {
+  onProfileStartup() {
     gDebugLog("onProfileStartup");
 
-    if (gStartingUp)
-    {
+    if (gStartingUp) {
       gStartingUp = false;
       // if checked, the "work offline" checkbox overrides
-      if (Services.io.offline && !Services.io.manageOfflineStatus)
-      {
+      if (Services.io.offline && !Services.io.manageOfflineStatus) {
         gDebugLog("already offline!");
         return;
       }
     }
 
     var manageOfflineStatus = Services.prefs.getBoolPref("offline.autoDetect");
     gOfflineStartupMode = Services.prefs.getIntPref(kOfflineStartupPref);
     let wasOffline = !Services.prefs.getBoolPref("network.online");
 
-    if (gOfflineStartupMode == kAutomatic)
-    {
+    if (gOfflineStartupMode == kAutomatic) {
       // Offline state should be managed automatically
       // so do nothing specific at startup.
-    }
-    else if (gOfflineStartupMode == kAlwaysOffline)
-    {
+    } else if (gOfflineStartupMode == kAlwaysOffline) {
       Services.io.manageOfflineStatus = false;
       Services.io.offline = true;
-    }
-    else if (gOfflineStartupMode == kAlwaysOnline)
-    {
+    } else if (gOfflineStartupMode == kAlwaysOnline) {
       Services.io.manageOfflineStatus = manageOfflineStatus;
       if (wasOffline)
         Services.prefs.setBoolPref("mailnews.playback_offline", true);
       // If we're managing the offline status, don't force online here... it may
       // be the network really is offline.
       if (!manageOfflineStatus)
         Services.io.offline = false;
-    }
-    else if (gOfflineStartupMode == kRememberLastState)
-    {
+    } else if (gOfflineStartupMode == kRememberLastState) {
       Services.io.manageOfflineStatus = manageOfflineStatus && !wasOffline;
       // If we are meant to be online, and managing the offline status
       // then don't force it - it may be the network really is offline.
       if (!manageOfflineStatus || wasOffline)
         Services.io.offline = wasOffline;
-    }
-    else if (gOfflineStartupMode == kAskForOnlineState)
-    {
+    } else if (gOfflineStartupMode == kAskForOnlineState) {
       var bundle = Services.strings.createBundle("chrome://messenger/locale/offlineStartup.properties");
       var title = bundle.GetStringFromName("title");
       var desc = bundle.GetStringFromName("desc");
       var button0Text = bundle.GetStringFromName("workOnline");
       var button1Text = bundle.GetStringFromName("workOffline");
-      var checkVal = {value:0};
+      var checkVal = {value: 0};
 
       var result = Services.prompt.confirmEx(null, title, desc,
         (Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING) +
         (Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_IS_STRING),
         button0Text, button1Text, null, null, checkVal);
       gDebugLog("result = " + result + "\n");
       Services.io.manageOfflineStatus = manageOfflineStatus && result != 1;
       Services.io.offline = result == 1;
       if (result != 1 && wasOffline)
         Services.prefs.setBoolPref("mailnews.playback_offline", true);
     }
   },
 
-  observe: function(aSubject, aTopic, aData)
-  {
+  observe(aSubject, aTopic, aData) {
     gDebugLog("observe: " + aTopic);
 
-    if (aTopic == "profile-change-net-teardown")
-    {
+    if (aTopic == "profile-change-net-teardown") {
       gDebugLog("remembering offline state");
       Services.prefs.setBoolPref("network.online", !Services.io.offline);
-    }
-    else if (aTopic == "app-startup")
-    {
+    } else if (aTopic == "app-startup") {
       Services.obs.addObserver(this, "profile-after-change");
       Services.obs.addObserver(this, "profile-change-net-teardown");
-    }
-    else if (aTopic == "profile-after-change")
-    {
+    } else if (aTopic == "profile-after-change") {
       this.onProfileStartup();
     }
   },
 
 
   QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
-}
+};
 
-function nsOfflineStartupModule()
-{
+function nsOfflineStartupModule() {
 }
 
-nsOfflineStartupModule.prototype =
-{
+nsOfflineStartupModule.prototype = {
   classID: Components.ID("3028a3c8-2165-42a4-b878-398da5d32736"),
-  _xpcom_factory:
-  {
-    createInstance: function(aOuter, aIID)
-    {
+  _xpcom_factory: {
+    createInstance(aOuter, aIID) {
       if (aOuter != null)
         throw Cr.NS_ERROR_NO_AGGREGATION;
 
       // return the singleton
       return nsOfflineStartup.QueryInterface(aIID);
     },
 
-    lockFactory: function(aLock)
-    {
+    lockFactory(aLock) {
       // quieten warnings
-    }
-  }
+    },
+  },
 };
 
 var components = [nsOfflineStartupModule];
 var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/extensions/smime/content/am-smime.js
+++ b/mailnews/extensions/smime/content/am-smime.js
@@ -26,27 +26,25 @@ var gBrandBundle;
 var gSmimePrefbranch;
 var gEncryptionChoicesLocked;
 var gSigningChoicesLocked;
 var kEncryptionCertPref = "identity.encryption_cert_name";
 var kSigningCertPref = "identity.signing_cert_name";
 
 document.addEventListener("dialogaccept", smimeOnAcceptEditor);
 
-function onInit()
-{
+function onInit() {
   smimeInitializeFields();
 }
 
-function smimeInitializeFields()
-{
+function smimeInitializeFields() {
   // initialize all of our elements based on the current identity values....
   gEncryptionCertName = document.getElementById(kEncryptionCertPref);
   gHiddenEncryptionPolicy = document.getElementById("identity.encryptionpolicy");
-  gEncryptionChoices = document.getElementById("encryptionChoices");
+  gEncryptionChoices  = document.getElementById("encryptionChoices");
   gSignCertName       = document.getElementById(kSigningCertPref);
   gSignMessages       = document.getElementById("identity.sign_mail");
   gEncryptAlways      = document.getElementById("encrypt_mail_always");
   gNeverEncrypt       = document.getElementById("encrypt_mail_never");
   gBundle             = document.getElementById("bundle_smime");
   gBrandBundle        = document.getElementById("bundle_brand");
 
   gEncryptionChoicesLocked = false;
@@ -67,141 +65,122 @@ function smimeInitializeFields()
     gSignCertName.dbKey = "";
 
     gEncryptAlways.setAttribute("disabled", true);
     gNeverEncrypt.setAttribute("disabled", true);
     gSignMessages.setAttribute("disabled", true);
 
     gSignMessages.checked = false;
     gEncryptionChoices.value = 0;
-  }
-  else {
+  } else {
     var certdb = Cc[nsX509CertDBContractID].getService(nsIX509CertDB);
     var x509cert = null;
 
     gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name");
     gEncryptionCertName.dbKey = gIdentity.getCharAttribute("encryption_cert_dbkey");
     // If we succeed in looking up the certificate by the dbkey pref, then
     // append the serial number " [...]" to the display value, and remember the
     // displayName in a separate property.
     try {
         if (certdb && gEncryptionCertName.dbKey &&
             (x509cert = certdb.findCertByDBKey(gEncryptionCertName.dbKey))) {
             gEncryptionCertName.value = x509cert.displayName + " [" + x509cert.serialNumber + "]";
             gEncryptionCertName.displayName = x509cert.displayName;
         }
-    } catch(e) {}
+    } catch (e) {}
 
     gEncryptionChoices.value = gIdentity.getIntAttribute("encryptionpolicy");
 
     if (!gEncryptionCertName.value) {
       gEncryptAlways.setAttribute("disabled", true);
       gNeverEncrypt.setAttribute("disabled", true);
-    }
-    else {
+    } else {
       enableEncryptionControls(true);
     }
 
     gSignCertName.value = gIdentity.getUnicharAttribute("signing_cert_name");
     gSignCertName.dbKey = gIdentity.getCharAttribute("signing_cert_dbkey");
     x509cert = null;
     // same procedure as with gEncryptionCertName (see above)
     try {
         if (certdb && gSignCertName.dbKey &&
             (x509cert = certdb.findCertByDBKey(gSignCertName.dbKey))) {
             gSignCertName.value = x509cert.displayName + " [" + x509cert.serialNumber + "]";
             gSignCertName.displayName = x509cert.displayName;
         }
-    } catch(e) {}
+    } catch (e) {}
 
     gSignMessages.checked = gIdentity.getBoolAttribute("sign_mail");
-    if (!gSignCertName.value)
-    {
+    if (!gSignCertName.value) {
       gSignMessages.setAttribute("disabled", true);
-    }
-    else {
+    } else {
       enableSigningControls(true);
     }
   }
 
   // Always start with enabling signing and encryption cert select buttons.
   // This will keep the visibility of buttons in a sane state as user
   // jumps from security panel of one account to another.
   enableCertSelectButtons();
 
   // Disable all locked elements on the panel
   if (gIdentity)
     onLockPreference();
 }
 
-function onPreInit(account, accountValues)
-{
+function onPreInit(account, accountValues) {
   gIdentity = account.defaultIdentity;
 }
 
-function onSave()
-{
+function onSave() {
   smimeSave();
 }
 
-function smimeSave()
-{
+function smimeSave() {
   // find out which radio for the encryption radio group is selected and set that on our hidden encryptionChoice pref....
   var newValue = gEncryptionChoices.value;
-  gHiddenEncryptionPolicy.setAttribute('value', newValue);
+  gHiddenEncryptionPolicy.setAttribute("value", newValue);
   gIdentity.setIntAttribute("encryptionpolicy", newValue);
   gIdentity.setUnicharAttribute("encryption_cert_name",
     gEncryptionCertName.displayName || gEncryptionCertName.value);
   gIdentity.setCharAttribute("encryption_cert_dbkey", gEncryptionCertName.dbKey);
 
   gIdentity.setBoolAttribute("sign_mail", gSignMessages.checked);
   gIdentity.setUnicharAttribute("signing_cert_name",
     gSignCertName.displayName || gSignCertName.value);
   gIdentity.setCharAttribute("signing_cert_dbkey", gSignCertName.dbKey);
 }
 
-function smimeOnAcceptEditor(event)
-{
-  try {
-    if (!onOk()) {
-      event.preventDefault();
-      return;
-    }
-  }
-  catch (ex) {}
-
+function smimeOnAcceptEditor(event) {
   smimeSave();
 }
 
-function onLockPreference()
-{
+function onLockPreference() {
   var initPrefString = "mail.identity";
   var finalPrefString;
 
   var allPrefElements = [
-    { prefstring:"signingCertSelectButton", id:"signingCertSelectButton"},
-    { prefstring:"encryptionCertSelectButton", id:"encryptionCertSelectButton"},
-    { prefstring:"sign_mail", id:"identity.sign_mail"},
-    { prefstring:"encryptionpolicy", id:"encryptionChoices"}
+    { prefstring: "signingCertSelectButton", id: "signingCertSelectButton" },
+    { prefstring: "encryptionCertSelectButton", id: "encryptionCertSelectButton" },
+    { prefstring: "sign_mail", id: "identity.sign_mail" },
+    { prefstring: "encryptionpolicy", id: "encryptionChoices" },
   ];
 
   finalPrefString = initPrefString + "." + gIdentity.key + ".";
   gSmimePrefbranch = Services.prefs.getBranch(finalPrefString);
 
-  disableIfLocked( allPrefElements );
+  disableIfLocked(allPrefElements);
 }
 
 
 // Does the work of disabling an element given the array which contains xul id/prefstring pairs.
 // Also saves the id/locked state in an array so that other areas of the code can avoid
 // stomping on the disabled state indiscriminately.
-function disableIfLocked( prefstrArray )
-{
-  var i;
-  for (i=0; i<prefstrArray.length; i++) {
+function disableIfLocked(prefstrArray) {
+  for (let i = 0; i < prefstrArray.length; i++) {
     var id = prefstrArray[i].id;
     var element = document.getElementById(id);
     if (gSmimePrefbranch.prefIsLocked(prefstrArray[i].prefstring)) {
       // If encryption choices radio group is locked, make sure the individual
       // choices in the group are locked. Set a global (gEncryptionChoicesLocked)
       // indicating the status so that locking can be maintained further.
       if (id == "encryptionChoices") {
         document.getElementById("encrypt_mail_never").setAttribute("disabled", "true");
@@ -209,113 +188,99 @@ function disableIfLocked( prefstrArray )
         gEncryptionChoicesLocked = true;
       }
       // If option to sign mail is locked (with true/false set in config file), disable
       // the corresponding checkbox and set a global (gSigningChoicesLocked) in order to
       // honor the locking as user changes other elements on the panel.
       if (id == "identity.sign_mail") {
         document.getElementById("identity.sign_mail").setAttribute("disabled", "true");
         gSigningChoicesLocked = true;
-      }
-      else {
+      } else {
         element.setAttribute("disabled", "true");
         if (id == "signingCertSelectButton") {
           document.getElementById("signingCertClearButton").setAttribute("disabled", "true");
-        }
-        else if (id == "encryptionCertSelectButton") {
+        } else if (id == "encryptionCertSelectButton") {
           document.getElementById("encryptionCertClearButton").setAttribute("disabled", "true");
         }
       }
     }
   }
 }
 
-function alertUser(message)
-{
+function alertUser(message) {
   Services.prompt.alert(window,
                         gBrandBundle.getString("brandShortName"),
                         message);
 }
 
-function askUser(message)
-{
+function askUser(message) {
   let button = Services.prompt.confirmEx(
     window,
     gBrandBundle.getString("brandShortName"),
     message,
     Services.prompt.STD_YES_NO_BUTTONS,
     null,
     null,
     null,
     null,
     {});
   // confirmEx returns button index:
   return (button == 0);
 }
 
-function checkOtherCert(cert, pref, usage, msgNeedCertWantSame, msgWantSame, msgNeedCertWantToSelect, enabler)
-{
+function checkOtherCert(cert, pref, usage, msgNeedCertWantSame, msgWantSame, msgNeedCertWantToSelect, enabler) {
   var otherCertInfo = document.getElementById(pref);
   if (otherCertInfo.dbKey == cert.dbKey) {
     // All is fine, same cert is now selected for both purposes.
     return;
   }
 
   var secMsg = Cc["@mozilla.org/nsCMSSecureMessage;1"]
-    .getService(Ci.nsICMSSecureMessage);
+                 .getService(Ci.nsICMSSecureMessage);
 
   var matchingOtherCert;
   if (email_recipient_cert_usage == usage) {
-    if(secMsg.canBeUsedForEmailEncryption(cert)) {
+    if (secMsg.canBeUsedForEmailEncryption(cert)) {
       matchingOtherCert = cert;
     }
-  }
-  else if (email_signing_cert_usage == usage) {
+  } else if (email_signing_cert_usage == usage) {
     if (secMsg.canBeUsedForEmailSigning(cert)) {
       matchingOtherCert = cert;
     }
-  }
-  else {
+  } else {
     throw new Error("Unexpected SECCertUsage: " + usage);
   }
 
   var userWantsSameCert = false;
   if (!otherCertInfo.value) {
     if (matchingOtherCert) {
       userWantsSameCert = askUser(gBundle.getString(msgNeedCertWantSame));
-    }
-    else {
-      if (askUser(gBundle.getString(msgNeedCertWantToSelect))) {
-        smimeSelectCert(pref);
-      }
+    } else if (askUser(gBundle.getString(msgNeedCertWantToSelect))) {
+      smimeSelectCert(pref);
     }
-  }
-  else {
-    if (matchingOtherCert) {
-      userWantsSameCert = askUser(gBundle.getString(msgWantSame));
-    }
+  } else if (matchingOtherCert) {
+    userWantsSameCert = askUser(gBundle.getString(msgWantSame));
   }
 
   if (userWantsSameCert) {
     otherCertInfo.value = cert.displayName + " [" + cert.serialNumber + "]";
     otherCertInfo.displayName = cert.displayName;
     otherCertInfo.dbKey = cert.dbKey;
     enabler(true);
   }
 }
 
-function smimeSelectCert(smime_cert)
-{
+function smimeSelectCert(smime_cert) {
   var certInfo = document.getElementById(smime_cert);
   if (!certInfo)
     return;
 
   var picker = Cc["@mozilla.org/user_cert_picker;1"]
                .createInstance(Ci.nsIUserCertPicker);
-  var canceled = new Object;
+  var canceled = {};
   var x509cert = 0;
   var certUsage;
   var selectEncryptionCert;
 
   if (smime_cert == kEncryptionCertPref) {
     selectEncryptionCert = true;
     certUsage = email_recipient_cert_usage;
   } else if (smime_cert == kSigningCertPref) {
@@ -325,34 +290,33 @@ function smimeSelectCert(smime_cert)
 
   try {
     x509cert = picker.pickByUsage(window,
       certInfo.value,
       certUsage, // this is from enum SECCertUsage
       false, true,
       gIdentity.email,
       canceled);
-  } catch(e) {
+  } catch (e) {
     canceled.value = false;
     x509cert = null;
   }
 
   if (!canceled.value) {
     if (!x509cert) {
       if (gIdentity.email) {
         alertUser(gBundle.getFormattedString(selectEncryptionCert ?
                                              "NoEncryptionCertForThisAddress" :
                                              "NoSigningCertForThisAddress",
                                              [ gIdentity.email ]));
       } else {
         alertUser(gBundle.getString(selectEncryptionCert ?
                                     "NoEncryptionCert" : "NoSigningCert"));
       }
-    }
-    else {
+    } else {
       certInfo.removeAttribute("disabled");
       certInfo.value = x509cert.displayName + " [" + x509cert.serialNumber + "]";
       certInfo.displayName = x509cert.displayName;
       certInfo.dbKey = x509cert.dbKey;
 
       if (selectEncryptionCert) {
         enableEncryptionControls(true);
 
@@ -373,69 +337,63 @@ function smimeSelectCert(smime_cert)
           enableEncryptionControls);
       }
     }
   }
 
   enableCertSelectButtons();
 }
 
-function enableEncryptionControls(do_enable)
-{
+function enableEncryptionControls(do_enable) {
   if (gEncryptionChoicesLocked)
     return;
 
   if (do_enable) {
     gEncryptAlways.removeAttribute("disabled");
     gNeverEncrypt.removeAttribute("disabled");
     gEncryptionCertName.removeAttribute("disabled");
-  }
-  else {
+  } else {
     gEncryptAlways.setAttribute("disabled", "true");
     gNeverEncrypt.setAttribute("disabled", "true");
     gEncryptionCertName.setAttribute("disabled", "true");
     gEncryptionChoices.value = 0;
   }
 }
 
-function enableSigningControls(do_enable)
-{
+function enableSigningControls(do_enable) {
   if (gSigningChoicesLocked)
     return;
 
   if (do_enable) {
     gSignMessages.removeAttribute("disabled");
     gSignCertName.removeAttribute("disabled");
-  }
-  else {
+  } else {
     gSignMessages.setAttribute("disabled", "true");
     gSignCertName.setAttribute("disabled", "true");
     gSignMessages.checked = false;
   }
 }
 
-function enableCertSelectButtons()
-{
+function enableCertSelectButtons() {
   document.getElementById("signingCertSelectButton").removeAttribute("disabled");
 
-  if (document.getElementById('identity.signing_cert_name').value.length)
+  if (document.getElementById("identity.signing_cert_name").value.length)
     document.getElementById("signingCertClearButton").removeAttribute("disabled");
   else
     document.getElementById("signingCertClearButton").setAttribute("disabled", "true");
 
   document.getElementById("encryptionCertSelectButton").removeAttribute("disabled");
 
-  if (document.getElementById('identity.encryption_cert_name').value.length)
+  if (document.getElementById("identity.encryption_cert_name").value.length)
     document.getElementById("encryptionCertClearButton").removeAttribute("disabled");
   else
     document.getElementById("encryptionCertClearButton").setAttribute("disabled", "true");
 }
 
-function smimeClearCert(smime_cert)
-{
+function smimeClearCert(smime_cert) {
   var certInfo = document.getElementById(smime_cert);
   if (!certInfo)
     return;
 
   certInfo.setAttribute("disabled", "true");
   certInfo.value = "";
   certInfo.displayName = "";
   certInfo.dbKey = "";
@@ -444,40 +402,37 @@ function smimeClearCert(smime_cert)
     enableEncryptionControls(false);
   } else if (smime_cert == kSigningCertPref) {
     enableSigningControls(false);
   }
 
   enableCertSelectButtons();
 }
 
-function openCertManager()
-{
+function openCertManager() {
   // Check for an existing certManager window and focus it; it's not
   // application modal.
   let lastCertManager = Services.wm.getMostRecentWindow("mozilla:certmanager");
   if (lastCertManager)
     lastCertManager.focus();
   else
     window.openDialog("chrome://pippki/content/certManager.xul", "",
                       "centerscreen,resizable=yes,dialog=no");
 }
 
-function openDeviceManager()
-{
+function openDeviceManager() {
   // Check for an existing deviceManager window and focus it; it's not
   // application modal.
   let lastCertManager = Services.wm.getMostRecentWindow("mozilla:devicemanager");
   if (lastCertManager)
     lastCertManager.focus();
   else
     window.openDialog("chrome://pippki/content/device_manager.xul", "",
                       "centerscreen,resizable=yes,dialog=no");
 }
 
-function smimeOnLoadEditor()
-{
+function smimeOnLoadEditor() {
   smimeInitializeFields();
 
   document.documentElement.setAttribute("ondialogaccept",
                                         "return smimeOnAcceptEditor();");
 }
 
--- a/mailnews/extensions/smime/content/certFetchingStatus.js
+++ b/mailnews/extensions/smime/content/certFetchingStatus.js
@@ -24,32 +24,29 @@ var gDirectoryPref;
 var gLdapServerURL;
 var gLdapConnection;
 var gCertDB;
 var gLdapOperation;
 var gLogin;
 
 document.addEventListener("dialogcancel", stopFetching);
 
-function onLoad()
-{
+function onLoad() {
   gDirectoryPref = window.arguments[0];
   gEmailAddresses = window.arguments[1];
 
-  if (!gEmailAddresses.length)
-  {
+  if (!gEmailAddresses.length) {
     window.close();
     return;
   }
 
   setTimeout(search, 1);
 }
 
-function search()
-{
+function search() {
   // get the login to authenticate as, if there is one
   try {
     gLogin = Services.prefs.getStringPref(gDirectoryPref + ".auth.dn");
   } catch (ex) {
     // if we don't have this pref, no big deal
   }
 
   try {
@@ -58,105 +55,94 @@ function search()
     gLdapServerURL = Services.io
       .newURI(url).QueryInterface(Ci.nsILDAPURL);
 
     gLdapConnection = Cc["@mozilla.org/network/ldap-connection;1"]
       .createInstance().QueryInterface(Ci.nsILDAPConnection);
 
     gLdapConnection.init(gLdapServerURL, gLogin, new boundListener(),
       null, Ci.nsILDAPConnection.VERSION3);
-
   } catch (ex) {
     dump(ex);
     dump(" exception creating ldap connection\n");
     window.close();
   }
 }
 
-function stopFetching()
-{
+function stopFetching() {
   if (gLdapOperation) {
     try {
       gLdapOperation.abandon();
-    }
-    catch (e) {
+    } catch (e) {
     }
   }
 }
 
-function importCert(ber_value)
-{
+function importCert(ber_value) {
   if (!gCertDB) {
     gCertDB = Cc[nsX509CertDB].getService(nsIX509CertDB);
   }
 
-  var cert_length = new Object();
+  var cert_length = {};
   var cert_bytes = ber_value.get(cert_length);
 
   if (cert_bytes) {
     gCertDB.importEmailCertificate(cert_bytes, cert_length.value, null);
   }
 }
 
-function getLDAPOperation()
-{
-    gLdapOperation = Cc["@mozilla.org/network/ldap-operation;1"]
-      .createInstance().QueryInterface(Ci.nsILDAPOperation);
+function getLDAPOperation() {
+  gLdapOperation = Cc["@mozilla.org/network/ldap-operation;1"]
+                     .createInstance(Ci.nsILDAPOperation);
 
-    gLdapOperation.init(gLdapConnection,
-                        new ldapMessageListener(),
-                        null);
+  gLdapOperation.init(gLdapConnection,
+                      new ldapMessageListener(),
+                      null);
 }
 
-function getPassword()
-{
+function getPassword() {
   // we only need a password if we are using credentials
-  if (gLogin)
-  {
+  if (gLogin) {
     let authPrompter = Services.ww.getNewAuthPrompter(window.QueryInterface(Ci.nsIDOMWindow));
-    let strBundle = document.getElementById('bundle_ldap');
+    let strBundle = document.getElementById("bundle_ldap");
     let password = { value: "" };
 
     // nsLDAPAutocompleteSession uses asciiHost instead of host for the prompt text, I think we should be
     // consistent.
     if (authPrompter.promptPassword(strBundle.getString("authPromptTitle"),
                                      strBundle.getFormattedString("authPromptText", [gLdapServerURL.asciiHost]),
                                      gLdapServerURL.spec,
                                      authPrompter.SAVE_PASSWORD_PERMANENTLY,
                                      password))
       return password.value;
   }
 
   return null;
 }
 
-function kickOffBind()
-{
+function kickOffBind() {
   try {
     getLDAPOperation();
     gLdapOperation.simpleBind(getPassword());
-  }
-  catch (e) {
+  } catch (e) {
     window.close();
   }
 }
 
-function kickOffSearch()
-{
+function kickOffSearch() {
   try {
     var prefix1 = "";
     var suffix1 = "";
 
     var urlFilter = gLdapServerURL.filter;
 
     if (urlFilter != null && urlFilter.length > 0 && urlFilter != "(objectclass=*)") {
-      if (urlFilter.startsWith('(')) {
+      if (urlFilter.startsWith("(")) {
         prefix1 = "(&" + urlFilter;
-      }
-      else {
+      } else {
         prefix1 = "(&(" + urlFilter + ")";
       }
       suffix1 = ")";
     }
 
     var prefix2 = "";
     var suffix2 = "";
 
@@ -182,37 +168,33 @@ function kickOffSearch()
     // Maybe that number should be larger, to allow for deployments,
     // where even more certs can be stored per user???
 
     var maxEntriesWanted = gEmailAddresses.length * 2;
 
     getLDAPOperation();
     gLdapOperation.searchExt(gLdapServerURL.dn, gLdapServerURL.scope,
                              filter, wanted_attributes, 0, maxEntriesWanted);
-  }
-  catch (e) {
+  } catch (e) {
     window.close();
   }
 }
 
 
 function boundListener() {
 }
 
 boundListener.prototype.QueryInterface =
   ChromeUtils.generateQI(["nsILDAPMessageListener"]);
 
-boundListener.prototype.onLDAPMessage =
-  function(aMessage) {
-  }
+boundListener.prototype.onLDAPMessage = function(aMessage) {};
 
-boundListener.prototype.onLDAPInit =
-  function(aConn, aStatus) {
-    kickOffBind();
-  }
+boundListener.prototype.onLDAPInit = function(aConn, aStatus) {
+  kickOffBind();
+};
 
 
 function ldapMessageListener() {
 }
 
 ldapMessageListener.prototype.QueryInterface =
   ChromeUtils.generateQI(["nsILDAPMessageListener"]);
 
@@ -221,34 +203,30 @@ ldapMessageListener.prototype.onLDAPMess
     if (Ci.nsILDAPMessage.RES_SEARCH_RESULT == aMessage.type) {
       window.close();
       return;
     }
 
     if (Ci.nsILDAPMessage.RES_BIND == aMessage.type) {
       if (Ci.nsILDAPErrors.SUCCESS != aMessage.errorCode) {
         window.close();
-      }
-      else {
+      } else {
         kickOffSearch();
       }
       return;
     }
 
     if (Ci.nsILDAPMessage.RES_SEARCH_ENTRY == aMessage.type) {
-      var outSize = new Object();
+      var outSize = {};
       try {
         var outBinValues = aMessage.getBinaryValues(CertAttribute, outSize);
 
-        var i;
-        for (i=0; i < outSize.value; ++i) {
+        for (let i = 0; i < outSize.value; ++i) {
           importCert(outBinValues[i]);
         }
-      }
-      catch (e) {
+      } catch (e) {
       }
-      return;
     }
-  }
+  };
 
 ldapMessageListener.prototype.onLDAPInit =
   function(aConn, aStatus) {
-  }
+  };
--- a/mailnews/extensions/smime/content/certpicker.js
+++ b/mailnews/extensions/smime/content/certpicker.js
@@ -7,18 +7,17 @@
 const nsIDialogParamBlock = Ci.nsIDialogParamBlock;
 
 var dialogParams;
 var itemCount = 0;
 
 document.addEventListener("dialogaccept", doOK);
 document.addEventListener("dialogcancel", doCancel);
 
-function onLoad()
-{
+function onLoad() {
   dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
 
   var selectElement = document.getElementById("nicknames");
   itemCount = dialogParams.GetInt(0);
 
   var selIndex = dialogParams.GetInt(1);
   if (selIndex < 0) {
     selIndex = 0;
@@ -35,40 +34,36 @@ function onLoad()
       selectElement.selectedItem = menuItemNode;
     }
   }
 
   dialogParams.SetInt(0, 0); // Set cancel return value.
   setDetails();
 }
 
-function setDetails()
-{
+function setDetails() {
   let selItem = document.getElementById("nicknames").value;
   if (selItem.length == 0) {
     return;
   }
 
   let index = parseInt(selItem);
   let details = dialogParams.GetString(index + itemCount);
   document.getElementById("details").value = details;
 }
 
-function onCertSelected()
-{
+function onCertSelected() {
   setDetails();
 }
 
-function doOK()
-{
+function doOK() {
   // Signal that the user accepted.
   dialogParams.SetInt(0, 1);
 
   // Signal the index of the selected cert in the list of cert nicknames
   // provided.
   let index = parseInt(document.getElementById("nicknames").value);
   dialogParams.SetInt(1, index);
 }
 
-function doCancel()
-{
+function doCancel() {
   dialogParams.SetInt(0, 0); // Signal that the user cancelled.
 }
--- a/mailnews/extensions/smime/content/msgCompSecurityInfo.js
+++ b/mailnews/extensions/smime/content/msgCompSecurityInfo.js
@@ -13,169 +13,142 @@ var gCertIssuedInfos;
 var gCertExpiresInfos;
 var gCerts;
 var gCount;
 
 var gSMimeContractID = "@mozilla.org/messenger-smime/smimejshelper;1";
 var gISMimeJSHelper = Ci.nsISMimeJSHelper;
 var gIX509Cert = Ci.nsIX509Cert;
 var nsICertificateDialogs = Ci.nsICertificateDialogs;
-var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
+var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1";
 
-function onLoad()
-{
+function onLoad() {
   var params = window.arguments[0];
   if (!params)
     return;
 
   var helper = Cc[gSMimeContractID].createInstance(gISMimeJSHelper);
 
   if (!helper)
     return;
 
   gListBox = document.getElementById("infolist");
   gViewButton = document.getElementById("viewCertButton");
   gBundle = document.getElementById("bundle_smime_comp_info");
 
-  gEmailAddresses = new Object();
-  gCertIssuedInfos = new Object();
-  gCertExpiresInfos = new Object();
-  gCerts = new Object();
-  gCount = new Object();
-  var canEncrypt = new Object();
+  gEmailAddresses = {};
+  gCertIssuedInfos = {};
+  gCertExpiresInfos = {};
+  gCerts = {};
+  gCount = {};
+  var canEncrypt = {};
 
   var allow_ldap_cert_fetching = params.smFields.requireEncryptMessage;
 
-  while (true)
-  {
-    try
-    {
+  while (true) {
+    try {
       helper.getRecipientCertsInfo(
         params.compFields,
         gCount,
         gEmailAddresses,
         {}, // certStatusSummaries - provide no useful info anymore
         gCertIssuedInfos,
         gCertExpiresInfos,
         gCerts,
         canEncrypt);
-    }
-    catch (e)
-    {
+    } catch (e) {
       dump(e);
       return;
     }
 
     if (!allow_ldap_cert_fetching)
       break;
 
     allow_ldap_cert_fetching = false;
 
-    var missing = new Array();
+    var missing = [];
 
-    for (var j = gCount.value - 1; j >= 0; --j)
-    {
-      if (!gCerts.value[j])
-      {
+    for (let j = gCount.value - 1; j >= 0; --j) {
+      if (!gCerts.value[j]) {
         missing[missing.length] = gEmailAddresses.value[j];
       }
     }
 
-    if (missing.length > 0)
-    {
+    if (missing.length > 0) {
       var autocompleteLdap = Services.prefs
         .getBoolPref("ldap_2.autoComplete.useDirectory");
 
-      if (autocompleteLdap)
-      {
+      if (autocompleteLdap) {
         var autocompleteDirectory = null;
         if (params.currentIdentity.overrideGlobalPref) {
           autocompleteDirectory = params.currentIdentity.directoryServer;
         } else {
           autocompleteDirectory = Services.prefs
             .getCharPref("ldap_2.autoComplete.directoryServer");
         }
 
-        if (autocompleteDirectory)
-        {
-          window.openDialog('chrome://messenger-smime/content/certFetchingStatus.xul',
-            '',
-            'chrome,resizable=1,modal=1,dialog=1',
+        if (autocompleteDirectory) {
+          window.openDialog("chrome://messenger-smime/content/certFetchingStatus.xul",
+            "",
+            "chrome,resizable=1,modal=1,dialog=1",
             autocompleteDirectory,
             missing
           );
         }
       }
     }
   }
 
-  if (gBundle)
-  {
+  if (gBundle) {
     var yes_string = gBundle.getString("StatusYes");
     var no_string = gBundle.getString("StatusNo");
     var not_possible_string = gBundle.getString("StatusNotPossible");
 
     var signed_element = document.getElementById("signed");
     var encrypted_element = document.getElementById("encrypted");
 
-    if (params.smFields.requireEncryptMessage)
-    {
-      if (params.isEncryptionCertAvailable && canEncrypt.value)
-      {
+    if (params.smFields.requireEncryptMessage) {
+      if (params.isEncryptionCertAvailable && canEncrypt.value) {
         encrypted_element.value = yes_string;
-      }
-      else
-      {
+      } else {
         encrypted_element.value = not_possible_string;
       }
-    }
-    else
-    {
+    } else {
       encrypted_element.value = no_string;
     }
 
-    if (params.smFields.signMessage)
-    {
-      if (params.isSigningCertAvailable)
-      {
+    if (params.smFields.signMessage) {
+      if (params.isSigningCertAvailable) {
         signed_element.value = yes_string;
-      }
-      else
-      {
+      } else {
         signed_element.value = not_possible_string;
       }
-    }
-    else
-    {
+    } else {
       signed_element.value = no_string;
     }
   }
 
   var imax = gCount.value;
 
-  for (var i = 0; i < imax; ++i)
-  {
+  for (let i = 0; i < imax; ++i) {
     let email = document.createElement("label");
     email.setAttribute("value", gEmailAddresses.value[i]);
     email.setAttribute("crop", "end");
     email.setAttribute("style", "width: var(--recipientWidth)");
 
     let listitem = document.createElement("richlistitem");
     listitem.appendChild(email);
 
-    if (!gCerts.value[i])
-    {
+    if (!gCerts.value[i]) {
       let notFound = document.createElement("label");
       notFound.setAttribute("value", gBundle.getString("StatusNotFound"));
       notFound.setAttribute("style", "width: var(--statusWidth)");
 
       listitem.appendChild(notFound);
-    }
-    else
-    {
+    } else {
       let status = document.createElement("label");
       status.setAttribute("value", "?"); // temporary placeholder
       status.setAttribute("crop", "end");
       status.setAttribute("style", "width: var(--statusWidth)");
       let issued = document.createElement("label");
       issued.setAttribute("value", gCertIssuedInfos.value[i]);
       issued.setAttribute("crop", "end");
       issued.setAttribute("style", "width: var(--issuedWidth)");
@@ -269,40 +242,37 @@ function asyncDetermineUsages(cert) {
                     chain: aVerifiedChain });
         });
     }));
   });
   return Promise.all(promises);
 }
 // --- /borrowed from pippki.js ---
 
-function onSelectionChange(event)
-{
+function onSelectionChange(event) {
   gViewButton.disabled = !(gListBox.selectedItems.length == 1 &&
                            certForRow(gListBox.selectedIndex));
 }
 
 function viewCertHelper(parent, cert) {
   Services.ww.openWindow(parent, "chrome://pippki/content/certViewer.xul",
                          "_blank", "centerscreen,chrome,titlebar", cert);
 }
 
 function certForRow(aRowIndex) {
   return gCerts.value[aRowIndex];
 }
 
-function viewSelectedCert()
-{
+function viewSelectedCert() {
   if (!gViewButton.disabled)
     viewCertHelper(window, certForRow(gListBox.selectedIndex));
 }
 
-function doHelpButton()
-{
-  openHelp('compose_security', 'chrome://communicator/locale/help/suitehelp.rdf');
+/* globals openHelp */// Suite only.
+function doHelpButton() {
+  openHelp("compose_security", "chrome://communicator/locale/help/suitehelp.rdf");
 }
 
-function createCell(label)
-{
+function createCell(label) {
   var cell = document.createElement("listcell");
-  cell.setAttribute("label", label)
+  cell.setAttribute("label", label);
   return cell;
 }
--- a/mailnews/extensions/smime/content/msgReadSMIMEOverlay.js
+++ b/mailnews/extensions/smime/content/msgReadSMIMEOverlay.js
@@ -1,53 +1,49 @@
 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+/* globals gDBView, GetNumSelectedMessages */
+
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gEncryptionStatus = -1;
 var gSignatureStatus = -1;
 var gSignerCert = null;
 var gEncryptionCert = null;
 
 addEventListener("load", smimeReadOnLoad, {capture: false, once: true});
 
-function smimeReadOnLoad()
-{
+function smimeReadOnLoad() {
   top.controllers.appendController(SecurityController);
 
   addEventListener("unload", smimeReadOnUnload, {capture: false, once: true});
 }
 
-function smimeReadOnUnload()
-{
+function smimeReadOnUnload() {
   top.controllers.removeController(SecurityController);
 }
 
-function showImapSignatureUnknown()
-{
+function showImapSignatureUnknown() {
   let readSmimeBundle = document.getElementById("bundle_read_smime");
   let brandBundle = document.getElementById("bundle_brand");
   if (!readSmimeBundle || !brandBundle)
     return;
 
   if (Services.prompt.confirm(window, brandBundle.getString("brandShortName"),
-                              readSmimeBundle.getString("ImapOnDemand")))
-  {
+                              readSmimeBundle.getString("ImapOnDemand"))) {
     gDBView.reloadMessageWithAllParts();
   }
 }
 
-function showMessageReadSecurityInfo()
-{
+function showMessageReadSecurityInfo() {
   let gSignedUINode = document.getElementById("signedHdrIcon");
-  if (gSignedUINode && gSignedUINode.getAttribute("signed") == "unknown")
-  {
+  if (gSignedUINode && gSignedUINode.getAttribute("signed") == "unknown") {
     showImapSignatureUnknown();
     return;
   }
 
   let params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
     .createInstance(Ci.nsIDialogParamBlock);
   params.objects = Cc["@mozilla.org/array;1"]
     .createInstance(Ci.nsIMutableArray);
@@ -58,45 +54,39 @@ function showMessageReadSecurityInfo()
   // int array starts with index 0, but that is used for window exit status
   params.SetInt(1, gSignatureStatus);
   params.SetInt(2, gEncryptionStatus);
 
   window.openDialog("chrome://messenger-smime/content/msgReadSecurityInfo.xul",
                     "", "chrome,resizable,modal,dialog,centerscreen", params);
 }
 
-var SecurityController =
-{
-  supportsCommand: function(command)
-  {
-    switch (command)
-    {
+var SecurityController = {
+  supportsCommand(command) {
+    switch (command) {
       case "cmd_viewSecurityStatus":
         return true;
 
       default:
         return false;
     }
   },
 
-  isCommandEnabled: function(command)
-  {
-    switch (command)
-    {
+  isCommandEnabled(command) {
+    switch (command) {
       case "cmd_viewSecurityStatus":
-        if (document.documentElement.getAttribute('windowtype') == "mail:messageWindow")
+        if (document.documentElement.getAttribute("windowtype") == "mail:messageWindow")
           return GetNumSelectedMessages() > 0;
 
-        if (GetNumSelectedMessages() > 0 && gDBView)
-        {
+        if (GetNumSelectedMessages() > 0 && gDBView) {
           let enabled = {value: false};
           let checkStatus = {};
           gDBView.getCommandStatus(Ci.nsMsgViewCommandType.cmdRequiringMsgBody,
                                    enabled, checkStatus);
           return enabled.value;
         }
         // else: fall through.
 
       default:
         return false;
     }
-  }
+  },
 };
--- a/mailnews/extensions/smime/content/msgReadSecurityInfo.js
+++ b/mailnews/extensions/smime/content/msgReadSecurityInfo.js
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var nsIDialogParamBlock = Ci.nsIDialogParamBlock;
 var nsIX509Cert = Ci.nsIX509Cert;
 var nsICMSMessageErrors = Ci.nsICMSMessageErrors;
 var nsICertificateDialogs = Ci.nsICertificateDialogs;
-var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
+var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1";
 
 var gSignerCert = null;
 var gEncryptionCert = null;
 
 var gSignatureStatus = -1;
 var gEncryptionStatus = -1;
 
 function setText(id, value) {
@@ -22,26 +22,26 @@ function setText(id, value) {
   if (!element)
     return;
   if (element.hasChildNodes())
     element.firstChild.remove();
   var textNode = document.createTextNode(value);
   element.appendChild(textNode);
 }
 
-function onLoad()
-{
+/* eslint-disable complexity */
+function onLoad() {
   var paramBlock = window.arguments[0].QueryInterface(nsIDialogParamBlock);
   paramBlock.objects.QueryInterface(Ci.nsIMutableArray);
   try {
     gSignerCert = paramBlock.objects.queryElementAt(0, nsIX509Cert);
-  } catch(e) { } // maybe null
+  } catch (e) { } // maybe null
   try {
     gEncryptionCert = paramBlock.objects.queryElementAt(1, nsIX509Cert);
-  } catch(e) { } // maybe null
+  } catch (e) { } // maybe null
 
   gSignatureStatus = paramBlock.GetInt(1);
   gEncryptionStatus = paramBlock.GetInt(2);
 
   var bundle = document.getElementById("bundle_smime_read_info");
 
   if (bundle) {
     var sigInfoLabel = null;
@@ -122,18 +122,17 @@ function onLoad()
       label = document.getElementById("signatureHeader");
       label.collapsed = false;
       label.value = bundle.getString(sigInfoHeader);
     }
 
     var str;
     if (sigInfo) {
       str = bundle.getString(sigInfo);
-    }
-    else if (sigInfo_clueless) {
+    } else if (sigInfo_clueless) {
       str = bundle.getString("SIClueless") + " (" + gSignatureStatus + ")";
     }
     setText("signatureExplanation", str);
 
     var encInfoLabel = null;
     var encInfoHeader = null;
     var encInfo = null;
     var encInfo_clueless = false;
@@ -170,18 +169,17 @@ function onLoad()
     if (encInfoHeader) {
       label = document.getElementById("encryptionHeader");
       label.collapsed = false;
       label.value = bundle.getString(encInfoHeader);
     }
 
     if (encInfo) {
       str = bundle.getString(encInfo);
-    }
-    else if (encInfo_clueless) {
+    } else if (encInfo_clueless) {
       str = bundle.getString("EIClueless");
     }
     setText("encryptionExplanation", str);
   }
 
   if (gSignerCert) {
     document.getElementById("signatureCert").collapsed = false;
     if (gSignerCert.subjectName) {
@@ -203,32 +201,31 @@ function onLoad()
     if (gEncryptionCert.emailAddress) {
       document.getElementById("recipientEmail").value = gEncryptionCert.emailAddress;
     }
     if (gEncryptionCert.issuerName) {
       document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;
     }
   }
 }
+/* eslint-enable complexity */
 
 function viewCertHelper(parent, cert) {
   Services.ww.openWindow(parent, "chrome://pippki/content/certViewer.xul",
                          "_blank", "centerscreen,chrome,titlebar", cert);
 }
 
-function viewSignatureCert()
-{
+function viewSignatureCert() {
   if (gSignerCert) {
     viewCertHelper(window, gSignerCert);
   }
 }
 
-function viewEncryptionCert()
-{
+function viewEncryptionCert() {
   if (gEncryptionCert) {
     viewCertHelper(window, gEncryptionCert);
   }
 }
 
-function doHelpButton()
-{
-  openHelp('received_security');
+/* globals openHelp */// Suite only.
+function doHelpButton() {
+  openHelp("received_security");
 }
--- a/mailnews/extensions/smime/content/smime.js
+++ b/mailnews/extensions/smime/content/smime.js
@@ -1,14 +1,12 @@
 /* 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/. */
 
 /*
    Add any default pref values we want for smime
 */
 
-pref("mail.identity.default.encryption_cert_name","");
-pref("mail.identity.default.encryptionpolicy",  0);
+pref("mail.identity.default.encryption_cert_name", "");
+pref("mail.identity.default.encryptionpolicy", 0);
 pref("mail.identity.default.signing_cert_name", "");
 pref("mail.identity.default.sign_mail", false);
-
-
--- a/mailnews/extensions/smime/src/smime-service.js
+++ b/mailnews/extensions/smime/src/smime-service.js
@@ -5,17 +5,17 @@
 
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function SMIMEService() {}
 
 SMIMEService.prototype = {
   name: "smime",
   chromePackageName: "messenger",
-  showPanel: function(server) {
+  showPanel(server) {
     // don't show the panel for news, rss, or local accounts
     return (server.type != "nntp" && server.type != "rss" &&
             server.type != "im" && server.type != "none");
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
   classID: Components.ID("{f2809796-1dd1-11b2-8c1b-8f15f007c699}"),
 };