Closed Bug 1512331 Opened 6 years ago Closed 5 years ago

Item IFrame not considering recurrence dates (rule.untilDate is undefined)

Categories

(Calendar :: Dialogs, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: public, Assigned: public)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch fix against comm-central (obsolete) — — Splinter Review
STR:
0. Thunderbird 60.3.0, clean profile, Lightning enabled.
1. Create a sequence of events (for example repeating daily)
2. Copy a single instance of the sequence
3. Paste the instance somewhere in the calendar
4. Double-click on the new instance

Expected:
Window to edit the event opens, no errors in error console

Actual:
Window to edit the event opens, error console logs:
> TypeError: rule.untilDate is undefined
>  updateRepeat chrome://lightning/content/lightning-item-iframe.js:2599:17
>  updateCalendar chrome://lightning/content/lightning-item-iframe.js:2491:9
>  loadDialog chrome://lightning/content/lightning-item-iframe.js:730:9
>  onLoad chrome://lightning/content/lightning-item-iframe.js:380:5
>  onload chrome://lightning/content/lightning-item-iframe.xul:1:1

As updateRepeat is not finishing, there could also be some update issues and Add-ons relying on updateRepeat change their behavior – that's how I found the bug.

Reason:
lightning-item-iframe.js:2598-2599 is (comm-central:2720-2721)
> if (!rule.isByCount && rule.isFinite) {
>   gUntilDate = rule.untilDate.clone().getInTimezone(cal.dtz.defaultTimezone);
assuming that "rule" is a calIRecurrenceRule, but in this case it's a
calIRecurrenceDate, which doesn't implement isByCount. rule.untilDate is also
not implemented – attempting to clone undefined obviously fails.

Fix:
It seems to me that lightning-item-iframe.js globally assumes that the first positive recurrence item is a calIRecurrenceRule. In most cases, that works, as accessing isFinite and untilDate yields a falsy value for both rules and dates. If one wants to keep the style this bug can be fixed by checking untilDate before cloning; I attached a patch for that, as I assume the current style was conceived for a reason (performance?).

If there was no particular reason to violate the interfaces, it might be a better idea to fix this bug differently: for example by limiting splitRecurrenceRules to positive rules or checking the recurrence items' type before accessing rule-only members.
Attachment #9029749 - Flags: review?(philipp)
Attached patch fix against comm-central — — Splinter Review
Sorry, forgot the patch header. This *should* satisfy the requirements.
Attachment #9029749 - Attachment is obsolete: true
Attachment #9029749 - Flags: review?(philipp)
Attachment #9029753 - Flags: review?(philipp)
Assignee: nobody → public
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 9029753 [details] [diff] [review]
fix against comm-central

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

This seems like a reasonable fix, thanks for digging in!
Attachment #9029753 - Flags: review?(philipp) → review+

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/13f5e1afe5a3
Don't access undefined untilDate on calIRecurrenceDate. r=philipp

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

Attachment

General

Created:
Updated:
Size: