Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e22461b30ac3b924ecdf82c6639e28f36b482266
https://github.com/WebKit/WebKit/commit/e22461b30ac3b924ecdf82c6639e28f36b482266
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-10 (Thu, 10 Sep 2026)
Changed paths:
M LayoutTests/editing/pasteboard/datatransfer-items-copy-html-expected.txt
M LayoutTests/editing/pasteboard/datatransfer-items-copy-html.html
M
LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext-expected.txt
M LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext.html
A
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitem-disabled-mode-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitem-disabled-mode.html
M Source/WebCore/dom/DataTransferItem.cpp
Log Message:
-----------
DataTransferItem.kind should return the empty string for an item in the
disabled mode
https://bugs.webkit.org/show_bug.cgi?id=321855
rdar://185010027
Reviewed by Chris Dumez.
HTML, 6.11.3.2 The DataTransferItem interface
<https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface>:
When the DataTransferItem object's DataTransfer object is not associated
with
a drag data store, or if the item that the DataTransferItem object
represents
has been removed from the relevant drag data store item list, the
DataTransferItem object's mode is the disabled mode.
The kind attribute must return the empty string if the DataTransferItem
object is in the disabled mode; otherwise it must return the string given in
the cell from the second column of the following table [...]
WebKit already tracks removal from the item list: DataTransferItemList's
remove(), clear(), didClearStringData() and didSetStringData() clear the item's
list back-pointer, which is what isInDisabledMode() tests. type(),
getAsString() and getAsFile() all honor it; kind() was the one getter that did
not, so an item removed by items.remove(), items.clear(), clearData(), or a
setData() call replacing the same type string ended up self-inconsistent, with
an empty type but a kind still reporting "string" or "file".
Return the empty string from kind() when the item is in the disabled mode, as
type() already does.
The two editing/pasteboard tests that cover the disabled mode expected the old
self-inconsistent behavior, so their kind expectations move from "string" to the
empty string. While here, the tail of datatransfer-items-copy-html.html was dead
code: it used shouldBe() with a bare 'string' / 'text/html' as the expected
*expression*, so the first of those threw "ReferenceError: Can't find variable:
string" out of the copy event handler and silently skipped the remaining eight
assertions (the ReferenceError was baked into the baseline). Those become
shouldBeEqualToString(), which is what the rest of the file uses, and the
now-running assertions cover kind and type of an item disabled by
items.remove().
The last getAsString() there also reused checkContent(4), whose expected content
belongs to a different item; it becomes checkContent(5).
Test:
imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitem-disabled-mode.html
* LayoutTests/editing/pasteboard/datatransfer-items-copy-html-expected.txt:
* LayoutTests/editing/pasteboard/datatransfer-items-copy-html.html:
* LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext-expected.txt:
* LayoutTests/editing/pasteboard/datatransfer-items-copy-plaintext.html:
*
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitem-disabled-mode-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitem-disabled-mode.html:
Added.
* Source/WebCore/dom/DataTransferItem.cpp:
(WebCore::DataTransferItem::kind const):
Canonical link: https://commits.webkit.org/320874@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications