Skip to content

Commit

Permalink
FSA: Change locking error to NoModificationAllowed
Browse files Browse the repository at this point in the history
When attempting to delete, rename or move a file that is currently
locked, the reported error is "Operation aborted by the user" (delete)
or InvalidStateError (move / rename). This CL changes the locking
errors of all three methods to NoModificationAllowed.

Change-Id: I1c620452fbe772d16d8964e1a8714ddb5fb6050f
Bug: 1259565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3217394
Reviewed-by: Austin Sullivan <[email protected]>
Commit-Queue: Richard Stotz <[email protected]>
Cr-Commit-Position: refs/heads/main@{#931168}
  • Loading branch information
rstz authored and Gabisampaio committed Nov 18, 2021
1 parent 5e12deb commit 7ca0b6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ directory_test(async (t, root) => {
await createFileWithContents(t, 'file-to-keep', 'abc', root);

const writable = await handle.createWritable();
await promise_rejects_dom(t, 'AbortError', handle.remove());
await promise_rejects_dom(t, 'NoModificationAllowedError', handle.remove());

await writable.close();
assert_array_equals(
Expand Down
8 changes: 4 additions & 4 deletions file-system-access/script-tests/FileSystemFileHandle-move.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ directory_test(async (t, root) => {

// Cannot move handle with an active writable.
const stream = await file.createWritable();
await promise_rejects_dom(t, 'InvalidStateError', file.move(dir_dest));
await promise_rejects_dom(t, 'NoModificationAllowedError', file.move(dir_dest));

assert_array_equals(
await getSortedDirectoryEntries(root), ['dir-dest/', 'dir-src/']);
Expand All @@ -185,7 +185,7 @@ directory_test(async (t, root) => {

// Cannot move handle with an active writable.
const stream = await file.createWritable();
await promise_rejects_dom(t, 'InvalidStateError', file.move(dir_dest));
await promise_rejects_dom(t, 'NoModificationAllowedError', file.move(dir_dest));

assert_array_equals(
await getSortedDirectoryEntries(root), ['dir-dest/', 'dir-src/']);
Expand All @@ -210,7 +210,7 @@ directory_test(async (t, root) => {

// Cannot overwrite handle with an active writable.
const stream = await file_dest.createWritable();
await promise_rejects_dom(t, 'InvalidStateError', file.move(dir_dest));
await promise_rejects_dom(t, 'NoModificationAllowedError', file.move(dir_dest));

assert_array_equals(
await getSortedDirectoryEntries(root), ['dir-dest/', 'dir-src/']);
Expand Down Expand Up @@ -238,7 +238,7 @@ directory_test(async (t, root) => {
// Cannot overwrite handle with an active writable.
const stream = await file_dest.createWritable();
await promise_rejects_dom(
t, 'InvalidStateError', file.move(dir_dest, 'file-dest'));
t, 'NoModificationAllowedError', file.move(dir_dest, 'file-dest'));

assert_array_equals(
await getSortedDirectoryEntries(root), ['dir-dest/', 'dir-src/']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ directory_test(async (t, root) => {
// Cannot rename handle with an active writable.
const stream = await handle.createWritable();
await promise_rejects_dom(
t, 'InvalidStateError', handle.rename('file-after'));
t, 'NoModificationAllowedError', handle.rename('file-after'));

// Can move handle once the writable is closed.
await stream.close();
Expand All @@ -97,7 +97,7 @@ directory_test(async (t, root) => {
// Cannot overwrite a handle with an active writable.
const stream = await handle_dest.createWritable();
await promise_rejects_dom(
t, 'InvalidStateError', handle.rename('file-after'));
t, 'NoModificationAllowedError', handle.rename('file-after'));

// Can move handle once the writable is closed.
await stream.close();
Expand Down

0 comments on commit 7ca0b6d

Please sign in to comment.