Add the FileSystemFileHandle.move method#180
Add the FileSystemFileHandle.move method#180valadaptive wants to merge 12 commits intowhatwg:mainfrom
FileSystemFileHandle.move method#180Conversation
index.bs
Outdated
| </div> | ||
|
|
||
| <div algorithm> | ||
| The <dfn method for=FileSystemFileHandle>move({{FileSystemDirectoryHandle}}: |destinationDirectory|)</dfn> |
There was a problem hiding this comment.
We don't list the types here. This should maybe also use <p> as in the output all these algorithms look squished together.
There was a problem hiding this comment.
Removed the types from the algorithm headers (hopefully I didn't miss any).
I chose not to use <p> since it currently only appears twice in the entire document, at the footer. If we want to use <p> in more places for clarity, I think it's better to do that consistently as a separate change than to introduce it here.
index.bs
Outdated
| with "`exclusive`" on |entry|. | ||
|
|
||
| 1. If |destinationEntry| is not `null`: | ||
| 1. Let |destinationLockResult| be the result of |
There was a problem hiding this comment.
Initialize this variable in the outer scope once for clarity as you need it later. And then overwrite it for this non-null case. We usually keep "null" without markup btw, not null, just null.
There was a problem hiding this comment.
Initialized it to "not taken", overwriting it inside the conditional.
I also changed all the uses of null in the new section to plain "null". There are some other pre-existing areas that use null; maybe another editorial change for later.
An earlier version of this was proposed in #10, but stalled out due to complications around moving directories.
When looking into it, I was therefore surprised to find that this method (at least, a subset of it) has shipped in browsers since late 2021!
Apparently, Firefox and WebKit both shipped (early versions of) this method without a flag, and have kept them ever since. Chromium added these methods to the public IDL of
FileSystemFileHandlein a commit that claimed only to remove them fromFileSystemHandle. (A slightly-later update changed the single-argument version fromrenametomove.)I've taken #10 and adjusted it to match what Chrome has actually been shipping, in the hope that it can be standardized and documented. In particular, directory entries can no longer be moved, and the
movemethod has been moved fromFileSystemHandletoFileSystemFileHandle.Aside from just moving things around in the spec, there are a couple other changes:
I've reworded the non-normative sections slightly, since Bikeshed now warns if you use the word "may" in a non-normative section.
I've removed a couple steps in the algorithm that only exist to handle edge cases around moving directories. These steps were ensuring a directory could not be moved within itself, and ensuring the root of a bucket file system could not be moved.
The rewording is in its own commit, to make it easier to review that diff specifically.
FileSystemHandle.FileSystemHandle.FileSystemHandletoFileSystemFileHandle)FileSystemHandletoFileSystemFileHandle, and add the other two overload signatures)Preview | Diff