Replace cal.createAdapter-based calendar observers with explicit calIObserver objects#67
Conversation
Replace cal.createAdapter-based calendar observers with explicit calIObserver objects ## Summary This replaces `cal.createAdapter(Ci.calIObserver, ...)` usage in the calendar experiment with explicit `calIObserver` objects using: ```js QueryInterface: ChromeUtils.generateQI(["calIObserver"])
|
@mkmelin can you give this a quick look? I believe you removed createAdapter in core code. |
|
One more note on downstream impact: NC Connector depends on the persisted "browser.calendar.items.*" lifecycle events provided by this experiment layer. These events are not just used for UI updates, but for the add-on's post-save synchronization flow after a calendar item is actually created, updated, or removed. In practice, that flow is used to keep Talk room metadata in sync with the saved event, persist the event↔room mapping, run deferred participant/delegation updates, and clean up associated Talk rooms again when an event is deleted. So while restoring an equivalent helper in core would of course also help downstream consumers, this PR keeps the fix local and minimal by removing the experiment's remaining dependency on "cal.createAdapter()". |
|
createCalendarObserver() is added twice with the same implementation — should we move that into a shared helper? |
|
Yes I think you can put it in ext-calendar-utils.sys.mjs ? |
Move createCalendarObserver() into ext-calendar-utils.sys.mjs and import it from ext-calendar-calendars.js and ext-calendar-items.js. This removes duplicate observer factory code while preserving behavior.
Fixes #66
Summary
This PR replaces
cal.createAdapter(Ci.calIObserver, ...)usage in the calendar experiment with explicitcalIObserverobjects using:Problem
On newer Thunderbird releases,
cal.createAdapteris no longer available.That breaks listener registration in the calendar experiment and prevents these experiment events from being registered correctly:
calendar.items.onCreatedcalendar.items.onUpdatedcalendar.items.onRemovedcalendar.calendars.onUpdatedCause
The experiment currently relies on:
for internal observer creation.
When that helper is unavailable, observer registration fails before
cal.manager.addCalendarObserver(observer)can succeed.Fix
Replace the removed helper usage with explicit
calIObserverobjects.The patch adds small local helpers which provide:
QueryInterface: ChromeUtils.generateQI(["calIObserver"])This keeps the public experiment API unchanged and only updates internal observer construction.
Affected files
calendar/experiments/calendar/parent/ext-calendar-items.jscalendar/experiments/calendar/parent/ext-calendar-calendars.jsVerification
Verified manually on:
After the patch:
calendar.items.onCreatedworkscalendar.items.onUpdatedworkscalendar.items.onRemovedworkscalendar.calendars.onUpdatedworkscal.createAdapter is not a functionruntime errors are goneNotes
This is a compatibility fix only.
It does not change the public experiment API surface or semantics.