Title: [223278] trunk
Revision
223278
Author
wenson_hs...@apple.com
Date
2017-10-13 00:14:29 -0700 (Fri, 13 Oct 2017)

Log Message

"text/html" data is not exposed when dragging and dropping across origins
https://bugs.webkit.org/show_bug.cgi?id=178253
<rdar://problem/34971203>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Minor tweak to DataTransfer::setDataFromItemList to allow "text/html" written from bindings to transfer across
origins without requiring a sanitized representation. Currently, sanitizedData is null, which limits "text/html"
to being treated as custom data, inaccessible across origins. We should instead treat markup supplied via
bindings the same way as we do "text/plain" supplied via bindings.

Modified Tests: editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html
                editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html

* dom/DataTransfer.cpp:
(WebCore::DataTransfer::setDataFromItemList):

LayoutTests:

Renames some existing layout tests, and also augments two tests to verify that "text/html" is preserved when
copying and dragging across origins that don't match.

* TestExpectations:
* editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt.
* editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt.
* editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html.
* editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt.
* editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html.
* editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt.
* editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html.
* platform/mac-wk1/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (223277 => 223278)


--- trunk/LayoutTests/ChangeLog	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/ChangeLog	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,3 +1,24 @@
+2017-10-13  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        "text/html" data is not exposed when dragging and dropping across origins
+        https://bugs.webkit.org/show_bug.cgi?id=178253
+        <rdar://problem/34971203>
+
+        Reviewed by Ryosuke Niwa.
+
+        Renames some existing layout tests, and also augments two tests to verify that "text/html" is preserved when
+        copying and dragging across origins that don't match.
+
+        * TestExpectations:
+        * editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt.
+        * editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt.
+        * editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html.
+        * editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt.
+        * editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html.
+        * editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin-expected.txt: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt.
+        * editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html: Renamed from LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html.
+        * platform/mac-wk1/TestExpectations:
+
 2017-10-12  Brady Eidson  <beid...@apple.com>
 
         SW "Hello world".

Modified: trunk/LayoutTests/TestExpectations (223277 => 223278)


--- trunk/LayoutTests/TestExpectations	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/TestExpectations	2017-10-13 07:14:29 UTC (rev 223278)
@@ -77,7 +77,7 @@
 editing/pasteboard/data-transfer-get-data-on-drop-rich-text.html [ Skip ]
 editing/pasteboard/data-transfer-get-data-on-drop-url.html [ Skip ]
 editing/pasteboard/data-transfer-is-unique-for-dragenter-and-dragleave.html [ Skip ]
-editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html [ Skip ]
+editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html [ Skip ]
 editing/pasteboard/drag-end-crash-accessing-item-list.html [ Skip ]
 editing/pasteboard/data-transfer-item-list-add-file-on-drag.html [ Skip ]
 editing/pasteboard/data-transfer-items-drop-file.html [ Skip ]

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-expected.txt (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,15 @@
+This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS urlReadInSameDocument is "hello, world"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
+PASS event.clipboardData.getData("url") is ""
+PASS JSON.stringify(event.clipboardData.types) is "[]"
+PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[]"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin-expected.txt (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,15 @@
+This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS urlReadInSameDocument is "hello, world"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
+PASS event.clipboardData.getData("url") is ""
+PASS JSON.stringify(event.clipboardData.types) is "[]"
+PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[]"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin.html (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-malformed-url-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description('This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document');
+jsTestIsAsync = true;
+
+if (window.internals)
+    internals.settings.setCustomPasteboardDataEnabled(true);
+
+const iframe = document.createElement('iframe');
+document.body.appendChild(iframe);
+iframe.src = "" html>
+<button _onclick_="runTest()">1. Copy</button>
+<div><br></div>
+<div id="source" _oncopy_="copy(event)" contenteditable>some text</div>
+<div id="destination" _onpaste_="paste(event)" contenteditable>2. Paste here</div>
+<script>
+
+function copy(event) {
+    event.clipboardData.setData('url', 'hello, world');
+    event.preventDefault();
+}
+
+function paste(event) {
+    parent.postMessage({
+        url: event.clipboardData.getData('url'),
+        types: event.clipboardData.types,
+        items: Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})),
+    }, '*');
+}
+
+function runTest() {
+    document.body.getBoundingClientRect();
+    document.getElementById('source').focus();
+    document.execCommand('selectAll');
+    document.execCommand('copy');
+    document.getElementById('destination').focus();
+    if (window.testRunner)
+        document.execCommand('paste');
+}
+
+if (window.testRunner)
+    setTimeout(runTest, 10);
+
+</scri` + 'pt>';
+
+_onmessage_ = (event) => {
+    urlReadInSameDocument = event.data.url;
+    shouldBeEqualToString('urlReadInSameDocument', 'hello, world');
+    typesInSameDocument = event.data.types;
+    shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
+    itemsInSameDocument = event.data.items;
+    shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
+    document.getElementById('destination').focus();
+    if (window.testRunner)
+        document.execCommand('paste');
+}
+
+function doPaste(event) {
+    shouldBeEqualToString('event.clipboardData.getData("url")', '');
+    shouldBeEqualToString('JSON.stringify(event.clipboardData.types)', '[]');
+    shouldBeEqualToString('JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})))', '[]');
+    document.getElementById('destination').remove();
+    finishJSTest();
+}
+
+</script>
+<div id="destination" _onpaste_="doPaste(event)" contenteditable>3. Paste here</div>
+<script src=""
+</body>
+</html>

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,15 +0,0 @@
-This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS urlReadInSameDocument is "hello, world"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-PASS event.clipboardData.getData("url") is ""
-PASS JSON.stringify(event.clipboardData.types) is "[]"
-PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[]"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,15 +0,0 @@
-This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS urlReadInSameDocument is "hello, world"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-PASS event.clipboardData.getData("url") is ""
-PASS JSON.stringify(event.clipboardData.types) is "[]"
-PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[]"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src=""
-<script>
-
-description('This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document');
-jsTestIsAsync = true;
-
-if (window.internals)
-    internals.settings.setCustomPasteboardDataEnabled(true);
-
-const iframe = document.createElement('iframe');
-document.body.appendChild(iframe);
-iframe.src = "" html>
-<button _onclick_="runTest()">1. Copy</button>
-<div><br></div>
-<div id="source" _oncopy_="copy(event)" contenteditable>some text</div>
-<div id="destination" _onpaste_="paste(event)" contenteditable>2. Paste here</div>
-<script>
-
-function copy(event) {
-    event.clipboardData.setData('url', 'hello, world');
-    event.preventDefault();
-}
-
-function paste(event) {
-    parent.postMessage({
-        url: event.clipboardData.getData('url'),
-        types: event.clipboardData.types,
-        items: Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})),
-    }, '*');
-}
-
-function runTest() {
-    document.body.getBoundingClientRect();
-    document.getElementById('source').focus();
-    document.execCommand('selectAll');
-    document.execCommand('copy');
-    document.getElementById('destination').focus();
-    if (window.testRunner)
-        document.execCommand('paste');
-}
-
-if (window.testRunner)
-    setTimeout(runTest, 10);
-
-</scri` + 'pt>';
-
-_onmessage_ = (event) => {
-    urlReadInSameDocument = event.data.url;
-    shouldBeEqualToString('urlReadInSameDocument', 'hello, world');
-    typesInSameDocument = event.data.types;
-    shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
-    itemsInSameDocument = event.data.items;
-    shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
-    document.getElementById('destination').focus();
-    if (window.testRunner)
-        document.execCommand('paste');
-}
-
-function doPaste(event) {
-    shouldBeEqualToString('event.clipboardData.getData("url")', '');
-    shouldBeEqualToString('JSON.stringify(event.clipboardData.types)', '[]');
-    shouldBeEqualToString('JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})))', '[]');
-    document.getElementById('destination').remove();
-    finishJSTest();
-}
-
-</script>
-<div id="destination" _onpaste_="doPaste(event)" contenteditable>3. Paste here</div>
-<script src=""
-</body>
-</html>

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin-expected.txt (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,16 @@
+This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6<"
+PASS htmlReadInSameDocument is "testing"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+PASS event.clipboardData.getData("url") is "http://webkit.org/b/%F0%9F%A4%94?x=8%20+%206%3C"
+PASS JSON.stringify(event.clipboardData.types) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description('This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document');
+jsTestIsAsync = true;
+
+if (window.internals)
+    internals.settings.setCustomPasteboardDataEnabled(true);
+
+const iframe = document.createElement('iframe');
+document.body.appendChild(iframe);
+iframe.src = "" html>
+<button _onclick_="runTest()">1. Copy</button>
+<div><br></div>
+<div id="source" _oncopy_="copy(event)" contenteditable>http://webkit.org/b/&#x1F914;?x=8 + 6<</div>
+<div id="destination" _onpaste_="paste(event)" contenteditable>2. Paste here</div>
+<script>
+
+const originalURL = document.getElementById('source').textContent;
+function copy(event) {
+    event.clipboardData.setData('url', originalURL);
+    event.clipboardData.setData('text/html', 'testing');
+    event.preventDefault();
+}
+
+function paste(event) {
+    parent.postMessage({
+        originalURL,
+        url: event.clipboardData.getData('url'),
+        html: event.clipboardData.getData('text/html'),
+        types: event.clipboardData.types,
+        items: Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})),
+    }, '*');
+}
+
+function runTest() {
+    document.body.getBoundingClientRect();
+    document.getElementById('source').focus();
+    document.execCommand('selectAll');
+    document.execCommand('copy');
+    document.getElementById('destination').focus();
+    if (window.testRunner)
+        document.execCommand('paste');
+}
+
+if (window.testRunner)
+    runTest();
+
+</scri` + 'pt>';
+
+_onmessage_ = (event) => {
+    originalURL = event.data.originalURL;
+    urlReadInSameDocument = event.data.url;
+    shouldBeEqualToString('urlReadInSameDocument', originalURL);
+    htmlReadInSameDocument = event.data.html;
+    shouldBeEqualToString('htmlReadInSameDocument', "testing");
+    typesInSameDocument = event.data.types;
+    shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list","text/html"]');
+    itemsInSameDocument = event.data.items;
+    shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"},{"kind":"string","type":"text/html"}]');
+    document.getElementById('destination').focus();
+    if (window.testRunner)
+        document.execCommand('paste');
+}
+
+function doPaste(event) {
+    shouldBeEqualToString('event.clipboardData.getData("url")', (new URL(originalURL)).href);
+    shouldBeEqualToString('JSON.stringify(event.clipboardData.types)', '["text/uri-list","text/html"]');
+    shouldBeEqualToString('JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})))',
+        '[{"kind":"string","type":"text/uri-list"},{"kind":"string","type":"text/html"}]');
+    document.getElementById('destination').remove();
+    finishJSTest();
+}
+
+</script>
+<div id="destination" _onpaste_="doPaste(event)" contenteditable>3. Paste here</div>
+<script src=""
+</body>
+</html>

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin-expected.txt (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,44 @@
+This tests calling setData to set a URL in a null origin document. The URL should be sanitized when reading in another document.
+To manually test, drag and drop the "1. Drag this" above to "2. Drop here" and "3. Drop here".
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+dragstart in the null origin document:
+PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
+PASS htmlReadInSameDocument is "testing"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+
+dragover in the null origin document:
+PASS urlReadInSameDocument is ""
+PASS htmlReadInSameDocument is ""
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+
+drop in the null origin document:
+PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
+PASS htmlReadInSameDocument is "testing"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+
+dragstart in the null origin document:
+PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
+PASS htmlReadInSameDocument is "testing"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+
+dragover in the file URL document:
+PASS urlReadInSameDocument is ""
+PASS htmlReadInSameDocument is ""
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+
+drop in the file URL document:
+PASS urlReadInSameDocument is "http://webkit.org/b/%F0%9F%A4%94?x=8%20+%206"
+PASS htmlReadInSameDocument is "testing"
+PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\",\"text/html\"]"
+PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"},{\"kind\":\"string\",\"type\":\"text/html\"}]"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html (from rev 223277, trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html) (0 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -0,0 +1,166 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="container">
+<div id="destination">3. Drop here</div>
+</div>
+<div id="description"></div>
+<div id="console"></div>
+<script src=""
+<script>
+
+description('This tests calling setData to set a URL in a null origin document. The URL should be sanitized when reading in another document.<br>'
+    + 'To manually test, drag and drop the "1. Drag this" above to "2. Drop here" and "3. Drop here".');
+jsTestIsAsync = true;
+
+if (window.internals)
+    internals.settings.setCustomPasteboardDataEnabled(true);
+
+const iframe = document.createElement('iframe');
+const destination = document.getElementById('destination');
+document.getElementById('container').prepend(iframe);
+
+iframe.src = "" html>
+<div id="source" draggable="true" data-value="http://webkit.org/b/&#x1F914;?x=8 + 6">1. Drag this</div>
+<div id="destination" _onpaste_="paste(event)">2. Drop here</div>
+<script>
+
+const source = document.getElementById('source');
+const destination = document.getElementById('destination');
+const originalURL = source.dataset.value;
+parent.postMessage({kind: 'originalURL', originalURL}, '*');
+
+function postContent(kind, dataTransfer) {
+    parent.postMessage({
+        kind,
+        documentLabel: 'the null origin document',
+        url: dataTransfer.getData('url'),
+        html: dataTransfer.getData('text/html'),
+        types: dataTransfer.types,
+        items: Array.from(dataTransfer.items).map((item) => ({kind: item.kind, type: item.type})),
+    }, '*');
+}
+
+let postDragOver;
+source.addEventListener("dragstart", (event) => {
+    postDragOver = false;
+    event.dataTransfer.setData('url', originalURL);
+    event.dataTransfer.setData('text/html', 'testing');
+    postContent('dragstart', event.dataTransfer);
+});
+destination.addEventListener("dragover", (event) => {
+    event.preventDefault();
+    if (postDragOver)
+        return;
+    postDragOver = true;
+    postContent('dragover', event.dataTransfer);
+});
+destination.addEventListener("drop", (event) => {
+    postContent('drop', event.dataTransfer);
+    destination.remove();
+    top.postMessage({kind: 'secondDrop'}, '*');
+});
+
+if (window.eventSender) {
+    const iframeOffset = {x: 10, y: 10};
+    eventSender.mouseMoveTo(iframeOffset.x + source.offsetLeft + 5, iframeOffset.y + source.offsetTop + 5);
+    eventSender.mouseDown();
+    eventSender.leapForward(500);
+    eventSender.mouseMoveTo(iframeOffset.x + destination.offsetLeft + 5, iframeOffset.y + destination.offsetTop + 5);
+    eventSender.mouseUp();
+}
+
+</scri` + 'pt>';
+
+_onmessage_ = (event) => {
+    const kind = event.data.kind;
+    if (kind == 'originalURL') {
+        originalURL = event.data.originalURL;
+        return;
+    }
+    if (kind == 'secondDrop')
+        return doSecondDrop(event.data.postContent);
+    debug(`${kind} in ${event.data.documentLabel}:`);
+    switch (kind) {
+    case 'dragstart':
+        urlReadInSameDocument = event.data.url;
+        shouldBeEqualToString('urlReadInSameDocument', originalURL);
+        htmlReadInSameDocument = event.data.html;
+        shouldBeEqualToString('htmlReadInSameDocument', "testing");
+        typesInSameDocument = event.data.types;
+        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list","text/html"]');
+        itemsInSameDocument = event.data.items;
+        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"},{"kind":"string","type":"text/html"}]');
+        break;
+    case 'dragover':
+        urlReadInSameDocument = event.data.url;
+        shouldBeEqualToString('urlReadInSameDocument', '');
+        htmlReadInSameDocument = event.data.html;
+        shouldBeEqualToString('htmlReadInSameDocument', '');
+        typesInSameDocument = event.data.types;
+        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list","text/html"]');
+        itemsInSameDocument = event.data.items;
+        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"},{"kind":"string","type":"text/html"}]');
+        break;
+    case 'drop':
+        urlReadInSameDocument = event.data.url;
+        shouldBeEqualToString('urlReadInSameDocument', event.data.documentLabel.includes('null') ? originalURL : (new URL(originalURL)).href);
+        htmlReadInSameDocument = event.data.html;
+        shouldBeEqualToString('htmlReadInSameDocument', "testing");
+        typesInSameDocument = event.data.types;
+        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list","text/html"]');
+        itemsInSameDocument = event.data.items;
+        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"},{"kind":"string","type":"text/html"}]');
+        if (!event.data.documentLabel.includes('null')) {
+            document.getElementById('container').remove();
+            finishJSTest();
+        }
+        break;
+    }
+    debug('');
+}
+
+function postContent(kind, dataTransfer) {
+    window.postMessage({
+        kind,
+        documentLabel: 'the file URL document',
+        url: dataTransfer.getData('url'),
+        html: dataTransfer.getData('text/html'),
+        types: dataTransfer.types,
+        items: Array.from(dataTransfer.items).map((item) => ({kind: item.kind, type: item.type})),
+    }, '*');
+}
+
+let postDragOver = false;
+destination.addEventListener("dragover", (event) => {
+    event.preventDefault();
+    if (postDragOver)
+        return;
+    postDragOver = true;
+    postContent('dragover', event.dataTransfer);
+});
+destination.addEventListener("drop", (event) => {
+    postContent('drop', event.dataTransfer);
+});
+
+function doSecondDrop(postContent) {
+    postDragOver = false;
+    if (!window.eventSender)
+        return;
+
+    eventSender.leapForward(500);
+    eventSender.mouseMoveTo(iframe.offsetLeft + 10, iframe.offsetTop + 10);
+    eventSender.mouseDown();
+    eventSender.leapForward(500);
+
+    const destinationRect = destination.getBoundingClientRect();
+    eventSender.mouseMoveTo(destination.offsetLeft + 5, destination.offsetTop + 5);
+    eventSender.mouseUp();
+}
+
+setTimeout(finishJSTest, 3000);
+
+</script>
+<script src=""
+</body>
+</html>

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,15 +0,0 @@
-This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6<"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-PASS event.clipboardData.getData("url") is "http://webkit.org/b/%F0%9F%A4%94?x=8%20+%206%3C"
-PASS JSON.stringify(event.clipboardData.types) is "[\"text/uri-list\"]"
-PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src=""
-<script>
-
-description('This tests calling setData with a malformed URL in a null origin document. The malformed value should not be readable in another document');
-jsTestIsAsync = true;
-
-if (window.internals)
-    internals.settings.setCustomPasteboardDataEnabled(true);
-
-const iframe = document.createElement('iframe');
-document.body.appendChild(iframe);
-iframe.src = "" html>
-<button _onclick_="runTest()">1. Copy</button>
-<div><br></div>
-<div id="source" _oncopy_="copy(event)" contenteditable>http://webkit.org/b/&#x1F914;?x=8 + 6<</div>
-<div id="destination" _onpaste_="paste(event)" contenteditable>2. Paste here</div>
-<script>
-
-const originalURL = document.getElementById('source').textContent;
-function copy(event) {
-    event.clipboardData.setData('url', originalURL);
-    event.preventDefault();
-}
-
-function paste(event) {
-    parent.postMessage({
-        originalURL,
-        url: event.clipboardData.getData('url'),
-        types: event.clipboardData.types,
-        items: Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})),
-    }, '*');
-}
-
-function runTest() {
-    document.body.getBoundingClientRect();
-    document.getElementById('source').focus();
-    document.execCommand('selectAll');
-    document.execCommand('copy');
-    document.getElementById('destination').focus();
-    if (window.testRunner)
-        document.execCommand('paste');
-}
-
-if (window.testRunner)
-    runTest();
-
-</scri` + 'pt>';
-
-_onmessage_ = (event) => {
-    originalURL = event.data.originalURL;
-    urlReadInSameDocument = event.data.url;
-    shouldBeEqualToString('urlReadInSameDocument', originalURL);
-    typesInSameDocument = event.data.types;
-    shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
-    itemsInSameDocument = event.data.items;
-    shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
-    document.getElementById('destination').focus();
-    if (window.testRunner)
-        document.execCommand('paste');
-}
-
-function doPaste(event) {
-    shouldBeEqualToString('event.clipboardData.getData("url")', (new URL(originalURL)).href);
-    shouldBeEqualToString('JSON.stringify(event.clipboardData.types)', '["text/uri-list"]');
-    shouldBeEqualToString('JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type})))',
-        '[{"kind":"string","type":"text/uri-list"}]');
-    document.getElementById('destination').remove();
-    finishJSTest();
-}
-
-</script>
-<div id="destination" _onpaste_="doPaste(event)" contenteditable>3. Paste here</div>
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin-expected.txt	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,38 +0,0 @@
-This tests calling setData to set a URL in a null origin document. The URL should be sanitized when reading in another document.
-To manually test, drag and drop the "1. Drag this" above to "2. Drop here" and "3. Drop here".
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-dragstart in the null origin document:
-PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-
-dragover in the null origin document:
-PASS urlReadInSameDocument is ""
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-
-drop in the null origin document:
-PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-
-dragstart in the null origin document:
-PASS urlReadInSameDocument is "http://webkit.org/b/🤔?x=8 + 6"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-
-dragover in the file URL document:
-PASS urlReadInSameDocument is ""
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-
-drop in the file URL document:
-PASS urlReadInSameDocument is "http://webkit.org/b/%F0%9F%A4%94?x=8%20+%206"
-PASS JSON.stringify(typesInSameDocument) is "[\"text/uri-list\"]"
-PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/uri-list\"}]"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html (223277 => 223278)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,157 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<div id="container">
-<div id="destination">3. Drop here</div>
-</div>
-<div id="description"></div>
-<div id="console"></div>
-<script src=""
-<script>
-
-description('This tests calling setData to set a URL in a null origin document. The URL should be sanitized when reading in another document.<br>'
-    + 'To manually test, drag and drop the "1. Drag this" above to "2. Drop here" and "3. Drop here".');
-jsTestIsAsync = true;
-
-if (window.internals)
-    internals.settings.setCustomPasteboardDataEnabled(true);
-
-const iframe = document.createElement('iframe');
-const destination = document.getElementById('destination');
-document.getElementById('container').prepend(iframe);
-
-iframe.src = "" html>
-<div id="source" draggable="true" data-value="http://webkit.org/b/&#x1F914;?x=8 + 6">1. Drag this</div>
-<div id="destination" _onpaste_="paste(event)">2. Drop here</div>
-<script>
-
-const source = document.getElementById('source');
-const destination = document.getElementById('destination');
-const originalURL = source.dataset.value;
-parent.postMessage({kind: 'originalURL', originalURL}, '*');
-
-function postContent(kind, dataTransfer) {
-    parent.postMessage({
-        kind,
-        documentLabel: 'the null origin document',
-        url: dataTransfer.getData('url'),
-        types: dataTransfer.types,
-        items: Array.from(dataTransfer.items).map((item) => ({kind: item.kind, type: item.type})),
-    }, '*');
-}
-
-let postDragOver;
-source.addEventListener("dragstart", (event) => {
-    postDragOver = false;
-    event.dataTransfer.setData('url', originalURL);
-    postContent('dragstart', event.dataTransfer);
-});
-destination.addEventListener("dragover", (event) => {
-    event.preventDefault();
-    if (postDragOver)
-        return;
-    postDragOver = true;
-    postContent('dragover', event.dataTransfer);
-});
-destination.addEventListener("drop", (event) => {
-    postContent('drop', event.dataTransfer);
-    destination.remove();
-    top.postMessage({kind: 'secondDrop'}, '*');
-});
-
-if (window.eventSender) {
-    const iframeOffset = {x: 10, y: 10};
-    eventSender.mouseMoveTo(iframeOffset.x + source.offsetLeft + 5, iframeOffset.y + source.offsetTop + 5);
-    eventSender.mouseDown();
-    eventSender.leapForward(500);
-    eventSender.mouseMoveTo(iframeOffset.x + destination.offsetLeft + 5, iframeOffset.y + destination.offsetTop + 5);
-    eventSender.mouseUp();
-}
-
-</scri` + 'pt>';
-
-_onmessage_ = (event) => {
-    const kind = event.data.kind;
-    if (kind == 'originalURL') {
-        originalURL = event.data.originalURL;
-        return;
-    }
-    if (kind == 'secondDrop')
-        return doSecondDrop(event.data.postContent);
-    debug(`${kind} in ${event.data.documentLabel}:`);
-    switch (kind) {
-    case 'dragstart':
-        urlReadInSameDocument = event.data.url;
-        shouldBeEqualToString('urlReadInSameDocument', originalURL);
-        typesInSameDocument = event.data.types;
-        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
-        itemsInSameDocument = event.data.items;
-        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
-        break;
-    case 'dragover':
-        urlReadInSameDocument = event.data.url;
-        shouldBeEqualToString('urlReadInSameDocument', '');
-        typesInSameDocument = event.data.types;
-        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
-        itemsInSameDocument = event.data.items;
-        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
-        break;
-    case 'drop':
-        urlReadInSameDocument = event.data.url;
-        shouldBeEqualToString('urlReadInSameDocument', event.data.documentLabel.includes('null') ? originalURL : (new URL(originalURL)).href);
-        typesInSameDocument = event.data.types;
-        shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/uri-list"]');
-        itemsInSameDocument = event.data.items;
-        shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/uri-list"}]');
-        if (!event.data.documentLabel.includes('null')) {
-            document.getElementById('container').remove();
-            finishJSTest();
-        }
-        break;
-    }
-    debug('');
-}
-
-function postContent(kind, dataTransfer) {
-    window.postMessage({
-        kind,
-        documentLabel: 'the file URL document',
-        url: dataTransfer.getData('url'),
-        types: dataTransfer.types,
-        items: Array.from(dataTransfer.items).map((item) => ({kind: item.kind, type: item.type})),
-    }, '*');
-}
-
-let postDragOver = false;
-destination.addEventListener("dragover", (event) => {
-    event.preventDefault();
-    if (postDragOver)
-        return;
-    postDragOver = true;
-    postContent('dragover', event.dataTransfer);
-});
-destination.addEventListener("drop", (event) => {
-    postContent('drop', event.dataTransfer);
-});
-
-function doSecondDrop(postContent) {
-    postDragOver = false;
-    if (!window.eventSender)
-        return;
-
-    eventSender.leapForward(500);
-    eventSender.mouseMoveTo(iframe.offsetLeft + 10, iframe.offsetTop + 10);
-    eventSender.mouseDown();
-    eventSender.leapForward(500);
-
-    const destinationRect = destination.getBoundingClientRect();
-    eventSender.mouseMoveTo(destination.offsetLeft + 5, destination.offsetTop + 5);
-    eventSender.mouseUp();
-}
-
-setTimeout(finishJSTest, 3000);
-
-</script>
-<script src=""
-</body>
-</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (223277 => 223278)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-10-13 07:14:29 UTC (rev 223278)
@@ -12,7 +12,7 @@
 editing/pasteboard/data-transfer-get-data-on-drop-rich-text.html [ Pass ]
 editing/pasteboard/data-transfer-get-data-on-drop-url.html [ Pass ]
 editing/pasteboard/data-transfer-is-unique-for-dragenter-and-dragleave.html [ Pass ]
-editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html [ Pass ]
+editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html [ Pass ]
 editing/pasteboard/drag-end-crash-accessing-item-list.html [ Pass ]
 editing/pasteboard/data-transfer-item-list-add-file-on-drag.html [ Pass ]
 editing/pasteboard/data-transfer-items-drop-file.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (223277 => 223278)


--- trunk/Source/WebCore/ChangeLog	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/Source/WebCore/ChangeLog	2017-10-13 07:14:29 UTC (rev 223278)
@@ -1,3 +1,22 @@
+2017-10-13  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        "text/html" data is not exposed when dragging and dropping across origins
+        https://bugs.webkit.org/show_bug.cgi?id=178253
+        <rdar://problem/34971203>
+
+        Reviewed by Ryosuke Niwa.
+
+        Minor tweak to DataTransfer::setDataFromItemList to allow "text/html" written from bindings to transfer across
+        origins without requiring a sanitized representation. Currently, sanitizedData is null, which limits "text/html"
+        to being treated as custom data, inaccessible across origins. We should instead treat markup supplied via
+        bindings the same way as we do "text/plain" supplied via bindings.
+
+        Modified Tests: editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html
+                        editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html
+
+        * dom/DataTransfer.cpp:
+        (WebCore::DataTransfer::setDataFromItemList):
+
 2017-10-12  Brady Eidson  <beid...@apple.com>
 
         SW "Hello world".

Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (223277 => 223278)


--- trunk/Source/WebCore/dom/DataTransfer.cpp	2017-10-13 06:44:47 UTC (rev 223277)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp	2017-10-13 07:14:29 UTC (rev 223278)
@@ -213,7 +213,7 @@
         auto url = ""
         if (url.isValid())
             sanitizedData = url.string();
-    } else if (type == "text/plain")
+    } else if (type == "text/plain" || type == "text/html")
         sanitizedData = data; // Nothing to sanitize.
 
     if (sanitizedData != data)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to