Diff
Modified: trunk/LayoutTests/ChangeLog (220781 => 220782)
--- trunk/LayoutTests/ChangeLog 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/ChangeLog 2017-08-16 02:23:41 UTC (rev 220782)
@@ -1,3 +1,33 @@
+2017-08-15 Ryosuke Niwa <rn...@webkit.org>
+
+ Make DataTransferItemList work with plain text entries
+ https://bugs.webkit.org/show_bug.cgi?id=175596
+
+ Reviewed by Wenson Hsieh.
+
+ Rebaselined the tests and added two regression tests for pasting plain text and dropping a plain text file.
+
+ Unfortunately, dropping a file is only supported by DumpRenderTree on Mac :( so it's disabled elsewhere.
+
+ * editing/pasteboard/datatransfer-idl-expected.txt: Rebaselined now that NoInterfaceObject has been dropped from
+ DataTransferItem.idl and DataTransferItemList.idl as expected.
+ * editing/pasteboard/datatransfer-idl.html: Fixed the bug that it wasn't testing IDL for DataTransferItem.
+ * editing/pasteboard/datatransfer-items-drop-plaintext-file-expected.txt: Added.
+ * editing/pasteboard/datatransfer-items-drop-plaintext-file.html: Added.
+ * editing/pasteboard/datatransfer-items-paste-plaintext-expected.txt: Added.
+ * editing/pasteboard/datatransfer-items-paste-plaintext.html: Added.
+ * editing/resources/text-pasteboard-data.txt: Added.
+ * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+ * platform/ios/TestExpectations:
+ * platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-highsierra-wk1/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-highsierra/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac/js/dom/global-constructors-attributes-expected.txt:
+ * platform/win/TestExpectations:
+ * platform/wk2/TestExpectations:
+ * platform/wpe/js/dom/global-constructors-attributes-expected.txt:
+
2017-08-15 Chris Dumez <cdu...@apple.com>
Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
Modified: trunk/LayoutTests/editing/pasteboard/datatransfer-idl-expected.txt (220781 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-idl-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-idl-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 251: callback not yet supported
PASS DataTransfer interface: existence and properties of interface object
PASS DataTransfer interface object length
@@ -13,14 +14,23 @@
PASS DataTransfer interface: operation setData(DOMString,DOMString)
PASS DataTransfer interface: operation clearData(DOMString)
PASS DataTransfer interface: attribute files
-FAIL DataTransferItemList interface: existence and properties of interface object assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface object length assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface object name assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: existence and properties of interface prototype object assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: attribute length assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: operation add(DOMString,DOMString) assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: operation add(File) assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: operation remove(unsigned long) assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
-FAIL DataTransferItemList interface: operation clear() assert_own_property: self does not have own property "DataTransferItemList" expected property "DataTransferItemList" missing
+PASS DataTransferItemList interface: existence and properties of interface object
+PASS DataTransferItemList interface object length
+PASS DataTransferItemList interface object name
+PASS DataTransferItemList interface: existence and properties of interface prototype object
+PASS DataTransferItemList interface: existence and properties of interface prototype object's "constructor" property
+PASS DataTransferItemList interface: attribute length
+FAIL DataTransferItemList interface: operation add(DOMString,DOMString) assert_equals: property has wrong .length expected 1 but got 0
+FAIL DataTransferItemList interface: operation add(File) assert_equals: property has wrong .length expected 1 but got 0
+PASS DataTransferItemList interface: operation remove(unsigned long)
+PASS DataTransferItemList interface: operation clear()
+PASS DataTransferItem interface: existence and properties of interface object
+PASS DataTransferItem interface object length
+PASS DataTransferItem interface object name
+PASS DataTransferItem interface: existence and properties of interface prototype object
+PASS DataTransferItem interface: existence and properties of interface prototype object's "constructor" property
+PASS DataTransferItem interface: attribute kind
+PASS DataTransferItem interface: attribute type
+PASS DataTransferItem interface: operation getAsString(FunctionStringCallback)
+PASS DataTransferItem interface: operation getAsFile()
Modified: trunk/LayoutTests/editing/pasteboard/datatransfer-idl.html (220781 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-idl.html 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-idl.html 2017-08-16 02:23:41 UTC (rev 220782)
@@ -39,7 +39,7 @@
interface DataTransferItem {
readonly attribute DOMString kind;
readonly attribute DOMString type;
- void getAsString(FunctionStringCallback? _callback);
+ void getAsString(FunctionStringCallback? callback);
File? getAsFile();
};
@@ -48,13 +48,11 @@
<script>
var idlsArray = new IdlArray();
var idl = document.getElementById("datatransfer-idl").textContent
- + document.getElementById("datatransferitemlist-idl").textContent;
+ + document.getElementById("datatransferitemlist-idl").textContent
+ document.getElementById("datatransferitem-idl").textContent;
idlsArray.add_idls(idl);
idlsArray.add_untested_idls("interface Element {};");
-//idlsArray.add_untested_idls("interface ReadableStream {};");
-//idlsArray.add_objects({ Response: ['new Response()'] });
idlsArray.test();
</script>
</body>
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file-expected.txt (0 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -0,0 +1,17 @@
+This tests accessing DataTransferItemList when dropping a file. To manually test, drag and drop LayoutTests/editing/resources/text-pasteboard-data.txt from another app (e.g. Finder) to the box below.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS dataTransfer.items.length is 1
+PASS dataTransfer.items[0].kind is "file"
+PASS dataTransfer.items[0].type is "text/plain"
+PASS file = dataTransfer.items[0].getAsFile(); file is not null
+PASS file.name is "text-pasteboard-data.txt"
+PASS reader = new FileReader(); reader._onload_ = () => checkFileContent(reader.result); reader.readAsText(file); did not throw exception.
+PASS "hello, world." is "hello, world."
+PASS dataTransfer.items[0].getAsFile() is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file.html (0 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-plaintext-file.html 2017-08-16 02:23:41 UTC (rev 220782)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<body _onload_="runTest()">
+<script src=""
+<script>
+
+description('This tests accessing DataTransferItemList when dropping a file.'
+ + ' To manually test, drag and drop <a href="" from another app (e.g. Finder) to the box below.');
+
+function runTest()
+{
+ if (!window.testRunner)
+ return;
+ if (!window.eventSender || !eventSender.beginDragWithFiles) {
+ testFailed('This test requires eventSender.beginDragWithFiles');
+ finishJSTest();
+ return;
+ }
+
+ eventSender.beginDragWithFiles(["../resources/text-pasteboard-data.txt"]);
+ const target = document.getElementById('target');
+ eventSender.mouseMoveTo(target.offsetLeft + 5, target.offsetTop + 5);
+ eventSender.mouseUp();
+}
+
+function drop(event)
+{
+ event.preventDefault();
+ dataTransfer = event.dataTransfer;
+ shouldBe('dataTransfer.items.length', '1');
+ shouldBeEqualToString('dataTransfer.items[0].kind', 'file');
+ shouldBeEqualToString('dataTransfer.items[0].type', 'text/plain');
+ shouldNotBe('file = dataTransfer.items[0].getAsFile(); file', 'null');
+ shouldBeEqualToString('file.name', 'text-pasteboard-data.txt');
+ shouldNotThrow('reader = new FileReader(); reader._onload_ = () => checkFileContent(reader.result); reader.readAsText(file);');
+}
+
+function checkFileContent(content)
+{
+ shouldBeEqualToString('"' + content + '"', 'hello, world.');
+ shouldBe('dataTransfer.items[0].getAsFile()', 'null');
+ finishJSTest();
+}
+
+jsTestIsAsync = true;
+successfullyParsed = true;
+
+</script>
+<script src=""
+<div id="target" contenteditable="true" _ondrop_="drop(event)" style="width: 100px; height: 100px; border: solid 1px black;"></div>
+</body>
+</html>
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext-expected.txt (0 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -0,0 +1,15 @@
+This tests dataTransfer.items. To manually test, click on "Copy text" and paste (Command+V on Mac Control+V elsewhere).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS clipboardData.items.length is 1
+PASS clipboardData.items[0].kind is "string"
+PASS clipboardData.items[0].type is "text/plain"
+PASS clipboardData.items[0].getAsFile() is null
+PASS clipboardData.items[0].getAsString(checkContent) is undefined
+PASS "hello, world" is "hello, world"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext.html (0 => 220782)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-paste-plaintext.html 2017-08-16 02:23:41 UTC (rev 220782)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description('This tests dataTransfer.items. To manually test, click on "Copy text" and paste (Command+V on Mac Control+V elsewhere).');
+
+function copyText()
+{
+ document.getElementById('source').style.display = null;
+ document.getElementById('source').focus();
+ document.execCommand('SelectAll', false, null);
+ document.execCommand('Copy', false, null);
+ document.getElementById('source').style.display = 'none';
+ document.getElementById('target').focus();
+ if (window.testRunner)
+ testRunner.execCommand('Paste', null);
+}
+
+function paste(event)
+{
+ clipboardData = event.clipboardData;
+ shouldBe('clipboardData.items.length', '1');
+ shouldBeEqualToString('clipboardData.items[0].kind', 'string');
+ shouldBeEqualToString('clipboardData.items[0].type', 'text/plain');
+ shouldBe('clipboardData.items[0].getAsFile()', 'null');
+ shouldBe('clipboardData.items[0].getAsString(checkContent)', 'undefined');
+}
+
+function checkContent(content)
+{
+ shouldBeEqualToString('"' + content + '"', 'hello, world');
+ document.getElementById('container').style.display = 'none';
+ finishJSTest();
+}
+
+if (window.testRunner)
+ window._onload_ = copyText;
+jsTestIsAsync = true;
+successfullyParsed = true;
+
+</script>
+<div id="container">
+ <button _onclick_="copyText();">Copy text</button>
+ <div id="source" contenteditable="true" style="display: none">hello, world</div>
+ <div id="target" contenteditable="true" _onpaste_="paste(event)"></div>
+</div>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/editing/resources/text-pasteboard-data.txt (0 => 220782)
--- trunk/LayoutTests/editing/resources/text-pasteboard-data.txt (rev 0)
+++ trunk/LayoutTests/editing/resources/text-pasteboard-data.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -0,0 +1 @@
+hello, world.
\ No newline at end of file
Modified: trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -398,6 +398,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/ios/TestExpectations (220781 => 220782)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-08-16 02:23:41 UTC (rev 220782)
@@ -235,6 +235,8 @@
fast/canvas/canvas-toDataURL-webp.html
# Drag-and-drop is not supported:
+editing/pasteboard/datatransfer-items-drop-plaintext-file.html
+editing/pasteboard/datatransfer-items-paste-plaintext.html
editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
fast/events/bogus-dropEffect-effectAllowed.html
fast/events/clear-drag-state.html
Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -403,6 +403,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -388,6 +388,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -398,6 +398,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-highsierra/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/mac-highsierra/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/mac-highsierra/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -408,6 +408,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/mac-highsierra-wk1/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -393,6 +393,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/win/TestExpectations (220781 => 220782)
--- trunk/LayoutTests/platform/win/TestExpectations 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/win/TestExpectations 2017-08-16 02:23:41 UTC (rev 220782)
@@ -121,6 +121,7 @@
fast/repaint/overflow-scroll-touch-repaint.html [ Skip ]
# TODO Drag & Drop doesn't work correctly in DRT <rdar://5621244>
+editing/pasteboard/datatransfer-items-drop-plaintext-file.html
fast/events/drop-handler-should-not-stop-navigate.html [ Skip ]
fast/events/drag-in-frames.html [ Skip ]
fast/events/drag-to-navigate.html [ Skip ]
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (220781 => 220782)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2017-08-16 02:23:41 UTC (rev 220782)
@@ -563,6 +563,7 @@
# WebKitTestRunner needs an implementation of eventSender.beginDragWithFiles
# https://bugs.webkit.org/show_bug.cgi?id=64285
+editing/pasteboard/datatransfer-items-drop-plaintext-file.html
editing/pasteboard/file-drag-to-editable.html [ Skip ]
editing/pasteboard/file-input-files-access.html
fast/dom/FileList-iterator.html
Modified: trunk/LayoutTests/platform/wpe/js/dom/global-constructors-attributes-expected.txt (220781 => 220782)
--- trunk/LayoutTests/platform/wpe/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/LayoutTests/platform/wpe/js/dom/global-constructors-attributes-expected.txt 2017-08-16 02:23:41 UTC (rev 220782)
@@ -393,6 +393,16 @@
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'DataTransfer').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').value is DataTransferItem
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItem').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').value is DataTransferItemList
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DataTransferItemList').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
Modified: trunk/Source/_javascript_Core/ChangeLog (220781 => 220782)
--- trunk/Source/_javascript_Core/ChangeLog 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-08-16 02:23:41 UTC (rev 220782)
@@ -1,3 +1,14 @@
+2017-08-15 Ryosuke Niwa <rn...@webkit.org>
+
+ Make DataTransferItemList work with plain text entries
+ https://bugs.webkit.org/show_bug.cgi?id=175596
+
+ Reviewed by Wenson Hsieh.
+
+ Added DataTransferItem as a common identifier since it's a runtime enabled feature.
+
+ * runtime/CommonIdentifiers.h:
+
2017-08-15 Robin Morisset <rmoris...@apple.com>
Support the 'with' keyword in FTL
Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (220781 => 220782)
--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-08-16 02:23:41 UTC (rev 220782)
@@ -43,6 +43,7 @@
macro(CustomElementRegistry) \
macro(Date) \
macro(DateTimeFormat) \
+ macro(DataTransferItem) \
macro(DataTransferItemList) \
macro(DocumentTimeline) \
macro(Error) \
Modified: trunk/Source/WebCore/ChangeLog (220781 => 220782)
--- trunk/Source/WebCore/ChangeLog 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/ChangeLog 2017-08-16 02:23:41 UTC (rev 220782)
@@ -1,3 +1,41 @@
+2017-08-15 Ryosuke Niwa <rn...@webkit.org>
+
+ Make DataTransferItemList work with plain text entries
+ https://bugs.webkit.org/show_bug.cgi?id=175596
+
+ Reviewed by Wenson Hsieh.
+
+ Added the basic machinery to get the list of plain text items to DataTransferItemList and DataTransferItem.
+
+ Each DataTransferItem now depends on DataTransfer so it does ref-forwarding like DataTransferItemList to make
+ DataTransfer alive as long as any DataTransferItem is alive.
+
+ Specifications: https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface
+ https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
+
+ Tests: editing/pasteboard/datatransfer-items-drop-plaintext-file.html
+ editing/pasteboard/datatransfer-items-paste-plaintext.html
+
+ * dom/DataTransferItem.cpp:
+ (WebCore::DataTransferItem::DataTransferItem): Added two variants one for plain text and another one for a file.
+ (WebCore::DataTransferItem::kind const): Rewritten.
+ (WebCore::DataTransferItem::getAsString const): Implemented.
+ (WebCore::DataTransferItem::getAsFile const): Implemented.
+ * dom/DataTransferItem.h:
+ (WebCore::DataTransferItem::ref): Added.
+ (WebCore::DataTransferItem::deref): Added.
+ (WebCore::DataTransferItem::type const): Returns String instead of AtomicString.
+ (WebCore::DataTransferItem::kind const): Moved to cpp.
+ * dom/DataTransferItem.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
+ * dom/DataTransferItemList.cpp:
+ (WebCore::DataTransferItemList::length): Implemented.
+ (WebCore::DataTransferItemList::item): Ditto.
+ (WebCore::isSupportedType): Added. For now, we only support text/plain.
+ (WebCore::DataTransferItemList::ensureItems): Added. Constructs the list of DataTransferItems.
+ * dom/DataTransferItemList.h:
+ (DataTransferItemList): Added m_items. The list is filled lazily by ensureItems.
+ * dom/DataTransferItemList.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
+
2017-08-15 Simon Fraser <simon.fra...@apple.com>
Remove ScrollView::clipsRepaints() which was only used by Chromium
Modified: trunk/Source/WebCore/dom/DataTransferItem.cpp (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItem.cpp 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItem.cpp 2017-08-16 02:23:41 UTC (rev 220782)
@@ -32,26 +32,48 @@
#include "config.h"
#include "DataTransferItem.h"
-#include "Blob.h"
+#include "File.h"
+#include "ScriptExecutionContext.h"
#include "StringCallback.h"
namespace WebCore {
-DataTransferItem::DataTransferItem()
+DataTransferItem::DataTransferItem(DataTransfer& dataTransfer, const String& type)
+ : m_dataTransfer(dataTransfer)
+ , m_type(type)
{
}
+DataTransferItem::DataTransferItem(DataTransfer& dataTransfer, const String& type, Ref<File>&& file)
+ : m_dataTransfer(dataTransfer)
+ , m_type(type)
+ , m_file(WTFMove(file))
+{
+}
+
DataTransferItem::~DataTransferItem()
{
}
-void DataTransferItem::getAsString(RefPtr<StringCallback>&&) const
+String DataTransferItem::kind() const
{
+ return m_file ? ASCIILiteral("file") : ASCIILiteral("string");
}
-RefPtr<Blob> DataTransferItem::getAsFile() const
+void DataTransferItem::getAsString(ScriptExecutionContext& context, RefPtr<StringCallback>&& callback) const
{
- return nullptr;
+ if (!callback || !m_dataTransfer.canReadData() || m_file)
+ return;
+
+ // FIXME: Make this async.
+ callback->scheduleCallback(context, m_dataTransfer.getData(m_type));
}
+RefPtr<File> DataTransferItem::getAsFile() const
+{
+ if (!m_dataTransfer.canReadData())
+ return nullptr;
+ return m_file.copyRef();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/DataTransferItem.h (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItem.h 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItem.h 2017-08-16 02:23:41 UTC (rev 220782)
@@ -31,6 +31,8 @@
#pragma once
+#include "DataTransfer.h"
+#include "ScriptWrappable.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
@@ -37,22 +39,30 @@
namespace WebCore {
-class Blob;
+class File;
+class ScriptExecutionContext;
class StringCallback;
-class DataTransferItem : public RefCounted<DataTransferItem> {
+class DataTransferItem : public ScriptWrappable {
+ WTF_MAKE_NONCOPYABLE(DataTransferItem); WTF_MAKE_FAST_ALLOCATED;
public:
- DataTransferItem();
+ DataTransferItem(DataTransfer&, const String&);
+ DataTransferItem(DataTransfer&, const String&, Ref<File>&&);
~DataTransferItem();
- const AtomicString& kind() const { return m_kind; }
- const AtomicString& type() const { return m_type; }
- void getAsString(RefPtr<StringCallback>&&) const;
- RefPtr<Blob> getAsFile() const;
+ // DataTransfer owns DataTransferItem, and DataTransfer is kept alive as long as DataTransferItem is alive.
+ void ref() { m_dataTransfer.ref(); }
+ void deref() { m_dataTransfer.deref(); }
+ String kind() const;
+ const String& type() const { return m_type; }
+ void getAsString(ScriptExecutionContext&, RefPtr<StringCallback>&&) const;
+ RefPtr<File> getAsFile() const;
+
private:
- AtomicString m_kind;
- AtomicString m_type;
+ DataTransfer& m_dataTransfer;
+ const String m_type;
+ RefPtr<File> m_file;
};
}
Modified: trunk/Source/WebCore/dom/DataTransferItem.idl (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItem.idl 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItem.idl 2017-08-16 02:23:41 UTC (rev 220782)
@@ -30,7 +30,6 @@
*/
[
- NoInterfaceObject,
EnabledAtRuntime=DataTransferItems,
ImplementationLacksVTable,
] interface DataTransferItem {
@@ -37,7 +36,7 @@
readonly attribute DOMString kind;
readonly attribute DOMString type;
- void getAsString(optional StringCallback? callback);
- Blob getAsFile();
+ [CallWith=ScriptExecutionContext] void getAsString(StringCallback? callback);
+ File getAsFile();
};
Modified: trunk/Source/WebCore/dom/DataTransferItemList.cpp (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItemList.cpp 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItemList.cpp 2017-08-16 02:23:41 UTC (rev 220782)
@@ -27,17 +27,21 @@
#include "DataTransferItemList.h"
#include "DataTransferItem.h"
+#include "FileList.h"
namespace WebCore {
unsigned DataTransferItemList::length() const
{
- return 0;
+ return ensureItems().size();
}
-RefPtr<DataTransferItem> DataTransferItemList::item(unsigned)
+RefPtr<DataTransferItem> DataTransferItemList::item(unsigned index)
{
- return nullptr;
+ auto& items = ensureItems();
+ if (items.size() <= index)
+ return nullptr;
+ return items[index].get();
}
ExceptionOr<void> DataTransferItemList::add(const String&, const String&)
@@ -57,5 +61,36 @@
{
}
+// FIXME: DataTransfer should filter types itself.
+static bool isSupportedType(const String& type)
+{
+ return equalIgnoringASCIICase(type, "text/plain");
}
+Vector<std::unique_ptr<DataTransferItem>>& DataTransferItemList::ensureItems() const
+{
+ if (m_items)
+ return *m_items;
+
+ Vector<std::unique_ptr<DataTransferItem>> items;
+ for (String& type : m_dataTransfer.types()) {
+ if (isSupportedType(type))
+ items.append(std::make_unique<DataTransferItem>(m_dataTransfer, type));
+ }
+
+ FileList& files = m_dataTransfer.files();
+ for (unsigned i = 0, length = files.length(); i < length; ++i) {
+ File& file = *files.item(i);
+ String type = File::contentTypeForFile(file.path());
+ if (isSupportedType(type))
+ items.append(std::make_unique<DataTransferItem>(m_dataTransfer, type, file));
+ }
+
+
+ m_items = WTFMove(items);
+
+ return *m_items;
+}
+
+}
+
Modified: trunk/Source/WebCore/dom/DataTransferItemList.h (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItemList.h 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItemList.h 2017-08-16 02:23:41 UTC (rev 220782)
@@ -32,16 +32,17 @@
#pragma once
#include "DataTransfer.h"
+#include "DataTransferItem.h"
#include "ExceptionOr.h"
+#include "ScriptWrappable.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
-class DataTransferItem;
class File;
-class DataTransferItemList {
+class DataTransferItemList : public ScriptWrappable {
WTF_MAKE_NONCOPYABLE(DataTransferItemList); WTF_MAKE_FAST_ALLOCATED;
public:
DataTransferItemList(DataTransfer& dataTransfer)
@@ -61,7 +62,10 @@
void clear();
private:
+ Vector<std::unique_ptr<DataTransferItem>>& ensureItems() const;
+
DataTransfer& m_dataTransfer;
+ mutable std::optional<Vector<std::unique_ptr<DataTransferItem>>> m_items;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/DataTransferItemList.idl (220781 => 220782)
--- trunk/Source/WebCore/dom/DataTransferItemList.idl 2017-08-16 02:05:28 UTC (rev 220781)
+++ trunk/Source/WebCore/dom/DataTransferItemList.idl 2017-08-16 02:23:41 UTC (rev 220782)
@@ -30,7 +30,6 @@
*/
[
- NoInterfaceObject,
EnabledAtRuntime=DataTransferItems,
JSGenerateToNativeObject,
JSGenerateToJSObject,