Closed Bug 908978 Opened 11 years ago Closed 11 years ago

new Notification API events onclick and onclose aren't being handled

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

defect
Not set
normal

Tracking

(blocking-b2g:koi+)

RESOLVED DUPLICATE of bug 910915
blocking-b2g koi+

People

(Reporter: caiolima, Unassigned)

References

Details

(Whiteboard: [systemsfe])

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130814063812

Steps to reproduce:

Using the UITest case "new Notification()", showing a notification and after clicking on it, neither the onclick and onclose aren't handled.

The same happens if we click the button to close the notification.



Expected results:

These methods should be executed.
Flags: needinfo?(kyle)
Flags: needinfo?(felash)
Could you confirm this bug please?
I saw that already too, I said that in bug 901856 comment 1.

Thanks for filing the bug :)
Blocks: 892528
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(felash)
blocking-b2g: --- → koi?
Component: Gaia → Gaia::System
I identified the problem, but I'm a little lost to solve it.

When I use the "nsIAppsService->ShowAppNotification(...)" the observer code is executed normally, but the close operation doesn't work because it's based on "nsIAlertService->ShowAlertNotification"

I guess the correct way to fix it is to make the oberver be called, but I don't have a lot of knowledge how it works.

Could anyone give me a direction?
Attached patch bug-908978-fix.patch (obsolete) — Splinter Review
Attachment #795197 - Flags: review?(felash)
Flags: needinfo?(kyle)
Comment on attachment 795197 [details] [diff] [review]
bug-908978-fix.patch

Review of attachment 795197 [details] [diff] [review]:
-----------------------------------------------------------------

I don't know this code very well.

Gregor, do you feel like you could review this ? Otherwise William Chen or waiting until Vivien is back ?

::: b2g/chrome/content/shell.js
@@ +722,5 @@
>            Services.io.newURI(listener.target, null, null),
>            Services.io.newURI(listener.manifestURL, null, null)
>          );
>        }
> +    } else if (uid.startsWith("alert") || detail.type.startsWith("desktop-notification")) {

you need to check if detail.type is a String first, this comes from content.
Attachment #795197 - Flags: review?(felash) → review?(anygregor)
(In reply to Julien Wajsberg [:julienw] from comment #5)
> you need to check if detail.type is a String first, this comes from content.

Do you think it's really necessary? There is a case where the type is not a string?
I think this can be null/undefined...
(In reply to Julien Wajsberg [:julienw] from comment #7)
> I think this can be null/undefined...

I understand, you are right.
Added a verification if type is null
Attachment #795197 - Attachment is obsolete: true
Attachment #795197 - Flags: review?(anygregor)
Attachment #796122 - Flags: review?(anygregor)
Blocks: 910997
Note that this may be fixed by the new logic in Bug 910915. Instead of checking detail type, I moved the alert check first, then do a global fall-through otherwise, because as far as I can tell, if it's not an alert, all we care about is either shipping to the message manager or making a system message regardless of detail info.
Checked on UI test, bug 910915 does fix this. Will wait until reviews are in before taking status actions though.
Ok, this did end up being a dupe of bug 910915. It'll be fixed when that lands (waiting for tree to unburn).
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
No longer blocks: b2g-notifications
blocking-b2g: koi? → koi+
Whiteboard: [systemsfe]
Attachment #796122 - Flags: review?(anygregor)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: