Avoid putting an exception log on the console output when no accounts exist, Bug 558607, r=bienvenu, sr=standard8
authorBen Bucksch <ben.bucksch@beonex.com>
Wed, 14 Apr 2010 13:21:20 +0200
changeset 5438 1f508d2cf9057b427156cd2e51f27ae6bb53aee6
parent 5437 598c45ea36a05e61e119c8c2b67cb7e7badc0225
child 5439 ac35d3b6584e3bc6bc7bd402ece51cb8a9e1acb7
push idunknown
push userunknown
push dateunknown
reviewersbienvenu, standard8
bugs558607
Avoid putting an exception log on the console output when no accounts exist, Bug 558607, r=bienvenu, sr=standard8 Add empty prefs for accounts list and smtp servers list
mailnews/base/util/mailnewsMigrator.js
mailnews/mailnews.js
--- a/mailnews/base/util/mailnewsMigrator.js
+++ b/mailnews/base/util/mailnewsMigrator.js
@@ -67,16 +67,18 @@ function MigrateServerAuthPref()
 {
   try {
     // comma-separated list of all accounts.
     var accounts = gPrefs.getCharPref("mail.accountmanager.accounts")
         .split(",");
     for (let i = 0; i < accounts.length; i++)
     {
       let accountKey = accounts[i]; // e.g. "account1"
+      if (!accountKey)
+        continue;
       let serverKey = gPrefs.getCharPref("mail.account." + accountKey +
          ".server");
       let server = "mail.server." + serverKey + ".";
       if (gPrefs.prefHasUserValue(server + "authMethod"))
         continue;
       if (!gPrefs.prefHasUserValue(server + "useSecAuth") &&
           !gPrefs.prefHasUserValue(server + "auth_login"))
         continue;
@@ -98,16 +100,18 @@ function MigrateServerAuthPref()
                            Ci.nsMsgAuthMethod.passwordCleartext) :
                        Ci.nsMsgAuthMethod.old);
     }
 
     // same again for SMTP servers
     var smtpservers = gPrefs.getCharPref("mail.smtpservers").split(",");
     for (let i = 0; i < smtpservers.length; i++)
     {
+      if (!smtpservers[i])
+        continue;
       let server = "mail.smtpserver." + smtpservers[i] + ".";
       if (gPrefs.prefHasUserValue(server + "authMethod"))
         continue;
       if (!gPrefs.prefHasUserValue(server + "useSecAuth") &&
           !gPrefs.prefHasUserValue(server + "auth_method"))
         continue;
       // auth_method = 0 => no auth
       // else: useSecAuth = true => "secure auth"
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -444,16 +444,19 @@ pref("mail.collect_email_address_newsgro
 #endif
 pref("mail.collect_email_address_outgoing", true);
 
 // by default, use the Collected Addressbook for collection
 pref("mail.collect_addressbook", "moz-abmdbdirectory://history.mab");
 
 pref("mail.default_sendlater_uri", "mailbox://nobody@Local%20Folders/Unsent%20Messages");
 
+pref("mail.smtpservers", "");
+pref("mail.accountmanager.accounts", "");
+
 pref("mail.server.default.port", -1);
 pref("mail.server.default.offline_support_level", -1);
 pref("mail.server.default.leave_on_server", false);
 pref("mail.server.default.download_on_biff", false);
 pref("mail.server.default.check_time", 10);
 pref("mail.server.default.delete_by_age_from_server", false);
 pref("mail.server.default.num_days_to_leave_on_server", 7);
 pref("mail.server.default.dot_fix", true);