Closed Bug 788125 Opened 12 years ago Closed 12 years ago

System messages don't work with different entry points if the app is not already open

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18
blocking-basecamp +

People

(Reporter: etienne, Assigned: fabrice)

References

Details

(Keywords: feature, Whiteboard: [WebAPI:P1][LOE:S])

Attachments

(1 file, 4 obsolete files)

+++ This bug was initially created as a clone of Bug #779176 +++ Discovered while working on https://bugzilla.mozilla.org/show_bug.cgi?id=782488 The easiest STR is to take this branch https://github.com/etiennesegonzac/gaia/tree/dialer-minus-bg-service On incoming call the "Communications" app is launched but the system message handler (in dialer/js/dialer.js) is never triggered (should log in logcat) But once the app is launched, it works. Going back to a gaia version where the Dialer is a standalone app it works perfectly (the app is launched and the system message is triggered).
Well the system message glue is asking gaia to launch |app://communications.gaiamobile.org/| and not |app://communications.gaiamobile.org/dialer/| so the system message handler is never *registered* (and obviously never called). We get around this for WebActivities with the |href| property. What can we do here?
(In reply to Etienne Segonzac from comment #1) > Well the system message glue is asking gaia to launch > |app://communications.gaiamobile.org/| and not > |app://communications.gaiamobile.org/dialer/| so the system message handler > is never *registered* (and obviously never called). > > We get around this for WebActivities with the |href| property. > > What can we do here? Should we register the system message adding the href when a activity declares it? Or is totally out of the scope of WebActivities? Thanks!
blocking-basecamp: + → ?
IIRC, when we worked on this API with Jonas, the idea was that the app manifest could point which URL should be opened when a specific system message was received. I do not remember if that was implemented so it's not clear to me if the issue is the lack of this being implemented or a bug in that implementation.
(In reply to Mounir Lamouri (:mounir) from comment #3) > IIRC, when we worked on this API with Jonas, the idea was that the app > manifest could point which URL should be opened when a specific system > message was received. Sounds good. I'll check with Fabrice.
Attached patch POC (obsolete) (deleted) — Splinter Review
Allowing an alternative syntax: ``` "messages": [ { "message": "telephony-incoming", "href": "/dialer/index.html" } ] ``` To declare a system message handler with a href param.
Attachment #658105 - Flags: feedback?(fabrice)
(In reply to Etienne Segonzac from comment #5) > Created attachment 658105 [details] [diff] [review] > POC > > Allowing an alternative syntax: > ``` > "messages": [ > { > "message": "telephony-incoming", > "href": "/dialer/index.html" > } > ] > ``` > > To declare a system message handler with a href param. Could we do something like: "messages: [ "foo": { href: "bar.html" }, "bar", "foobar" }
We could add the href to the |messages| property indeed, but I think that what apps dev actually want is to bind a message to an entry point. So another option is to allow |messages| in entry_points and use the launch_path of the entry point. This also applies to web activities.
Attached patch POC v2 (obsolete) (deleted) — Splinter Review
Implementing the new syntax discussed: "messages": [ { "telephony-incoming": { "href": "/dialer/index.html" } } ]
Attachment #658105 - Attachment is obsolete: true
Attachment #658105 - Flags: feedback?(fabrice)
Attachment #658124 - Flags: feedback?(fabrice)
(In reply to Fabrice Desré [:fabrice] from comment #7) > We could add the href to the |messages| property indeed, but I think that > what apps dev actually want is to bind a message to an entry point. So > another option is to allow |messages| in entry_points and use the > launch_path of the entry point. This also applies to web activities. Interesting... I don't really have a strong opinion one way or the other. Mounir?
Fabrice says this is a nice to have and not a v1 blocker.
blocking-basecamp: ? → -
Well #782488 is a basecamp+ and we cannot do the Gaia part of the change without this one...
blocking-basecamp: - → ?
Blocks: 782488
Yeah, my bad. I misread that as a web activities issues. That should block.
Assignee: nobody → fabrice
blocking-basecamp: ? → +
Attached patch patch (obsolete) (deleted) — Splinter Review
This patch implements both the syntax from comment #8 and the entry points idea. I also update the activities code to let authors declare activities in entry points. Etienne, can you test with you gaia branch?
Attachment #658124 - Attachment is obsolete: true
Attachment #658124 - Flags: feedback?(fabrice)
Awesome! Tested with the |messages| field in the |entry_points|, working well. No luck with the syntax from comment #8, didn't investigate further.
Whiteboard: [WebAPI:P1]
Attached patch patch v2 (obsolete) (deleted) — Splinter Review
updated patch, that supports a slightly different syntax: "messages": [ { "telephony-incoming": "/dialer/index.html" }, "alarm" ] I like the compactness of this syntax. Etienne, let me know if that's good enough for you.
Attachment #659412 - Attachment is obsolete: true
(In reply to Fabrice Desré [:fabrice] from comment #15) > Created attachment 659790 [details] [diff] [review] > patch v2 > > updated patch, that supports a slightly different syntax: > > "messages": [ > { "telephony-incoming": "/dialer/index.html" }, > "alarm" > ] > > I like the compactness of this syntax. Etienne, let me know if that's good > enough for you. Sounds good to me.
(In reply to Fabrice Desré [:fabrice] from comment #15) > Created attachment 659790 [details] [diff] [review] > I like the compactness of this syntax. Etienne, let me know if that's good > enough for you. Looks good. Do you want me to test the patch?
Both syntaxes are working flawlessly!
Comment on attachment 659790 [details] [diff] [review] patch v2 Mounir, Vivien: whoever can do this review, thank you!
Attachment #659790 - Flags: review?(mounir)
Attachment #659790 - Flags: review?(21)
Comment on attachment 659790 [details] [diff] [review] patch v2 Review of attachment 659790 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/apps/src/Webapps.jsm @@ +132,5 @@ > + _registerSystemMessagesForEntryPoint: function(aManifest, aApp, aEntryPoint) { > + let root = aManifest; > + if (aEntryPoint && aManifest.entry_points[aEntryPoint]) { > + root = aManifest.entry_points[aEntryPoint]; > + } Do you really need aEntryPoint as parameter or can you replace aManifest directly from the caller? I just feel like some work is duplicated but i can be wrong.
Comment on attachment 659790 [details] [diff] [review] patch v2 Review of attachment 659790 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/apps/src/Webapps.jsm @@ +154,5 @@ > } > }, > > + _registerSystemMessages: function(aManifest, aApp) { > + this._registerSystemMessagesForEntryPoint(aManifest, aApp, null); Isn't this going to register all system messages on the root? @@ +199,5 @@ > } > }, > > + _registerActivities: function(aManifest, aApp) { > + this._registerActivitiesForEntryPoint(aManifest, aApp, null); ditto for activities.
Attachment #659790 - Flags: review?(mounir)
Attached patch patch v3 (deleted) — Splinter Review
Minor changes in this patch: - a couple of comments - fixing the system messages and activities registration in confirmInstall - doing an early return in _registerSystemMessagesForEntryPoint > ::: dom/apps/src/Webapps.jsm > @@ +132,5 @@ > > + _registerSystemMessagesForEntryPoint: function(aManifest, aApp, aEntryPoint) { > > + let root = aManifest; > > + if (aEntryPoint && aManifest.entry_points[aEntryPoint]) { > > + root = aManifest.entry_points[aEntryPoint]; > > + } > > Do you really need aEntryPoint as parameter or can you replace aManifest > directly from the caller? I just feel like some work is duplicated but i can > be wrong. Unfortunately I need it to get the fullLaunchPath... > > > > + _registerSystemMessages: function(aManifest, aApp) { > > + this._registerSystemMessagesForEntryPoint(aManifest, aApp, null); > > Isn't this going to register all system messages on the root? yes, this will register system messages declared on the root of the manifest, which is what we want. Declaring them in the entry_point is just a convenience for authors.
Attachment #659790 - Attachment is obsolete: true
Attachment #659790 - Flags: review?(21)
Attachment #660467 - Flags: review?(21)
Keywords: verifyme
Keywords: feature
Whiteboard: [WebAPI:P1] → [WebAPI:P1][LOE:S]
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Keywords: verifyme
QA Contact: jsmith
Keywords: verifyme
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: