Index: sdk/lib/html/dartium/html_dartium.dart |
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
index e612c4518e75ea8b33c3e73cde6a2f7a16a8b147..218dc5129906b9f4a74c49c6f68ab1a71180e235 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -40352,17 +40352,17 @@ class NodeValidatorBuilder implements NodeValidator { |
} |
class _SimpleNodeValidator implements NodeValidator { |
- final Set<String> allowedElements; |
- final Set<String> allowedAttributes; |
- final Set<String> allowedUriAttributes; |
+ final Set<String> allowedElements = new Set<String>(); |
+ final Set<String> allowedAttributes = new Set<String>(); |
+ final Set<String> allowedUriAttributes = new Set<String>(); |
final UriPolicy uriPolicy; |
factory _SimpleNodeValidator.allowNavigation(UriPolicy uriPolicy) { |
return new _SimpleNodeValidator(uriPolicy, |
- allowedElements: [ |
+ allowedElements: const [ |
'A', |
'FORM'], |
- allowedAttributes: [ |
+ allowedAttributes: const [ |
'A::accesskey', |
'A::coords', |
'A::hreflang', |
@@ -40379,7 +40379,7 @@ class _SimpleNodeValidator implements NodeValidator { |
'FORM::novalidate', |
'FORM::target', |
], |
- allowedUriAttributes: [ |
+ allowedUriAttributes: const [ |
'A::href', |
'FORM::action', |
]); |
@@ -40387,10 +40387,10 @@ class _SimpleNodeValidator implements NodeValidator { |
factory _SimpleNodeValidator.allowImages(UriPolicy uriPolicy) { |
return new _SimpleNodeValidator(uriPolicy, |
- allowedElements: [ |
+ allowedElements: const [ |
'IMG' |
], |
- allowedAttributes: [ |
+ allowedAttributes: const [ |
'IMG::align', |
'IMG::alt', |
'IMG::border', |
@@ -40402,14 +40402,14 @@ class _SimpleNodeValidator implements NodeValidator { |
'IMG::vspace', |
'IMG::width', |
], |
- allowedUriAttributes: [ |
+ allowedUriAttributes: const [ |
'IMG::src', |
]); |
} |
factory _SimpleNodeValidator.allowTextElements() { |
return new _SimpleNodeValidator(null, |
- allowedElements: [ |
+ allowedElements: const [ |
'B', |
'BLOCKQUOTE', |
'BR', |
@@ -40437,13 +40437,18 @@ class _SimpleNodeValidator implements NodeValidator { |
*/ |
_SimpleNodeValidator(this.uriPolicy, |
{Iterable<String> allowedElements, Iterable<String> allowedAttributes, |
- Iterable<String> allowedUriAttributes}): |
- this.allowedElements = allowedElements != null ? |
- new Set.from(allowedElements) : new Set(), |
- this.allowedAttributes = allowedAttributes != null ? |
- new Set.from(allowedAttributes) : new Set(), |
- this.allowedUriAttributes = allowedUriAttributes != null ? |
- new Set.from(allowedUriAttributes) : new Set(); |
+ Iterable<String> allowedUriAttributes}) { |
+ this.allowedElements.addAll(allowedElements ?? const []); |
+ allowedAttributes = allowedAttributes ?? const []; |
+ allowedUriAttributes = allowedUriAttributes ?? const []; |
+ var legalAttributes = allowedAttributes.where( |
+ (x) => !_Html5NodeValidator._uriAttributes.contains(x)); |
+ var extraUriAttributes = allowedAttributes.where( |
+ (x) => _Html5NodeValidator._uriAttributes.contains(x)); |
+ this.allowedAttributes.addAll(legalAttributes); |
+ this.allowedUriAttributes.addAll(allowedUriAttributes); |
+ this.allowedUriAttributes.addAll(extraUriAttributes); |
+ } |
bool allowsElement(Element element) { |
return allowedElements.contains(element.tagName); |