DataTransfer: propagate CanGc argument (#35062)

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2025-01-18 19:24:49 +01:00 committed by GitHub
parent 17b70c5178
commit 1bd34a5781
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 18 deletions

View file

@ -66,7 +66,7 @@ impl DataTransfer {
can_gc: CanGc,
data_store: Rc<RefCell<Option<DragDataStore>>>,
) -> DomRoot<DataTransfer> {
let item_list = DataTransferItemList::new(window, Rc::clone(&data_store));
let item_list = DataTransferItemList::new(window, Rc::clone(&data_store), can_gc);
reflect_dom_object_with_proto(
Box::new(DataTransfer::new_inherited(data_store, &item_list)),
@ -251,13 +251,13 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
}
/// <https://html.spec.whatwg.org/multipage/#dom-datatransfer-files>
fn Files(&self) -> DomRoot<FileList> {
fn Files(&self, can_gc: CanGc) -> DomRoot<FileList> {
// Step 1 Start with an empty list.
let mut files = Vec::new();
// Step 2 If the DataTransfer is not associated with a data store return the empty list.
if let Some(data_store) = self.data_store.borrow().as_ref() {
data_store.files(&self.global(), &mut files);
data_store.files(&self.global(), can_gc, &mut files);
}
// Step 5