Skip to content

Commit 1f4904f

Browse files
authored
Fix for each iterations referring to infra (w3c#578)
- Fix iteration over directive's value, which is an ordered set. - Add proper references to infra for all "for each" iterations. - Fix iteration over element's attribute list.
1 parent 947d892 commit 1f4904f

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

index.bs

+39-40
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
469469
1. Let |policy| be a new [=/policy=] with an empty [=policy/directive set=], a [=policy/source=]
470470
of |source|, and a [=policy/disposition=] of |disposition|.
471471

472-
2. For each |token| returned by [=strictly split a string|strictly splitting=] |serialized| on
472+
2. <a for=list>For each</a> |token| returned by [=strictly split a string|strictly splitting=] |serialized| on
473473
the U+003B SEMICOLON character (`;`):
474474

475475
1. [=Strip leading and trailing ASCII whitespace=] from |token|.
@@ -552,7 +552,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
552552
|response|'s [=response/header list=], with a [=policy/source=] of "`header`", and a
553553
[=policy/disposition=] of "`report`".
554554

555-
3. For each |policy| in |policies|:
555+
3. <a for=list>For each</a> |policy| of |policies|:
556556

557557
1. Set |policy|'s [=policy/self-origin=] to |response|'s [=response/url=]'s
558558
[=url/origin=].
@@ -1027,7 +1027,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
10271027

10281028
1. Let |CSP list| be |request|'s [=request/policy container=]'s [=policy container/CSP list=].
10291029

1030-
2. For each |policy| in |CSP list|:
1030+
2. <a for=list>For each</a> |policy| of |CSP list|:
10311031

10321032
1. If |policy|'s <a for="policy">disposition</a> is "`enforce`",
10331033
then skip to the next |policy|.
@@ -1051,7 +1051,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
10511051

10521052
2. Let |result| be "`Allowed`".
10531053

1054-
3. For each |policy| in |CSP list|:
1054+
3. <a for=list>For each</a> |policy| of |CSP list|:
10551055

10561056
1. If |policy|'s <a for="policy">disposition</a> is "`report`",
10571057
then skip to the next |policy|.
@@ -1080,9 +1080,9 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
10801080

10811081
2. Let |result| be "`Allowed`".
10821082

1083-
3. For each |policy| in |CSP list|:
1083+
3. <a for=list>For each</a> |policy| of |CSP list|:
10841084

1085-
1. For each |directive| in |policy|:
1085+
1. <a for=set>For each</a> |directive| of |policy|:
10861086

10871087
1. If the result of executing |directive|'s
10881088
<a for="directive">post-request check</a> is "`Blocked`", then:
@@ -1162,10 +1162,10 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
11621162
Given a {{Document}} (|document|), the user agent performs the following
11631163
steps in order to initialize CSP for |document|:
11641164

1165-
1. For each |policy| in |document|'s [=Document/policy container=]'s
1165+
1. <a for=list>For each</a> |policy| of |document|'s [=Document/policy container=]'s
11661166
[=policy container/CSP list=]:
11671167

1168-
1. For each |directive| in |policy|:
1168+
1. <a for=set>For each</a> |directive| of |policy|:
11691169

11701170
1. Execute |directive|'s <a for="directive">initialization</a>
11711171
algorithm on |document|, and assert: its returned value is
@@ -1203,10 +1203,10 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
12031203

12041204
2. Let |result| be "`Allowed`".
12051205

1206-
3. For each |policy| in |element|'s {{Document}}'s <a for="/">global object</a>'s
1206+
3. <a for=list>For each</a> |policy| of |element|'s {{Document}}'s <a for="/">global object</a>'s
12071207
<a for="global object">CSP list</a>:
12081208

1209-
1. For each |directive| in |policy|'s <a for="policy">directive set</a>:
1209+
1. <a for=set>For each</a> |directive| of |policy|'s <a for="policy">directive set</a>:
12101210

12111211
1. If |directive|'s <a for="directive">inline check</a> returns
12121212
"`Allowed`" when executed upon |element|, |type|, |policy| and |source|,
@@ -1249,10 +1249,10 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
12491249
<ol class="algorithm">
12501250
1. Let |result| be "`Allowed`".
12511251

1252-
2. For each |policy| in |navigation request|'s <a for="request">policy container</a>'s
1252+
2. <a for=list>For each</a> |policy| of |navigation request|'s <a for="request">policy container</a>'s
12531253
<a for="policy container">CSP list</a>:
12541254

1255-
1. For each |directive| in |policy|:
1255+
1. <a for=set>For each</a> |directive| of |policy|:
12561256

12571257
1. If |directive|'s <a for="directive">pre-navigation check</a>
12581258
returns "`Allowed`" when executed upon |navigation request|,
@@ -1274,11 +1274,11 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
12741274
3. If |result| is "`Allowed`", and if |navigation request|'s
12751275
<a for="request">current URL</a>'s <a for="url">scheme</a> is `javascript`:
12761276

1277-
1. For each |policy| in |navigation request|'s <a for="request">client</a>'s
1277+
1. <a for=list>For each</a> |policy| of |navigation request|'s <a for="request">client</a>'s
12781278
<a for="environment settings object">global object</a>'s
12791279
<a for="global object">CSP list</a>:
12801280

1281-
1. For each |directive| in |policy|:
1281+
1. <a for=set>For each</a> |directive| of |policy|:
12821282

12831283
1. Let |directive-name| be the result of executing
12841284
[[#effective-directive-for-inline-check]] on |type|.
@@ -1318,12 +1318,12 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
13181318
<ol class="algorithm">
13191319
1. Let |result| be "`Allowed`".
13201320

1321-
2. For each |policy| in |response CSP list|:
1321+
2. <a for=list>For each</a> |policy| of |response CSP list|:
13221322

13231323
Note: Some directives (like <a>frame-ancestors</a>) allow a |response|'s
13241324
<a>Content Security Policy</a> to act on the navigation.
13251325

1326-
1. For each |directive| in |policy|:
1326+
1. <a for=set>For each</a> |directive| of |policy|:
13271327

13281328
1. If |directive|'s <a for="directive">navigation response check</a>
13291329
returns "`Allowed`" when executed upon |navigation request|, |type|,
@@ -1345,13 +1345,13 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
13451345
5. If |policy|'s <a for="policy">disposition</a> is "`enforce`", then
13461346
set |result| to "`Blocked`".
13471347

1348-
3. For each |policy| in |navigation request|'s <a for="request">policy container</a>'s
1348+
3. <a for=list>For each</a> |policy| of |navigation request|'s <a for="request">policy container</a>'s
13491349
<a for="policy container">CSP list</a>:
13501350

13511351
Note: Some directives in the |navigation request|'s context (like <a>frame-ancestors</a>)
13521352
need the |response| before acting on the navigation.
13531353

1354-
1. For each |directive| in |policy|:
1354+
1. <a for=set>For each</a> |directive| of |policy|:
13551355

13561356
1. If |directive|'s <a for="directive">navigation response check</a>
13571357
returns "`Allowed`" when executed upon |navigation request|, |type|,
@@ -1385,9 +1385,9 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
13851385
<ol class="algorithm">
13861386
1. Let |result| be "`Allowed`".
13871387

1388-
2. For each |policy| in |global|'s [=global object/CSP list=]:
1388+
2. <a for=list>For each</a> |policy| of |global|'s [=global object/CSP list=]:
13891389

1390-
1. For each |directive| in |policy|:
1390+
1. <a for=set>For each</a> |directive| of |policy|:
13911391

13921392
1. Execute |directive|'s <a for="directive">initialization</a> algorithm on
13931393
|global|. If its returned value is "`Blocked`", then set |result| to
@@ -1411,8 +1411,8 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
14111411
<ol class="algorithm">
14121412
1. Let |result| be "`Allowed`".
14131413

1414-
2. For each |policy| in |global|'s [=global object/CSP list=]:
1415-
1. For each |directive| in |policy|:
1414+
2. <a for=list>For each</a> |policy| of |global|'s [=global object/CSP list=]:
1415+
1. <a for=set>For each</a> |directive| of |policy|:
14161416
1. If |directive|'s <a for="directive">webrtc pre-connect check</a>
14171417
returns "`Allowed`", [=iteration/continue=].
14181418

@@ -1450,7 +1450,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
14501450

14511451
2. Let |global| be |realm|'s [=realm/global object=].
14521452

1453-
3. For each |policy| in |global|'s [=global object/CSP list=]:
1453+
3. <a for=list>For each</a> |policy| of |global|'s [=global object/CSP list=]:
14541454

14551455
1. Let |source-list| be `null`.
14561456

@@ -1504,7 +1504,7 @@ this algorithm returns normally if compilation is allowed, and throws a
15041504

15051505
2. Let |result| be "`Allowed`".
15061506

1507-
3. For each |policy| in |global|'s [=global object/CSP list=]:
1507+
3. <a for=list>For each</a> |policy| of |global|'s [=global object/CSP list=]:
15081508

15091509
1. Let |source-list| be `null`.
15101510

@@ -1791,9 +1791,8 @@ this algorithm returns normally if compilation is allowed, and throws a
17911791
<a for="policy">directive set</a> contains a <a>directive</a> named
17921792
"<a>`report-to`</a>", skip the remaining substeps.
17931793

1794-
2. For each |token| returned by <a lt="split a string on ASCII whitespace">
1795-
splitting a string on ASCII whitespace</a> with |directive|'s
1796-
<a for="directive">value</a> as the `input`.
1794+
2. <a for=set>For each</a> |token| of |directive|'s
1795+
<a for="directive">value</a>:
17971796

17981797
1. Let |endpoint| be the result of executing the <a>URL parser</a>
17991798
with |token| as the input, and |violation|'s
@@ -3412,7 +3411,7 @@ this algorithm returns normally if compilation is allowed, and throws a
34123411
returns "`Allowed`" if |base| may be used as the value of a <{base}>
34133412
element's <{base/href}> attribute, and "`Blocked`" otherwise:
34143413

3415-
1. For each |policy| in |document|'s <a for="/">global object</a>'s
3414+
1. <a for=list>For each</a> |policy| of |document|'s <a for="/">global object</a>'s
34163415
<a for="global object">csp list</a>:
34173416

34183417
1. Let |source list| be `null`.
@@ -3721,7 +3720,7 @@ this algorithm returns normally if compilation is allowed, and throws a
37213720

37223721
3. Let |bypass due to integrity match| be `true`.
37233722

3724-
4. For each |source| in |integrity sources|:
3723+
4. <a for=set>For each</a> |source| of |integrity sources|:
37253724

37263725
1. If |directive|'s <a for="directive">value</a> does not
37273726
contain a <a>source expression</a> whose
@@ -3797,7 +3796,7 @@ this algorithm returns normally if compilation is allowed, and throws a
37973796

37983797
1. Let |violates| be "`Does Not Violate`".
37993798

3800-
2. For each |directive| in |policy|:
3799+
2. <a for=set>For each</a> |directive| of |policy|:
38013800

38023801
1. Let |result| be the result of executing |directive|'s
38033802
<a for="directive">pre-request check</a> on |request| and |policy|.
@@ -3819,7 +3818,7 @@ this algorithm returns normally if compilation is allowed, and throws a
38193818

38203819
2. If |nonce| is the empty string, return "`Does Not Match`".
38213820

3822-
3. For each |expression| in |source list|:
3821+
3. <a for=set>For each</a> |expression| of |source list|:
38233822

38243823
1. If |expression| matches the <a grammar>`nonce-source`</a> grammar,
38253824
and |nonce| is <a for="string" lt="is">identical to</a> |expression|'s
@@ -3879,7 +3878,7 @@ this algorithm returns normally if compilation is allowed, and throws a
38793878
of « `'none'`, `https://example.com` », on the other hand, would match
38803879
`https://example.com/`.
38813880

3882-
4. For each |expression| in |source list|:
3881+
4. <a for=set>For each</a> |expression| of |source list|:
38833882

38843883
1. If [[#match-url-to-source-expression]] returns "`Matches`" when
38853884
executed upon |url|, |expression|, |origin|, and |redirect count|, return
@@ -4118,7 +4117,7 @@ this algorithm returns normally if compilation is allowed, and throws a
41184117

41194118
2. Remove the final item from |path list A|.
41204119

4121-
8. For each |piece A| in |path list A|:
4120+
8. <a for=list>For each</a> |piece A| of |path list A|:
41224121

41234122
1. Let |piece B| be the next item in |path list B|.
41244123

@@ -4147,8 +4146,8 @@ this algorithm returns normally if compilation is allowed, and throws a
41474146
1. If |element| does not have an attribute named "`nonce`", return "`Not
41484147
Nonceable`".
41494148

4150-
2. If |element| is a <{script}> element, then for each |attribute| in
4151-
|element|:
4149+
2. If |element| is a <{script}> element, then <a for=list>for each</a> |attribute| of
4150+
|element|'s <a for=Element>attribute list</a>:
41524151

41534152
1. If |attribute|'s name is an <a>ASCII case-insensitive</a> match for
41544153
the string "<code>&lt;script</code>" or the string
@@ -4191,7 +4190,7 @@ this algorithm returns normally if compilation is allowed, and throws a
41914190

41924191
1. Let |allow all inline| be `false`.
41934192

4194-
2. For each |expression| in |list|:
4193+
2. <a for=set>For each</a> |expression| of |list|:
41954194

41964195
1. If |expression| matches the <a grammar>`nonce-source`</a> or
41974196
<a grammar>`hash-source`</a> grammar, return "`Does Not Allow`".
@@ -4257,7 +4256,7 @@ this algorithm returns normally if compilation is allowed, and throws a
42574256
2. If |type| is "`script`" or "`style`", and [[#is-element-nonceable]]
42584257
returns "`Nonceable`" when executed upon |element|:
42594258

4260-
1. For each |expression| in |list|:
4259+
1. <a for=set>For each</a> |expression| of |list|:
42614260

42624261
1. If |expression| matches the <a grammar>`nonce-source`</a> grammar,
42634262
and |element| has a <{htmlsvg-global/nonce}> attribute whose value
@@ -4269,7 +4268,7 @@ this algorithm returns normally if compilation is allowed, and throws a
42694268

42704269
3. Let |unsafe-hashes flag| be `false`.
42714270

4272-
4. For each |expression| in |list|:
4271+
4. <a for=set>For each</a> |expression| of |list|:
42734272

42744273
1. If |expression| is an <a>ASCII case-insensitive</a> match for the
42754274
<a grammar>`keyword-source`</a>
@@ -4283,7 +4282,7 @@ this algorithm returns normally if compilation is allowed, and throws a
42834282
on the result of executing <a for="JavaScript string" data-lt="convert">JavaScript string converting</a>
42844283
on |source|.
42854284

4286-
2. For each |expression| in |list|:
4285+
2. <a for=set>For each</a> |expression| of |list|:
42874286

42884287
1. If |expression| matches the <a grammar>`hash-source`</a> grammar:
42894288

@@ -4503,7 +4502,7 @@ this algorithm returns normally if compilation is allowed, and throws a
45034502
1. Let |directive fallback list| be the result of executing [[#directive-fallback-list]]
45044503
on |effective directive name|.
45054504

4506-
2. For each |fallback directive| in |directive fallback list|:
4505+
2. <a for=set>For each</a> |fallback directive| of |directive fallback list|:
45074506

45084507
1. If |directive name| is |fallback directive|, Return "`Yes`".
45094508

0 commit comments

Comments
 (0)