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, a-callek for CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 14 Apr 2015 14:38:30 +0200
changeset 21992 e29397e78a33b465feeb24dded9e189b1f0bac5b
parent 21991 3ca0490d9fc943c41457301fc443ea3a2963cc7d
child 21993 af0a31082a9d8d1635a6576e2fe1277731cce059
push id1332
push userkent@caspia.com
push dateTue, 14 Apr 2015 22:49:43 +0000
treeherdercomm-beta@e29397e78a33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, rkent, a-callek
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, a-callek for CLOSED TREE
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;