Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interfaces/native-file-system.idl and test #24121

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions interfaces/native-file-system.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ interface FileSystemHandle {
readonly attribute boolean isDirectory;
readonly attribute USVString name;

Promise<boolean> isSameEntry(FileSystemHandle other);

Promise<PermissionState> queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
Promise<PermissionState> requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
};

dictionary FileSystemCreateWriterOptions {
dictionary FileSystemCreateWritableOptions {
boolean keepExistingData = false;
};

[Exposed=(Window,Worker), SecureContext, Serializable]
interface FileSystemFileHandle : FileSystemHandle {
Promise<File> getFile();
Promise<FileSystemWriter> createWriter(optional FileSystemCreateWriterOptions options = {});
Promise<FileSystemWritableFileStream> createWritable(optional FileSystemCreateWritableOptions options = {});
};

dictionary FileSystemGetFileOptions {
Expand All @@ -41,20 +43,36 @@ dictionary FileSystemRemoveOptions {

[Exposed=(Window,Worker), SecureContext, Serializable]
interface FileSystemDirectoryHandle : FileSystemHandle {
async iterable<USVString, FileSystemHandle>;

Promise<FileSystemFileHandle> getFile(USVString name, optional FileSystemGetFileOptions options = {});
Promise<FileSystemDirectoryHandle> getDirectory(USVString name, optional FileSystemGetDirectoryOptions options = {});

// This really returns an async iterable, but that is not yet expressable in WebIDL.
object getEntries();

Promise<void> removeEntry(USVString name, optional FileSystemRemoveOptions options = {});

Promise<sequence<USVString>?> resolve(FileSystemHandle possibleDescendant);
};

enum WriteCommandType {
"write",
"seek",
"truncate",
};

dictionary WriteParams {
required WriteCommandType type;
unsigned long long? size;
unsigned long long? position;
(BufferSource or Blob or USVString)? data;
};

typedef (BufferSource or Blob or USVString or WriteParams) FileSystemWriteChunkType;

[Exposed=(Window,Worker), SecureContext]
interface FileSystemWriter {
Promise<void> write(unsigned long long position, (BufferSource or Blob or USVString) data);
interface FileSystemWritableFileStream : WritableStream {
Promise<void> write(FileSystemWriteChunkType data);
Promise<void> seek(unsigned long long position);
Promise<void> truncate(unsigned long long size);
Promise<void> close();
};

enum ChooseFileSystemEntriesType { "open-file", "save-file", "open-directory" };
Expand All @@ -78,15 +96,7 @@ partial interface Window {
chooseFileSystemEntries(optional ChooseFileSystemEntriesOptions options = {});
};

enum SystemDirectoryType {
"sandbox"
};

dictionary GetSystemDirectoryOptions {
required SystemDirectoryType type;
};

[SecureContext]
partial interface FileSystemDirectoryHandle {
static Promise<FileSystemDirectoryHandle> getSystemDirectory(GetSystemDirectoryOptions options);
partial interface mixin WindowOrWorkerGlobalScope {
Promise<FileSystemDirectoryHandle> getOriginPrivateDirectory();
};
2 changes: 1 addition & 1 deletion native-file-system/idlharness.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

idl_test(
['native-file-system'],
['html', 'dom'],
['streams', 'html', 'dom'],
idl_array => {
idl_array.add_objects({
// TODO: Add instances of FileSystemHandle, FileSystemFileHandle,
Expand Down