Always pass the principal to push observer notifications

RESOLVED FIXED in Firefox 49

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: lina, Assigned: lina)

Tracking

unspecified
mozilla49
Points:
---

Firefox Tracking Flags

(firefox49 fixed)

Details

(Whiteboard: btpp-active)

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

2 years ago
Created attachment 8747828 [details] [diff] [review]
pushObserverPrincipals.patch

It occurred to me that we don't pass the subscription principal to any of the push observers. I suspect this might be an issue when we eventually start using origin attributes (like `userContextId`).

"push-subscription-change" and "push-subscription-refresh" don't currently have a subject, so we can pass the principal directly to them.

"push-message" takes an optional nsIPushMessage; for that case, I think we'll want to change nsIPushMessage to a wrapper, and pass the actual data as an attribute. JS callers need to null-check and QI to nsIPushMessage, anyway, so I don't think this makes things any more complicated.
Attachment #8747828 - Flags: review?(dd.mozilla)
(Assignee)

Updated

2 years ago
Whiteboard: btpp-active
Comment on attachment 8747828 [details] [diff] [review]
pushObserverPrincipals.patch

Review of attachment 8747828 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/push/PushNotifier.cpp
@@ +472,5 @@
> +PushMessage::GetPrincipal(nsIPrincipal** aPrincipal)
> +{
> +  if (!aPrincipal) {
> +    return NS_ERROR_INVALID_ARG;
> +  }

we could use  NS_ENSURE_ARG_POINTER here?
Attachment #8747828 - Flags: review?(dd.mozilla) → review+
(Assignee)

Updated

2 years ago
Depends on: 1269385
(Assignee)

Comment 2

2 years ago
(In reply to Dragana Damjanovic [:dragana] from comment #1)
> we could use  NS_ENSURE_ARG_POINTER here?

Good call, thanks! Added NS_ENSURE_ARG{_POINTER} to the other methods, too. Carrying r+ forward.

I had to rename "nsIPushMessageData" to "nsIPushData," since it conflicts with the refcount tracing for the WebIDL interface: https://treeherder.mozilla.org/logviewer.html#?job_id=20274692&repo=try It's also shorter. :-)
(Assignee)

Comment 3

2 years ago
Created attachment 8748120 [details] [diff] [review]
pushObserverPrincipals.patch
Attachment #8747828 - Attachment is obsolete: true
Attachment #8748120 - Flags: review+

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/aaa6c0e38d61
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox49: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.