Diff
Modified: trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext-expected.txt (293207 => 293208)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext-expected.txt 2022-04-22 03:56:06 UTC (rev 293207)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext-expected.txt 2022-04-22 05:21:54 UTC (rev 293208)
@@ -30,7 +30,7 @@
PASS clipboardData.items[0].type is "text/plain"
PASS clipboardData.items[0].getAsFile() is null
PASS clipboardData.items[0].getAsString(checkContent(3, "WebKit")) is undefined
-PASS clipboardData.items.remove(1) threw exception IndexSizeError: The index is not in the allowed range..
+PASS clipboardData.items.remove(1) did not throw exception.
PASS clipboardData.items.length is 1
PASS clipboardData.items.remove(0); clipboardData.items.length is 0
PASS clipboardData.getData("text/plain") is ""
Modified: trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext.html (293207 => 293208)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext.html 2022-04-22 03:56:06 UTC (rev 293207)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext.html 2022-04-22 05:21:54 UTC (rev 293208)
@@ -49,7 +49,7 @@
shouldBe('clipboardData.items[0].getAsFile()', 'null');
shouldBe('clipboardData.items[0].getAsString(checkContent(3, "WebKit"))', 'undefined');
- shouldThrowErrorName('clipboardData.items.remove(1)', 'IndexSizeError');
+ shouldNotThrow('clipboardData.items.remove(1)');
shouldBe('clipboardData.items.length', '1');
shouldBe('clipboardData.items.remove(0); clipboardData.items.length', '0');
shouldBeEqualToString('clipboardData.getData("text/plain")', '');
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (293207 => 293208)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-22 03:56:06 UTC (rev 293207)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-22 05:21:54 UTC (rev 293208)
@@ -1,3 +1,15 @@
+2022-04-21 Chris Dumez <cdu...@apple.com>
+
+ No-op, instead of throwing, on dataTransfer.items.remove()
+ https://bugs.webkit.org/show_bug.cgi?id=239618
+
+ Reviewed by Wenson Hsieh.
+
+ Import test coverage from upstream WPT.
+
+ * web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove-expected.txt: Added.
+ * web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove.html: Added.
+
2022-04-20 Cathie Chen <cathiec...@igalia.com>
Parsing of contain-intrinsic-size and adding a runtime flag for it
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove-expected.txt (0 => 293208)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove-expected.txt 2022-04-22 05:21:54 UTC (rev 293208)
@@ -0,0 +1,3 @@
+
+PASS remove()ing an out-of-bounds index does nothing
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove.html (0 => 293208)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove.html 2022-04-22 05:21:54 UTC (rev 293208)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>DataTransferItemList remove() method</title>
+<script src=""
+<script src=""
+
+<script>
+"use strict";
+
+// https://github.com/whatwg/html/issues/2925
+test(() => {
+ const dt = new DataTransfer();
+
+ // Must not throw
+ dt.items.remove(0);
+ dt.items.remove(1);
+
+ dt.items.add("data", "text/plain");
+
+ // Must not throw
+ dt.items.remove(1);
+}, "remove()ing an out-of-bounds index does nothing");
+</script>
Modified: trunk/Source/WebCore/ChangeLog (293207 => 293208)
--- trunk/Source/WebCore/ChangeLog 2022-04-22 03:56:06 UTC (rev 293207)
+++ trunk/Source/WebCore/ChangeLog 2022-04-22 05:21:54 UTC (rev 293208)
@@ -1,3 +1,21 @@
+2022-04-21 Chris Dumez <cdu...@apple.com>
+
+ No-op, instead of throwing, on dataTransfer.items.remove()
+ https://bugs.webkit.org/show_bug.cgi?id=239618
+
+ Reviewed by Wenson Hsieh.
+
+ Calling dataTransfer.items.remove() with an out-of-range index should be a no-op instead of
+ throwing as per the latest HTML specification:
+ - https://github.com/whatwg/html/pull/7844
+
+ We were the only browser behaving this way so this was a compatibility risk.
+
+ Test: imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-remove.html
+
+ * dom/DataTransferItemList.cpp:
+ (WebCore::DataTransferItemList::remove):
+
2022-04-20 Yusuke Suzuki <ysuz...@apple.com>
[WTF] Add string concatenate adapter for UUID
Modified: trunk/Source/WebCore/dom/DataTransferItemList.cpp (293207 => 293208)
--- trunk/Source/WebCore/dom/DataTransferItemList.cpp 2022-04-22 03:56:06 UTC (rev 293207)
+++ trunk/Source/WebCore/dom/DataTransferItemList.cpp 2022-04-22 05:21:54 UTC (rev 293208)
@@ -103,7 +103,7 @@
auto& items = ensureItems();
if (items.size() <= index)
- return Exception { IndexSizeError }; // Matches Gecko. See https://github.com/whatwg/html/issues/2925
+ return { };
// FIXME: Remove the file from the pasteboard object once we add support for it.
Ref<DataTransferItem> removedItem = items[index].copyRef();