Skip to content

Commit 22353f9

Browse files
author
Joone Hur
committed
feat(explainer): add alternatives considered section
* Introduce "Alternatives Considered" section in the explainer. * Discuss the implications of using dataTransfer.items with File objects. * Highlight the advantages of the DownloadURL model for memory efficiency.
1 parent e4bb41c commit 22353f9

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

DownloadURL-list/explainer.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Author: [Joone Hur](https://github.com/joone) (Microsoft)
2727
- [Drag Bomb](#drag-bomb)
2828
- [Limit Download Requests](#limit-download-requests)
2929
- [Single-click button to delete all downloaded files](#single-click-button-to-delete-all-downloaded-files)
30+
- [Alternatives Considered](#alternatives-considered)
31+
- [Using dataTransfer.items with File objects](#using-datatransferitems-with-file-objects)
3032
- [Acknowledgements](#acknowledgements)
3133
- [References](#references)
3234

@@ -38,7 +40,7 @@ The `DownloadURL` drag type is a Chromium‑specific drag‑and‑drop mechanism
3840

3941
# Goals
4042

41-
Enable users to drag multiple files from Chromium to a desktop folder on Windows using the `DownloadURL-list` drag type.
43+
Enable users to drag multiple files from Chromium to a desktop folder using the `DownloadURL-list` drag type.
4244

4345
# Non-goals
4446

@@ -224,11 +226,27 @@ If the user does not consent to multiple downloads, the entire set of dragged fi
224226

225227
A single-click option should be provided in the Chrome UI (download bubble and `chrome://downloads`) to allow users to easily remove all downloaded files from their device if they no longer want them or downloaded them by mistake.
226228

229+
# Alternatives Considered
230+
231+
## Using `dataTransfer.items` with `File` objects
232+
233+
The `DownloadURL` drag type follows a file download model: the dragged URL is materialized as a local file during the drop operation, but the exact behavior differs across operating systems.
234+
235+
For example:
236+
* Windows: Chromium uses delayed rendering: it registers a placeholder at drag-start with no actual file path. When the user drops onto the file manager, it requests the file data which triggers Chromium to start downloading the URL. The file manager waits asynchronously until the download completes, then retrieves the real file path and copies the file to the target folder.
237+
* Linux: A similar approach can be used by materializing the file and exposing it via text/uri-list with file:// URIs, but it works synchronously, so the drop target can freeze during the drop operation.
238+
* macOS: macOS uses a promised file model, where the drop target determines the destination path. After the drop, the drag source materializes the file directly at that location. Unlike Windows and Linux, this avoids creating a temporary file and eliminates the need for an additional copy step.
239+
240+
If we instead used `dataTransfer.items` with `File` objects, the entire file content would need to be loaded into memory before the drag starts. The drop target would then need to materialize the `File` object into an actual file on disk, which is synchronous work that blocks the drop operation. This is impractical for large files or multiple files.
241+
242+
The `DownloadURL` model avoids this by deferring file materialization to disk and transferring a file path to the operating system. This keeps memory usage bounded and avoids requiring the renderer to hold the entire file content in memory during the drag operation.
243+
227244
# Acknowledgements
228245
Many thanks for valuable feedback and advice from:
246+
- Alex Russell
229247
- Lingling Becker
230248
- Mike Jackson
231-
- Alex Russell
249+
- Avi Drissman (Google)
232250
- Daniel Cheng (Google)
233251
- Lily Chen (Google)
234252
- Min Qin (Google)

0 commit comments

Comments
 (0)