DescriptionPush API: Return cached registration if available.
This is the implementation for the following steps of the register
algorithm[1]:
'If the webapp is already registered, run the following substeps:
1. Retrieve the push registration associated with the webapp.
2. If there is an error, reject promise with a DOMException whose
name is "AbortError" and terminate these steps.
3. When the request has been completed, resolve promise with a
PushRegistration providing the details of the retrieved push
registration.'
Currently the implementation assumes that errors can be recovered from
and attempts to do a fresh push registration if accessing storage
fails; I left a TODO for us to decide this case later.
Depends on https://codereview.chromium.org/785983002
[1]: https://w3c.github.io/push-api/#widl-PushRegistrationManager-register-Promise-PushRegistration
BUG=401422, 429212
Committed: https://crrev.com/ce39d41c13db11a69564ba2299f7e83d3fa05c3c
Cr-Commit-Position: refs/heads/master@{#308135}
Patch Set 1 #Patch Set 2 : Add test, refactor and rebase #
Total comments: 4
Patch Set 3 : Address review comments #
Total comments: 6
Patch Set 4 : Address review comments v2 #Patch Set 5 : Rebase #Patch Set 6 : Rebase #Messages
Total messages: 23 (6 generated)
|