FileLink regressions in calendar event/task dialog
Categories
(Calendar :: Dialogs, defect)
Tracking
(thunderbird_esr78+ fixed, thunderbird85 affected)
People
(Reporter: jkufner, Assigned: lasana)
Details
(Keywords: regression)
Attachments
(4 files, 3 obsolete files)
58.77 KB,
image/png
|
Details | |
20.14 KB,
patch
|
darktrojan
:
review+
wsmwk
:
approval-comm-esr78+
|
Details | Diff | Splinter Review |
5.81 KB,
patch
|
Details | Diff | Splinter Review | |
19.44 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Steps to reproduce:
Lightning's events and tasks allow only links to be attached. It is a CalDAV limitation. It would be nice if we could attach a local file and it would be uploaded to a cloud, adding the link to the event.
"FileLink for Nextcloud and ownCloud" (https://gitlab.com/joendres/filelink-nextcloud/) extension can handle the uploading part. It works just fine for e-mail attachments, but there is no Filelink API support for such a thing in the calendar.
See https://gitlab.com/joendres/filelink-nextcloud/-/issues/266#note_425612547 for the original issue.
Reporter | ||
Comment 1•4 years ago
|
||
It seems that the feature is already there, but user interface does not expect it nor handle it well.
this is already possible, but it looks like the option to do so got lost from the toolbar button, which is worth filing as a bug (interested in patching? :).
You can still do so via the menu Options > Attach > File using (ProviderName)
Moreover, the file upload is not handled well by the user interface. Completed uploads appear in-progress forever and failures are not handled.
So, it is likely only matter of user interface rather than some internals.
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 2•4 years ago
•
|
||
This is a regression on previously existing functionality, the attach button used to have a dropdown, and uploads would attach normally. Would be great to get this fixed along with a bc test to keep it working.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 3•4 years ago
|
||
I still see the code in 60 - https://dxr.mozilla.org/comm-central/rev/2a29ee0adb310b54a6a2df72034953fed8f2b043/comm/calendar/lightning/content/lightning-item-toolbar.xul#77-80 which would now be at https://searchfox.org/comm-central/rev/2d7ba685276279da8ba4d01b5081e4420c897398/calendar/lightning/content/lightning-item-toolbar.inc.xhtml#53-59
Have no idea where it went and hg doesn't seem to want to tell me. But I'd imagine it's trivial to add back.
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
How do I enable the WeTransfer plugin in a development version? I see it in daily but it's not there in my development build.
Comment 5•4 years ago
|
||
Preferences | Attachments | Add WeTransfer.
Showing for me in local builds.
Assignee | ||
Comment 6•4 years ago
|
||
This is what I see when I go there.
Comment 7•4 years ago
|
||
Strange. For the purpose of this bug you can of course install some other provider as well.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 8•4 years ago
|
||
How do I add an extension in a test?
Assignee | ||
Comment 9•4 years ago
|
||
Oh, I should add that it appears the WeTransfer plugin is not there in artifact builds.
Assignee | ||
Comment 10•4 years ago
|
||
Never mind I found this test:
https://searchfox.org/comm-central/source/mail/components/preferences/test/browser/browser_cloudfile.js#20
Assignee | ||
Comment 11•4 years ago
|
||
I restored the attach menu and added a test for web link and a custom provider.
Assignee | ||
Comment 12•4 years ago
|
||
Assignee | ||
Comment 13•4 years ago
|
||
I plan to add the helper functions to CalendarTestUtils in bug 1683444.
Assignee | ||
Comment 14•4 years ago
|
||
Test is failing on try server. Working on it...
Comment 15•4 years ago
|
||
Assignee | ||
Comment 16•4 years ago
|
||
verify that the file picker "opened"
Is that possible with MockFilePicker? Seems like it does not actually open the file dialog.
Also, after saving and reopening the event, since my extension had the default icon (chrome://messenger/content/extension.svg), which is larger than the usual size, it wasn't constrained to be the usual size. That should be fixed.
Can we tackle this in another bug?
Comment 17•4 years ago
|
||
(In reply to Lasana Murray from comment #16)
Is that possible with MockFilePicker? Seems like it does not actually open the file dialog.
No, it doesn't open the dialog, that's the point of it. (Actually opening the dialog would cause the test to time out because we can't control it.) But you can check that it was asked to open the dialog by looking at the value of MockFilePicker.shown
.
Can we tackle this in another bug?
If you must, so long as it happens.
Assignee | ||
Comment 18•4 years ago
|
||
Ok, so I made some changes to the test here after some deep, painful debugging and learned a few things:
-
The calendar-event-dialog uses
postMessage()
and asynchronously updates various parts of the menu UI and other things. This causes the test to timeout because it seems like the DOM is modified when I click on the attach menu. This shows up intermittently and I was unable to figure out a way to wait until all the changes are done so I usesetTimeout()
. -
Don't use
SimpleTest.waitForFocus()
. It looked attractive but looks like it causes serious crashes on OSX and Windows when I used it.
Included the icon url in the test, also updated the code that displays the icon in the dropdown and attachments tab.
Assignee | ||
Comment 19•4 years ago
|
||
Assignee | ||
Comment 20•4 years ago
|
||
This function does async work but is not async, neither is the functions that call it. This caused the test to fail. Can I treat this as a bug Geoff or was it intentional?
https://searchfox.org/comm-central/source/calendar/lightning/content/lightning-item-iframe.js#2348
Interestingly, I see code MockFilePicker.open does the same thing.
Comment 21•4 years ago
|
||
Yes it's intentional. The uploading happens asynchronously but the code calling it doesn't care about the result, and in fact needs to carry on immediately without waiting for the result.
The file picker does the same thing because it's from the mythical time before Promise
.
Comment 22•4 years ago
|
||
Interestingly the mail/ corresponding uploadCloudAttachment is marked as async.
Just because we mark things as async doesn't need they need to be awaited, so IMO we could mark uploadCloudAttachment etc. async for clarity.
Comment 23•4 years ago
|
||
I've been trying to figure out if that time out can be replaced by something a bit more specific. Can't remember exactly where I was three days ago, but I'll have another look tomorrow.
On a related note, I noticed that right-clicking on the attachments list only brings up the FileLink menu items if an attachment is selected. This doesn't account for those menu items, I guess it was written before they existed.
Assignee | ||
Comment 24•4 years ago
|
||
Yes it's intentional. The uploading happens asynchronously but the code calling it doesn't care about the result, and in fact needs to carry on immediately without waiting for the result.
I can understand the reasons for this, especially in a single threaded, event loop oriented language environment like JS, but in practice intermingling sync and async operations like this can be a source of very hard to reason about bugs. I've already been stuck a few times elsewhere and realized that async operations were going on and not being awaited (thus my test failing only occasionally). We should at least document stuff like this in function comments so anyone looking instantly knows it's doing something the callers don't have control of.
I'm also wondering what happens if for any reason those promises end in a rejection? Will the error propagate? logged to console? silently ignored?
Just because we mark things as async doesn't need they need to be awaited, so IMO we could mark uploadCloudAttachment etc. async for clarity.
We could, if the body of the function actually awaits or returns its promises. Still, creating promises and not including them in control flow is likely to create problems down the road IMO.
Comment 25•4 years ago
|
||
(In reply to Lasana Murray from comment #24)
I'm also wondering what happens if for any reason those promises end in a rejection? Will the error propagate? logged to console? silently ignored?
This happens. It's better than nothing but really should alert the user on failure like the compose code does.
Comment 26•4 years ago
|
||
Reporter | ||
Comment 27•4 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #25)
(In reply to Lasana Murray from comment #24)
I'm also wondering what happens if for any reason those promises end in a rejection? Will the error propagate? logged to console? silently ignored?
This happens. It's better than nothing but really should alert the user on failure like the compose code does.
Error handling is indeed really poor (from user perspective), but that is another issue.
Assignee | ||
Comment 28•4 years ago
|
||
Hmmm. I can't see anything in this function that should have this problem. Using waitForCondition would be a better option, if you can figure out what's not ready in time.
Instead of calling setTimeout, you could wait here for the menuitem to exist.
I tried various iterations of this but the test would still occasionally timeout. Reason seems to be the dropdown menu closes as soon as it is opened and the following click targets the calendar field instead of the menuitem.
For some reason this no longer happens and it does not fail on the try server, I'm removing the timeouts.
Assignee | ||
Comment 29•4 years ago
|
||
Made requested changes, removed timeouts, also made the test check the summary dialog for the attachment.
Updated•4 years ago
|
Comment 30•4 years ago
|
||
Comment on attachment 9195512 [details] [diff] [review]
bug16698003v4.patch
This piece is all fine, but I had a look at your Try run and realised this patch has broken this test code, so you'll need to get that fixed before landing. It should just be a case of waiting for the menu to open then clicking on the menuitem, like you're already doing here.
Assignee | ||
Comment 31•4 years ago
|
||
Included the changes recommended. eventDialog test no longer fails.
Assignee | ||
Comment 32•4 years ago
•
|
||
browser_timezones.js
fails on OSX but I don't think it's related to this patch.
Comment 33•4 years ago
|
||
Comment on attachment 9195870 [details] [diff] [review]
bug1669803v5.patch
Nice one. Got there in the end.
Assignee | ||
Updated•4 years ago
|
Comment 34•4 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/e159a02960ab
Restore the attachment dropdown in the event dialog. r=darktrojan
Comment 35•4 years ago
|
||
I removed the lines setting/resetting the timezone since I forgot to ask you to do it after bug 1684485.
Updated•4 years ago
|
Comment 36•4 years ago
|
||
Comment on attachment 9195870 [details] [diff] [review]
bug1669803v5.patch
[Approval Request Comment]
Regression, baked on beta.
Comment 37•4 years ago
|
||
Comment on attachment 9195870 [details] [diff] [review]
bug1669803v5.patch
[Triage Comment]
Approved for esr78
Comment 38•4 years ago
|
||
Adds CalendarTestUtils.jsm to 78.
Comment 39•4 years ago
|
||
Port to 78.
Comment 40•4 years ago
|
||
bugherder uplift |
Comment 41•4 years ago
|
||
bugherder uplift |
I made a silly mistake in the backporting and somehow failed to notice:
https://hg.mozilla.org/releases/comm-esr78/rev/8de9dbf0b785
Description
•