Bug 1202216 Make clicking on a desktop notification switch to the notifying tab r=Ratty
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 20 Sep 2015 21:34:20 +0100
changeset 18208 fc768b4b5baec96036cce5d149ec24d3bf9d646c
parent 18207 998a6fac4571fc297af324ad8d8a92e9ea3faac1
child 18209 ae189fe20938345f2ed3125215c76dfa9cb03643
push id1510
push usermbanner@mozilla.com
push dateThu, 29 Oct 2015 19:29:37 +0000
treeherdercomm-esr52@97b5a596b58b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty
bugs1202216
Bug 1202216 Make clicking on a desktop notification switch to the notifying tab r=Ratty
suite/browser/tabbrowser.xml
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -2879,16 +2879,29 @@
 
           if (this.tabs.length == 1)
             return;
 
           this.removeTab(this._getTabForContentWindow(event.target));
           event.preventDefault();
         ]]>
       </handler>
+
+      <handler event="DOMWebNotificationClicked" phase="capturing">
+        <![CDATA[
+          if (!event.isTrusted)
+            return;
+
+          // The user clicked a desktop notification; make sure its
+          // tab is brought to the front and then raise the window.
+          this.selectedTab = this._getTabForContentWindow(event.target.top);
+          window.focus();
+        ]]>
+      </handler>
+
       <handler event="DOMWillOpenModalDialog" phase="capturing">
         <![CDATA[
           if (!event.isTrusted)
             return;
 
           // We're about to open a modal dialog, make sure the opening
           // tab is brought to the front.
           this.selectedTab = this._getTabForContentWindow(event.target.top);