Closed Bug 1528133 Opened 5 years ago Closed 5 years ago

Calendar functionality failing with objects needing QueryInterface

Categories

(Calendar :: Internal Components, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: darktrojan, Assigned: darktrojan)

Details

Attachments

(2 files, 1 obsolete file)

Something to do with the component registration changes has broken the calendar startup service.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/42fae7cba14d
Fix calendar startup by QIing services to calIStartupService; rs=bustage-fix CLOSED TREE

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 6.9
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Summary: Calendar startup service failing → Calendar functionality failing with objects needing QueryInterface

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/8ec819a812a7
Add more QueryInterface calls to fix broken calendar views; rs=bustage-fix CLOSED TREE

Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED

Okay, that should fix all the calendar tests except testLocalICS.js – I don't know what's wrong with that.

But wait there's moreβ€½ I didn't realise the XPCShell tests were busted too.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch 1528133-calendar-xpcshell-qi-1.diff (obsolete) β€” β€” Splinter Review

These are all the QIs needed to make the XPCShell tests pass. (And yes, I know making the tests pass doesn't fix the problem.) I've commented testOfflineStorage in test_providers.js because it is all kinds of broken.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/333bacc41597
Add necessary QueryInterface calls to calendar; rs=bustage-fix

Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED

This is the net result of the patches I've landed for this bug.

I've just been reminded that part of test_providers.js is still neutered, so I'm going to reopen the bug. I don't know how to fix it.

Attachment #9044376 - Attachment is obsolete: true
Attachment #9044533 - Flags: review?(philipp)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 9044533 [details] [diff] [review]
1528133-calendar-qi-2.diff

Review of attachment 9044533 [details] [diff] [review]:
-----------------------------------------------------------------

I knew this would happen some time. I guess it is time to speed up getting rid of xpcom, good thing Paul is on board now.

::: calendar/base/modules/calRecurrenceUtils.jsm
@@ +446,4 @@
>                      let exceptionIds = recInfo.getExceptionIds({});
>                      for (let exceptionId of exceptionIds) {
>                          let recur = recInfo.getExceptionFor(exceptionId);
> +                        recur.QueryInterface(Ci.calIEvent);

I've had cases where just QI'ing for side-effects didn't work well, see also cal.wrapInstance(). I think you should strap the QI onto the line before.

::: calendar/base/src/calFilter.js
@@ +780,4 @@
>                  if (this.isItemInFilters(next)) {
>                      return next;
>                  }
> +                next.QueryInterface(Ci.calIEvent);

Similar here. Also happens in other places in this patch I'm not going to flag individually.
Attachment #9044533 - Flags: review?(philipp) → review+

We might want to back this out and update https://searchfox.org/comm-central/source/calendar/base/modules/calUtils.jsm#225 to adapt for bug 1526382. It looks like changing getInterfaces to get interfaces() or an array would fix more things at once.

Flags: needinfo?(geoff)

I did a Try run with this change and the others backed out and it worked okay. Does it not make sense to leave the QIs I added in place? XPCOM is a bit of a black box to me.

Flags: needinfo?(geoff)
Attachment #9045150 - Flags: review?(philipp)
Comment on attachment 9045150 [details] [diff] [review]
1528133-calendar-classinfo-1.diff

Review of attachment 9045150 [details] [diff] [review]:
-----------------------------------------------------------------

I guess we could leave them in. Eventually classInfo might break completely, and then we've made headway.

For making it less of a black box: Without nsIClassInfo, Javascript XPCOM objects are wrapped so that they provide the methods and properties of one specific interface (in the worst case nsISupports). If nsIClassInfo is there and the interfaces are known, it will make all of the methods and properties of all known interfaces available.

Ideally, we're getting rid of all the xpcom in JS and moving that to pure js classes, for which we'd not need the QI's. That's still a bit down the line though.
Attachment #9045150 - Flags: review?(philipp) → review+
Keywords: checkin-needed

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/e0d601d1f154
Fix calendar's ClassInfo implementation to follow the changes from bug 1526382. r=philipp

Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: