Closed Bug 1635524 Opened 5 years ago Closed 2 months ago

pushsubscriptionchange event doesn't have oldSubscription/newSubscription (using ExtendableEvent instead of PushSubscriptionChangeEvent)

Categories

(Core :: DOM: Push Subscriptions, enhancement, P3)

75 Branch
enhancement

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: glagh14, Assigned: saschanaz)

References

(Blocks 2 open bugs)

Details

(Whiteboard: dom-lws-bugdash-triage)

Attachments

(2 files)

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
Type: defect → enhancement
Component: DOM: Service Workers → DOM: Push Subscriptions
Summary: pushsubscriptionchange event doesn't have oldSubscription/newSubscription → pushsubscriptionchange event doesn't have oldSubscription/newSubscription (using ExtendableEvent instead of PushSubscriptionChangeEvent)
Whiteboard: dom-lws-bugdash-triage
Attachment #9460253 - Attachment description: WIP: Bug 1635524 - Part 2: Pass nsIPushSubscription to nsIPushNotifier.notifySubscriptionChange → WIP: Bug 1635524 - Part 2: Pass oldSubscription for pushsubscriptionchange event
Assignee: nobody → krosylight
Attachment #9460252 - Attachment description: WIP: Bug 1635524 - Part 1: Add PushSubscriptionChangeEvent interface → Bug 1635524 - Part 1: Add PushSubscriptionChangeEvent interface r=asuth
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9460253 - Attachment description: WIP: Bug 1635524 - Part 2: Pass oldSubscription for pushsubscriptionchange event → Bug 1635524 - Part 2: Pass oldSubscription for pushsubscriptionchange event r=asuth
Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d1ee5f4d9a42 Part 1: Add PushSubscriptionChangeEvent interface r=asuth https://hg.mozilla.org/integration/autoland/rev/33887d137cbc Part 2: Pass oldSubscription for pushsubscriptionchange event r=asuth https://hg.mozilla.org/integration/autoland/rev/3a52c8a31e42 1943111: apply code formatting via Lando
Flags: needinfo?(krosylight)
Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/60accb9c03d0 Part 1: Add PushSubscriptionChangeEvent interface r=asuth https://hg.mozilla.org/integration/autoland/rev/9b6a7e93e074 Part 2: Pass oldSubscription for pushsubscriptionchange event r=asuth
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: