diff --git a/testing/web-platform/tests/interfaces/native-file-system.idl b/testing/web-platform/tests/interfaces/native-file-system.idl index f4679175c46ec..60a28f055ded9 100644 --- a/testing/web-platform/tests/interfaces/native-file-system.idl +++ b/testing/web-platform/tests/interfaces/native-file-system.idl @@ -13,18 +13,20 @@ interface FileSystemHandle { readonly attribute boolean isDirectory; readonly attribute USVString name; + Promise isSameEntry(FileSystemHandle other); + Promise queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); Promise requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); }; -dictionary FileSystemCreateWriterOptions { +dictionary FileSystemCreateWritableOptions { boolean keepExistingData = false; }; [Exposed=(Window,Worker), SecureContext, Serializable] interface FileSystemFileHandle : FileSystemHandle { Promise getFile(); - Promise createWriter(optional FileSystemCreateWriterOptions options = {}); + Promise createWritable(optional FileSystemCreateWritableOptions options = {}); }; dictionary FileSystemGetFileOptions { @@ -41,20 +43,36 @@ dictionary FileSystemRemoveOptions { [Exposed=(Window,Worker), SecureContext, Serializable] interface FileSystemDirectoryHandle : FileSystemHandle { + async iterable; + Promise getFile(USVString name, optional FileSystemGetFileOptions options = {}); Promise getDirectory(USVString name, optional FileSystemGetDirectoryOptions options = {}); - // This really returns an async iterable, but that is not yet expressable in WebIDL. - object getEntries(); - Promise removeEntry(USVString name, optional FileSystemRemoveOptions options = {}); + + Promise?> 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 write(unsigned long long position, (BufferSource or Blob or USVString) data); +interface FileSystemWritableFileStream : WritableStream { + Promise write(FileSystemWriteChunkType data); + Promise seek(unsigned long long position); Promise truncate(unsigned long long size); - Promise close(); }; enum ChooseFileSystemEntriesType { "open-file", "save-file", "open-directory" }; @@ -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 getSystemDirectory(GetSystemDirectoryOptions options); +partial interface mixin WindowOrWorkerGlobalScope { + Promise getOriginPrivateDirectory(); }; diff --git a/testing/web-platform/tests/native-file-system/idlharness.https.any.js b/testing/web-platform/tests/native-file-system/idlharness.https.any.js index 98b27fd9e3842..a9090baeee5a9 100644 --- a/testing/web-platform/tests/native-file-system/idlharness.https.any.js +++ b/testing/web-platform/tests/native-file-system/idlharness.https.any.js @@ -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,