From c541310949828a92737b1bf2dd08bc1de6867b5d Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Tue, 17 Jan 2023 21:54:45 +0000 Subject: [PATCH] replace more dot accesses --- index.bs | 151 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 67 deletions(-) diff --git a/index.bs b/index.bs index cc5dfa8..9fa31be 100644 --- a/index.bs +++ b/index.bs @@ -491,9 +491,10 @@ The getFile() method steps are: 1. Let |f| be a new {{File}}. 1. Set |f|'s snapshot state to the current state of |entry|. 1. Set |f|'s underlying byte sequence to a copy of |entry|'s [=binary data=]. - 1. Set |f|.{{File/name}} to |entry|'s [=file system entry/name=]. - 1. Set |f|.{{File/lastModified}} to |entry|'s [=file entry/modification timestamp=]. - 1. Set |f|.{{Blob/type}} to an [=implementation-defined=] value, based on for example |entry|'s [=file system entry/name=] or its file extension. + 1. Set |f|'s {{File/name}} to |entry|'s [=file system entry/name=]. + 1. Set |f|'s {{File/lastModified}} to |entry|'s [=file entry/modification timestamp=]. + 1. Set |f|'s {{Blob/type}} to an [=implementation-defined=] value, based on + for example |entry|'s [=file system entry/name=] or its file extension. Issue: The reading and snapshotting behavior needs to be better specified in the [[FILE-API]] spec, for now this is kind of hand-wavy. @@ -822,7 +823,7 @@ The getFileHandle(|name|, |options|)getFileHandle(|name|, |options|)creating a child `FileSystemFileHandle` with |locator| and |child|'s [=file system entry/name=] in |realm| and abort these steps. - 1. If |options|.{{FileSystemGetFileOptions/create}} is false: + 1. If |options|'s {{FileSystemGetFileOptions/create}} is false: 1. [=/Reject=] |result| with a "{{NotFoundError}}" {{DOMException}} and abort these steps. 1. Let |child| be a new [=file entry=] whose [=query access=] and @@ -904,7 +905,7 @@ The getDirectoryHandle(|name|, |option abort these steps. 1. Let |entry| be the result of [=locating an entry=] given |locator|. - 1. If |options|.{{FileSystemGetDirectoryOptions/create}} is true: + 1. If |options|'s {{FileSystemGetDirectoryOptions/create}} is true: 1. Let |accessResult| be the result of running |entry|'s [=file system entry/request access=] given "`readwrite`". 1. Otherwise: @@ -930,7 +931,7 @@ The getDirectoryHandle(|name|, |option creating a child `FileSystemDirectoryHandle` with |locator| and |child|'s [=file system entry/name=] in |realm| and abort these steps. - 1. If |options|.{{FileSystemGetFileOptions/create}} is false: + 1. If |options|'s {{FileSystemGetFileOptions/create}} is false: 1. [=/Reject=] |result| with a "{{NotFoundError}}" {{DOMException}} and abort these steps. 1. Let |child| be a new [=directory entry=] whose [=query access=] and @@ -999,7 +1000,7 @@ The removeEntry(|name|, |options|) @@ -1440,10 +1447,10 @@ Issue(35): Specify how Access Handles should react when reading from a file that
The read(|buffer|, {{FileSystemReadWriteOptions}}: |options|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" - {{DOMException}}. +1. If [=this=]'s [=[[state]]=] is "`closed`", + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Let |bufferSize| be |buffer|'s [=byte length=]. -1. Let |fileContents| be [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. +1. Let |fileContents| be [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. 1. Let |fileSize| be |fileContents|'s [=byte sequence/length=]. 1. Let |readStart| be |options|["{{FileSystemReadWriteOptions/at}}"] if |options|["{{FileSystemReadWriteOptions/at}}"] [=map/exists=]; otherwise @@ -1482,14 +1489,15 @@ The read(|buffer|, {{FileSystemReadWr
The write(|buffer|, {{FileSystemReadWriteOptions}}: |options|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" - {{DOMException}}. +1. If [=this=]'s [=[[state]]=] is "`closed`", + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Let |writePosition| be |options|["{{FileSystemReadWriteOptions/at}}"] if |options|["{{FileSystemReadWriteOptions/at}}"] [=map/exists=]; otherwise [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=]. 1. If the underlying file system does not support writing to a file offset of |writePosition|, [=throw=] a {{TypeError}}. -1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. +1. Let |fileContents| be a copy of [=this=]'s + [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. 1. Let |oldSize| be |fileContents|'s [=byte sequence/length=]. 1. Let |bufferSize| be |buffer|'s [=byte length=]. 1. If |writePosition| is larger than |oldSize|, @@ -1508,15 +1516,17 @@ The write(|buffer|, {{FileSystemReadW 1. Let |newSize| be |head|'s [=byte sequence/length=] + |bufferSize| + |tail|'s [=byte sequence/length=]. 1. If |newSize| − |oldSize| exceeds the available [=storage quota=], [=throw=] a "{{QuotaExceededError}}" {{DOMException}}. -1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] to the concatenation of |head|, the contents of |buffer| and |tail|. +1. Set [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s + [=file entry/binary data=] to the concatenation of + |head|, the contents of |buffer| and |tail|. Note: The mechanism used to access buffer's contents is left purposely vague. It is likely that implementations will choose to focus on performance by issuing direct write calls to the host operating system (instead of creating a copy of buffer), which prevents a detailed specification of the write order and the results of partial writes. -1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps - failed: +1. If the operations modifying the [=this=]'s[=FileSystemSyncAccessHandle/[[file]]=]'s + [=file entry/binary data=] in the previous steps failed: 1. If there were partial writes and the number of bytes that were written from |buffer| is known: 1. Let |bytesWritten| be the number of bytes that were written from |buffer|. 1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |writePosition| + |bytesWritten|. @@ -1539,25 +1549,31 @@ The write(|buffer|, {{FileSystemReadW
The truncate(|newSize|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" - {{DOMException}}. -1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. -1. 1. Let |oldSize| be the [=byte sequence/length=] of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. +1. If [=this=]'s [=[[state]]=] is "`closed`", + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. Let |fileContents| be a copy of [=this=]'s + [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. +1. Let |oldSize| be the [=byte sequence/length=] of [=this=]'s + [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. 1. If the underlying file system does not support setting a file's size to |newSize|, [=throw=] a {{TypeError}}. 1. If |newSize| is larger than |oldSize|: 1. If |newSize| − |oldSize| exceeds the available [=storage quota=], [=throw=] a "{{QuotaExceededError}}" {{DOMException}}. - 1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] formed by concatenating - |fileContents| with a [=byte sequence=] - containing |newSize| − |oldSize| 0x00 bytes. - 1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps - failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. + 1. Set [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s to a + [=byte sequence=] formed by concatenating |fileContents| with a + [=byte sequence=] containing |newSize| − |oldSize| 0x00 bytes. + 1. If the operations modifying the [=this=]'s + [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] + in the previous steps failed, + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Otherwise, if |newSize| is smaller than |oldSize|: - 1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] containing the first |newSize| bytes - in |fileContents|. - 1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps - failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. + 1. Set [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s to a + [=byte sequence=] containing the first |newSize| bytes in |fileContents|. + 1. If the operations modifying the [=this=]'s + [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] + in the previous steps failed, + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] is greater than |newSize|, then set [=FileSystemSyncAccessHandle/file position cursor=] to |newSize|.
@@ -1572,9 +1588,10 @@ The truncate(|newSize|) method
The getSize() method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" - {{DOMException}}. -1. Return [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]'s [=byte sequence/length=]. +1. If [=this=]'s [=[[state]]=] is "`closed`", + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. Return [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s + [=file entry/binary data=]'s [=byte sequence/length=].
@@ -1588,8 +1605,8 @@ The getSize() method steps are:
The flush() method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" - {{DOMException}}. +1. If [=this=]'s [=[[state]]=] is "`closed`", + [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Attempt to transfer all cached modifications of the file's content to the file system's underlying storage device.