Open Bug 570164 Opened 14 years ago Updated 2 years ago

support proposed DownloadURL format string on DataTransfer object

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, enhancement)

x86
All
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.
--> 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
Component: Shell Integration → DOM
Product: Firefox → Core
QA Contact: shell.integration → general
Component: DOM → Drag and Drop
QA Contact: general → drag-drop
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.
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.
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.
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.
I believe someone from Google may jump onto this bug, soon!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: drag and drop in gmail does not work → support proposed DownloadURL format string on DataTransfer object
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.
Here is a good explanation of how it works :
http://www.thecssninja.com/javascript/gmail-dragout along with a simpler example than gmail.
hello, 
is there some progress here?
No.  If there were, it would be in this bug.
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.
Blocks: 819373

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.

Severity: normal → S4
Priority: -- → P5

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.

Keywords: parity-chrome
OS: Windows 7 → All
Severity: S4 → --
Priority: P5 → --

Safari doesn't support this.

Chrome seems to block cross-origin downloads (which makes sense).

Assignee: nobody → mbrodesser

When this is implemented in Gecko, perhaps a test from Chromium can be lifted to a WPT.

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..

For the record, some insights from a discussion with :jgraham, about writing automatic tests for this issue:

  1. 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".
  2. Perhaps a test for D&D within the browser can be written as a Mochitest.
  3. Presumably, such a Mochitest could be transformed to a mozilla specific WPT. And perhaps later be lifted to a WPT.
  4. Directly writing a mozilla-specific WPT using SpecialPowers is not possible, because some D&D test-code is Mochitest-specific (synthesizePlainDragAndDrop, promiseNativeMouseDrag).
Assignee: mbrodesser → nobody
Type: defect → enhancement
You need to log in before you can comment on or make changes to this bug.