Part of bug 511079. If send in background is turned on, don't send in background if the compose window is the last window open on Linux and Windows, to ensure that the message is sent. r=Standard8
authorDavid Bienvenu <mozilla@davidbienvenu.org>
Thu, 01 Nov 2012 13:58:51 +0000
changeset 11428 2c2b7ad3bed3899a752f0e96ce7330f175d244ff
parent 11427 9494ce4e9eff564721f4f13924b0910119a00323
child 11429 d94324488af96b29092578783c603a6aba2e6a8b
push id8541
push userbugzilla@standard8.plus.com
push dateThu, 01 Nov 2012 13:59:06 +0000
treeherdercomm-central@2c2b7ad3bed3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs511079
Part of bug 511079. If send in background is turned on, don't send in background if the compose window is the last window open on Linux and Windows, to ensure that the message is sent. r=Standard8
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2936,19 +2936,27 @@ function CheckValidEmailAddress(to, cc, 
     return false;
   }
   return true;
 }
 
 function SendMessage()
 {
   let sendInBackground =
-    Components.classes["@mozilla.org/preferences-service;1"]
-              .getService(Components.interfaces.nsIPrefBranch)
-              .getBoolPref("mailnews.sendInBackground");
+    Services.prefs.getBoolPref("mailnews.sendInBackground");
+  if (sendInBackground && !Application.platformIsMac) {
+    let enumerator = Services.wm.getEnumerator(null);
+    let count = 0;
+    while (enumerator.hasMoreElements() && count < 2) {
+      let win = enumerator.getNext();
+      count++;
+    }
+    if (count == 1)
+      sendInBackground = false;
+  }
 
   GenericSendMessage(sendInBackground ?
                      nsIMsgCompDeliverMode.Background :
                      nsIMsgCompDeliverMode.Now);
 }
 
 function SendMessageWithCheck()
 {