summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-03-19 01:03:04 +0100
committerGitHub <noreply@github.com>2018-03-19 01:03:04 +0100
commitdcd332ecece7e1eaa73179a8497e6469488f8048 (patch)
treefe2ef2305f5105133ed2c316276b733392761b7f
parent1832d2b0f420ed598019b61710794d7edd2dd699 (diff)
parent59a8c7bfb05e6151b9b768e7af69f810df28cbd6 (diff)
downloadpalemoon-gre-dcd332ecece7e1eaa73179a8497e6469488f8048.tar.gz
Merge pull request #1642 from janekptacijarabaci/desktopNotifications_click_1
Clicking on a notification should select the originating tab
-rw-r--r--browser/base/content/content.js6
-rw-r--r--browser/base/content/tabbrowser.xml13
2 files changed, 17 insertions, 2 deletions
diff --git a/browser/base/content/content.js b/browser/base/content/content.js
index 19032eb84..3587bbeef 100644
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -61,4 +61,8 @@ addEventListener("blur", function(event) {
addMessageListener("Finder:Initialize", function () {
let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {});
new RemoteFinderListener(global);
-}); \ No newline at end of file
+});
+
+addEventListener("DOMWebNotificationClicked", function(event) {
+ sendAsyncMessage("DOMWebNotificationClicked", {});
+}, false);
diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml
index b8d5f3e41..51f7063f3 100644
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -2950,13 +2950,23 @@
let browser = aMessage.target;
switch (aMessage.name) {
- case "DOMTitleChanged":
+ case "DOMTitleChanged": {
let tab = this.getTabForBrowser(browser);
if (!tab)
return;
let titleChanged = this.setTabTitle(tab);
if (titleChanged && !tab.selected && !tab.hasAttribute("busy"))
tab.setAttribute("titlechanged", "true");
+ break;
+ }
+ case "DOMWebNotificationClicked": {
+ let tab = this.getTabForBrowser(browser);
+ if (!tab)
+ return;
+ this.selectedTab = tab;
+ window.focus();
+ break;
+ }
}
]]></body>
</method>
@@ -3022,6 +3032,7 @@
this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID,
this.mCurrentBrowser);
}
+ messageManager.addMessageListener("DOMWebNotificationClicked", this);
]]>
</constructor>