java.lang.Object
org.htmlunit.csp.Directive
org.htmlunit.csp.directive.RequireTrustedTypesForDirective
Represents the
require-trusted-types-for CSP directive.
This directive instructs the user agent to require Trusted Types for certain
DOM sinks. Currently the only defined keyword is 'script', which
enforces Trusted Types for all script-related injection sinks.
- Author:
- Michael Smith, Salvation Team
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.csp.Directive
Directive.DirectiveErrorConsumer -
Field Summary
Fields inherited from class org.htmlunit.csp.Directive
IS_DIRECTIVE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionRequireTrustedTypesForDirective(List<String> values, Directive.DirectiveErrorConsumer errors) Parses arequire-trusted-types-fordirective from the given list of values. -
Method Summary
Methods inherited from class org.htmlunit.csp.Directive
addValue, containsNonDirectiveCharacter, getValues, removeValueIgnoreCase
-
Constructor Details
-
RequireTrustedTypesForDirective
public RequireTrustedTypesForDirective(List<String> values, Directive.DirectiveErrorConsumer errors) Parses arequire-trusted-types-fordirective from the given list of values.The only currently recognised keyword is
'script'(case-insensitive). An empty directive, duplicate keywords, and unrecognised tokens are reported through the suppliederrorsconsumer.- Parameters:
values- the raw string values for this directiveerrors- consumer that receives parsing errors and warnings
-
-
Method Details
-
script
public boolean script()Returns whether the'script'keyword is present.When
true, Trusted Types are required for all script-related DOM injection sinks.- Returns:
trueif the'script'keyword is present
-
setScript
public void setScript(boolean script) Sets whether the'script'keyword is present.Setting to
trueadds'script'to the directive values; setting tofalseremoves it.- Parameters:
script-trueto add'script',falseto remove it
-