@@ -98,7 +98,8 @@ permission-related algorithms and types are defined as follows:
9898 <xmp class=idl>
9999 enum FileSystemPermissionMode {
100100 "read",
101- "readwrite"
101+ "readwrite",
102+ "write"
102103 };
103104
104105 dictionary FileSystemPermissionDescriptor : PermissionDescriptor {
@@ -126,8 +127,14 @@ permission-related algorithms and types are defined as follows:
126127 with the same {{FileSystemPermissionDescriptor/handle}} ,
127128 but whose {{FileSystemPermissionDescriptor/mode}} is
128129 "{{FileSystemPermissionMode/read}} ".
129- 1. If |read state| is not "{{PermissionState/granted}} ", this descriptor's [=permission state=]
130- must be equal to |read state|.
130+ 1. Let |write state| be the [=permission state=] for a descriptor
131+ with the same {{FileSystemPermissionDescriptor/handle}} ,
132+ but whose {{FileSystemPermissionDescriptor/mode}} is
133+ "{{FileSystemPermissionMode/write}} ".
134+ 1. If |read state| is "{{PermissionState/denied}} " or |write state| is "{{PermissionState/denied}} ",
135+ this descriptor's [=permission state=] must be "{{PermissionState/denied}} ".
136+ 1. Otherwise, if |read state| is "{{PermissionState/prompt}} " or |write state| is "{{PermissionState/prompt}} ",
137+ this descriptor's [=permission state=] must be "{{PermissionState/prompt}} ".
131138
132139Issue(whatwg/fs#101): Make these checks no longer associated with an entry.
133140
@@ -183,10 +190,7 @@ given a {{FileSystemHandle}} |handle| and a {{FileSystemPermissionMode}} |mode|,
183190
184191</div>
185192
186- Issue(119): Currently {{FileSystemPermissionMode}} can only be
187- "{{FileSystemPermissionMode/read}} " or "{{FileSystemPermissionMode/readwrite}} ".
188- In the future we might want to add a "write" mode as well to support write-only
189- handles.
193+
190194
191195## The {{FileSystemHandle}} interface ## {#api-filesystemhandle}
192196
@@ -231,6 +235,13 @@ partial interface FileSystemHandle {
231235 {{FileSystemHandle/requestPermission()}} .
232236 There is no automatic prompting for read access when attempting to
233237 read from a file or directory.
238+
239+ : |status| = await |handle| . {{FileSystemHandle/queryPermission()|queryPermission}} ({ {{FileSystemHandlePermissionDescriptor/mode}} : "{{FileSystemPermissionMode/write}} " })
240+ : |status| = (await navigator.{{Navigator/permissions}} .{{Permissions/query()|query}} ({ {{PermissionDescriptor/name}} : "{{PermissionName/file-system}} ", {{FileSystemPermissionDescriptor/handle}} : |handle|, {{FileSystemPermissionDescriptor/mode}} : "{{FileSystemPermissionMode/write}} " }).{{PermissionStatus/state}}
241+ :: Queries the current state of the write permission of this handle.
242+ If this returns "{{PermissionState/prompt}} ", attempting to modify the
243+ file or directory this handle represents will require user activation
244+ and will result in a confirmation prompt being shown to the user.
234245</div>
235246
236247Advisement: The integration with the permissions API's {{Permissions/query()}} method is not yet implemented in Chrome.
@@ -270,6 +281,14 @@ The <dfn method for=FileSystemHandle>queryPermission(|descriptor|)</dfn> method,
270281 and this will show a confirmation prompt to the user.
271282 The new write permission state is then returned, depending on
272283 what the user selected.
284+
285+ : |status| = await |handle| . {{FileSystemHandle/requestPermission()|requestPermission}} ({ {{FileSystemHandlePermissionDescriptor/mode}} : "{{FileSystemPermissionMode/write}} " })
286+ :: If the state of the write permission of this handle is anything other than
287+ "{{PermissionState/prompt}} ", this will return that state directly.
288+ If it is "{{PermissionState/prompt}} " however, user activation is needed and
289+ this will show a confirmation prompt to the user.
290+ The new write permission state is then returned, depending on
291+ what the user selected.
273292</div>
274293
275294<div algorithm>
@@ -859,6 +878,10 @@ these steps:
859878 the selected directory. The user agent can combine read and write permission requests on this handle into
860879 one subsequent prompt.
861880
881+ : |handle| = await window . {{Window/showDirectoryPicker()}} ({ {{DirectoryPickerOptions/mode}} : 'write' })
882+ :: Shows a directory picker that lets the user select a single directory, returning a handle for
883+ the selected directory if the user grants write permission.
884+
862885 The {{DirectoryPickerOptions/id}} and {{DirectoryPickerOptions/startIn}} fields behave
863886 identically to the {{FilePickerOptions/id}} and {{FilePickerOptions/startIn}} fields, respectively.
864887 See [[#api-filepickeroptions-starting-directory]] for details on how to use these fields.
0 commit comments