Closed
Bug 951150
Opened 11 years ago
Closed 11 years ago
Notification system message object is not in sync with DesktopNotification API
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: gerard-majax, Assigned: gerard-majax)
References
Details
Attachments
(1 file)
3.60 KB,
patch
|
mikehenrty
:
review+
|
Details | Diff | Splinter Review |
When an application triggers a notification and the application gets closed, further activation of the notification will trigger a 'notification' system message that can be caught in the app using the mozSetMessageHandler().
The handler defined this way gets called with an object in parameter. This object is simply built with the original notification properties. This is done at https://hg.mozilla.org/mozilla-central/file/b980c2dee2e7/b2g/chrome/content/shell.js#l782, so one can see that we resend: title, body, imageURL. Which is matching the old notification API.
In case of a notification sent from the new API, we are missing at least: dir, lang and id fields.
I did some debug in shell.js, and this is what we get from low level:
I/GeckoDump( 3722): XXX alert_receiveMessage: data={"imageURL":"app://communications.gaiamobile.org/dialer/style/icons/Dialer_60.png","title":"Missed call","text":"From +336xxxxxxx","uid":"app://communications.gaiamobile.org/manifest.webapp#notag:{33e828f5-0bde-4b5f-9f97-6228ea76adbf}","details":{"dir":"auto","id":"app://communications.gaiamobile.org/manifest.webapp#notag:{33e828f5-0bde-4b5f-9f97-6228ea76adbf}","lang":"","manifestURL":"app://communications.gaiamobile.org/manifest.webapp","textClickable":true}}
Assignee | ||
Comment 1•11 years ago
|
||
May I ask Julien and Vivien your feedback on this ? Since you seem to be the last ones to have hacked around this part of shell.js :)
Flags: needinfo?(felash)
Flags: needinfo?(21)
Comment 2•11 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #1)
> May I ask Julien and Vivien your feedback on this ? Since you seem to be the
> last ones to have hacked around this part of shell.js :)
What is the question ?
Flags: needinfo?(21)
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #2)
> (In reply to Alexandre LISSY :gerard-majax from comment #1)
> > May I ask Julien and Vivien your feedback on this ? Since you seem to be the
> > last ones to have hacked around this part of shell.js :)
>
> What is the question ?
Should the object passed to the handler of the system message notification be a better copy of the original notification ? Or do we want to keep it as it is currently ?
Flags: needinfo?(21)
Comment 4•11 years ago
|
||
I think you should discuss about this with Michael and/or Kyle.
The Notification subsystem is essentialy un-owned so it's really great to see you working on this. You (as the System Front end team) should take ownership over this and take decisions ;)
Now, my own take on this is that we didn't use to store the notification, and maybe we do now (see bug 899574) although Mike will know better.
Also, it's better to have a real question. Which feedback do you ask on what? :)
Updated•11 years ago
|
Flags: needinfo?(felash) → needinfo?(mhenretty)
Comment 5•11 years ago
|
||
IMHO the only reason why the object was stripped down is because the old API was not providing the useful informations. Then if you want to forward more data because the new API has more data, that makes sense to me.
Flags: needinfo?(21)
Assignee | ||
Comment 6•11 years ago
|
||
Thanks for your feedback.
Assignee | ||
Comment 7•11 years ago
|
||
After working on Dialer notification migration, it turns out since we can use Notification.get(), this issue might not be that important for now.
Comment 8•11 years ago
|
||
Sorry about the late response. I agree that the system message should have all the relevant information for the new API.
Also, how is Notification.get() a workaround here if we don't even send the "tag" property in the system message? ie, how do we know which notification was clicked when the info we do send (title, body, and imageURL) are not guaranteed to be unique?
Flags: needinfo?(mhenretty)
Comment 9•11 years ago
|
||
I think this is application-specific code. In the SMS app, we have a unique imageURL, for example. Yes, this is a hack.
Assignee | ||
Comment 10•11 years ago
|
||
(In reply to Michael Henretty [:mhenretty] from comment #8)
> Sorry about the late response. I agree that the system message should have
> all the relevant information for the new API.
>
> Also, how is Notification.get() a workaround here if we don't even send the
> "tag" property in the system message? ie, how do we know which notification
> was clicked when the info we do send (title, body, and imageURL) are not
> guaranteed to be unique?
Excellent. As we would like to use the 'tag' element in WapPush, I'm starting to work on this.
Comment 11•11 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #10)
> Excellent. As we would like to use the 'tag' element in WapPush, I'm
> starting to work on this.
+1
BTW the e-mail app is already using the |tag| field so I wonder if they did encounter some bugs related to that.
Assignee | ||
Comment 12•11 years ago
|
||
Hm.
The interface http://hg.mozilla.org/mozilla-central/file/9409405e0739/dom/interfaces/notification/nsIDOMDesktopNotification.idl references AppNotificationServiceOptions http://hg.mozilla.org/mozilla-central/file/124d80d7556d/dom/webidl/AppNotificationServiceOptions.webidl which is not containing any tag at all :(
Comment 13•11 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #12)
> Hm.
>
> The interface
> http://hg.mozilla.org/mozilla-central/file/9409405e0739/dom/interfaces/
> notification/nsIDOMDesktopNotification.idl references
> AppNotificationServiceOptions
> http://hg.mozilla.org/mozilla-central/file/124d80d7556d/dom/webidl/
> AppNotificationServiceOptions.webidl which is not containing any tag at all
> :(
This is a major meh :-/ The spec draft mandates the |tag| property to be supported, it even gives examples on how to use it:
http://www.w3.org/TR/notifications/#tags-example
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #13)
> (In reply to Alexandre LISSY :gerard-majax from comment #12)
> > Hm.
> >
> > The interface
> > http://hg.mozilla.org/mozilla-central/file/9409405e0739/dom/interfaces/
> > notification/nsIDOMDesktopNotification.idl references
> > AppNotificationServiceOptions
> > http://hg.mozilla.org/mozilla-central/file/124d80d7556d/dom/webidl/
> > AppNotificationServiceOptions.webidl which is not containing any tag at all
> > :(
>
> This is a major meh :-/ The spec draft mandates the |tag| property to be
> supported, it even gives examples on how to use it:
>
> http://www.w3.org/TR/notifications/#tags-example
It's only in the case of system messages :)
Assignee | ||
Comment 15•11 years ago
|
||
First WIP patch. As far as I could test in the dialer handler of the system notification, I now have access to the tag value.
Comment 16•11 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #13)
> (In reply to Alexandre LISSY :gerard-majax from comment #12)
> > Hm.
> >
> > The interface
> > http://hg.mozilla.org/mozilla-central/file/9409405e0739/dom/interfaces/
> > notification/nsIDOMDesktopNotification.idl references
> > AppNotificationServiceOptions
> > http://hg.mozilla.org/mozilla-central/file/124d80d7556d/dom/webidl/
> > AppNotificationServiceOptions.webidl which is not containing any tag at all
> > :(
>
> This is a major meh :-/ The spec draft mandates the |tag| property to be
> supported, it even gives examples on how to use it:
>
> http://www.w3.org/TR/notifications/#tags-example
Yeah, it's bad. The problem stems from the fact that when we implemented the new Web Notifications API, we re-used a lot of the scaffolding from the old DesktopNotifications API. My guess is that the system message case (which only happens if the app process is killed before a notification event fires), is enough of an edge case that is was never properly updated for the new API. In any case, its good we are fixing this now.
Assignee | ||
Comment 17•11 years ago
|
||
Michael, I've searched the whole morning without finding anything: do we have absolutely no test at all against the notification system message mechanism ?
Flags: needinfo?(mhenretty)
Assignee | ||
Comment 18•11 years ago
|
||
I've sent the patch to try, https://tbpl.mozilla.org/?tree=Try&rev=db3450d6db9a
Comment 19•11 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #17)
> Michael, I've searched the whole morning without finding anything: do we
> have absolutely no test at all against the notification system message
> mechanism ?
I don't know of any. We did have the workings for a gaia integration test that makes sure clicking on a notification will launch an app (which I believe would use the system mechanism), but it is blocked by OOP afaict:
https://github.com/mozilla-b2g/gaia/blob/5e3a70295bb3c242228beeaca85fc4344d8e2538/apps/system/test/marionette/notification_launch_app.js#L36
In any case, my opinion is we need tests for this up in gaia more so than in the platform right now.
Flags: needinfo?(mhenretty)
Assignee | ||
Comment 20•11 years ago
|
||
(In reply to Michael Henretty [:mhenretty] from comment #19)
> (In reply to Alexandre LISSY :gerard-majax from comment #17)
> > Michael, I've searched the whole morning without finding anything: do we
> > have absolutely no test at all against the notification system message
> > mechanism ?
>
> I don't know of any. We did have the workings for a gaia integration test
> that makes sure clicking on a notification will launch an app (which I
> believe would use the system mechanism), but it is blocked by OOP afaict:
> https://github.com/mozilla-b2g/gaia/blob/
> 5e3a70295bb3c242228beeaca85fc4344d8e2538/apps/system/test/marionette/
> notification_launch_app.js#L36
>
> In any case, my opinion is we need tests for this up in gaia more so than in
> the platform right now.
Thanks. Then I'll flip the review switch on this patch. If you can share a bug number for this OOP thing, we might be able to make it.
Assignee | ||
Comment 21•11 years ago
|
||
Follow up opened as bug 958654 for dealing with testing the content of the system message.
Assignee | ||
Comment 22•11 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #18)
> I've sent the patch to try,
> https://tbpl.mozilla.org/?tree=Try&rev=db3450d6db9a
FYI Try is green.
Assignee | ||
Updated•11 years ago
|
Attachment #8357796 -
Flags: review?(mhenretty)
Comment 23•11 years ago
|
||
Comment on attachment 8357796 [details] [diff] [review]
0001-Bug-951150-Sync-notification-system-message-with-Not.patch
LGTM. Ran this against the notification integration tests in gaia, and it looks good.
Attachment #8357796 -
Flags: review?(mhenretty) → review+
Assignee | ||
Comment 24•11 years ago
|
||
(In reply to Michael Henretty [:mhenretty] from comment #23)
> Comment on attachment 8357796 [details] [diff] [review]
> 0001-Bug-951150-Sync-notification-system-message-with-Not.patch
>
> LGTM. Ran this against the notification integration tests in gaia, and it
> looks good.
Sure, I'm rebuilding with my patch right now to run gaia integration tests.
Assignee | ||
Comment 25•11 years ago
|
||
As far as I can say, only system and email app have integration tests for notification. I ran both, and nothing is broken \o/
Keywords: checkin-needed
Comment 26•11 years ago
|
||
I think the SMS app has some as well, but part of the Python-based Integration tests (as opposed to the JS-based Integration tests).
Comment 27•11 years ago
|
||
Keywords: checkin-needed
Comment 28•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Updated•11 years ago
|
Blocks: b2g-notifications
You need to log in
before you can comment on or make changes to this bug.
Description
•