Skip to content

Commit 3320303

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 2a7b613 commit 3320303

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

index.bs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Each [=/file system locator=] has an associated <dfn export for="file system loc
241241
a <dfn export for="file system locator" id=locator-kind>kind</dfn> (a {{FileSystemHandleKind}}), and
242242
a <dfn export for="file system locator" id=locator-root>root</dfn> (a [=file system root=]).
243243

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

246246
A <dfn export>file locator</dfn> is a [=/file system locator=] whose
247247
[=file system locator/kind=] is {{FileSystemHandleKind/"file"}}.
@@ -341,6 +341,20 @@ A {{FileSystemHandle}} object is associated with a <dfn for=FileSystemHandle exp
341341
Note: Multiple {{FileSystemHandle}} objects can have
342342
[=the same locator as|the same=] [=/file system locator=].
343343

344+
A {{FileSystemHandle}}
345+
<dfn for=FileSystemHandle export>is in an origin private file system</dfn>
346+
if the first [=list/item=] of its [=FileSystemHandle/locator=]'s
347+
[=file system locator/path=] is the empty string.
348+
349+
Note: This is a bit magical, but it works since only the root directory of an
350+
[=origin private file system=] can have a [=file system locator/path=] which
351+
[=list/contains=] an empty string. See {{StorageManager/getDirectory()}}.
352+
All other [=list/item=]s of a [=file system locator/path=] will be a
353+
[=valid file name=].
354+
355+
Issue(109): Consider improving this situation by giving each locator a
356+
[=storage bucket=].
357+
344358
<div algorithm="serialization steps">
345359
{{FileSystemHandle}} objects are [=serializable objects=].
346360

@@ -594,8 +608,8 @@ The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method
594608
The returned {{FileSystemSyncAccessHandle}} offers synchronous methods. This allows for higher performance
595609
on contexts where asynchronous operations come with high overhead, e.g., WebAssembly.
596610

597-
For the time being, this method will only succeed when the |fileHandle| belongs to the
598-
[=origin private file system=].
611+
For the time being, this method will only succeed when the |fileHandle|
612+
[=FileSystemHandle/is in an origin private file system=].
599613
</div>
600614

601615
<div algorithm>
@@ -605,6 +619,8 @@ The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method s
605619
1. Let |locator| be [=this=]'s [=FileSystemHandle/locator=].
606620
1. Let |realm| be [=this=]'s [=relevant Realm=].
607621
1. Let |global| be [=this=]'s [=relevant global object=].
622+
1. Let |isInAnOriginPrivateFileSystem| be whether
623+
[=this=] [=FileSystemHandle/is in an origin private file system=].
608624
1. [=Enqueue the following steps=] to the [=file system queue=]:
609625
1. Let |entry| be the result of [=locating an entry=] given |locator|.
610626
1. Let |accessResult| be the result of running |entry|'s
@@ -615,15 +631,15 @@ The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method s
615631
|accessResult|'s [=file system access result/error name=] and
616632
abort these steps.
617633

634+
1. If |isInAnOriginPrivateFileSystem| is true,
635+
[=queue a storage task=] with |global| to
636+
[=/reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and
637+
abort these steps.
638+
618639
1. If |entry| is `null`, [=queue a storage task=] with |global| to [=/reject=]
619640
|result| with a "{{NotFoundError}}" {{DOMException}} and abort these steps.
620641
1. [=Assert=]: |entry| is a [=file entry=].
621642

622-
1. If |entry| does not represent a [=/file system entry=] in an
623-
[=origin private file system=], [=queue a storage task=] with |global| to
624-
[=/reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and
625-
abort these steps.
626-
627643
1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=]
628644
with "`exclusive`" on |entry|.
629645

@@ -1653,7 +1669,7 @@ partial interface StorageManager {
16531669

16541670
<div class="note domintro">
16551671
: |directoryHandle| = await navigator . storage . {{StorageManager/getDirectory()}}
1656-
:: Returns the root directory of the origin private file system.
1672+
:: Returns the root directory of the [=origin private file system=].
16571673
</div>
16581674

16591675
<div algorithm>

0 commit comments

Comments
 (0)