support proposed DownloadURL format string on DataTransfer object
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, enhancement)
Tracking
()
People
(Reporter: alessandro.vescovi, Unassigned)
References
(Blocks 1 open bug, )
Details
(Keywords: parity-chrome)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a4) Gecko/20100407 MozillaDeveloperPreview/3.7a4 GTB7.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a4) Gecko/20100407 MozillaDeveloperPreview/3.7a4 GTB7.1 gmail's drag and drop does not open the drop box Reproducible: Always Steps to Reproduce: 1.new mail in gmail 2.drag a file onto the new mail window 3.
Comment 1•14 years ago
|
||
--> Core::DOM Jonas, do we know what's going on here? I'm also seeing reports that drag-and-drop *from* Gmail to the desktop doesn't work as it's supposed to according to: http://gmailblog.blogspot.com/2010/08/drag-and-drop-attachments-to-save-them.html
Updated•14 years ago
|
I think this uses some chrome-specific (or webkit-specific) features. I don't think we have support for this at all. Not sure if the blog post forgets to say that this only works in some browsers.
Comment 3•14 years ago
|
||
That would surprise me, and if it's the case, we should figure out why they chose not to use the File and Drag and Drop APIs.
HTML5 file drag-n-drop does not support dragging files out of the browser to the desktop AFAIK. Only from desktop to browser And within the browser. I think the only thing a page caninitialy a DataTransfer object with is textual content, such as text and HTML.
Actually, so I don't think it supports dragging files within the browser either. Other than that we might treat grabbing an image in a page roughly as dragging it from the desktop. Would be good to have Neil verify though. I might have missed some way for sure.
Comment 6•14 years ago
|
||
The default drag handler supports dragging an image and creating a file out of it. Other than that, content cannot create file drag data. In fact, a security exception will occur if an attempt is made to do so. What chrome-specific apis are being used here?
I've heard that chrome supports some sort of "download_uri" attribute. Can't really find any information on it though.
Comment 8•14 years ago
|
||
Looks like it was added by https://bugs.webkit.org/show_bug.cgi?id=31090 Also, see http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-August/022118.html dataTransfer.setData("DownloadURL", someURL) and someURL will be downloaded to a file when dropped.
Comment 9•14 years ago
|
||
I believe someone from Google may jump onto this bug, soon!
Updated•14 years ago
|
Comment 10•14 years ago
|
||
It is indeed done using what was proposed in that post from august 2009, with modifications brought out by the actual implementation. In dragstart, we add a DownloadURL transfer format to the DataTransfer object in the event. The value is a string with colon-separated components: mime-type:filename:url It doesn't, unfortunately, act fully like a file (e.g. you can't drag an attachment from a conversation to a compose, though we're hoping to be able to use a custom data format to include the message id and attachment id, and thereby avoid downloading and re-uploading the attachment, so if you can support application-defined transfer formats, we could use that), but it does act enough like a file for dragging things out to file managers and desktops on win/mac/linux.
Comment 11•14 years ago
|
||
Here is a good explanation of how it works : http://www.thecssninja.com/javascript/gmail-dragout along with a simpler example than gmail.
Comment 12•13 years ago
|
||
hello, is there some progress here?
No. If there were, it would be in this bug.
Comment 14•12 years ago
|
||
Tom, given your recent awesome work on the download API, is this something you have the relevant knowledge to implement easily? Looks like it basically involves supporting the download_uri attribute, which would let people drag attachments from gmail into the OS file manager. A friend of mine says this is the main thing keeping him on Chrome.
Comment 16•3 years ago
|
||
Bulk-downgrade of unassigned, untouched DOM/Storage bug's priority.
If you have reason to believe, this is wrong, please write a comment and ni :jstutte.
Comment 17•3 years ago
|
||
This affects macOS too. The example given in #c14, drag-and-dropping from Gmail to the file manager, doesn't work with Firefox. Works with Chrome.
On Ubuntu, it doesn't work with Chrome either.
Updated•3 years ago
|
Comment 18•3 years ago
•
|
||
Safari doesn't support this.
Chrome seems to block cross-origin downloads (which makes sense).
Updated•3 years ago
|
Comment 19•3 years ago
•
|
||
When this is implemented in Gecko, perhaps a test from Chromium can be lifted to a WPT.
Comment 20•3 years ago
|
||
Mirko asked me out of band, if there are security concerns. I'm not too worried about the functionality in itself, but of course we'll need a sound implementation to handle e.g., the cross-origin cases correctly..
Comment 21•3 years ago
|
||
For the record, some insights from a discussion with :jgraham, about writing automatic tests for this issue:
- Writing a WPT which drops to the OS is currently not supported. A long time ago, something similar was written for Opera and the code was apparently "a nightmare".
- Perhaps a test for D&D within the browser can be written as a Mochitest.
- Presumably, such a Mochitest could be transformed to a mozilla specific WPT. And perhaps later be lifted to a WPT.
- Directly writing a mozilla-specific WPT using
SpecialPowers
is not possible, because some D&D test-code is Mochitest-specific (synthesizePlainDragAndDrop
,promiseNativeMouseDrag
).
Updated•3 years ago
|
Updated•2 years ago
|
Description
•