Closed Bug 1295525 Opened 8 years ago Closed 8 years ago

Event capture/edit dialog not working when cloud attachment provider is configured and enabled (fallout from bug 1277972)

Categories

(Calendar :: Dialogs, defect)

Lightning 5.3
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jorgk-bmo, Assigned: pmorris)

References

Details

(Keywords: regression)

Attachments

(1 file)

If cloud attachment providers are configured and mail.cloud_files.enabled is set (true==default), calendar event entry/edit does not work as detailed in bug 1277972 comment #44.

JS message:
JavaScript error: chrome://lightning/content/lightning-item-iframe.js, line 1866: TypeError: optionsPopup is null
This patch implements async message passing for the UI for attaching files via cloud providers.  This enables this feature and appears to fix the spinning cursor and these issues:

> - Double click into an empty day, not equal today.
>   I get offered today and the current time. Not right, I wanted the other day.
>   The time used to be rounded to the next hour, now I get the exact time.
> - Double click an existing event. Again, I get today and now instead of the 
>   event's details.

(Note: the context menu for the attachments tab panel does not currently display the cloud provider menu items, but in my testing this is an existing issue in the current release and is not caused by this patch.  It will need fixing one way or another.)

The problems with reoccurring events appear to be a somewhat separate issue, as I get the following error immediately upon opening TB, with the calendar tab open that is displaying a reoccurring event.  I have not yet investigated this any further.

Error: Could not extract integer from ":0"		ical.js:103:13

[calStorageCalendar] Message: Error getting recurrence for item 'test' (1298f0af-8e0d-454e-bc0b-75e9a71ee89c)!
Connection Ready: true
Last DB Error Number: 100
Last DB Error Message: unknown error
Database File: /home/paul/.thunderbird/b1jpjklm.test3/calendar-data/local.sqlite
Last DB Statement: [object StatementJSHelper]
Last Statement param [item_id]: 1298f0af-8e0d-454e-bc0b-75e9a71ee89c
Last Statement param [cal_id]: c1d8800f-bfd6-426c-b388-26d1b9c706c2
Last Statement param [QueryInterface]: function QueryInterface() {
    [native code]
}
Exception: [Exception... "[JavaScript Error: "Could not extract integer from ":0"" {file: "resource://calendar/modules/ical.js" line: 103}]'[JavaScript Error: "Could not extract integer from ":0"" {file: "resource://calendar/modules/ical.js" line: 103}]' when calling method: [calIRecurrenceRule::icalProperty]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js :: cSC_getRecurrenceItemFromRow :: line 1889"  data: yes]
1: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:2428] cSC_logError
2: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:1754] cSC_getAdditionalDataForItem
3: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:1613] cSC_getEventFromRow
4: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:1560] cSC_assureRecurringItemCaches
5: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:724] cSC_getItems_
6: [file:///home/paul/tbdev/comm-central/obj-x86_64-pc-linux-gnu/dist/bin/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calStorageCalendar.js:666] cSC_getItems/<
Attachment #8781689 - Flags: review?(makemyday)
Thanks for the quick response.

(In reply to Paul Morris [:pmorris] from comment #1)
> Error: Could not extract integer from ":0" - ical.js:103:13
This (sadly) is a known (long-standing) problem, see bug 1294668 or bug 1179783 comment #2.
You could use the old C++ libical by switching calendar.icaljs to false, then you won't have this problem.
Comment on attachment 8781689 [details] [diff] [review]
cloud-provider-messaging-aug16.patch

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

Thanks for the quick patch.

r+ with the below nits fixed.

Please file another bug for the cloud provider menu items not showing up, if there isn't any already.

The recurrence issue is maybe related to bug 1179783 (see also bug 1294668) and not related to the event in a tab patch.

::: calendar/lightning/content/lightning-item-iframe.js
@@ +1837,2 @@
>  function loadCloudProviders() {
>      let cloudFileEnabled = Preferences.get("mail.cloud_files.enabled", false)

Missing ;

@@ +1945,3 @@
>      }
>  
>      var files;

let files;
Attachment #8781689 - Flags: review?(makemyday) → review+
Assignee: nobody → paul
Status: NEW → ASSIGNED
Version: unspecified → Lightning 5.3
https://hg.mozilla.org/comm-central/rev/141fa85916e4
Landed with nits fixed, mind you, they were in existing code.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Thanks for fixing the nits and landing the patch.  Here's the bug for the attachments context menu: 
https://bugzilla.mozilla.org/show_bug.cgi?id=1295861
Comment on attachment 8781689 [details] [diff] [review]
cloud-provider-messaging-aug16.patch

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

::: calendar/lightning/content/lightning-item-iframe.js
@@ +1925,5 @@
> + *
> + * @param {string} aAccountKey  The accountKey for a cloud provider
> + */
> +function attachFileByAccountKey(aAccountKey) {
> +    for (let [,cloudProvider] in Iterator(cloudFileAccounts.accounts)) {

Iterator is being removed everywhere, please do not add new ones (bug 1293003).
Thanks for the heads up, Aceman. But I let it pass intentionally here as I will take care of the Iterators in the other bug 1293003 alltogether. But could have made a comment to make this obvious.

@JorgK: thanks for landing this, but please don't forget to set the approriate target milestone whenever landing calendar patches.
Target Milestone: --- → 5.3
Sorry, I got confused by "Version: unspecified → Lightning 5.3" after comment #3. I thought, MayMyDay is being pro-active. It was late. ;-)
Paul, have you tried added attachments via a cloud service?
I've tried with varying success. I got three cases:
1) File uploaded but link was to local file in attachment box.
2) File uploaded but no link was inserted.
3) Success: File uploaded and link placed into attachment box.

I've also seen heaps of warnings on the JS console:
TypeError: parent is null lightning-item-iframe.js:156:5
[calendar-event-dialog] Uploading cloud attachment failed. Status code: 2153066778 lightning-item-iframe.js:2066:17
NS_ERROR_NOT_INITIALIZED:

Looks like these were caused by the problems mentioned in 1) and 2). I've created some more events with cloud attachments and now I saw consistent success with no messaged on the error console.

I also saved and closed the event before the upload was finished, that might have caused the "parent is null" error.

Note that were the upload failed, I got no error message. I just failed silently.
Flags: needinfo?(paul)
Excuse the grammar errors:
Paul, have you tried adding attachments via a cloud service?
and
... with no messages on the error console.
Raised bug 1295970 for this.
Flags: needinfo?(paul)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: