Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Issue 2575303002: Fix webkitdropzone to accept file drops on non-file: page. (Closed)

Created:
4 years ago by pwnall
Modified:
4 years ago
Reviewers:
jsbell, dcheng
CC:
chromium-reviews, blink-reviews, dcheng
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix webkitdropzone to accept file drops on non-file: page. Most of webkitdropzone's implementation is in findDropZone() in core/input/EventHandler.cpp. The implementation relies on two functions in DataTransfer that only work for DataTransfer instances that allow all the drop data to be read. According to the drag-and-drop specification, this should only be the case in the event handlers for dragstart (when the DataTransfer instance is writable) and for drop. In all other cases, the DataTransfer instance only allows limited metadata to be read. For some reason we let DataTransfer instances be readable most of the time for pages served from file: origins. This will be fixed in a follow-up CL. Out LayoutTest covering file drops into a webkitdropzone element passes due to this glitch, combined with the fact that the test is served from a file: origin. This CL fixes the functions in webkitdropzone's implementation, mostly to clear the way for fixing DataTransfer's permissions. BUG=104681 Committed: https://crrev.com/ce3b8eda8ca0eb98813fb256e069cff3f569a8aa Cr-Commit-Position: refs/heads/master@{#439280}

Patch Set 1 : Fix tests. #

Total comments: 3

Patch Set 2 : jsbell feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -12 lines) Patch
A third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html View 1 1 chunk +50 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/dnd/resources/dragged-file.txt View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/clipboard/DataTransfer.cpp View 2 chunks +13 lines, -12 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 30 (22 generated)
pwnall
PTAL?
4 years ago (2016-12-16 08:32:34 UTC) #17
pwnall
jsbell: Can you please review the layout tests?
4 years ago (2016-12-16 19:58:56 UTC) #19
dcheng
Code changes LGTM. Perhaps let's try moving the helper up a level in a followup. ...
4 years ago (2016-12-16 20:50:52 UTC) #20
jsbell
test lgtm https://codereview.chromium.org/2575303002/diff/40001/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html File third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html (right): https://codereview.chromium.org/2575303002/diff/40001/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html#newcode27 third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html:27: dropZone.ondrop = t.step_func_done((event) => { nit: no ...
4 years ago (2016-12-16 21:18:52 UTC) #21
pwnall
Thanks for the quick turnaround! https://codereview.chromium.org/2575303002/diff/40001/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html File third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html (right): https://codereview.chromium.org/2575303002/diff/40001/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html#newcode27 third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html:27: dropZone.ondrop = t.step_func_done((event) => ...
4 years ago (2016-12-16 21:31:42 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2575303002/60001
4 years ago (2016-12-16 21:33:42 UTC) #25
commit-bot: I haz the power
Committed patchset #2 (id:60001)
4 years ago (2016-12-17 01:35:44 UTC) #28
commit-bot: I haz the power
4 years ago (2016-12-17 01:40:12 UTC) #30
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/ce3b8eda8ca0eb98813fb256e069cff3f569a8aa
Cr-Commit-Position: refs/heads/master@{#439280}

Powered by Google App Engine
This is Rietveld 408576698