Bug 1052779 - Clicking on Mac share icons does not get Firefox into focus. r=Enn, a=sledru
authorFlorian Quèze <florian@queze.net>
Thu, 14 Aug 2014 19:30:52 +0200
changeset 217590 559fe257d838798a0e5c042d71b7beb1bba656ea
parent 217589 014effcd77b44ef0f8a70ca1e1bc599f7e4de392
child 217591 d3ff71d97d365dc49ef2bf0f555e578eea7634b5
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEnn, sledru
bugs1052779
milestone33.0a2
Bug 1052779 - Clicking on Mac share icons does not get Firefox into focus. r=Enn, a=sledru
browser/modules/webrtcUI.jsm
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -73,16 +73,29 @@ this.webrtcUI = {
       browserWindow.gBrowser.selectedTab = aActiveStream.tab;
     } else {
       aActiveStream.browser.focus();
     }
     browserWindow.focus();
     let PopupNotifications = browserWindow.PopupNotifications;
     let notif = PopupNotifications.getNotification("webRTC-sharing" + aType,
                                                    aActiveStream.browser);
+#ifdef XP_MACOSX
+    if (!Services.focus.activeWindow) {
+      browserWindow.addEventListener("activate", function onActivate() {
+        browserWindow.removeEventListener("activate", onActivate);
+        Services.tm.mainThread.dispatch(function() {
+          notif.reshow();
+        }, Ci.nsIThread.DISPATCH_NORMAL);
+      });
+      Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport)
+        .activateApplication(true);
+      return;
+    }
+#endif
     notif.reshow();
   },
 
   updateMainActionLabel: function(aMenuList) {
     let type = aMenuList.selectedItem.getAttribute("devicetype");
     let document = aMenuList.ownerDocument;
     document.getElementById("webRTC-all-windows-shared").hidden = type != "Screen";