Skip to content

Commit

Permalink
[NativeFS] Keep directory iterator alive while it has pending promises.
Browse files Browse the repository at this point in the history
Should hopefully also fix test flakiness where tests seemed to already
be running into this.

Fixed: 1074123
Change-Id: If57c8d6f622c17d795bc1429f66485cda94befd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313763
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791122}
  • Loading branch information
mkruisselbrink authored and chromium-wpt-export-bot committed Jul 23, 2020
1 parent b3199ab commit e73575c
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -78,3 +78,21 @@ directory_test(async (t, root) => {
names.sort();
assert_array_equals(names, [file_name1, file_name2]);
}, 'keys: full iteration works');

directory_test(async (t, root) => {
const file_name1 = 'foo1.txt';
await createFileWithContents(t, file_name1, 'contents', /*parent=*/ root);

const next = (() => {
const iterator = root.entries();
return iterator.next();
})();
garbageCollect();
let entry = await next;
assert_false(entry.done);
assert_true(Array.isArray(entry.value));
assert_equals(entry.value.length, 2);
assert_equals(entry.value[0], file_name1);
assert_true(entry.value[1] instanceof FileSystemFileHandle);
assert_equals(entry.value[1].name, file_name1);
}, 'iteration while iterator gets garbage collected');

0 comments on commit e73575c

Please sign in to comment.