mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 12:41:59 +03:00
LibWeb: Reverse check for whether a FilesList index is supported
This fixes for..of iteration of a FilesList object.
This commit is contained in:
parent
c2ef506b4a
commit
0cc8698a62
Notes:
sideshowbarker
2024-07-17 10:05:47 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/0cc8698a62 Pull-request: https://github.com/SerenityOS/serenity/pull/23574
@ -1,7 +1,12 @@
|
||||
Select file...file1 Select files...4 files selected. input1:
|
||||
file1: Contents for file1
|
||||
file1 (index iteration): Contents for file1
|
||||
file1 (for..of iteration): Contents for file1
|
||||
input2:
|
||||
file1: Contents for file1
|
||||
file2: Contents for file2
|
||||
file3: Contents for file3
|
||||
file4: Contents for file4
|
||||
file1 (index iteration): Contents for file1
|
||||
file2 (index iteration): Contents for file2
|
||||
file3 (index iteration): Contents for file3
|
||||
file4 (index iteration): Contents for file4
|
||||
file1 (for..of iteration): Contents for file1
|
||||
file2 (for..of iteration): Contents for file2
|
||||
file3 (for..of iteration): Contents for file3
|
||||
file4 (for..of iteration): Contents for file4
|
||||
|
@ -13,7 +13,13 @@
|
||||
const file = input.files.item(i);
|
||||
const text = await file.text();
|
||||
|
||||
println(`${file.name}: ${text}`);
|
||||
println(`${file.name} (index iteration): ${text}`);
|
||||
}
|
||||
|
||||
for (let file of input.files) {
|
||||
const text = await file.text();
|
||||
|
||||
println(`${file.name} (for..of iteration): ${text}`);
|
||||
}
|
||||
|
||||
resolve();
|
||||
|
@ -41,7 +41,7 @@ bool FileList::is_supported_property_index(u32 index) const
|
||||
if (m_files.is_empty())
|
||||
return false;
|
||||
|
||||
return m_files.size() < index;
|
||||
return index < m_files.size();
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<JS::Value> FileList::item_value(size_t index) const
|
||||
|
Loading…
Reference in New Issue
Block a user