Skip to content

Commit 5efb213

Browse files
committed
Assert that the config is valid
1 parent 84178c2 commit 5efb213

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

index.bs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ By explicitly sorting the result of this method, we give implementations the opp
312312
</div>
313313

314314
1. Let |config| be [=this=]'s [=Sanitizer/configuration=].
315+
1. [=Assert=]: |config| is [=SanitizerConfig/valid=].
315316
1. If |config|["{{SanitizerConfig/elements}}"] [=map/exists=]:
316317
1. [=list/iterate|For any=] |element| of |config|["{{SanitizerConfig/elements}}"]:
317318
1. If |element|["{{SanitizerElementNamespaceWithAttributes/attributes}}"] [=map/exists=]:
@@ -351,6 +352,7 @@ allow- or remove-lists for attributes. This requires that we distinguish 4 cases
351352
</div>
352353

353354
1. Let |configuration| be [=this=]'s [=Sanitizer/configuration=].
355+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
354356
1. Set |element| to the result of [=canonicalize a sanitizer element with attributes=] with
355357
|element|.
356358
1. If |configuration|["{{SanitizerConfig/elements}}"] [=map/exists=]:
@@ -437,6 +439,7 @@ to [=remove an element=] with |element| and [=this=]'s [=Sanitizer/configuration
437439
The <dfn for="Sanitizer" method export>replaceElementWithChildren(|element|)</dfn> method steps are:
438440

439441
1. Let |configuration| be [=this=]'s [=Sanitizer/configuration=].
442+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
440443
1. Set |element| to the result of [=canonicalize a sanitizer element=] with |element|.
441444
1. If |configuration|["{{SanitizerConfig/replaceWithChildrenElements}}"] [=map/contains=] |element|:
442445
1. Return false.
@@ -457,6 +460,7 @@ up per-element allow- or remove-lists to maintain our validity criteria.
457460
</div>
458461

459462
1. Let |configuration| be [=this=]'s [=Sanitizer/configuration=].
463+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
460464
1. Set |attribute| to the result of [=canonicalize a sanitizer attribute=] with |attribute|.
461465
1. If |configuration|["{{SanitizerConfig/attributes}}"] [=map/exists=]:
462466
1. [=Comment=]: If we have a global allow-list, we need to add |attribute|.
@@ -495,6 +499,7 @@ The <dfn for="Sanitizer" method export>removeAttribute(|attribute|)</dfn> method
495499
The <dfn for="Sanitizer" method export>setComments(|allow|)</dfn> method steps are:
496500

497501
1. Let |configuration| be [=this=]'s [=Sanitizer/configuration=].
502+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
498503
1. If |configuration|["{{SanitizerConfig/comments}}"] [=map/exists=] and
499504
|configuration|["{{SanitizerConfig/comments}}"] equals |allow|, then return false;
500505
1. Set |configuration|["{{SanitizerConfig/comments}}"] to |allow|.
@@ -506,6 +511,7 @@ The <dfn for="Sanitizer" method export>setComments(|allow|)</dfn> method steps a
506511
The <dfn for="Sanitizer" method export>setDataAttributes(|allow|)</dfn> method steps are:
507512

508513
1. Let |configuration| be [=this=]'s [=Sanitizer/configuration=].
514+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
509515
1. If |configuration|["{{SanitizerConfig/attributes}}"] does not [=map/exist=], then return false.
510516
1. If |configuration|["{{SanitizerConfig/dataAttributes}}"] equals |allow|, then return false.
511517
1. If |allow| is true:
@@ -1000,6 +1006,7 @@ This method requires that we distinguish 4 cases:
10001006
10011007
</div>
10021008
1009+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
10031010
1. Set |element| to the result of [=canonicalize a sanitizer element=] with |element|.
10041011
1. Set |modified| to the result of
10051012
[=SanitizerConfig/remove=] |element| from
@@ -1031,6 +1038,7 @@ remove-list. If we add |attribute| to the global remove-list, we may need to do
10311038
to fix up per-element allow- or remove-lists to maintain our validity criteria. If we remove
10321039
|attribute| from a global allow-list, we may also have to remove it from local remove-lists.
10331040
1041+
1. [=Assert=]: |configuration| is [=SanitizerConfig/valid=].
10341042
1. Set |attribute| to the result of [=canonicalize a sanitizer attribute=] with |attribute|.
10351043
1. If |configuration|["{{SanitizerConfig/attributes}}"] [=map/exists=]:
10361044
1. [=Comment=]: If we have a global allow-list, we need to add |attribute|.

0 commit comments

Comments
 (0)