Enable Web Push support in GeckoView
Categories
(GeckoView :: General, enhancement, P1)
Tracking
(firefox-esr60 wontfix, firefox66 wontfix, firefox67 wontfix, firefox68 wontfix, firefox69 wontfix, firefox70 wontfix, firefox71 fixed)
People
(Reporter: snorp, Assigned: snorp)
References
Details
(Whiteboard: [geckoview:m1909])
Attachments
(4 files, 2 obsolete files)
Web Push could be a very powerful feature if exposed to GeckoView consumers. GCM is kind of a PITA in comparison (IMHO), and Android's WebView does not support it AFAIK. I am not sure what it would really look like, but it would probably provide a way for the Service Worker to communicate with an Android service.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
I'll note that using anything other than native message support could cause the OS to trigger battery use warnings. That's one of the bigger reasons that we picked using GCM / APNs as a "bridge" system. There are a few other options, of course, but they come with conditions. 1) Instead of keeping a constant connection open, poll the server to see if any messages are outstanding. Cons: potentially high delay for message delivery compared with "native" implementations. 2) Use the bridge as a "poke" service. Send a "data-free" poke over the bridge to wake the UA to fetch messages using websocket method. Cons: Kinda wasteful, still requires costly decryption but also now separate connection costs. 3) Use only native push service. GCM/FCM provide webpush. We could skip our own system in favor of a "pure" native implementation. Cons: Significantly complicates future mozilla services like pushbox and broadcast.
Comment 2•5 years ago
|
||
Fenix will need GV API support for push notifications.
Updated•5 years ago
|
Updated•4 years ago
|
Comment 3•4 years ago
|
||
P3 because Barbara says Web Push is not needed for Fenix MVP.
Updated•4 years ago
|
Comment 4•4 years ago
|
||
AC issue to add an Engine component API for Web Push:
https://github.com/mozilla-mobile/android-components/issues/1919
Comment 5•4 years ago
|
||
Adding [geckoview:fenix:m7] whiteboard tag because we should figure out our Web Push plans in Q2.
Comment 6•4 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #4)
AC issue to add an Engine component API for Web Push:
https://github.com/mozilla-mobile/android-components/issues/1919
I've closed the A-C ticket above as it was more for investigation on how a-c could support WebPush subscriptions. Now that we have some initial support, there are still some a-s dependencies that we can use to make this work.
This is a more appropriate a-c ticket to reference: https://github.com/mozilla-mobile/android-components/issues/3418
Comment 7•4 years ago
|
||
Snorp, Jonathan, JR, and I chatted about this in Whistler. We decided on adding a delegate to handle creating, fetching, and removing push subscriptions. Consumers like Fenix could wire up this delegate to the a-s Rust Push component, or any other backend they like. We can also use the delegate to mock the push server.
Here's a sketch of the delegate, and the DOM APIs it would support:
interface PushDelegate {
/** Creates a push subscription for the given service worker scope. A scope
* uniquely identifies a service worker. `appServerKey` optionally
* creates a restricted subscription
* (http://w3c.github.io/push-api/#dom-pushmanager-subscribe,
* http://w3c.github.io/push-api/#dom-pushsubscriptionoptionsinit-applicationserverkey) */
GeckoResult<PushSubscription> onSubscribe(@NonNull String scope,
@Nullable byte[] appServerKey);
/** Retrieves a subscription for the given service worker scope.
* (http://w3c.github.io/push-api/#dom-pushmanager-getsubscription) */
GeckoResult<PushSubscription> onGetSubscription(@NonNull String scope);
/** Removes a push subscription. Resolves with `true` if the subscription
* was successfully removed, `false` otherwise. This is passed through to
* the DOM API
* (http://w3c.github.io/push-api/#dom-pushsubscription-unsubscribe). */
GeckoResult<Boolean> onUnsubscribe(@NonNull String scope);
}
/** Push subscription info to forward to the DOM API. */
interface PushSubscription {
// http://w3c.github.io/push-api/#dom-pushsubscription-endpoint
@NonNull String getEndpoint();
// http://w3c.github.io/push-api/#dom-pushsubscription-getkey, "p256dh"
@NonNull byte[] getEncryptionKey();
// http://w3c.github.io/push-api/#dom-pushsubscription-getkey, "auth"
@NonNull byte[] getAuthKey();
// http://w3c.github.io/push-api/#dom-pushsubscriptionoptions, returns the same
// value as the optional `appServerKey` argument.
@Nullable byte[] getAppServerKey();
}
// On ServiceWorkerManager...
class ServiceWorkerManager {
// ...
/** Delivers a decrypted push message to the service worker for the given scope. */
void onPushMessageReceived(String scope, byte[] message);
/** Fires a `pushsubscriptionchange` event for a service worker, indicating the
worker's subscription has been lost and the worker must resubscribe. */
void onPushSubscriptionChange(String scope);
}
Assignee | ||
Comment 8•4 years ago
|
||
It looks to me like we may want to register a new thing here[0], but it seems like those bits really want you to look like a WebSocket or H2 type of push impl. It may be easier and/or more appropriate to implement nsIPushService
[1] directly, which pretty much matches the public API we'd like to expose. It may, however, be a baby/bathwater situation.
[0] https://searchfox.org/mozilla-central/rev/c0ca77697c6868482f30af873ec8069f2c080a34/dom/push/PushService.jsm#15
[1] https://searchfox.org/mozilla-central/source/dom/interfaces/push/nsIPushService.idl
Comment 9•4 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) (he/him) from comment #8)
It may be easier and/or more appropriate to implement
nsIPushService
[1] directly, which pretty much matches the public API we'd like to expose. It may, however, be a baby/bathwater situation.
That might be the best option. We can also add the GeckoView implementation as a different backend here—keeping PushComponents
mostly as it is now, but avoiding all the funky PushService.jsm
machinery.
Comment 10•4 years ago
|
||
Though nsIPushService
is pretty small, and, if we can use Messaging.jsm
directly from the content process—or if we need to use it from content, anyway, to get the right event dispatcher—we wouldn't need PushServiceContent
at all.
Assignee | ||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
[geckoview:fenix:m7]
bugs should be priority P1.
I'm editing a bunch of GeckoView bugs. If you'd like to filter all this bugmail, search and destroy emails containing this UUID:
e88a5094-0fc0-4b7c-b7c5-aef00a11dbc9
Comment 12•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 13•4 years ago
|
||
Assignee | ||
Comment 14•4 years ago
|
||
Assignee | ||
Comment 15•4 years ago
|
||
Assignee | ||
Comment 16•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 17•4 years ago
|
||
Pushed by jwillcox@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/37c92bba3e1c Enable web push pref for GeckoView r=geckoview-reviewers,droeh https://hg.mozilla.org/integration/autoland/rev/0bef62794abb Use window context for `GeckoSessionTestRule.evaluateJS()` r=geckoview-reviewers,droeh https://hg.mozilla.org/integration/autoland/rev/c22a725950f0 Add WebPush support to GeckoView r=jcj,lina,agi,geckoview-reviewers,droeh,mt
Comment 18•4 years ago
•
|
||
Backed out 3 changesets (Bug 1343678) for breaking Android web platform tests CLOSED TREE
Failure log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257332&repo=autoland&lineNumber=1281
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257330&repo=autoland&lineNumber=1263
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257340&repo=autoland&lineNumber=1248
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257314&repo=autoland&lineNumber=1312
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257320&repo=autoland&lineNumber=1295
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263257315&repo=autoland&lineNumber=1737
Backout: https://hg.mozilla.org/integration/autoland/rev/d0859d17e38bd70a5427d590c080098a691208d1
Assignee | ||
Updated•4 years ago
|
Comment 19•4 years ago
|
||
Pushed by jwillcox@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b01343e4c2eb Enable web push pref for GeckoView r=geckoview-reviewers,droeh,smaug https://hg.mozilla.org/integration/autoland/rev/5010684cdca4 Use window context for `GeckoSessionTestRule.evaluateJS()` r=geckoview-reviewers,droeh https://hg.mozilla.org/integration/autoland/rev/619e7838ebfd Add WebPush support to GeckoView r=jcj,lina,agi,geckoview-reviewers,droeh,mt
Comment 20•4 years ago
|
||
Backed out 3 changesets (bug 1343678) for WPT failures on Android. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=263920274&repo=autoland&lineNumber=7812
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=619e7838ebfd94672b993d34914f3852610b2905
Backout:
https://hg.mozilla.org/integration/autoland/rev/13c98841413b119c56fafe2bbeaaa631825fdd53
Assignee | ||
Comment 21•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Comment 22•4 years ago
|
||
Pushed by jwillcox@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3551cc55620d Enable web push pref for GeckoView r=geckoview-reviewers,droeh,smaug https://hg.mozilla.org/integration/autoland/rev/07b757a21222 Use window context for `GeckoSessionTestRule.evaluateJS()` r=geckoview-reviewers,droeh https://hg.mozilla.org/integration/autoland/rev/85526faefe6d Add WebPush support to GeckoView r=jcj,lina,agi,geckoview-reviewers,droeh,mt https://hg.mozilla.org/integration/autoland/rev/7396789341b1 Ensure events expecting a reply get one even if there is no listener r=geckoview-reviewers,droeh,agi
Comment 23•4 years ago
|
||
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4b77646bc788 Followup to fix rebase error. r=snorp
Comment 24•4 years ago
|
||
Backed out 5 changesets (Bug 1343678) for causing multiple web-platform failures CLOSED TREE
Failure logs: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=264118841&repo=autoland&lineNumber=1530
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=264121604&repo=autoland&lineNumber=5603
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=264121633&repo=autoland&lineNumber=2952
Backout: https://hg.mozilla.org/integration/autoland/rev/6390dc77aaf0a3cb47f40227e8e0da858facdcff
Comment 25•4 years ago
|
||
Adding this bug to GV's September sprint.
Comment 26•4 years ago
|
||
Pushed by jwillcox@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b2ae7f641b2d Enable web push pref for GeckoView r=geckoview-reviewers,droeh,smaug,jgraham https://hg.mozilla.org/integration/autoland/rev/2c7b6826afe9 Use window context for `GeckoSessionTestRule.evaluateJS()` r=geckoview-reviewers,droeh https://hg.mozilla.org/integration/autoland/rev/b70bcfe2473f Add WebPush support to GeckoView r=jcj,lina,agi,geckoview-reviewers,droeh,mt https://hg.mozilla.org/integration/autoland/rev/3dc75350ad97 Ensure events expecting a reply get one even if there is no listener r=geckoview-reviewers,droeh,agi
Comment 27•4 years ago
|
||
Pushed by malexandru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c0810f35c8d5 Mark a few more wpt tests as passing on Android r=me
Comment 28•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b2ae7f641b2d
https://hg.mozilla.org/mozilla-central/rev/2c7b6826afe9
https://hg.mozilla.org/mozilla-central/rev/b70bcfe2473f
https://hg.mozilla.org/mozilla-central/rev/3dc75350ad97
https://hg.mozilla.org/mozilla-central/rev/c0810f35c8d5
Assignee | ||
Updated•4 years ago
|
Comment 29•4 years ago
|
||
firefox70=wontfix because I assume Fenix doesn't need us to uplift Web Push to GV 70 Beta. GV 71 Nightly will ride to Beta on October 21.
Description
•