mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 21:00:42 +02:00
Automatic update from web-platform-tests [Native File System] Aborting a directory iteration succeeds The return statement of the async iterator was not returning the expected type. This removes the ability to cancel an iteration which fixes the bug where an error would be thrown otherwise. A full implementation of directory iteration will re-implement this functionality correctly. BUG=1007509 Change-Id: I77f3b76b117b7df939e73da826f4fc9b82e9441e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826993 Commit-Queue: Olivier Yiptong <oyiptong@chromium.org> Reviewed-by: Marijn Kruisselbrink <mek@chromium.org> Cr-Commit-Position: refs/heads/master@{#701356} -- wpt-commits: 6c043ae7c1c6edb9c6c329a1c2a559d6da4e45ae wpt-pr: 19330
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
directory_test(async (t, root) => {
|
|
const file_name1 = 'foo1.txt';
|
|
const file_name2 = 'foo2.txt';
|
|
await createFileWithContents(t, file_name1, 'contents', /*parent=*/ root);
|
|
await createFileWithContents(t, file_name2, 'contents', /*parent=*/ root);
|
|
|
|
let abortIter = async (dir) => {
|
|
for await (let entry of dir.getEntries()) {
|
|
return entry.name;
|
|
}
|
|
};
|
|
|
|
try {
|
|
await abortIter(root);
|
|
} catch(e) {
|
|
assert_unreached('Error thrown on iteration abort.');
|
|
}
|
|
|
|
}, 'getEntries(): returning early from an iteration works');
|
|
|
|
directory_test(async (t, root) => {
|
|
const file_name1 = 'foo1.txt';
|
|
const file_name2 = 'foo2.txt';
|
|
await createFileWithContents(t, file_name1, 'contents', /*parent=*/ root);
|
|
await createFileWithContents(t, file_name2, 'contents', /*parent=*/ root);
|
|
|
|
let fullIter = async (dir) => {
|
|
let name;
|
|
for await (let entry of dir.getEntries()) {
|
|
name = entry.name;
|
|
}
|
|
return name;
|
|
};
|
|
|
|
try {
|
|
await fullIter(root);
|
|
} catch(e) {
|
|
assert_unreached('Error thrown on iteration.');
|
|
}
|
|
|
|
}, 'getEntries(): full iteration works');
|