Skip to content

Commit 2b0a522

Browse files
authored
Editorial: xref "throw" and "reject"
Fixes #89.
1 parent c482c69 commit 2b0a522

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

index.bs

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Their [=deserialization steps=], given |serialized| and |value| are:
212212

213213
1. If |serialized|.\[[Origin]] is not [=same origin=] with
214214
|value|'s [=relevant settings object=]'s [=environment settings object/origin=],
215-
then throw a "{{DataCloneError}}" {{DOMException}}.
215+
then [=throw=] a "{{DataCloneError}}" {{DOMException}}.
216216
1. Set |value|'s [=FileSystemHandle/entry=] to |serialized|.\[[Entry]]
217217

218218
</div>
@@ -293,7 +293,7 @@ The <dfn method for=FileSystemFileHandle>getFile()</dfn> method steps are:
293293
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
294294
[=file system entry/query access=] given "`read`".
295295
1. If |access| is not "{{PermissionState/granted}}",
296-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
296+
[=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
297297
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
298298
1. Let |f| be a new {{File}}.
299299
1. Set |f|'s <a spec=FileAPI>snapshot state</a> to the current state of |entry|.
@@ -351,7 +351,7 @@ The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method
351351
[=file system entry/request access=] given "`readwrite`".
352352
If that throws an exception, [=reject=] |result| with that exception and abort.
353353
1. If |access| is not "{{PermissionState/granted}}",
354-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
354+
[=reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
355355
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
356356
1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`shared`" on |entry|.
357357
1. If |lockResult| is false, [=reject=] |result| with a "{{NoModificationAllowedError}}" {{DOMException}} and abort.
@@ -393,10 +393,10 @@ The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method s
393393
[=file system entry/request access=] given "`readwrite`".
394394
If that throws an exception, [=reject=] |result| with that exception and abort.
395395
1. If |access| is not "{{PermissionState/granted}}",
396-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
396+
[=reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
397397
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
398398
1. If |entry| does not represent a [=/file system entry=] in an [=origin private file system=],
399-
reject |result| with an "{{InvalidStateError}}" {{DOMException}} and abort.
399+
[=reject=] |result| with an "{{InvalidStateError}}" {{DOMException}} and abort.
400400
1. Let |lockResult| be the result of [=file entry/lock/take|taking a lock=] with "`exclusive`" on |entry|.
401401
1. If |lockResult| is false, [=reject=] |result| with a "{{NoModificationAllowedError}}" {{DOMException}} and abort.
402402
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:
462462
[=file system entry/query access=] given "`read`".
463463

464464
1. If |access| is not "{{PermissionState/granted}}",
465-
throw a "{{NotAllowedError}}" {{DOMException}}.
465+
[=throw=] a "{{NotAllowedError}}" {{DOMException}}.
466466

467467
1. Set |iterator|'s <dfn for="FileSystemDirectoryHandle-iterator">past results</dfn> to an empty [=/set=].
468468

@@ -480,7 +480,8 @@ and its async iterator |iterator|:
480480
[=file system entry/query access=] given "`read`".
481481

482482
1. If |access| is not "{{PermissionState/granted}}",
483-
reject |promise| with a "{{NotAllowedError}}" {{DOMException}} and return |promise|.
483+
[=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}} and
484+
return |promise|.
484485

485486
1. Let |child| be a [=/file system entry=] in |directory|'s [=directory entry/children=],
486487
such that |child|'s [=file system entry/name=] is not contained in |iterator|'s [=past results=],
@@ -543,7 +544,7 @@ The <dfn method for=FileSystemDirectoryHandle>getFileHandle(|name|, |options|)</
543544
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
544545
[=file system entry/query access=] given "`read`".
545546
1. If |access| is not "{{PermissionState/granted}}",
546-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
547+
[=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
547548

548549
1. [=set/For each=] |child| of |entry|'s [=directory entry/children=]:
549550
1. If |child|'s [=file system entry/name=] equals |name|:
@@ -604,7 +605,7 @@ The <dfn method for=FileSystemDirectoryHandle>getDirectoryHandle(|name|, |option
604605
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
605606
[=file system entry/query access=] given "`read`".
606607
1. If |access| is not "{{PermissionState/granted}}",
607-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
608+
[=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
608609

609610
1. [=set/For each=] |child| of |entry|'s [=directory entry/children=]:
610611
1. If |child|'s [=file system entry/name=] equals |name|:
@@ -657,7 +658,7 @@ The <dfn method for=FileSystemDirectoryHandle>removeEntry(|name|, |options|)</df
657658
[=file system entry/request access=] given "`readwrite`".
658659
If that throws an exception, [=reject=] |result| with that exception and abort.
659660
1. If |access| is not "{{PermissionState/granted}}",
660-
reject |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
661+
[=/reject=] |result| with a "{{NotAllowedError}}" {{DOMException}} and abort.
661662

662663
1. [=set/For each=] |child| of |entry|'s [=directory entry/children=]:
663664
1. If |child|'s [=file system entry/name=] equals |name|:
@@ -799,7 +800,8 @@ in a [=/Realm=] |realm|, run these steps:
799800
1. Run these steps [=in parallel=]:
800801
1. Let |access| be the result of running |file|'s [=file system entry/query access=] given "`readwrite`".
801802
1. If |access| is not "{{PermissionState/granted}}",
802-
reject |closeResult| with a "{{NotAllowedError}}" {{DOMException}} and abort.
803+
[=/reject=] |closeResult| with a "{{NotAllowedError}}" {{DOMException}}
804+
and abort.
803805
1. Run [=implementation-defined=] malware scans and safe browsing checks.
804806
If these checks fail, [=/reject=] |closeResult| with an "{{AbortError}}" {{DOMException}} and abort.
805807
1. Set |stream|.[=FileSystemWritableFileStream/[[file]]=]'s [=file entry/binary data=] to |stream|.[=[[buffer]]=].
@@ -837,14 +839,14 @@ runs these steps:
837839
1. Let |access| be the result of running |stream|'s [=FileSystemWritableFileStream/[[file]]=]'s
838840
[=file system entry/query access=] given "`readwrite`".
839841
1. If |access| is not "{{PermissionState/granted}}",
840-
reject |p| with a "{{NotAllowedError}}" {{DOMException}} and abort.
842+
[=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and abort.
841843
1. Let |command| be |input|.{{WriteParams/type}} if |input| is a {{WriteParams}},
842844
and {{WriteCommandType/"write"}} otherwise.
843845
1. If |command| is {{WriteCommandType/"write"}}:
844846
1. Let |data| be |input|.{{WriteParams/data}} if |input| is a {{WriteParams}},
845847
and |input| otherwise.
846848
1. If |data| is `undefined`,
847-
reject |p| with a {{TypeError}} and abort.
849+
[=/reject=] |p| with a {{TypeError}} and abort.
848850
1. Let |writePosition| be |stream|.[=[[seekOffset]]=].
849851
1. If |input| is a {{WriteParams}} and |input|.{{WriteParams/position}} is not `undefined`,
850852
set |writePosition| to |input|.{{WriteParams/position}}.
@@ -1073,7 +1075,7 @@ Issue(35): Specify how Access Handles should react when reading from a file that
10731075
<div algorithm>
10741076
The <dfn method for=FileSystemSyncAccessHandle>read(|buffer|, {{FileSystemReadWriteOptions}}: |options|)</dfn> method steps are:
10751077

1076-
1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}"
1078+
1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
10771079
{{DOMException}}.
10781080
1. Let |bufferSize| be |buffer|'s [=byte length=].
10791081
1. Let |fileContents| be [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
@@ -1115,13 +1117,13 @@ The <dfn method for=FileSystemSyncAccessHandle>read(|buffer|, {{FileSystemReadWr
11151117
<div algorithm>
11161118
The <dfn method for=FileSystemSyncAccessHandle>write(|buffer|, {{FileSystemReadWriteOptions}}: |options|)</dfn> method steps are:
11171119

1118-
1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}"
1120+
1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
11191121
{{DOMException}}.
11201122
1. Let |writePosition| be |options|["{{FileSystemReadWriteOptions/at}}"] if
11211123
|options|["{{FileSystemReadWriteOptions/at}}"] [=map/exists=]; otherwise
11221124
[=this=]'s [=FileSystemSyncAccessHandle/file position cursor=].
11231125
1. If the underlying file system does not support writing to a file offset of
1124-
|writePosition|, throw a {{TypeError}}.
1126+
|writePosition|, [=throw=] a {{TypeError}}.
11251127
1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
11261128
1. Let |oldSize| be |fileContents|'s [=byte sequence/length=].
11271129
1. Let |bufferSize| be |buffer|'s [=byte length=].
@@ -1140,7 +1142,7 @@ The <dfn method for=FileSystemSyncAccessHandle>write(|buffer|, {{FileSystemReadW
11401142
|oldSize| &minus; (|writePosition| + |bufferSize|) bytes of |fileContents|.
11411143
1. Let |newSize| be |head|'s [=byte sequence/length=] + |bufferSize| + |tail|'s [=byte sequence/length=].
11421144
1. If |newSize| &minus; |oldSize| exceeds the available [=storage quota=],
1143-
throw a "{{QuotaExceededError}}" {{DOMException}}.
1145+
[=throw=] a "{{QuotaExceededError}}" {{DOMException}}.
11441146
1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] to the concatenation of |head|, the contents of |buffer| and |tail|.
11451147

11461148
Note: The mechanism used to access buffer's contents is left purposely vague.
@@ -1154,7 +1156,7 @@ The <dfn method for=FileSystemSyncAccessHandle>write(|buffer|, {{FileSystemReadW
11541156
1. Let |bytesWritten| be the number of bytes that were written from |buffer|.
11551157
1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |writePosition| + |bytesWritten|.
11561158
1. Return |bytesWritten|.
1157-
1. Otherwise throw an "{{InvalidStateError}}" {{DOMException}}.
1159+
1. Otherwise [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
11581160
1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |writePosition| + |bufferSize|.
11591161
1. Return |bufferSize|.
11601162

@@ -1172,24 +1174,25 @@ The <dfn method for=FileSystemSyncAccessHandle>write(|buffer|, {{FileSystemReadW
11721174
<div algorithm>
11731175
The <dfn method for=FileSystemSyncAccessHandle>truncate(|newSize|)</dfn> method steps are:
11741176

1175-
1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}"
1177+
1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
11761178
{{DOMException}}.
11771179
1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
11781180
1. 1. Let |oldSize| be the [=byte sequence/length=] of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
11791181
1. If the underlying file system does not support setting a file's size to
1180-
|newSize|, throw a {{TypeError}}.
1182+
|newSize|, [=throw=] a {{TypeError}}.
11811183
1. If |newSize| is larger than |oldSize|:
1182-
1. If |newSize| &minus; |oldSize| exceeds the available [=storage quota=], throw a "{{QuotaExceededError}}" {{DOMException}}.
1184+
1. If |newSize| &minus; |oldSize| exceeds the available [=storage quota=],
1185+
[=throw=] a "{{QuotaExceededError}}" {{DOMException}}.
11831186
1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] formed by concatenating
11841187
|fileContents| with a [=byte sequence=]
11851188
containing |newSize| &minus; |oldSize| 0x00 bytes.
11861189
1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps
1187-
failed, throw an "{{InvalidStateError}}" {{DOMException}}.
1190+
failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
11881191
1. Otherwise, if |newSize| is smaller than |oldSize|:
11891192
1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] containing the first |newSize| bytes
11901193
in |fileContents|.
11911194
1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps
1192-
failed, throw an "{{InvalidStateError}}" {{DOMException}}.
1195+
failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
11931196
1. If [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] is greater than |newSize|, then set [=FileSystemSyncAccessHandle/file position cursor=] to |newSize|.
11941197

11951198
</div>
@@ -1204,7 +1207,7 @@ The <dfn method for=FileSystemSyncAccessHandle>truncate(|newSize|)</dfn> method
12041207
<div algorithm>
12051208
The <dfn method for=FileSystemSyncAccessHandle>getSize()</dfn> method steps are:
12061209

1207-
1. If [=this=].[=[[state]]=] is "`closed`", throw an "{{InvalidStateError}}"
1210+
1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
12081211
{{DOMException}}.
12091212
1. Return [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]'s [=byte sequence/length=].
12101213

0 commit comments

Comments
 (0)