Closed Bug 1230332 Opened 10 years ago Closed 10 years ago

clicking on notification that sets client.focus() fails to close the notification

Categories

(Core :: DOM: Push Subscriptions, defect, P2)

All
macOS
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: edwong, Unassigned)

Details

reported by harald 1. go here: https://people.mozilla.org/~ewong2/push-notification-test/ 2. select: sw-focus.js in the combo box, register, then subscribe 3. click the XHR button 4. open a new tab to focus on 5. click on the notification displayed actual: nothing and notification doesn't close expected: tab should focus onto people.m.o page and notification should close
I fixed my test case and it does in focus properly but fails to close the notification. here's the new actual/expected: 1. go here: https://people.mozilla.org/~ewong2/push-notification-test/ 2. select: sw-focus.js in the combo box, register, then subscribe 3. click the XHR button 4. open a new tab to focus on 5. click on the notification displayed actual: notification doesn't close on click expected: notification should close on click
Summary: calling client.focus() in a push event on serviceworker isn't working → clicking on notification that sets client.focus() fails to close the notification
I think any JS exception in the SW causes the notification to not close on click. Kit, are you the right person to investigate - seems like a high priority.
Flags: needinfo?(kcambridge)
on chrome i get this: Uncaught (in promise) DOMException: Not allowed to open a window. which causes the notification to also not close.
:overholt - this may be a platform issue, can you investigate. We'd love to get this uplifted to fx45 as it's easily visible to users.
Flags: needinfo?(kcambridge) → needinfo?(overholt)
This Mac only (non XUL) but can be quite annoying for mac users.
OS: All → Mac OS X
Priority: -- → P2
William looked into this a bit earlier today. William, what'd you find?
Flags: needinfo?(overholt) → needinfo?(wchen)
I suspect that the behavior you are seeing is related to how Mac OS handles notifications in Notification Center. In Mac notification settings, if I set the "alert style" to "Banners" I am unable to reproduce the bug; when I click on the notification, it closes. If I set the alert style to "Alerts" the notification stays open when I click it and I have to click on the "Close" button to close it. Is this what you are experiencing? In the "Banners" case, it doesn't seem to be a problem. In the "Alerts" case, it seems like this is the normal behavior because notifications from other apps also don't close on click until you click the close button so I'm not even sure this is a bug. If you still think this is a bug, we could ignore the OS behavior and look into forcefully closing the notification on click.
Flags: needinfo?(wchen)
Yeah - i can't repro anymore. I'm going to close this out.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.