Closed Bug 2049782 Opened 5 months ago Closed 4 months ago

Refactor Alerts Services to have non-nsIObserver callbacks

Categories

(Toolkit :: Alerts Service, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

Details

(Whiteboard: [fidedi-notifications])

Attachments

(3 external files)

nsIObservers are limiting - they have exactly three vaguely-typed parameters that the callees need to figure out, and it's hard to add more topics because the callers may freak out on unexpected topics.

Having a separate observer interface that has different callbacks for each topic would be nicer.

Having this new interface should allow us to introduce more observer topics without fears on internal backwards compatibility.

This is still a "what do you think about this approach" kind of patch:

  • It does minimal refactoring of NotificationObserver rather than fulling using each nsIAlertCallbacks
  • The caller can use nsIAlertCallbacks but each backend still uses nsIObservers for windows

Followups will happen after landing this, if accepted.

Attachment #9600439 - Attachment description: Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=nrishel → Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=@-
Attachment #9600439 - Attachment description: Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=@- → WIP: Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=nrishel
Attachment #9600439 - Attachment description: WIP: Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=nrishel → Bug 2049782 - Add nsIAlertCallbacks to replace nsIObserver for Alerts Service r=nrishel

Updating AndroidAlerts is possible, but properly doing so requires GeckoView API change. For now we fall back to ShowAlert with nsIObserver.

Attachment #9609545 - Attachment description: WIP: Bug 2049782 - Fall back to ShowAlert in AndroidAlerts → Bug 2049782 - Fall back to ShowAlert in AndroidAlerts
Attachment #9609546 - Attachment description: WIP: Bug 2049782 - Update Alerts Service mocks to use showAlertWithCallbacks → Bug 2049782 - Update Alerts Service mocks to use showAlertWithCallbacks

Pushed by rperta@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/48cae055172c
https://hg.mozilla.org/integration/autoland/rev/e44f299a9a60
Revert "Bug 2046221, Bug 2046925, Bug 2052574, Bug 2049782 - Part 2: Add telemetry to NotificationParent r=nrishel" for causing mochitest-plain failures at test_ext_notifications.html

Regressions: 2057689

No leave-open but not closed?

Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED

Oh wait, the second push is not merged yet

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 4 months ago → 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
See Also: → 2057793
QA Whiteboard: [qa-triage-done-c156/b155]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: