Open Bug 1635524 Opened 4 years ago Updated 4 years ago

pushsubscriptionchange event doesn't have oldSubscription/newSubscription

Categories

(Core :: DOM: Service Workers, defect, P3)

75 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: glagh14, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4132.0 Safari/537.36

Steps to reproduce:

Question 1) I want to use event.oldSubscription and event.newSubscription in pushsubscriptionchange event. At least this is what w3c specs say and people about this. The way I triggered this event is simply by blocking and allowing notifications from mozilla's preference's notification's settings. i consoled.log event.oldSubscription and event.newSubscription

Question 2)

I have seen on the mozilla docs page, that the way it handles pushsubscriptionchange event is that in that event, it tries to subscribe again by using the event.oldSubscription. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/pushsubscriptionchange_event .

Question: Is this the standard approach or would the last lines of code on the following website https://pushpad.xyz/service-worker.js be enough?

Actual results:

Question 1) oldSubscription and newSubscription are both undefined. Why? could this be because of the way I trigger it? and if mozilla itself triggers this, would they NOT be undefined at that stage?

Question 2) I'd appreciate the answer to the above I put in what did you do section

Expected results:

Question 1) oldSubscription and newSubscription shouldn't be undefined.

Question 2) I'd appreciate the answer to the above I put in what did you do section

(In reply to glagh14 from comment #0)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4132.0 Safari/537.36

Steps to reproduce:

Question 1) I want to use event.oldSubscription and event.newSubscription in pushsubscriptionchange event. At least this is what w3c specs say and people about this. The way I triggered this event is simply by blocking and allowing notifications from mozilla's preference's notification's settings. i consoled.log event.oldSubscription and event.newSubscription

Question 2)

I have seen on the mozilla docs page, that the way it handles pushsubscriptionchange event is that in that event, it tries to subscribe again by using the event.oldSubscription. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/pushsubscriptionchange_event .

Question: Is this the standard approach or would the last lines of code on the following website https://pushpad.xyz/service-worker.js be enough?

Actual results:

Question 1) oldSubscription and newSubscription are both undefined. Why? could this be because of the way I trigger it? and if mozilla itself triggers this, would they NOT be undefined at that stage?

Question 2) I'd appreciate the answer to the above I put in what did you do section

Expected results:

Question 1) oldSubscription and newSubscription shouldn't be undefined.

Question 2) I'd appreciate the answer to the above I put in what did you do section

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Events
Product: Firefox → Core
Component: DOM: Events → DOM: Service Workers
Severity: normal → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.