Package com.google.javascript.jscomp
Class ConformanceRules.BanSettingAttributes
java.lang.Object
com.google.javascript.jscomp.ConformanceRules.AbstractRule
com.google.javascript.jscomp.ConformanceRules.BanSettingAttributes
- All Implemented Interfaces:
CheckConformance.Rule
- Enclosing class:
ConformanceRules
public static final class ConformanceRules.BanSettingAttributes
extends ConformanceRules.AbstractRule
Can be used to ban any function like
Element#setAttribute which takes two parameters,
an attribute name and a value.
The specific attribute names that are banned are specified in
SecuritySensitiveAttributes.BANNED_ATTRS.
-
Constructor Summary
ConstructorsConstructorDescriptionBanSettingAttributes(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) Create a custom checker to ban a function likeElement#setAttributebased on a conformance requirement spec. -
Method Summary
Modifier and TypeMethodDescriptionprotected ConformanceRules.ConformanceResultcheckConformance(NodeTraversal traversal, Node node) Methods inherited from class com.google.javascript.jscomp.ConformanceRules.AbstractRule
check, report, tsIsAllowlistedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.javascript.jscomp.CheckConformance.Rule
getPrecondition
-
Constructor Details
-
BanSettingAttributes
public BanSettingAttributes(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) throws CheckConformance.InvalidRequirementSpec Create a custom checker to ban a function likeElement#setAttributebased on a conformance requirement spec.Names in
valuefields indicate the functions that should be blocked. ThrowsCheckConformance.InvalidRequirementSpecif the requirement is malformed.
-
-
Method Details
-
checkConformance
- Specified by:
checkConformancein classConformanceRules.AbstractRule- Returns:
- Whether the code represented by the Node conforms to the rule.
-