Closed Bug 1269436 Opened 4 years ago Closed 4 years ago

Always pass the principal to push observer notifications

Categories

(Core :: DOM: Push Notifications, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: Lina, Assigned: Lina)

References

Details

(Whiteboard: btpp-active)

Attachments

(1 file, 1 obsolete file)

Attached patch pushObserverPrincipals.patch (obsolete) — Splinter Review
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)
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+
Depends on: 1269385
(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. :-)
Attachment #8747828 - Attachment is obsolete: true
Attachment #8748120 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/aaa6c0e38d61
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.