Bug 700535 - Add ability to pref off Account Provisioner feature. r=bwinton.
authorMike Conley <mconley@mozilla.com>
Tue, 08 Nov 2011 13:51:09 -0500
changeset 9174 79673156553b919c8aabd6b9d84eac7fd13e1b89
parent 9173 e8073cc15e83ce8af411118012b019dea727c86a
child 9175 9a930641d132dbeccb9e54478da709ed34d12629
push id240
push userbugzilla@standard8.plus.com
push dateTue, 08 Nov 2011 23:21:56 +0000
treeherdercomm-aurora@3ab51e6a98c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton
bugs700535
Bug 700535 - Add ability to pref off Account Provisioner feature. r=bwinton.
mail/app/profile/all-thunderbird.js
mail/base/content/mailWindowOverlay.js
mail/base/content/msgMail3PaneWindow.js
mail/test/mozmill/newmailaccount/test-newmailaccount.js
mailnews/base/prefs/content/accountcreation/emailWizard.js
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -729,16 +729,17 @@ pref("plugins.crash.supportUrl", "https:
 #ifdef XP_WIN
 pref("mail.taskbar.lists.enabled", true);
 pref("mail.taskbar.lists.tasks.enabled", true);
 #endif
 
 // Account provisioner.
 pref("mail.provider.providerList", "https://broker-live.mozillamessaging.com/provider/list");
 pref("mail.provider.suggestFromName", "https://broker-live.mozillamessaging.com/provider/suggest");
+pref("mail.provider.enabled", true);
 
 pref("mail.websearch.open_externally", false);
 
 // Pointer to the default engine name.
 pref("browser.search.defaultenginename", "chrome://messenger-region/locale/region.properties");
 
 // Ordering of search engines in the engine list.
 pref("browser.search.order.1", "chrome://messenger-region/locale/region.properties");
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -92,20 +92,25 @@ var gMarkViewedMessageAsReadTimer = null
 
 // the user preference,
 // if HTML is not allowed. I assume, that the user could have set this to a
 // value > 1 in his prefs.js or user.js, but that the value will not
 // change during runtime other than through the MsgBody*() functions below.
 var gDisallow_classes_no_html = 1;
 
 // Disable the new account menu item if the account preference is locked.
-// Two other affected areas are the account central and the account manager
-// dialog.
+// The other affected areas are the account central, the account manager
+// dialog, and the account provisioner window.
 function menu_new_init()
 {
+  // If the account provisioner is pref'd off, we shouldn't display the menu
+  // item.
+  ShowMenuItem("newCreateEmailAccountMenuItem",
+               gPrefBranch.getBoolPref("mail.provider.enabled"));
+
   // If we don't have a gFolderDisplay, just get out of here and leave the menu
   // as it is.
   if (!gFolderDisplay)
     return;
 
   let folder = gFolderDisplay.displayedFolder;
   if (!folder)
     return;
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -314,17 +314,20 @@ const MailPrefObserver = {
   }
 };
 
 /**
  * Called on startup if there are no accounts.
  */
 function AutoConfigWizard(okCallback)
 {
-  NewMailAccountProvisioner(msgWindow, { okCallback: okCallback });
+  if (gPrefBranch.getBoolPref("mail.provider.enabled"))
+    NewMailAccountProvisioner(msgWindow, { okCallback: okCallback });
+  else
+    NewMailAccount(msgWindow, okCallback);
 }
 
 /**
  * Called on startup to initialize various parts of the main window
  */
 function OnLoadMessenger()
 {
   migrateMailnews();
--- a/mail/test/mozmill/newmailaccount/test-newmailaccount.js
+++ b/mail/test/mozmill/newmailaccount/test-newmailaccount.js
@@ -59,28 +59,41 @@ Cu.import("resource:///modules/mailServi
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 var url = collector.addHttpResource('../newmailaccount/html', '');
 Services.prefs.setCharPref("mail.provider.providerList", url + "providerList");
 Services.prefs.setCharPref("mail.provider.suggestFromName", url + "suggestFromName");
 
 const kProvisionerUrl = "chrome://messenger/content/newmailaccount/accountProvisioner.xhtml";
+const kProvisionerEnabledPref = "mail.provider.enabled";
+
+// Record what the original value of the mail.provider.enabled pref is so
+// that we can put it back once the tests are done.
+var gProvisionerEnabled = Services.prefs.getBoolPref(kProvisionerEnabledPref);
 
 var setupModule = function(module) {
   let fdh = collector.getModule('folder-display-helpers');
   fdh.installInto(module);
   let cth = collector.getModule('content-tab-helpers');
   cth.installInto(module);
   let dh = collector.getModule('dom-helpers');
   dh.installInto(module);
   let wh = collector.getModule('window-helpers');
   wh.installInto(module);
+
+  // Make sure we enable the Account Provisioner.
+  Services.prefs.setBoolPref(kProvisionerEnabledPref, true);
 };
 
+function teardownModule(module) {
+  // Put the mail.provider.enabled pref back the way it was.
+  Services.prefs.setBoolPref(kProvisionerEnabledPref, gProvisionerEnabled);
+}
+
 // We can't use plan_for_new_window because it expects a window type and I have
 // no idea what on earth is the windowtype of an HTML window.
 function get_provisioner_window() {
   let wm = Services.wm;
   let windows = [w for each (w in fixIterator(wm.getEnumerator("")))];
   windows = windows.filter(function (window) window.document.location.href == kProvisionerUrl);
   return windows.length == 1 ? windows[0] : null;
 }
--- a/mailnews/base/prefs/content/accountcreation/emailWizard.js
+++ b/mailnews/base/prefs/content/accountcreation/emailWizard.js
@@ -207,16 +207,21 @@ EmailConfigWizard.prototype =
     setLabelFromStringBundle("out-authMethod-password-encrypted",
         "authPasswordEncrypted");
     setLabelFromStringBundle("out-authMethod-kerberos", "authKerberos");
     setLabelFromStringBundle("out-authMethod-ntlm", "authNTLM");
 
     e("incoming_port").value = gStringsBundle.getString("port_auto");
     this.fillPortDropdown("smtp");
 
+    // If the account provisioner is preffed off, don't display
+    // the account provisioner button.
+    if (!Services.prefs.getBoolPref("mail.provider.enabled"))
+      _hide("provisioner_button");
+
     // Populate SMTP server dropdown with already configured SMTP servers from
     // other accounts.
     var menulist = e("outgoing_hostname");
     var smtpManager = Cc["@mozilla.org/messengercompose/smtp;1"]
         .getService(Ci.nsISmtpService);
     var smtpServers = smtpManager.smtpServers;
     while (smtpServers.hasMoreElements()) {
       let server = smtpServers.getNext().QueryInterface(Ci.nsISmtpServer);