Bug 1630943 Comment 13 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

 In order for `asyncOnChannelRedirect` to be called, the network code will look at `httpchannel.notificationCallbacks`, QI that to `nsIInterfaceRequestor`, call `.getInterface(Ci.nsIChannelEventSink)` on that, and then call `asyncOnChannelRedirect` on the result.

The old code assumed that the calendar was always the notification callback, hence `prepHttpChannel` will first make it look like it needs a calendar, and then later pass it to `httpchannel.notificationCallbacks`. The new code refactors that a bit, so that `CalDavRequestBase` is supposed to be the notification callback, but the calendar is separate.

What you'll need to do is change [calProviderUtils line 49](https://searchfox.org/comm-central/rev/2006bce43f7350f93c37e18a136e149f9a7ffb6c/calendar/base/modules/utils/calProviderUtils.jsm#49) to not assume that it can be QI'd to a calICalendar. You could for example do `let calendar = aNotifcationCallbacks.getInterface(Ci.calICalendar)` instead. Then you need to actually pass `this` instead of `this.calendar` in the `reset()` method, so you are actually passing the `nsIInteraceRequestor` instead of the `calICalendar`.
 In order for `asyncOnChannelRedirect` to be called, the network code will look at `httpchannel.notificationCallbacks`, QI that to `nsIInterfaceRequestor`, call `.getInterface(Ci.nsIChannelEventSink)` on that, and then call `asyncOnChannelRedirect` on the result.

The old code assumed that the calendar was always the notification callback, hence `prepHttpChannel` will first make it look like it needs a calendar, and then later pass it to `httpchannel.notificationCallbacks`. The new code refactors that a bit, so that `CalDavRequestBase` is supposed to be the notification callback, but the calendar is separate.

What you'll need to do is change [calProviderUtils line 49](https://searchfox.org/comm-central/rev/2006bce43f7350f93c37e18a136e149f9a7ffb6c/calendar/base/modules/utils/calProviderUtils.jsm#49) to not assume that it can be QI'd to a calICalendar. You could for example do `let calendar = aNotifcationCallbacks.getInterface(Ci.calICalendar)` instead. Then you need to actually pass `this` instead of `this.calendar` in the `reset()` method, so you are actually passing the `nsIInteraceRequestor` instead of the `calICalendar`..

Back to Bug 1630943 Comment 13