[Webkit-unassigned] [Bug 135835] New: DragStart dataTransfer.setData clears (almost) all existing data

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 12 03:17:08 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=135835

           Summary: DragStart dataTransfer.setData clears (almost) all
                    existing data
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.9
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: web at alexanderweiss.nl


Calling dataTransfer.setData(type, value) does not just append the data to the existing data, it also clears all existing data the dataTransfer object contained except for a "dyn." type. This breaks dragging e.g. an image with custom data meant for use within a webpage to e.g. Finder.app (as default image data is missing).

Steps to reproduce:

1. Open any page and run the following code in the console:

document.addEventListener('dragstart', function(e) {
    //e.dataTransfer.setData('text/x-test', 'Test')
})
document.addEventListener('dragover', function(e) {
    e.preventDefault()
})
document.addEventListener('drop', function(e) {
    e.preventDefault()
    console.log(e.dataTransfer.types)
})

2. Drag anything and drop on the same web page. Console will output an array with several data types (depending on what was dragged, but generally more than 10).

3. Run the following code in the console:

document.addEventListener('dragstart', function(e) {
    e.dataTransfer.setData('text/x-test', 'Test')
})
document.addEventListener('dragover', function(e) {
    e.preventDefault()
})
document.addEventListener('drop', function(e) {
    e.preventDefault()
    console.log(e.dataTransfer.types)
})

4. Drag anything and drop on the same web page. Console will output an array with two values; "dyn."... and "text/x-test" (it will output these twice unless the page was refreshed).

Expected result:
Output in 4 having the same values as in 2 plus "text/x-test".
As per http://www.whatwg.org/specs/web-apps/current-work/multipage/interaction.html#dom-datatransfer-setdata

Actual result:
Output in 4 having the just "text/x-test" and one more value.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list