Bug 1152852 - Notification sound for highlights in chats not played if chat tab is selected, even when Thunderbird is not the currently focused application. r=clokep, a=rkent
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 14 Apr 2015 14:38:30 +0200
changeset 25947 f0b4be7157e50ed413677c501a2d704e2fe5064b
parent 25946 aed081047c5ed7be975525bfecc6c428e66c1507
child 25948 a8c343d873ac4508eb163a492b57eade03275c3d
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, rkent
bugs1152852
Bug 1152852 - Notification sound for highlights in chats not played if chat tab is selected, even when Thunderbird is not the currently focused application. r=clokep, a=rkent
mail/components/im/modules/chatNotifications.jsm
--- a/mail/components/im/modules/chatNotifications.jsm
+++ b/mail/components/im/modules/chatNotifications.jsm
@@ -38,17 +38,18 @@ var Notifications = {
   // Sender of the last message.
   _lastMessageSender: null,
   // timeout Id for the set timeout for showing notification.
   _timeoutId: null,
 
   _showMessageNotification: function(aMessage, aCounter = 0) {
     // We are about to show the notification, so let's play the notification sound.
     // We play the sound if the user is away from TB window or even away from chat tab.
-    if (Services.wm.getMostRecentWindow("mail:3pane").document
+    if (!Services.focus.activeWindow ||
+        Services.wm.getMostRecentWindow("mail:3pane").document
                 .getElementById("tabmail").currentTabInfo.mode.name != "chat")
       Services.obs.notifyObservers(aMessage, "play-chat-notification-sound", false);
 
     // If TB window has focus, there's no need to show the notification..
     if (Services.wm.getMostRecentWindow("mail:3pane").document.hasFocus()) {
       this._heldMessage = null;
       this._msgCounter = 0;
       return;