@@ -471,18 +471,21 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
471471 Parse a serialized CSP
472472 </h4>
473473
474- To <dfn abstract-op>parse a serialized CSP</dfn> , given a [=string =] |serialized|, a
475- [=policy/source=] |source|, and a [=policy/disposition=] |disposition|, execute the
476- following steps.
474+ To <dfn abstract-op>parse a serialized CSP</dfn> , given a [=byte sequence =] or
475+ [=string=] |serialized|, a [= policy/source=] |source|, and a [=policy/disposition=]
476+ |disposition|, execute the following steps.
477477
478478 This algorithm returns a [=Content Security Policy object=] . If |serialized| could not be
479479 parsed, the object's [=policy/directive set=] will be empty.
480480
481481 <ol class="algorithm">
482- 1. Let |policy| be a new [=/policy=] with an empty [=policy/directive set=] , a [=policy/source=]
482+ 1. If |serialized| is a [=byte sequence=] , then set |serialized| to be the result of
483+ [=isomorphic decoding=] |serialized|.
484+
485+ 2. Let |policy| be a new [=/policy=] with an empty [=policy/directive set=] , a [=policy/source=]
483486 of |source|, and a [=policy/disposition=] of |disposition|.
484487
485- 2 . <a for=list>For each</a> |token| returned by [=strictly split a string|strictly splitting=] |serialized| on
488+ 3 . <a for=list>For each</a> |token| returned by [=strictly split a string|strictly splitting=] |serialized| on
486489 the U+003B SEMICOLON character (`;`):
487490
488491 1. [=Strip leading and trailing ASCII whitespace=] from |token|.
@@ -513,64 +516,46 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
513516
514517 8. [=set/append|Append=] |directive| to |policy|'s [=policy/directive set=] .
515518
516- 3 . Return |policy|.
519+ 4 . Return |policy|.
517520 </ol>
518521
519- <h4 id="parse-serialized-policy-list " algorithm>
520- Parse a serialized CSP list
522+ <h4 id="parse-response-csp " algorithm dfn export >
523+ Parse |response|'s Content Security Policies
521524 </h4>
522525
523- To <dfn abstract-op>parse a serialized CSP list</dfn> , given a [=byte sequence=] or [=string=]
524- |list|, a [=policy/source=] |source|, and a [=policy/disposition=] |disposition|, execute
525- the following steps.
526+ To <dfn abstract-op>parse a response's Content Security Policies</dfn> given a <a>response</a>
527+ |response|, execute the following steps.
526528
527- This algorithm returns a [=list=] of [=Content Security Policy objects=] . If |list| cannot be
528- parsed, the returned list will be empty.
529+ This algorithm returns a [=list=] of [=Content Security Policy objects=] . If the policies cannot
530+ be parsed, the returned list will be empty.
529531
530532 <ol class="algorithm">
531- 1. If |list| is a [=byte sequence=] , then set |list| to be the result of <a
532- lt="isomorphic decode"> isomorphic decoding</a> |list|.
533-
534- 2. Let |policies| be an empty [=list=] .
533+ 1. Let |policies| be an empty [=list=] .
535534
536- 3. [=list/For each=] |token| returned by <a lt="split a string on commas">splitting |list| on commas</a> :
535+ 2. <a for=list>For each</a> |token| returned by [=extracting header list values=] given
536+ `Content-Security-Policy` and |response|'s [=response/header list=] :
537537
538- 1. Let |policy| be the result of <a abstract-op lt="parse a serialized CSP">parsing</a>
539- |token|, with a [=policy/source=] of |source |, and [=policy/disposition=] of
540- | disposition| .
538+ 1. Let |policy| be the result of
539+ <a abstract-op lt="parse a serialized CSP list">parsing</a> |token |, with a
540+ [=policy/source=] of "`header`", and a [=policy/ disposition=] of "`enforce`" .
541541
542- 2. If |policy|'s [=policy/directive set=] is empty, [=iteration/continue=] .
542+ 2. If |policy|'s [=policy/directive set=] is not empty, append |policy| to |policies| .
543543
544- 3. [=list/append|Append=] |policy| to |policies|.
544+ 3. <a for=list>For each</a> |token| returned by [=extracting header list values=] given
545+ `Content-Security-Policy-Report-Only` and |response|'s [=response/header list=] :
545546
546- 4. Return |policies|.
547- </ol>
548-
549- <h4 id="parse-response-csp" algorithm dfn export>
550- Parse |response|'s Content Security Policies
551- </h4>
552-
553- To <dfn abstract-op>parse a response's Content Security Policies</dfn> given a <a>response</a>
554- |response|:
555-
556- <ol class="algorithm">
557- 1. Let |policies| be the result of <a abstract-op lt="parse a serialized CSP list">parsing</a>
558- the result of [=extracting header list values=] given `Content-Security-Policy` and
559- |response|'s [=response/header list=] , with a [=policy/source=] of "`header`", and a
560- [=policy/disposition=] of "`enforce`".
547+ 1. Let |policy| be the result of
548+ <a abstract-op lt="parse a serialized CSP list">parsing</a> |token|, with a
549+ [=policy/source=] of "`header`", and a [=policy/disposition=] of "`report`".
561550
562- 2. Append to |policies| the result of
563- <a abstract-op lt="parse a serialized CSP list">parsing</a> the result of
564- [=extracting header list values=] given `Content-Security-Policy-Report-Only` and
565- |response|'s [=response/header list=] , with a [=policy/source=] of "`header`", and a
566- [=policy/disposition=] of "`report`".
551+ 2. If |policy|'s [=policy/directive set=] is not empty, append |policy| to |policies|.
567552
568- 3 . <a for=list>For each</a> |policy| of |policies|:
553+ 4 . <a for=list>For each</a> |policy| of |policies|:
569554
570555 1. Set |policy|'s [=policy/self-origin=] to |response|' s [=response/url=] 's
571556 [=url/origin=] .
572557
573- 4 . Return |policies|.
558+ 5 . Return |policies|.
574559 </ol>
575560
576561 Note: When <a abstract-op lt="parse a response's Content Security Policies">parsing a response's
0 commit comments