From 1a3f3a52208c41caad21964990f0b08a56d0264c Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Fri, 9 Dec 2022 15:00:05 -0800 Subject: [PATCH] FSA: Allow removing the root of an OPFS Removes the extra check added in https://crrev.com/c/3123735. See recent discussion on the spec here: https://github.com/whatwg/fs/pull/9#discussion_r1042179453 Bug: 1114923, 1399660 Change-Id: I0afd561238ae44dfa055e6fff234e801ee8de616 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4090632 Auto-Submit: Austin Sullivan Reviewed-by: Daseul Lee Commit-Queue: Austin Sullivan Cr-Commit-Position: refs/heads/main@{#1081696} --- .../script-tests/FileSystemBaseHandle-remove.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/file-system-access/script-tests/FileSystemBaseHandle-remove.js b/file-system-access/script-tests/FileSystemBaseHandle-remove.js index 95196db62b3c8b..fd27ff30850c53 100644 --- a/file-system-access/script-tests/FileSystemBaseHandle-remove.js +++ b/file-system-access/script-tests/FileSystemBaseHandle-remove.js @@ -94,5 +94,12 @@ directory_test(async (t, root) => { promise_test(async (t) => { const root = await navigator.storage.getDirectory(); - await promise_rejects_dom(t, 'NoModificationAllowedError', root.remove()); -}, 'cannot remove the root of a sandbox file system'); + await root.getFileHandle('file.txt', {create: true}); + assert_array_equals(await getSortedDirectoryEntries(root), ['file.txt']); + + await root.remove(); + + // Creates a fresh sandboxed file system. + const newRoot = await navigator.storage.getDirectory(); + assert_array_equals(await getSortedDirectoryEntries(newRoot), []); +}, 'can remove the root of a sandbox file system');