Files
sousa-gecko/testing/web-platform/tests/html/editing/dnd
Joone Hur da3eaa53bf Bug 2038082 [wpt PR 59744] - Support dragging JS File objects to native drop targets, a=testonly
Automatic update from web-platform-tests
Support dragging JS File objects to native drop targets

When a web app places a JS File object (new File([bytes], 'photo.jpg'))
into a dragstart handler, the blob bytes were previously discarded in
DataObject::ToWebDragData().

This CL reads the blob bytes synchronously at drag-start time using
SyncedFileReaderAccumulator::Load() and passes them as a BinaryDataItem
through the IPC pipeline. Platform-specific delivery to native drop
targets is handled by the existing PrepareDragForFileContents() path,
which is already enabled for Linux, ChromeOS, and Windows via BUILDFLAG
guards in web_contents_view_aura.cc.

Currently, image file types are supported via the
GetSafeFilenameForImageFileContents() gate.

To enable this feature, launch Chrome with:
--enable-blink-features=DragAndDropJSFileObjects

Bug: 41120809
Change-Id: Ibe12d867f7d01a972b7aeb6ce55660adb7300b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7603160
Reviewed-by: Rohan Raja <roraja@microsoft.com>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Joone Hur <joonehur@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1627402}

--

wpt-commits: 6fd907a40e68c632146df346deba6ba60299e2d5
wpt-pr: 59744
2026-05-12 08:48:30 +00:00
..
…
…
…
…
…

This is a test suite for the drag and drop API described in the HTML5
specification:

  http://dev.w3.org/html5/spec/dnd.html#dnd

Tests in target-origin/ relate to a proposed spec extension and are not covered
by HTML5 drafts at the time of writing. Contact Opera Sofware for details, and
mention CT-1656.

Tests in synthetic/ relate to incomplete parts of the HTML5 specification,
which allows synthetic events to be created. For compatibility with others,
the dataTransfer parameter allows null, undefined and other objects. Objects
will create a synthetic dataTransfer. To provide maximum functionality,
synthetic dataTransfer will have its own synthetic data store, detached from
the real data store used by real drag events (actual user interaction). For
security, real dataTransfer objects will remember the real event's protection
status inside synthetic events (the spec bases their protection only on the
event type, and does not consider the difference between real and synthetic
events).

Tests in platform/plugin are based on assumed "good" behaviour, where the
appropriate events are passed to the plugin. Platforms should determine if any
deviations from the expected results are problematic.