Closed Bug 1260519 Opened 4 years ago Closed 4 years ago

Support unsubscribing from Push API messages from a site


(Firefox for Android :: General, defect)

Not set



Firefox 48
Tracking Status
firefox48 --- fixed


(Reporter: nalexander, Assigned: nalexander)




(1 file)

Right now, it's a big TODO:  The functionality is all in place, just need to wire up the messages.

Testing this is the hardest part.
This was implemented, but never wired up.

I thought long and hard about how to unit test this, and it's quite
difficult.  First, we'd have to chose a layer of testing.  We could
unit test:

* the JS <-> Java message passing;

* the permission prompts <-> JS interface;

* some interactions with the Service Worker interface.

The first is difficult because none of our current testing emulators
have Google Play Services and GCM enabled, so we'd need to allow to
mock or otherwise fake the GCM registration.  Then we'd need to stand
up a mock autopush server (using httpd.js or the Java-side
equivalent), or mock out the autopush client as well.  At this point,
we're testing sendMessage.  This could be done, but I'd rather slide
this fix in before building out quite a bit of test infrastructure.
(For the record, the Java Push Service state machine is thoroughly
tested with Java unit tests, so I have confidence that the unsubscribe
logic works.)

The second is tested via the PushWebSocket tests, which are now
running on Android.  That is, if permissions and the PushService are
interacting badly, we should see it with the existing test suite.
Since PushServiceAndroidGCM is pretty much a pass-through, there's
little value to be added here.

Finally, the third is also tested via the PushWebSocket tests.
There's absolutely nothing GCM specific about the Service Worker
interface to the PushService.

So I'm left manually testing this -- and now we can unsubscribe from
Push messages from sites.

Review commit:
See other reviews:
Attachment #8736133 - Flags: review?(nchen)
Comment on attachment 8736133 [details]
MozReview Request: Bug 1260519 - Support unsubscribing from Push API messages from a site. r?jchen
Attachment #8736133 - Flags: review?(nchen) → review+
Bug 1260519 - Support unsubscribing from Push API messages from a site. r=jchen
Summary: Support unregistering from Push API messages from a site → Support unsubscribing from Push API messages from a site
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
You need to log in before you can comment on or make changes to this bug.