dragging ics file to today pane does not populate "New Event" window
Categories
(Calendar :: Import and Export, defect)
Tracking
(thunderbird_esr78 wontfix)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | wontfix |
People
(Reporter: rodrigo, Assigned: lasana)
References
(Regression)
Details
(Keywords: regression)
Attachments
(4 files, 6 obsolete files)
850 bytes,
application/x-extension-ics
|
Details | |
19.00 KB,
application/vnd.oasis.opendocument.spreadsheet
|
Details | |
46.27 KB,
patch
|
lasana
:
review+
|
Details | Diff | Splinter Review |
10.71 KB,
patch
|
darktrojan
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0
Steps to reproduce:
I took a standard ics calendar event filed and dragged it to the "Today Pane".
Actual results:
A "New Event" window was shown (expected) but the window was not populated with the details of the ics file. Instead, the ics file was added as an attachment.
Expected results:
As with pre-78 Thunderbird versions, the "New Event" window should have been populated with the details of the ics file and made available for edit by the user.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
![]() |
||
Comment 1•5 years ago
|
||
Could you please attach an ics calendar event file for test if possible.
![]() |
||
Comment 3•5 years ago
|
||
Regression window:
https://hg.mozilla.org/comm-central/pushloghtml?fromchange=506be393d5ef8d60b287903bb8e0cb1fca37460e&tochange=9aa142882f1850579cd4262bdbb7263306b2f00a
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4c982daa151954c59f20a9b9ac805c1768a350c2&tochange=4fd5c458be4c3bc2d1f22bd575667104a5d173fe
![]() |
Assignee | |
Comment 4•5 years ago
|
||
Bug 437711 seems to have made changes that will treat any file drag and dropped to the today pane as an attachment. Not sure this was intentional or not, bug 437711 comment 36 suggests this was working at the time of the patch, strange.
![]() |
Assignee | |
Updated•5 years ago
|
![]() |
Assignee | |
Comment 5•5 years ago
•
|
||
I'm making some changes to calendar-dnd-listener for this. The fix is cleaner if I use the non-vendor specific data transfer apis. I noticed however that ThreadOnPaneDragStart
adds 3 additional items to the data transfer:
https://searchfox.org/comm-central/source/mail/base/content/msgMail3PaneWindow.js#1793
This gives the DataTransfer.items property a length of 4 items instead of one and I would have to add code for this case if I keep using the standard apis. Additionally the deprecated, vendor specific mozItemCount
property remains at 1 so I can't help but feel like this is either a bug or wrong use of the data transfer.
Do we need to have 4 items sent for a message data transfer? I prefer to use the standard apis because this route detects the ics file quite nicely.
![]() |
Assignee | |
Comment 6•5 years ago
|
||
Ok, I think I see what's going on here. The items property isn't a list of items included in the drag, it's a list of alternate formats for the data. Guess I'll have to use the moz extensions.
![]() |
Assignee | |
Comment 7•5 years ago
•
|
||
On second thought, the spec says items.length "Returns the number of items in the drag data store.":
https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
The MDN page for items says:
"The read-only DataTransfer property items property is a list of the data transfer items in a drag operation. The list includes one item for each item in the operation and if the operation had no items, the list is empty."
https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items
This api seems rather ambiguous, the naming does not help either.
![]() |
Assignee | |
Comment 8•4 years ago
|
||
I'm uploading this for feedback now as I still need to do some more work on this before I try getting it landed.
calendar-dnd-listener
file seemed pretty broken, not sure if it was always the case or it got left behind as time rolled on.
I ended up redoing most of the file albeit, keeping the same logic for now.
This bug happens because the old calendar-dnd-listener ends up treating everything dragged from the OS as a url, so it gets added to the event as an attachment. This is because mozTypesAt
gives the following mime types: application/x-moz-file
, text/x-moz-url
for more or less everything.
If we use the standardized apis however, we get more accurate information like application/x-extension-ics
which we can use to figure out what to do. Note: Items dragged from the message pane also get treated like urls including attached ics files.
I mentioned in previous comments that it seems like m-c treats multiple items in a datatransfer as alternatives to the same item. Thus requiring use of the moz* apis to figure out what was actually sent. This is different to drops coming from the OS or external applications where, at least for the applications I tried with, each item dragged and drop has its own DataTransfer.items
entry.
This patch updates the code to better detect that and use the appropriate apis where possible. (We want to use the standardized apis if possible because they better identify the items being dropped)
I refactored the code to have each mime type have its own class to handle preprocessing of the drop data before calling the relevant callback. This makes the main listener less complex, adding new mime types is easy as creating a new class and including it in the mimeHandlers
property.
I also did some clean up and renaming for consistency sake.
I sill have more work to do on this mainly:
- Manually test dropping different file types internally and externally to make sure the result makes sense.
- For eml files, probably parse the message contents into an event.
- Add some mochitests, hopefully.
- Investigate the listener instances created here that appear not to be used anywhere.
Comment 9•4 years ago
|
||
![]() |
Assignee | |
Comment 10•4 years ago
|
||
I changed the approach a bit based on manually testing of various scenarios. I moved the handler classes into a jsm module so they don't pollute the global namespace. As you noticed, I did not touch much of the existing logic (yet!). Some of it is broken but I don't want to make this patch too long, I'll follow up with other bugs. I'm also attaching a spreadsheet I used to keep track of what works and what does not, might be useful when reviewing this patch.
I want to add some tests for this but I'll have to come back for that in the interest of time.
![]() |
Assignee | |
Comment 11•4 years ago
|
||
Test plan for this bug.
Comment 12•4 years ago
|
||
(In reply to Lasana Murray from comment #10)
I moved the handler classes into a jsm module so they don't pollute the global namespace.
You haven't achieved that at all. Now you've got a bunch of getters in the global namespace which is effectively the same thing. Plus the observers are still in the namespace. This code is only used in one window so I think a JSM isn't a good approach.
In case I was unclear before, here's what I'm asking for:
{
class CalDNDTransferHandler { ... }
class CalDNDMozMessageTransferHandler extends CalDNDTransferHandler { ... }
... etc. ...
class CalViewDNDObserver extends CalDNDListener { ... }
window.calendarViewDNDObserver = new CalViewDNDObserver();
... etc.
}
Or you could go for window.calendarViewDNDObserver = new class extends CalDNDListener { ... }
to avoid defining a class you're going to use only one of.
![]() |
Assignee | |
Comment 13•4 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #12)
(In reply to Lasana Murray from comment #10)
I moved the handler classes into a jsm module so they don't pollute the global namespace.
You haven't achieved that at all. Now you've got a bunch of getters in the global namespace which is effectively the same thing. Plus the observers are still in the namespace. This code is only used in one window so I think a JSM isn't a good approach.
Ah I understand now. The defineLazyModuleGetter
adds the imports to window? I'm guessing ChromeUtils.import
would not, but lazy loading is preferred for performance reasons?
For future reference, what if I add the getters to a local variable instead of window?
Like:
const ns = {};
XPCOMUtils.defineLazyModuleGetter(ns, {/*...*/});
let instance = new ns.SomeClass();
![]() |
Assignee | |
Comment 14•4 years ago
|
||
Removed the jsm. Placed most of the file in a block.
Comment 15•4 years ago
|
||
![]() |
Assignee | |
Comment 16•4 years ago
|
||
I also noticed a few comments in particular are wrapped quite narrowly and they look squished.
I try to keep lines <= 80 characters or less, maybe that's what your are referring to? Can you provide and example and an alternative?
![]() |
Assignee | |
Comment 17•4 years ago
|
||
Requested changes made.
Comment 18•4 years ago
|
||
![]() |
Assignee | |
Comment 19•4 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #18)
Comment on attachment 9205518 [details] [diff] [review]
bug1683460v4.patchReview of attachment 9205518 [details] [diff] [review]:
::: calendar/base/content/calendar-dnd-listener.js
@@ +628,5 @@
- /**
* Gets called in case we're dropping an array of items
* on one of the calendar views. In this case we just
* try to add these items to the currently selected calendar.
This comment tops out at 65 characters for no apparent reason.
I see. Those are actually old comments that were there before. Since this patch already touches the whole file I'll reformat them.
![]() |
Assignee | |
Comment 20•4 years ago
|
||
![]() |
Assignee | |
Updated•4 years ago
|
![]() |
Assignee | |
Comment 21•4 years ago
|
||
I have some other drag and drop related tests to get around to, I should be able to do some for this too.
Comment 22•4 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/d9aa47a90e16
Overhaul calendar-dnd-listener to handle internal and external drops. r=darktrojan
Comment 23•4 years ago
|
||
There's a linting error I will land a fix for. Exposing globals on the window but never declaring them this way seems odd though.
ALso, the calendarViewDNDObserver is never used anywhere. Is that intentional?
Comment 24•4 years ago
|
||
![]() |
Assignee | |
Comment 25•4 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #23)
ALso, the calendarViewDNDObserver is never used anywhere. Is that intentional?
I need to do some further digging to determine if usage was removed accidentally or intentionally.
![]() |
Assignee | |
Updated•4 years ago
|
![]() |
Assignee | |
Comment 26•4 years ago
|
||
Adding some tests. Using the drag service was difficult with these so I opted for simulating dom events instead.
![]() |
Assignee | |
Updated•4 years ago
|
![]() |
Assignee | |
Comment 27•4 years ago
|
||
Comment 28•4 years ago
|
||
![]() |
Assignee | |
Comment 29•4 years ago
|
||
Requested changes made.
Updated•4 years ago
|
![]() |
Assignee | |
Updated•4 years ago
|
Comment 30•4 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/00ca542b2738
Add tests for various supported drop types. r=darktrojan
![]() |
Assignee | |
Comment 31•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Description
•