New issue
Advanced search Search tips

Issue 701492 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 438479
Owner:
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

DataTransferItemList.add(file) Malfunctioning

Reported by mahdi.ne...@gmail.com, Mar 14 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3041.0 Safari/537.36

Steps to reproduce the problem:
1. Drag "drag me" in the test case over the drop zone.
2. Look at the console to see the debug output.

What is the expected behavior?
In response to add the file object to DataTransferItemList using "DataTransferItemList.add(file)" the Google Chrome change the item type to the String when store it and "item.getAsString()" returns the name of File!
According to DataTransferItemList interface specification for getting File type item's reference, using "item.getAsFile()" is suggested which works properly in the Mozilla Firefox, but in the Google Chrome it is problematic.

What went wrong?
In this test all logged type must be "application/json", but when it is stored on DataTransferItemList the Google Chrome change the item type to the String and returns "text/plain"

event.dataTransfer.items[0].getAsFile() returns a null . I expect it to return a File as it states in the specs here: https://html.spec.whatwg.org/#drag-data-store

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 59.0.3041.0  Channel: canary
OS Version: 10.0
Flash Version:
 
dataTransfer.html
1.0 KB View Download
screenshot.gif
36.7 KB View Download

Comment 1 by jsb...@chromium.org, Mar 14 2017

Status: Untriaged (was: Unconfirmed)
Confirmed. I minimized the repro a bit more, but same steps - drag 'drag me' onto 'drop zone' and watch the console.


Firefox logs: 'added kind file', 'drop kind file'
Chrome logs: 'added kind file', 'drop kind string'



dataTransfer.html
829 bytes View Download

Comment 2 by jsb...@chromium.org, Mar 14 2017

Note that I was testing in 57, so this is not a regression in 59.

Comment 3 by jsb...@chromium.org, Mar 14 2017

Mergedinto: 438479
Status: Duplicate (was: Untriaged)
Duplicate of issue 438479
This issue is not duplicate of other topics, because:

This issue and issue 438479 has same title but core concern of issue 438479 is async clipboard API. Although
current clipboard API has sync behavior and is based on DataTransfer. The user can use below code instead of canvas.toBlob until committed newly async clipboard interface proposal.

event.clipboardData.items.add(canvas.toDataURL(...), 'text/uri-list');

The issue 438479 is created on 2014.

 Issue 271424  emphasis the DataTransferItemList interface, but it behaves incorrectly according to W3 specification and it is unsolved completely but its status is Fixed?!
The  issue 271424  is created on 2013.

From 2013 till now this implementation has faulty behavior.

Comment 5 by foolip@chromium.org, Apr 13 2017

Blocking: 438479
Status: Untriaged (was: Duplicate)
The circumstances described are different, but do you believe that the root cause is? Reopening just to be safe, and marking as blocking issue 438479 to retest after that is fixed.
Definitely, DataTransferItemList for Drag & Drop is almost new standard and as I proved, it is not correctly implemented on the Google Chrome.
The fault is still remained in latest version. However  Issue 271424  has been marked as solved.
Owner: pwnall@chromium.org
Status: Assigned (was: Untriaged)
@pwnall, is this is a dup of 438479?

Comment 8 by pwnall@chromium.org, Apr 18 2017

#7: Yes.

Comment 9 by pwnall@chromium.org, Apr 18 2017

Blocking: -438479
Status: Duplicate (was: Assigned)

Sign in to add a comment