Skip to content

Commit 2b149ba

Browse files
committed
Specify "origin private file system"-ness
Fixes 103 Gives a FileSystemHandle an "is in an origin private file system" predicate which checks for the empty string in its path
1 parent 274a106 commit 2b149ba

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

index.bs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Each [=/file system locator=] has an associated <dfn export for="file system loc
197197
a <dfn export for="file system locator" id=locator-kind>kind</dfn> (a {{FileSystemHandleKind}}), and
198198
a <dfn export for="file system locator" id=locator-root>root</dfn> (a [=file system root=]).
199199

200-
Issue(103): Consider giving each locator a Storage Bucket.
200+
Issue(109): Consider giving each locator a [=storage bucket=].
201201

202202
A <dfn export>file locator</dfn> is a [=/file system locator=] whose
203203
[=file system locator/kind=] is {{FileSystemHandleKind/"file"}}.
@@ -297,6 +297,20 @@ A {{FileSystemHandle}} object is associated with a <dfn for=FileSystemHandle exp
297297
Note: Multiple {{FileSystemHandle}} objects can have
298298
[=the same locator as|the same=] [=/file system locator=].
299299

300+
A {{FileSystemHandle}}
301+
<dfn for=FileSystemHandle export>is in an origin private file system</dfn>
302+
if the first [=list/item=] of its [=FileSystemHandle/locator=]'s
303+
[=file system locator/path=] is the empty string.
304+
305+
Note: This is a bit magical, but it works since only the root directory of an
306+
[=origin private file system=] can have a [=file system locator/path=] which
307+
[=list/contains=] an empty string. See {{StorageManager/getDirectory()}}.
308+
All other [=list/item=]s of a [=file system locator/path=] will be a
309+
[=valid file name=].
310+
311+
Issue(109): Consider improving this situation by giving each locator a
312+
[=storage bucket=].
313+
300314
<div algorithm="serialization steps">
301315
{{FileSystemHandle}} objects are [=serializable objects=].
302316

@@ -535,15 +549,17 @@ The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method
535549
The returned {{FileSystemSyncAccessHandle}} offers synchronous methods. This allows for higher performance
536550
on contexts where asynchronous operations come with high overhead, e.g., WebAssembly.
537551

538-
For the time being, this method will only succeed when the |fileHandle| belongs to the
539-
[=origin private file system=].
552+
For the time being, this method will only succeed when the |fileHandle|
553+
[=FileSystemHandle/is in an origin private file system=].
540554
</div>
541555

542556
<div algorithm>
543557
The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method steps are:
544558

545559
1. Let |result| be [=a new promise=].
546560
1. Let |locator| be [=this=]'s [=FileSystemHandle/locator=].
561+
1. Let |isInOriginPrivateFileSystem| be whether
562+
[=this=] [=FileSystemHandle/is in an origin private file system=].
547563
1. Run these steps [=in parallel=]:
548564
1. Let |entry| be the result of [=locating an entry=] given |locator|.
549565
1. Let |access| be the result of running |entry|'s
@@ -552,12 +568,13 @@ The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method s
552568
1. If |access| is not "{{PermissionState/granted}}",
553569
[=reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
554570

571+
1. If |isInOriginPrivateFileSystem| is true, [=reject=] |result|
572+
with an "{{InvalidStateError}}" {{DOMException}} and abort.
573+
555574
1. If |entry| is `null`, [=/reject=] |result| with a
556575
"{{NotFoundError}}" {{DOMException}} and abort.
557576
1. [=Assert=]: |entry| is a [=file entry=].
558577

559-
1. If |entry| does not represent a [=/file system entry=] in an [=origin private file system=],
560-
[=reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and abort.
561578
1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`exclusive`" on |entry|.
562579
1. If |lockResult| is false, [=reject=] |result| with a "{{NoModificationAllowedError}}" {{DOMException}} and abort.
563580
1. Let |handle| be the result of <a>creating a new `FileSystemSyncAccessHandle`</a>
@@ -1525,7 +1542,7 @@ partial interface StorageManager {
15251542

15261543
<div class="note domintro">
15271544
: |directoryHandle| = await navigator . storage . {{StorageManager/getDirectory()}}
1528-
:: Returns the root directory of the origin private file system.
1545+
:: Returns the root directory of the [=origin private file system=].
15291546
</div>
15301547

15311548
<div algorithm>

0 commit comments

Comments
 (0)