Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 1236413002: Make sure NodeValidator uriAttributes aren't passed as attributes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: And regenerate libraries after formatting Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 0f15bdc72da26e478431c5f3d4952544ce9a94b9..a63c557a404149fd8270d76bbb72cc7a437563ac 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -39469,17 +39469,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',
@@ -39496,7 +39496,7 @@ class _SimpleNodeValidator implements NodeValidator {
'FORM::novalidate',
'FORM::target',
],
- allowedUriAttributes: [
+ allowedUriAttributes: const [
'A::href',
'FORM::action',
]);
@@ -39504,10 +39504,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',
@@ -39519,14 +39519,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',
@@ -39554,13 +39554,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);
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698