FSA: Update error code when attempting to remove sandbox root
Before: reject promise with InvalidStateError
After: reject promise with NoModificationAllowedError
Also updates wpt to run on both sandboxed and local backends, which
will allow us to move it to the fs/ repo once the remove() PR lands.
Bug: 1114923
, 1327741
Change-Id: I54629eb0849e71d95881e1e03f25bfae4211dae8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3671699
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Auto-Submit: Austin Sullivan <asully@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1009320}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5d055acb9d
commit
cd3b51e26d
storage/browser/file_system
third_party/blink/web_tests/external/wpt/file-system-access
@@ -793,7 +793,7 @@ base::File::Error ObfuscatedFileUtil::DeleteDirectory(
|
|||||||
return base::File::FILE_ERROR_NOT_FOUND;
|
return base::File::FILE_ERROR_NOT_FOUND;
|
||||||
if (!file_id) {
|
if (!file_id) {
|
||||||
// Cannot remove the root directory.
|
// Cannot remove the root directory.
|
||||||
return base::File::FILE_ERROR_FAILED;
|
return base::File::FILE_ERROR_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
FileInfo file_info;
|
FileInfo file_info;
|
||||||
if (!db->GetFileInfo(file_id, &file_info)) {
|
if (!db->GetFileInfo(file_id, &file_info)) {
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
// META: script=resources/test-helpers.js
|
// META: script=resources/test-helpers.js
|
||||||
// META: script=../fs/resources/sandboxed-fs-test-helpers.js
|
// META: script=../fs/resources/sandboxed-fs-test-helpers.js
|
||||||
// META: script=script-tests/FileSystemBaseHandle-remove.js
|
// META: script=script-tests/FileSystemBaseHandle-remove.js
|
||||||
|
|
||||||
directory_test(async (t, root) => {
|
|
||||||
await promise_rejects_dom(t, 'InvalidStateError', root.remove());
|
|
||||||
}, 'cannot remove the root of a sandbox file system');
|
|
||||||
|
@@ -91,3 +91,8 @@ directory_test(async (t, root) => {
|
|||||||
assert_array_equals(await getSortedDirectoryEntries(root), ['file-to-keep']);
|
assert_array_equals(await getSortedDirectoryEntries(root), ['file-to-keep']);
|
||||||
await promise_rejects_dom(t, 'NotFoundError', getFileContents(handle));
|
await promise_rejects_dom(t, 'NotFoundError', getFileContents(handle));
|
||||||
}, 'remove() while the file has an open writable fails');
|
}, 'remove() while the file has an open writable fails');
|
||||||
|
|
||||||
|
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');
|
||||||
|
Reference in New Issue
Block a user