Skip to content

Commit

Permalink
Throw TypeError if passed an offset not supported on the underlying OS (
Browse files Browse the repository at this point in the history
#84)

* throw TypeError if passed an unsupported offset

Fixes #31

* properly [=throw=]

Co-authored-by: Anne van Kesteren <[email protected]>
  • Loading branch information
a-sully and annevk authored Jan 11, 2023
1 parent e860d82 commit 149f02e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,8 @@ The <dfn method for=FileSystemSyncAccessHandle>read(|buffer|, {{FileSystemReadWr
1. Let |readStart| 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 reading from a file offset of
|readStart|, [=throw=] a {{TypeError}}.
1. If |readStart| is larger than |fileSize|:
1. Set [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] to |fileSize|.
1. Return 0.
Expand Down Expand Up @@ -1116,6 +1118,8 @@ The <dfn method for=FileSystemSyncAccessHandle>write(|buffer|, {{FileSystemReadW
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 |oldSize| be |fileContents|'s [=byte sequence/length=].
1. Let |bufferSize| be |buffer|'s [=byte length=].
Expand Down Expand Up @@ -1168,6 +1172,8 @@ The <dfn method for=FileSystemSyncAccessHandle>truncate(|newSize|)</dfn> method
1. If [=this=].[=[[state]]=] is "`closed`", throw an {{InvalidStateError}}.
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}}.
1. If |newSize| is larger than |oldSize|:
1. If |newSize| &minus; |oldSize| exceeds the available [=storage quota=], throw a {{QuotaExceededError}}.
1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] formed by concatenating
Expand Down

0 comments on commit 149f02e

Please sign in to comment.