From 332030324cd286480433601b0e2c54a7ef1ceb42 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Thu, 6 Apr 2023 17:53:18 +0000 Subject: [PATCH 1/2] 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 --- index.bs | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/index.bs b/index.bs index cc5dfa8..ee6006b 100644 --- a/index.bs +++ b/index.bs @@ -241,7 +241,7 @@ Each [=/file system locator=] has an associated kind (a {{FileSystemHandleKind}}), and a root (a [=file system root=]). -Issue(103): Consider giving each locator a Storage Bucket. +Issue(109): Consider giving each locator a [=storage bucket=]. A file locator is a [=/file system locator=] whose [=file system locator/kind=] is {{FileSystemHandleKind/"file"}}. @@ -341,6 +341,20 @@ A {{FileSystemHandle}} object is associated with a is in an origin private file system +if the first [=list/item=] of its [=FileSystemHandle/locator=]'s +[=file system locator/path=] is the empty string. + +Note: This is a bit magical, but it works since only the root directory of an +[=origin private file system=] can have a [=file system locator/path=] which +[=list/contains=] an empty string. See {{StorageManager/getDirectory()}}. +All other [=list/item=]s of a [=file system locator/path=] will be a +[=valid file name=]. + +Issue(109): Consider improving this situation by giving each locator a +[=storage bucket=]. +
{{FileSystemHandle}} objects are [=serializable objects=]. @@ -594,8 +608,8 @@ The createWritable(|options|) method The returned {{FileSystemSyncAccessHandle}} offers synchronous methods. This allows for higher performance on contexts where asynchronous operations come with high overhead, e.g., WebAssembly. - For the time being, this method will only succeed when the |fileHandle| belongs to the - [=origin private file system=]. + For the time being, this method will only succeed when the |fileHandle| + [=FileSystemHandle/is in an origin private file system=].
@@ -605,6 +619,8 @@ The createSyncAccessHandle() method s 1. Let |locator| be [=this=]'s [=FileSystemHandle/locator=]. 1. Let |realm| be [=this=]'s [=relevant Realm=]. 1. Let |global| be [=this=]'s [=relevant global object=]. +1. Let |isInAnOriginPrivateFileSystem| be whether + [=this=] [=FileSystemHandle/is in an origin private file system=]. 1. [=Enqueue the following steps=] to the [=file system queue=]: 1. Let |entry| be the result of [=locating an entry=] given |locator|. 1. Let |accessResult| be the result of running |entry|'s @@ -615,15 +631,15 @@ The createSyncAccessHandle() method s |accessResult|'s [=file system access result/error name=] and abort these steps. + 1. If |isInAnOriginPrivateFileSystem| is true, + [=queue a storage task=] with |global| to + [=/reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and + abort these steps. + 1. If |entry| is `null`, [=queue a storage task=] with |global| to [=/reject=] |result| with a "{{NotFoundError}}" {{DOMException}} and abort these steps. 1. [=Assert=]: |entry| is a [=file entry=]. - 1. If |entry| does not represent a [=/file system entry=] in an - [=origin private file system=], [=queue a storage task=] with |global| to - [=/reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and - abort these steps. - 1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`exclusive`" on |entry|. @@ -1653,7 +1669,7 @@ partial interface StorageManager {
: |directoryHandle| = await navigator . storage . {{StorageManager/getDirectory()}} - :: Returns the root directory of the origin private file system. + :: Returns the root directory of the [=origin private file system=].
From 355151dbf8632909196b51d205b975bce205a427 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Wed, 14 Jun 2023 23:21:19 +0000 Subject: [PATCH 2/2] flip bit (whoops) + clarify assignment --- index.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index ee6006b..657edeb 100644 --- a/index.bs +++ b/index.bs @@ -619,8 +619,9 @@ The createSyncAccessHandle() method s 1. Let |locator| be [=this=]'s [=FileSystemHandle/locator=]. 1. Let |realm| be [=this=]'s [=relevant Realm=]. 1. Let |global| be [=this=]'s [=relevant global object=]. -1. Let |isInAnOriginPrivateFileSystem| be whether - [=this=] [=FileSystemHandle/is in an origin private file system=]. +1. Let |isInAnOriginPrivateFileSystem| be true if + [=this=] [=FileSystemHandle/is in an origin private file system=]; + otherwise false. 1. [=Enqueue the following steps=] to the [=file system queue=]: 1. Let |entry| be the result of [=locating an entry=] given |locator|. 1. Let |accessResult| be the result of running |entry|'s @@ -631,7 +632,7 @@ The createSyncAccessHandle() method s |accessResult|'s [=file system access result/error name=] and abort these steps. - 1. If |isInAnOriginPrivateFileSystem| is true, + 1. If |isInAnOriginPrivateFileSystem| is false, [=queue a storage task=] with |global| to [=/reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and abort these steps.