@@ -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 <a
483+ lt="isomorphic decode"> isomorphic decoding</a> |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,37 +516,7 @@ 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|.
517- </ol>
518-
519- <h4 id="parse-serialized-policy-list" algorithm>
520- Parse a serialized CSP list
521- </h4>
522-
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-
527- This algorithm returns a [=list=] of [=Content Security Policy objects=] . If |list| cannot be
528- parsed, the returned list will be empty.
529-
530- <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=] .
535-
536- 3. [=list/For each=] |token| returned by <a lt="split a string on commas">splitting |list| on commas</a> :
537-
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|.
541-
542- 2. If |policy|'s [=policy/directive set=] is empty, [=iteration/continue=] .
543-
544- 3. [=list/append|Append=] |policy| to |policies|.
545-
546- 4. Return |policies|.
519+ 4. Return |policy|.
547520 </ol>
548521
549522 <h4 id="parse-response-csp" algorithm dfn export>
@@ -554,23 +527,28 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
554527 |response|:
555528
556529 <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`".
530+ 1. Let |policies| be an empty [=list=] .
531+
532+ 2. <a for=list>For each</a> |token| returned by [=extracting header list values=] given
533+ `Content-Security-Policy` and |response|'s [=response/header list=] :
534+
535+ 1. Append to |policies| the result of
536+ <a abstract-op lt="parse a serialized CSP list">parsing</a> |token|, with a
537+ [=policy/source=] of "`header`", and a [=policy/disposition=] of "`enforce`".
538+
539+ 3. <a for=list>For each</a> |token| returned by [=extracting header list values=] given
540+ `Content-Security-Policy-Report-Only` and |response|'s [=response/header list=] :
561541
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`".
542+ 1. Append to |policies| the result of
543+ <a abstract-op lt="parse a serialized CSP list">parsing</a> |token|, with a
544+ [=policy/source=] of "`header`", and a [=policy/disposition=] of "`report`".
567545
568- 3 . <a for=list>For each</a> |policy| of |policies|:
546+ 4 . <a for=list>For each</a> |policy| of |policies|:
569547
570548 1. Set |policy|'s [=policy/self-origin=] to |response|' s [=response/url=] 's
571549 [=url/origin=] .
572550
573- 4 . Return |policies|.
551+ 5 . Return |policies|.
574552 </ol>
575553
576554 Note: When <a abstract-op lt="parse a response's Content Security Policies">parsing a response's
0 commit comments