Title: [223471] trunk
Revision 223471
Author wenson_hs...@apple.com
Date 2017-10-16 23:56:00 -0700 (Mon, 16 Oct 2017)
Log Message
Allow reading data and blob URLs via DataTransfer when the pasteboard contains files
https://bugs.webkit.org/show_bug.cgi?id=178377
Reviewed by Ryosuke Niwa.
Source/WebCore:
Adds data and blob URLs, alongside http(s), as URL protocols safe to expose to bindings.
Test: editing/pasteboard/drag-drop-href-as-url.html
* platform/Pasteboard.cpp:
(WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles):
LayoutTests:
Tweaks an existing layout test to test dragging and dropping more URL protocols (ftp:, data: and blob:).
* editing/pasteboard/drag-drop-href-as-url-expected.txt:
* editing/pasteboard/drag-drop-href-as-url.html:
Modified Paths
trunk/LayoutTests/ChangeLog
trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url-expected.txt
trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url.html
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/Pasteboard.cpp
Diff
Modified: trunk/LayoutTests/ChangeLog (223470 => 223471)
--- trunk/LayoutTests/ChangeLog 2017-10-17 06:51:39 UTC (rev 223470)
+++ trunk/LayoutTests/ChangeLog 2017-10-17 06:56:00 UTC (rev 223471)
@@ -1,3 +1,15 @@
+2017-10-16 Wenson Hsieh
+
+Allow reading data and blob URLs via DataTransfer when the pasteboard contains files
+https://bugs.webkit.org/show_bug.cgi?id=178377
+
+Reviewed by Ryosuke Niwa.
+
+Tweaks an existing layout test to test dragging and dropping more URL protocols (ftp:, data: and blob:).
+
+* editing/pasteboard/drag-drop-href-as-url-expected.txt:
+* editing/pasteboard/drag-drop-href-as-url.html:
+
2017-10-16 Ryosuke Niwa
Strip away event handlers and _javascript_ URLs when copying
Modified: trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url-expected.txt (223470 => 223471)
--- trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url-expected.txt 2017-10-17 06:51:39 UTC (rev 223470)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url-expected.txt 2017-10-17 06:56:00 UTC (rev 223471)
@@ -9,3 +9,18 @@
url: ""
text/uri-list: ""
Found file of type image/png
+3. link.href = ""
+URL: "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D"
+url: "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D"
+text/uri-list: "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D"
+Found file of type image/png
+4. link.href = ""
+URL: "blob:https://www.webkit.org/1ef10222-3882-48c0-875e-1b55e845a931"
+url: "blob:https://www.webkit.org/1ef10222-3882-48c0-875e-1b55e845a931"
+text/uri-list: "blob:https://www.webkit.org/1ef10222-3882-48c0-875e-1b55e845a931"
+Found file of type image/png
+5. link.href = ""
+URL: ""
+url: ""
+text/uri-list: ""
+Found file of type image/png
Modified: trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url.html (223470 => 223471)
--- trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url.html 2017-10-17 06:51:39 UTC (rev 223470)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-href-as-url.html 2017-10-17 06:56:00 UTC (rev 223471)
@@ -30,6 +30,16 @@
target.appendChild(div);
}
+function simulateDragAndDrop() {
+let x = source.offsetLeft + source.offsetWidth / 2;
+let y = source.offsetTop + source.offsetHeight / 2;
+eventSender.mouseMoveTo(x, y);
+eventSender.mouseDown();
+eventSender.leapForward(500);
+eventSender.mouseMoveTo(x, y + 300);
+eventSender.mouseUp();
+}
+
async function setup() {
target.addEventListener("dragenter", event => event.preventDefault());
target.addEventListener("dragover", event => event.preventDefault());
@@ -49,24 +59,26 @@
testRunner.waitUntilDone();
await source.decode();
-let x = source.offsetLeft + source.offsetWidth / 2;
-let y = source.offsetTop + source.offsetHeight / 2;
append(`1. link.href = ""
-eventSender.mouseMoveTo(x, y);
-eventSender.mouseDown();
-eventSender.leapForward(500);
-eventSender.mouseMoveTo(x, y + 300);
-eventSender.mouseUp();
+simulateDragAndDrop();
link.href = ""
append(`2. link.href = ""
-eventSender.mouseMoveTo(x, y);
-eventSender.mouseDown();
-eventSender.leapForward(500);
-eventSender.mouseMoveTo(x, y + 300);
-eventSender.mouseUp();
+simulateDragAndDrop();
+link.href = ""
+append(`3. link.href = ""
+simulateDragAndDrop();
+
+link.href = ""
+append(`4. link.href = ""
+simulateDragAndDrop();
+
+link.href = ""
+append(`5. link.href = ""
+simulateDragAndDrop();
+
testRunner.notifyDone();
}
Modified: trunk/Source/WebCore/ChangeLog (223470 => 223471)
--- trunk/Source/WebCore/ChangeLog 2017-10-17 06:51:39 UTC (rev 223470)
+++ trunk/Source/WebCore/ChangeLog 2017-10-17 06:56:00 UTC (rev 223471)
@@ -1,3 +1,17 @@
+2017-10-16 Wenson Hsieh
+
+Allow reading data and blob URLs via DataTransfer when the pasteboard contains files
+