Skip to content

Commit fc0e6aa

Browse files
FS: Recursive RemoveEntry for non-existent handle throws NotFoundError.
This change ensures that FileSystemDirectoryHandle.removeEntry throws a 'NotFoundError' DOMException when attempting to remove a non-existent entry with recursive set to true. Previously, it returned undefined instead of throwing the expected DOMException. Bug: 362301049 Change-Id: I17873135fade0f25068fcbca53ed9faf0a363ee3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5990675 Reviewed-by: François Degros <[email protected]> Reviewed-by: Marijn Kruisselbrink <[email protected]> Commit-Queue: Xiaohan Zhao <[email protected]> Cr-Commit-Position: refs/heads/main@{#1407002}
1 parent e25c879 commit fc0e6aa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/script-tests/FileSystemDirectoryHandle-removeEntry.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,13 @@ directory_test(async (t, root) => {
128128

129129
assert_array_equals(await getSortedDirectoryEntries(root), []);
130130
}, 'createWritable after removeEntry succeeds but doesnt recreate the file');
131+
132+
directory_test(async (t, root) => {
133+
// root
134+
// ├──file-to-keep
135+
// ├──dir-to-keep
136+
await createFileWithContents('file-to-keep', 'abc', root);
137+
const dir_to_keep = await root.getDirectoryHandle('dir-to-keep', {create: true});
138+
await promise_rejects_dom(
139+
t, 'NotFoundError', root.removeEntry('dir-to-remove', {recursive: true}));
140+
}, 'removeEntry() on a non-existent directory recursively should throw NotFoundError');

0 commit comments

Comments
 (0)