Closed Bug 1756982 Opened 3 years ago Closed 3 years ago

Missing QueryInterface on opening calendar-event-dialog

Categories

(Calendar :: Calendar Frontend, defect)

defect

Tracking

(thunderbird_esr91 unaffected)

RESOLVED FIXED
99 Branch
Tracking Status
thunderbird_esr91 --- unaffected

People

(Reporter: henry-x, Assigned: darktrojan)

References

Details

Attachments

(1 file)

I noticed recently a new intermittent error when opening the edit window.

Steps to reproduce

  1. Open Browser Toolbox.
  2. Open and edit an existing event.

Result

On loading the calendar-event-dialog I sometimes see the following error in the console:

Uncaught TypeError: item.QueryInterface is not a function
    has resource:///modules/calendar/utils/calDataUtils.jsm:27
    add resource:///modules/calendar/utils/calDataUtils.jsm:69
    addObserver resource:///modules/calendar/utils/calProviderUtils.jsm:734
    observe chrome://calendar/content/calendar-item-iframe.js:190
    onLoad chrome://calendar/content/calendar-item-iframe.js:422
    onload chrome://calendar/content/calendar-item-iframe.xhtml:1

NOTE: for prosperity here are permalinks to the files:

https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/modules/utils/calDataUtils.jsm
https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/modules/utils/calProviderUtils.jsm
https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/content/item-editing/calendar-item-iframe.js

It seems that some events never reproduce this, but I don't know of a pattern.

Expect

No error is thrown.

Origin

It seems to derive from eventDialogCalendarObserver not having a QueryInterface method. I'm not sure what could have caused this.

Using the javascript debugger, in the cases where no error is thrown, if you step into this line https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/content/item-editing/calendar-item-iframe.js#190 then just before you reach addObserver we end up in this function https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/modules/calUtils.jsm#571 which is presumably part of adding the QueryInterface method. This doesn't happen in the cases where an error is thrown.

I don't know anything about XPCOM, so I wouldn't know how to fix this myself.

I've noticed this a while back, I was meaning to get back to it thanks. It's possible that a raw JS instance instead of a wrapped XPCOM calIEvent [1] is being passed. QueryInterface()[2] (scroll down) is used to get an XPCOM instance of any XPCOM interfaces the object supports, example: calIItem, calIEvent etc.

XPCOM in short, is a way for the native code to be able to share objects with JavaScript. In the long run, we want to de-XPCOM calendar so the preferred solution here would be to change the failing code to stop relying on QueryInterface.

[1] https://searchfox.org/comm-central/rev/b1ce128df25dee17e72fda5f07f2916f6249029e/calendar/base/public/calIEvent.idl
[2] http://www.xulplanet.com/tutorials/xultu/xpcom.html

We can add the missing QueryInterface method and that should fix it. I'm not sure that I've ever seen this error.

Assignee: nobody → geoff
Status: NEW → ASSIGNED

Henry are you still seeing this on trunk? I saw it before but have not in a while.

Flags: needinfo?(henry)

(In reply to Lasana Murray from comment #4)

Henry are you still seeing this on trunk? I saw it before but have not in a while.

Yup, I just checked with today's build. Still happens.

Flags: needinfo?(henry)
Blocks: 1757428
Target Milestone: --- → 99 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/33e514d6150a
Add QueryInterface to objects in calendar-item-iframe.js. r=lasana

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: