java.lang.Object
org.htmlunit.csp.Directive
org.htmlunit.csp.directive.SandboxDirective
Represents the
sandbox CSP directive.
The sandbox directive applies restrictions to the protected resource
similar to the <iframe sandbox> attribute. When present with no keywords,
the strictest sandbox is applied. Individual restrictions can be lifted by
including the corresponding allow-* keyword.
- Author:
- 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
ConstructorsConstructorDescriptionSandboxDirective(List<String> values, Directive.DirectiveErrorConsumer errors) Parses asandboxdirective from the given list of keyword values. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether theallow-downloadssandbox keyword is present.booleanReturns whether theallow-formssandbox keyword is present.booleanReturns whether theallow-modalssandbox keyword is present.booleanReturns whether theallow-orientation-locksandbox keyword is present.booleanReturns whether theallow-pointer-locksandbox keyword is present.booleanReturns whether theallow-popupssandbox keyword is present.booleanReturns whether theallow-popups-to-escape-sandboxsandbox keyword is present.booleanReturns whether theallow-presentationsandbox keyword is present.booleanReturns whether theallow-same-originsandbox keyword is present.booleanReturns whether theallow-scriptssandbox keyword is present.booleanReturns whether theallow-storage-access-by-user-activationsandbox keyword is present.booleanReturns whether theallow-top-navigationsandbox keyword is present.booleanReturns whether theallow-top-navigation-by-user-activationsandbox keyword is present.Methods inherited from class org.htmlunit.csp.Directive
addValue, containsNonDirectiveCharacter, getValues, removeValueIgnoreCase
-
Constructor Details
-
SandboxDirective
Parses asandboxdirective from the given list of keyword values.Each token is matched case-insensitively against the known sandbox keywords. Duplicates and unrecognised keywords are reported through the supplied
errorsconsumer.- Parameters:
values- the raw string values (sandbox keywords) for this directiveerrors- consumer that receives parsing errors and warnings
-
-
Method Details
-
allowDownloads
public boolean allowDownloads()Returns whether theallow-downloadssandbox keyword is present.- Returns:
trueif downloads are allowed
-
allowForms
public boolean allowForms()Returns whether theallow-formssandbox keyword is present.- Returns:
trueif form submission is allowed
-
allowModals
public boolean allowModals()Returns whether theallow-modalssandbox keyword is present.- Returns:
trueif modal dialogs (e.g.alert()) are allowed
-
allowOrientationLock
public boolean allowOrientationLock()Returns whether theallow-orientation-locksandbox keyword is present.- Returns:
trueif screen orientation locking is allowed
-
allowPointerLock
public boolean allowPointerLock()Returns whether theallow-pointer-locksandbox keyword is present.- Returns:
trueif the Pointer Lock API is allowed
-
allowPopups
public boolean allowPopups()Returns whether theallow-popupssandbox keyword is present.- Returns:
trueif popups (e.g.window.open(),target="_blank") are allowed
-
allowPopupsToEscapeSandbox
public boolean allowPopupsToEscapeSandbox()Returns whether theallow-popups-to-escape-sandboxsandbox keyword is present.- Returns:
trueif popups are allowed to open without inheriting the sandbox
-
allowPresentation
public boolean allowPresentation()Returns whether theallow-presentationsandbox keyword is present.- Returns:
trueif the Presentation API is allowed
-
allowSameOrigin
public boolean allowSameOrigin()Returns whether theallow-same-originsandbox keyword is present.- Returns:
trueif the content is treated as being from its normal origin
-
allowScripts
public boolean allowScripts()Returns whether theallow-scriptssandbox keyword is present.- Returns:
trueif script execution is allowed
-
allowStorageAccessByUserActivation
public boolean allowStorageAccessByUserActivation()Returns whether theallow-storage-access-by-user-activationsandbox keyword is present.- Returns:
trueif the Storage Access API is allowed with user activation
-