Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 628689a39d8ee9639725c857f3526b4267e4336b
      
https://github.com/WebKit/WebKit/commit/628689a39d8ee9639725c857f3526b4267e4336b
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-16 (Sun, 16 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-indexed-getter-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-indexed-getter.html
    M Source/WebCore/dom/DataTransferItemList.idl
    M Tools/TestWebKitAPI/Resources/cocoa/DataTransferItem-getAsEntry.html

  Log Message:
  -----------
  DataTransferItemList's indexed property getter should be anonymous and length 
should be unsigned long
https://bugs.webkit.org/show_bug.cgi?id=321861
rdar://185019165

Reviewed by Chris Dumez.

Two IDL declarations for DataTransferItemList do not match the HTML spec [1]:

    readonly attribute unsigned long length;
    getter DataTransferItem (unsigned long index);

* `length` was declared `long`, even though DataTransferItemList::length()
  returns unsigned. This is not observable from JS for realistic list sizes,
  but the declaration was simply wrong.

* The indexed property getter was declared with an identifier, `item`, which
  the spec does not have. That exposed a WebKit-only
  DataTransferItemList.prototype.item() operation; neither Chrome nor Firefox
  has it. Removing the identifier also removes the nullable annotation, as the
  pre-existing FIXME noted: nullability is implicit for an anonymous getter,
  and keeping the identifier while dropping `?` would not compile, since
  JSConverter<IDLInterface<T>> has no RefPtr overload.

The generated indexed getter is unaffected other than losing the prototype
function: it still null-checks the result of DataTransferItemList::item()
and unwraps it with IDLInterface<DataTransferItem>::extractValueFromNullable(),
so the implementation continues to return RefPtr<DataTransferItem> and
out-of-range indices continue to report the property as absent.

The only in-tree caller of the removed operation was the API test page
DataTransferItem-getAsEntry.html, used by DragAndDropTests
ExternalSourceDataTransferItemGetFolderAsEntry and
ExternalSourceDataTransferItemGetPlainTextFileAsEntry on iOS. It now uses
the indexed getter, `items[index]`. Previously the TypeError from calling
items.item() rejected handleDrop()'s await, so the page never posted its
"dropped" message and both tests timed out.

[1] 
https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface

Test: 
imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-indexed-getter.html

* 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-indexed-getter-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransferitemlist-indexed-getter.html:
 Added.
* Source/WebCore/dom/DataTransferItemList.idl:
* Tools/TestWebKitAPI/Resources/cocoa/DataTransferItem-getAsEntry.html:

Canonical link: https://commits.webkit.org/319259@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to