Skip to content

Commit 0d7956f

Browse files
committed
Add note to optimize contains a header-delivered CSP
1 parent 6f8d6f0 commit 0d7956f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

index.bs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/
135135
text: content security policy state; url: attr-meta-http-equiv-content-security-policy
136136
text: create and initialize a new document object; url: initialise-the-document-object
137137
text: initializing a new Document object; url: initialise-the-document-object
138+
for: policy container
139+
text: CSP list; url: policy-container-csp-list
140+
for: document
141+
text: policy container; url: concept-document-policy-container
138142

139143
spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
140144
type: grammar
@@ -543,6 +547,11 @@ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
543547
4. Return |policies|.
544548
</ol>
545549

550+
Note: When <a abstract-op lt="parse a response's Content Security Policies">parsing a response's
551+
Content Security Policies</a>, if the resulting |policies| end up containing at least one item,
552+
user agents can hold a flag on |policies| and use it to optimize away the [=/contains a
553+
header-delivered Content Security Policy=] algorithm.
554+
546555
<h3 id="framework-directives">Directives</h3>
547556

548557
Each <a for="/">policy</a> contains an <a>ordered set</a> of <dfn export>directives</dfn> (its
@@ -594,8 +603,8 @@ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
594603

595604
5. An <dfn for="directive" export>initialization</dfn>, which takes a {{Document}}
596605
or <a for="/">global object</a> and a <a for="/">policy</a> as arguments. This
597-
algorithm is executed during [[#initialize-document-csp]], and has no effect unless
598-
otherwise specified.
606+
algorithm is executed during [[#run-document-csp-initialization]], and has no
607+
effect unless otherwise specified.
599608

600609
6. A <dfn for="directive" export>pre-navigation check</dfn>, which takes a
601610
<a for="/">request</a>, a navigation type string ("`form-submission`"
@@ -1137,11 +1146,11 @@ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
11371146
Integration with HTML
11381147
</h3>
11391148

1140-
1. The [=policy container=] has a <a for="policy container">CSP list</a>, which holds
1149+
1. The [=/policy container=] has a [=policy container/CSP list=], which holds
11411150
all the <a for="/">policy</a> objects which are active for a given context. This
11421151
list is empty unless otherwise specified, and is populated from the <a>response</a> by <a
11431152
abstract-op lt="parse a response's Content Security Policies">parsing</a> <a>response</a>'s
1144-
Content Security Policies or inherited following the rules of the [=policy container=].
1153+
Content Security Policies or inherited following the rules of the [=/policy container=].
11451154

11461155
2. A <a for="/">global object</a>'s <dfn for="global object" id="global-object-csp-list">CSP list</dfn>
11471156
is the result of executing [[#get-csp-of-object]] with the <a for="/">global object</a>
@@ -1151,7 +1160,7 @@ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
11511160
<a for="/">global object</a> by inserting it into the <a for="/">global object</a>'s
11521161
<a for="global object">CSP list</a>.
11531162

1154-
4. [[#initialize-document-csp]] is called during the <a>create and initialize a
1163+
4. [[#run-document-csp-initialization]] is called during the <a>create and initialize a
11551164
new `Document` object</a> algorithm.
11561165

11571166
5. [[#should-block-inline]] is called during the <a>prepare a script</a> and
@@ -1182,14 +1191,14 @@ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
11821191
apply directive's navigation checks, as well as inline checks for
11831192
navigations to `javascript:` URLs.
11841193

1185-
<h4 id="initialize-document-csp" algorithm dfn export>
1186-
Initialize a `Document`'s `CSP`
1194+
<h4 id="run-document-csp-initialization" algorithm dfn export>
1195+
Run `CSP` initialization for a `Document`
11871196
</h4>
11881197

11891198
Given a {{Document}} (|document|), the user agent performs the following
1190-
steps in order to initialize |document|'s CSP:
1199+
steps in order to initialize CSP for |document|:
11911200

1192-
1. For each |policy| in |document|'s [=document/policy-container=]'s
1201+
1. For each |policy| in |document|'s [=document/policy container=]'s
11931202
[=policy container/CSP list=]:
11941203

11951204
1. For each |directive| in |policy|:

0 commit comments

Comments
 (0)