Skip to content

Commit abad896

Browse files
authored
Editorial: modernize algorithm steps language
Related to #64.
1 parent 38b0517 commit abad896

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

index.bs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ a <dfn for="file entry">lock</dfn> (a string that may exclusively be "`open`", "
9393
and a <dfn for="file entry">shared lock count</dfn> (a number representing the number shared locks that are taken at a given point in time).
9494

9595
<div algorithm>
96-
To <dfn for="file entry/lock">take</dfn> a [=file entry/lock=] with a |value| of "`exclusive`" or "`shared`" on a given [=file entry=] |file|,
97-
run the following steps:
96+
To <dfn for="file entry/lock">take</dfn> a [=file entry/lock=] with a |value| of "`exclusive`" or "`shared`" on a given [=file entry=] |file|:
9897

9998
1. Let |lock| be the |file|'s [=file entry/lock=].
10099
1. Let |count| be the |file|'s [=file entry/shared lock count=].
@@ -116,7 +115,7 @@ run the following steps:
116115

117116
<div algorithm>
118117
To <dfn for="file entry/lock">release</dfn> a [=file entry/lock=] on a given [=file entry=] |file|,
119-
run the following steps:
118+
run these steps:
120119

121120
1. Let |lock| be the |file|'s associated [=file entry/lock=].
122121
1. Let |count| be the |file|'s [=file entry/shared lock count=].
@@ -156,10 +155,10 @@ directory on disk but an entry doesn't have to map to any file on disk).
156155

157156
<div algorithm>
158157
To <dfn for="entry">resolve</dfn> an [=/entry=] |child| relative to a [=directory entry=] |root|,
159-
run the following steps:
158+
run these steps:
160159

161160
1. Let |result| be [=a new promise=].
162-
1. Run the following steps [=in parallel=]:
161+
1. Run these steps [=in parallel=]:
163162
1. If |child| is [=the same as=] |root|,
164163
[=/resolve=] |result| with an empty list, and abort.
165164
1. Let |childPromises| be « ».
@@ -170,7 +169,7 @@ run the following steps:
170169
1. If |path| is not null:
171170
1. [=list/Prepend=] |entry|'s [=entry/name=] to |path|.
172171
1. [=/Resolve=] |result| with |path|.
173-
1. [=Wait for all=] |childPromises|, with the following success steps:
172+
1. [=Wait for all=] |childPromises|, with the these success steps:
174173
1. If |result| hasn't been resolved yet, [=/resolve=] |result| with `null`.
175174
1. Return |result|.
176175

@@ -247,7 +246,7 @@ The <dfn method for=FileSystemHandle>isSameEntry(|other|)</dfn> method steps are
247246

248247
1. Let |realm| be [=this=]'s [=relevant Realm=].
249248
1. Let |p| be [=a new promise=] in |realm|.
250-
1. Run the following steps [=in parallel=]:
249+
1. Run these steps [=in parallel=]:
251250
1. If [=this=]'s [=FileSystemHandle/entry=] is [=the same as=] |other|'s [=FileSystemHandle/entry=],
252251
[=/resolve=] |p| with true.
253252
1. Otherwise [=/resolve=] |p| with false.
@@ -289,7 +288,7 @@ A {{FileSystemFileHandle}}'s associated [=FileSystemHandle/entry=] must be a [=f
289288
The <dfn method for=FileSystemFileHandle>getFile()</dfn> method steps are:
290289

291290
1. Let |result| be [=a new promise=].
292-
1. Run the following steps [=in parallel=]:
291+
1. Run these steps [=in parallel=]:
293292
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
294293
[=entry/query access=] given "`read`".
295294
1. If |access| is not "{{PermissionState/granted}}",
@@ -343,7 +342,7 @@ modifications to existing large files.
343342
The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method steps are:
344343

345344
1. Let |result| be [=a new promise=].
346-
1. Run the following steps [=in parallel=]:
345+
1. Run these steps [=in parallel=]:
347346
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
348347
[=entry/request access=] given "`readwrite`".
349348
If that throws an exception, [=reject=] |result| with that exception and abort.
@@ -385,7 +384,7 @@ The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method
385384
The <dfn method for=FileSystemFileHandle>createSyncAccessHandle()</dfn> method steps are:
386385

387386
1. Let |result| be [=a new promise=].
388-
1. Run the following steps [=in parallel=]:
387+
1. Run these steps [=in parallel=]:
389388
1. Let |access| be the result of running [=this=]'s [=FileSystemHandle/entry=]'s
390389
[=entry/request access=] given "`readwrite`".
391390
If that throws an exception, [=reject=] |result| with that exception and abort.
@@ -528,7 +527,7 @@ and its async iterator |iterator|:
528527
The <dfn method for=FileSystemDirectoryHandle>getFileHandle(|name|, |options|)</dfn> method steps are:
529528

530529
1. Let |result| be [=a new promise=].
531-
1. Run the following steps [=in parallel=]:
530+
1. Run these steps [=in parallel=]:
532531
1. If |name| is not a [=valid file name=], [=/reject=] |result| with a {{TypeError}} and abort.
533532

534533
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
@@ -589,7 +588,7 @@ The <dfn method for=FileSystemDirectoryHandle>getFileHandle(|name|, |options|)</
589588
The <dfn method for=FileSystemDirectoryHandle>getDirectoryHandle(|name|, |options|)</dfn> method steps are:
590589

591590
1. Let |result| be [=a new promise=].
592-
1. Run the following steps [=in parallel=]:
591+
1. Run these steps [=in parallel=]:
593592
1. If |name| is not a [=valid file name=], [=/reject=] |result| with a {{TypeError}} and abort.
594593

595594
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
@@ -647,7 +646,7 @@ The <dfn method for=FileSystemDirectoryHandle>getDirectoryHandle(|name|, |option
647646
The <dfn method for=FileSystemDirectoryHandle>removeEntry(|name|, |options|)</dfn> method steps are:
648647

649648
1. Let |result| be [=a new promise=].
650-
1. Run the following steps [=in parallel=]:
649+
1. Run these steps [=in parallel=]:
651650
1. If |name| is not a [=valid file name=], [=/reject=] |result| with a {{TypeError}} and abort.
652651

653652
1. Let |entry| be [=this=]'s [=FileSystemHandle/entry=].
@@ -787,19 +786,19 @@ Similarly, when piping a {{ReadableStream}} into a {{FileSystemWritableFileStrea
787786

788787
<div algorithm>
789788
To <dfn>create a new FileSystemWritableFileStream</dfn> given a [=file entry=] |file|
790-
in a [=/Realm=] |realm|, perform the following steps:
789+
in a [=/Realm=] |realm|, run these steps:
791790

792791
1. Let |stream| be a [=new=] {{FileSystemWritableFileStream}} in |realm|.
793792
1. Set |stream|.[=FileSystemWritableFileStream/[[file]]=] to |file|.
794793
1. Let |writeAlgorithm| be an algorithm which takes a |chunk| argument
795794
and returns the result of running the [=write a chunk=] algorithm with |stream| and |chunk|.
796-
1. Let |closeAlgorithm| be the following steps:
795+
1. Let |closeAlgorithm| be these steps:
797796
1. Let |closeResult| be [=a new promise=].
798-
1. Run the following steps [=in parallel=]:
797+
1. Run these steps [=in parallel=]:
799798
1. Let |access| be the result of running |file|'s [=entry/query access=] given "`readwrite`".
800799
1. If |access| is not "{{PermissionState/granted}}",
801800
reject |closeResult| with a {{NotAllowedError}} and abort.
802-
1. Perform [=implementation-defined=] malware scans and safe browsing checks.
801+
1. Run [=implementation-defined=] malware scans and safe browsing checks.
803802
If these checks fail, [=/reject=] |closeResult| with an {{AbortError}} and abort.
804803
1. Set |stream|.[=FileSystemWritableFileStream/[[file]]=]'s [=file entry/binary data=] to |stream|.[=[[buffer]]=].
805804
If that throws an exception, [=/reject=] |closeResult| with that exception and abort.
@@ -810,8 +809,8 @@ in a [=/Realm=] |realm|, perform the following steps:
810809
1. [=file entry/lock/release|Release the lock=] on |stream|.[=FileSystemWritableFileStream/[[file]]=].
811810
1. [=/Resolve=] |closeResult| with `undefined`.
812811
1. Return |closeResult|.
813-
1. Let |abortAlgorithm| be the following step:
814-
1. [=file entry/lock/release|Release the lock=] on |stream|.[=FileSystemWritableFileStream/[[file]]=].
812+
1. Let |abortAlgorithm| be this step: [=file entry/lock/release|release the lock=] on
813+
|stream|.[=FileSystemWritableFileStream/[[file]]=].
815814
1. Let |highWaterMark| be 1.
816815
1. Let |sizeAlgorithm| be an algorithm that returns `1`.
817816
1. [=WritableStream/Set up=] |stream| with <a for="WritableStream/set up"><var
@@ -832,7 +831,7 @@ runs these steps:
832831
1. Let |input| be the result of [=converted to an IDL value|converting=] |chunk| to a {{FileSystemWriteChunkType}}.
833832
If this throws an exception, then return [=a promise rejected with=] that exception.
834833
1. Let |p| be [=a new promise=].
835-
1. Run the following steps [=in parallel=]:
834+
1. Run these steps [=in parallel=]:
836835
1. Let |access| be the result of running |stream|'s [=FileSystemWritableFileStream/[[file]]=]'s
837836
[=entry/query access=] given "`readwrite`".
838837
1. If |access| is not "{{PermissionState/granted}}",
@@ -1047,7 +1046,7 @@ contexts where asynchronous operations come with high overhead, e.g., WebAssembl
10471046

10481047
<div algorithm>
10491048
To <dfn>create a new FileSystemSyncAccessHandle</dfn> given a [=file entry=] |file|
1050-
in a [=/Realm=] |realm|, perform the following steps:
1049+
in a [=/Realm=] |realm|, run these steps:
10511050

10521051
1. Let |handle| be a [=new=] {{FileSystemSyncAccessHandle}} in |realm|.
10531052
1. Set |handle|.[=FileSystemSyncAccessHandle/[[file]]=] to |file|.

0 commit comments

Comments
 (0)