Skip to content

Commit

Permalink
[M109] FSA: Re-enable overwriting moves
Browse files Browse the repository at this point in the history
Partial revert of https://crrev.com/c/3930658. Throwing on overwriting
moves does not match POSIX. See discussion on the spec:
whatwg/fs#10 (comment)

This CL is being cherry-picked to M109 to ensure overwriting moves
are allowed in that milestone (which matches the previous behavior)

(cherry picked from commit 0eeab37)

Bug: 1366652, 1381621
Change-Id: Ic27fb61e7598c4feb8ee770ceb78fe1fbfd28cda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4048780
Auto-Submit: Austin Sullivan <[email protected]>
Reviewed-by: Daseul Lee <[email protected]>
Commit-Queue: Daseul Lee <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#1074882}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4049684
Commit-Queue: Austin Sullivan <[email protected]>
Cr-Commit-Position: refs/branch-heads/5414@{chromium#223}
Cr-Branched-From: 4417ee5-refs/heads/main@{#1070088}
  • Loading branch information
a-sully authored and Chromium LUCI CQ committed Nov 24, 2022
1 parent 8677289 commit 9e24fbe
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@
#include "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom-forward.h"

namespace features {
// TODO(crbug.com/1381621): This feature was disabled since it does not match
// standard POSIX behavior. We should explore adding a flag to allow opting in
// to overwriting moves. See discussion at
// https://github.com/whatwg/fs/pull/10#issuecomment-1322993643.
BASE_FEATURE(kFileSystemAccessDoNotOverwriteOnMove,
"FileSystemAccessDoNotOverwriteOnMove",
base::FEATURE_ENABLED_BY_DEFAULT);
base::FEATURE_DISABLED_BY_DEFAULT);
} // namespace features

namespace content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"

namespace features {
// TODO(crbug.com/1366652): Remove this flag eventually.
// TODO(crbug.com/1381621): Remove this flag eventually.
// When enabled, move() will result in a promise rejection when the specified
// destination to move to exists.
BASE_DECLARE_FEATURE(kFileSystemAccessDoNotOverwriteOnMove);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is a testharness.js-based test.
PASS move(name) to rename a file
PASS get a handle to a moved file
PASS move(name) to rename a file the same name
PASS move("") to rename a file fails
PASS move(name) can be called multiple times
PASS move(name) with a name with a trailing period should fail
PASS move(name) with a name with invalid characters should fail
PASS move(name) while the file has an open writable fails
FAIL move(name) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
PASS move(dir, name) to rename a file
PASS move(dir, name) to rename a file the same name
PASS move(dir) to move a file to a new directory
PASS move(dir, "") to move a file to a new directory fails
PASS move(dir, name) to move a file to a new directory
PASS move(dir) can be called multiple times
PASS move(dir, name) can be called multiple times
PASS move(dir, name) with a name with invalid characters should fail
PASS move(dir) while the file has an open writable fails
PASS move(dir, name) while the file has an open writable fails
FAIL move(dir) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL move(dir, name) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is a testharness.js-based test.
PASS move(name) to rename a file
PASS get a handle to a moved file
PASS move(name) to rename a file the same name
PASS move("") to rename a file fails
PASS move(name) can be called multiple times
PASS move(name) with a name with a trailing period should fail
PASS move(name) with a name with invalid characters should fail
PASS move(name) while the file has an open writable fails
FAIL move(name) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
PASS move(dir, name) to rename a file
PASS move(dir, name) to rename a file the same name
PASS move(dir) to move a file to a new directory
PASS move(dir, "") to move a file to a new directory fails
PASS move(dir, name) to move a file to a new directory
PASS move(dir) can be called multiple times
PASS move(dir, name) can be called multiple times
PASS move(dir, name) with a name with invalid characters should fail
PASS move(dir) while the file has an open writable fails
PASS move(dir, name) while the file has an open writable fails
FAIL move(dir) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL move(dir, name) while the destination file has an open writable fails assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.

0 comments on commit 9e24fbe

Please sign in to comment.