Open Bug 1932368 Opened 1 year ago Updated 14 days ago

Remove cookie field from alerts

Categories

(Toolkit :: Alerts Service, task)

task

Tracking

()

People

(Reporter: saschanaz, Unassigned)

References

Details

The cookie parameter/field has been used to map between parent process listener and content process listener. Now the listener only exists in the parent process and thus it can go.

FYI we're using the cookie field in Thunderbird to identify which message an alert belongs to. There's probably some other way, but that's what we're doing at the moment.

It's also passing the same value to the name parameter too, maybe that's enough for Thunderbird? (Not sure why we would need two parameters having the same value.)

Flags: needinfo?(geoff)

We're using it to tell notifications apart where the same observer is used for multiple notifications. It looks like the extensions API does this as well. We could convert our code to use a new observer for each notification, I suppose.

Flags: needinfo?(geoff)

Oh hmm. We sorta assume that each notification has its own observer right now (example), as that's how notification action is implemented for Windows (or otherwise we don't have a field to indicate which action is triggered). But we may need to reconsider that. Thank you!

Hello Desktop Integration people, any opinion about comment #3 and comment #4?

Flags: needinfo?(nrishel)
Flags: needinfo?(nalexander)

(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #5)

Hello Desktop Integration people, any opinion about comment #3 and comment #4?

I vaguely remember being confused as to why there was cookie and name. IIRC, the name is used for deduping. Generally, I would like some unique identifier attached to a callback of this kind, but I don't have any opinion about whether it should be the existing cookie. My expectation is that cleaning this up will be better than any existing pattern. Nicholas may have deeper thoughts here: I can't page this back in right now.

Flags: needinfo?(nalexander)

(In reply to Nick Alexander :nalexander [he/him] from comment #6)

(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #5)

Hello Desktop Integration people, any opinion about comment #3 and comment #4?

I vaguely remember being confused as to why there was cookie and name. IIRC, the name is used for deduping. Generally, I would like some unique identifier attached to a callback of this kind, but I don't have any opinion about whether it should be the existing cookie. My expectation is that cleaning this up will be better than any existing pattern. Nicholas may have deeper thoughts here: I can't page this back in right now.

Oh, another wrinkle -- maybe some of these fields are client-controlled (i.e., untrusted) and some are not. Losing the browser-controleld, trusted value sounds bad for deduping and avoiding confusion errors.

I believe cookie is also client-controlled as it's from the constructor too. Maybe bug 1932393 will handle the "trusted" ID use case.

Off top of head and after a minute of investigation, I can't find any reason to object to removing the cookie field wrt Desktop Integrations uses. I think once upon a time we used it as part of the tag to differentiate the notification to Windows, but if that was ever the case it has since been removed.

Flags: needinfo?(nrishel)

(In reply to Geoff Lankow (:darktrojan) from comment #3)

We're using it to tell notifications apart where the same observer is used for multiple notifications. It looks like the extensions API does this as well. We could convert our code to use a new observer for each notification, I suppose.

Bug 2022705 shows a regression on Android caused by the repurposing of the data field in observer notifications (analysis in https://bugzilla.mozilla.org/show_bug.cgi?id=2022705#c1 ).

I'm going to fix that regression by switching away from the data parameter, and will also update the IDL file to emphasize that the cookie data is deprecated as a warning, referencing this bug.

See Also: → 2022705

I'll remove the uses in Thunderbird. The one I linked to in this bug has gone already, but there is another.

You need to log in before you can comment on or make changes to this bug.