From 2b0a5220646eb649c14e489e69c2f9e6e4a04291 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Fri, 13 Jan 2023 02:43:15 -0500 Subject: [PATCH] Editorial: xref "throw" and "reject" Fixes #89. --- index.bs | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/index.bs b/index.bs index a9686f6..9bd1ac7 100644 --- a/index.bs +++ b/index.bs @@ -212,7 +212,7 @@ Their [=deserialization steps=], given |serialized| and |value| are: 1. If |serialized|.\[[Origin]] is not [=same origin=] with |value|'s [=relevant settings object=]'s [=environment settings object/origin=], - then throw a "{{DataCloneError}}" {{DOMException}}. + then [=throw=] a "{{DataCloneError}}" {{DOMException}}. 1. Set |value|'s [=FileSystemHandle/entry=] to |serialized|.\[[Entry]] @@ -293,7 +293,7 @@ The getFile() method steps are: 1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s [=file system entry/query access=] given "`read`". 1. If |access| is not "{{PermissionState/granted}}", - reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. + [=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. 1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=]. 1. Let |f| be a new {{File}}. 1. Set |f|'s snapshot state to the current state of |entry|. @@ -351,7 +351,7 @@ The createWritable(|options|) method [=file system entry/request access=] given "`readwrite`". If that throws an exception, [=reject=] |result| with that exception and abort. 1. If |access| is not "{{PermissionState/granted}}", - reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. + [=reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. 1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=]. 1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`shared`" on |entry|. 1. If |lockResult| is false, [=reject=] |result| with a "{{NoModificationAllowedError}}" {{DOMException}} and abort. @@ -393,10 +393,10 @@ The createSyncAccessHandle() method s [=file system entry/request access=] given "`readwrite`". If that throws an exception, [=reject=] |result| with that exception and abort. 1. If |access| is not "{{PermissionState/granted}}", - reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. + [=reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. 1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=]. 1. If |entry| does not represent a [=/file system entry=] in an [=origin private file system=], - reject |result| with an "{{InvalidStateError}}" {{DOMException}} and abort. + [=reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and abort. 1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`exclusive`" on |entry|. 1. If |lockResult| is false, [=reject=] |result| with a "{{NoModificationAllowedError}}" {{DOMException}} and abort. 1. Let |handle| be the result of [=create a new FileSystemSyncAccessHandle|creating a new FileSystemSyncAccessHandle=] @@ -462,7 +462,7 @@ and its async iterator |iterator| are: [=file system entry/query access=] given "`read`". 1. If |access| is not "{{PermissionState/granted}}", - throw a "{{NotAllowedError}}" {{DOMException}}. + [=throw=] a "{{NotAllowedError}}" {{DOMException}}. 1. Set |iterator|'s past results to an empty [=/set=]. @@ -480,7 +480,8 @@ and its async iterator |iterator|: [=file system entry/query access=] given "`read`". 1. If |access| is not "{{PermissionState/granted}}", - reject |promise| with a "{{NotAllowedError}}" {{DOMException}} and return |promise|. + [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}} and + return |promise|. 1. Let |child| be a [=/file system entry=] in |directory|'s [=directory entry/children=], such that |child|'s [=file system entry/name=] is not contained in |iterator|'s [=past results=], @@ -543,7 +544,7 @@ The getFileHandle(|name|, |options|)getDirectoryHandle(|name|, |option 1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s [=file system entry/query access=] given "`read`". 1. If |access| is not "{{PermissionState/granted}}", - reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. + [=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort. 1. [=set/For each=] |child| of |entry|'s [=directory entry/children=]: 1. If |child|'s [=file system entry/name=] equals |name|: @@ -657,7 +658,7 @@ The removeEntry(|name|, |options|) The read(|buffer|, {{FileSystemReadWriteOptions}}: |options|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}" +1. If [=this=].[=[[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=]. @@ -1115,13 +1117,13 @@ The read(|buffer|, {{FileSystemReadWr
The write(|buffer|, {{FileSystemReadWriteOptions}}: |options|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}" +1. If [=this=].[=[[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}}. + |writePosition|, [=throw=] a {{TypeError}}. 1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]. 1. Let |oldSize| be |fileContents|'s [=byte sequence/length=]. 1. Let |bufferSize| be |buffer|'s [=byte length=]. @@ -1140,7 +1142,7 @@ The write(|buffer|, {{FileSystemReadW |oldSize| − (|writePosition| + |bufferSize|) bytes of |fileContents|. 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}}. + [=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|. Note: The mechanism used to access buffer's contents is left purposely vague. @@ -1154,7 +1156,7 @@ The write(|buffer|, {{FileSystemReadW 1. Let |bytesWritten| be the number of bytes that were written from |buffer|. 1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |writePosition| + |bytesWritten|. 1. Return |bytesWritten|. - 1. Otherwise throw an "{{InvalidStateError}}" {{DOMException}}. + 1. Otherwise [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |writePosition| + |bufferSize|. 1. Return |bufferSize|. @@ -1172,24 +1174,25 @@ The write(|buffer|, {{FileSystemReadW
The truncate(|newSize|) method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}" +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 the underlying file system does not support setting a file's size to - |newSize|, throw a {{TypeError}}. + |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. 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}}. + 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}}. + 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|.
@@ -1204,7 +1207,7 @@ The truncate(|newSize|) method
The getSize() method steps are: -1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}" +1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Return [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]'s [=byte sequence/length=].