Closed Bug 1650925 Opened 5 years ago Closed 5 years ago

"impl is null" errors from returning null in nsIInterfaceRequestor::getInterface()

Categories

(Calendar :: General, defect)

defect

Tracking

(thunderbird_esr78+ fixed)

RESOLVED FIXED
Thunderbird 80.0
Tracking Status
thunderbird_esr78 + fixed

People

(Reporter: pmorris, Assigned: pmorris)

References

Details

Attachments

(1 file, 3 obsolete files)

We should be throwing instead of returning null when implementing nsIInterfaceRequestor::getInterface (e.g. in InterfaceRequestor_getInterface in calProviderUtils.jsm), and the devtools code is complaining with impl is null errors in the console. I'll upload the fix from Philipp shortly.

These are basically the changes that Philipp shared over chat. I've added a similar change in CalDavSession.jsm. Still needs some more testing, and a try run, but going ahead and putting it up for review.

Attachment #9161756 - Flags: review?(geoff)

I realized I uploaded a botched version of the patch. Here's the correct one. The try run is with the correct patch, and looks okay.

Attachment #9161756 - Attachment is obsolete: true
Attachment #9161756 - Flags: review?(geoff)
Attachment #9161913 - Flags: review?(geoff)
Comment on attachment 9161913 [details] [diff] [review] throw-when-getting-interfaces-1.diff Review of attachment 9161913 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/modules/utils/calProviderUtils.jsm @@ +52,5 @@ > + // For example, when there is no calendar associated with a request, > + // as in calendar detection. > + calendar = aNotificationCallbacks.getInterface(Ci.calICalendar); > + } catch (e) { > + if (!e.result || e.result != Cr.NS_ERROR_NO_INTERFACE) { Do we need to check that e.result exists? If it's undefined, that's not equal to Cr.NS_ERROR_NO_INTERFACE. ::: calendar/providers/caldav/modules/CalDavRequest.jsm @@ +173,5 @@ > + let iface = tryGetInterface(this.session) || tryGetInterface(this.calendar); > + if (!iface) { > + throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE); > + } > + return iface; Flip this.
Attachment #9161913 - Flags: review?(geoff) → review+

Thanks for review. Comments addressed.

Attachment #9161913 - Attachment is obsolete: true
Attachment #9162129 - Flags: review+

I'm debugging some networking errors in a patch on top of this one, and I want to get it sorted out and make sure it's not related to this patch before we land this.

The errors are indeed due to this patch. Synchronizing a caldav calendar fails:

console.log: Lightning: [calCachedCalendar] Doing changelog based sync for calendar https://caldav.fastmail.com/dav/calendars/user/[...]
console.debug: Lightning: 
  CalDAV: send (PROPFIND https://caldav.fastmail.com/dav/calendars/user/[...]/): <?xml version="1.0" encoding="UTF-8"?>
<D:propfind xmlns:D='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav' xmlns:CS='http://calendarserver.org/ns/'><D:prop><D:resourcetype/><D:owner/><D:current-user-principal/><D:supported-report-set/><C:supported-calendar-component-set/><CS:getctag/></D:prop></D:propfind>
JavaScript error: resource://devtools/server/actors/network-monitor/network-response-listener.js, line 89: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIInterfaceRequestor.getInterface]
JavaScript error: resource://devtools/server/actors/network-monitor/utils/channel-map.js, line 57: TypeError: this.weakMap.get(...) is undefined
JavaScript error: resource://devtools/server/actors/network-monitor/utils/channel-map.js, line 57: TypeError: this.weakMap.get(...) is undefined
console.log: Lightning: CalDAV: Error during initial PROPFIND for calendar FM test cal: [object Object]
console.warn: Lightning: There has been an error reading data for calendar: FM test cal.  However, this error is believed to be minor, so the program will attempt to continue. Error code: DAV_NOT_DAV. Description: The resource at https://caldav.fastmail.com/dav/calendars/user/[...] is either not a DAV collection or not available
console.warn: Lightning: There has been an error reading data for calendar: FM test cal.  However, this error is believed to be minor, so the program will attempt to continue. Error code: READ_FAILED. Description: 
console.error: Lightning: 
  [calCachedCalendar] replay action failed: <unknown>, uri=https://caldav.fastmail.com/dav/calendars/user/[...], result=2147500037, operation=[xpconnect wrapped calIOperation]

Fixed. I had added similar changes to CalDavSession.getInterface and that was causing the new errors. This patch just drops those changes. The remaining changes have been reviewed, and manually tested, so this is ready to land.

Attachment #9162129 - Attachment is obsolete: true
Attachment #9162187 - Flags: review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/4290f6c66a27
Fix console errors due to returning null from getInterface in calendar network code. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 80.0

Comment on attachment 9162187 [details] [diff] [review]
throw-when-getting-interfaces-4.diff

[Approval Request Comment]
Annoying console error

Attachment #9162187 - Flags: approval-comm-esr78?

Comment on attachment 9162187 [details] [diff] [review]
throw-when-getting-interfaces-4.diff

[Triage Comment]
Approved for esr78

Attachment #9162187 - Flags: approval-comm-esr78? → approval-comm-esr78+
See Also: → 1659987
See Also: → 1667067
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: