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

Unified Diff: tools/dom/src/Validators.dart

Issue 1321613005: Dartium w/ JsInterop enabled (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/src/NodeValidatorBuilder.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/Validators.dart
diff --git a/tools/dom/src/Validators.dart b/tools/dom/src/Validators.dart
index 809f8e58d2f89c68c42653038edbea87058fef7a..11cb3d0d5ac642f9872959a9851baae3030c84da 100644
--- a/tools/dom/src/Validators.dart
+++ b/tools/dom/src/Validators.dart
@@ -72,7 +72,7 @@ abstract class NodeTreeSanitizer {
/**
* A sanitizer for trees that we trust. It does no validation and allows
* any elements. It is also more efficient, since it can pass the text
- * directly through to the underlying APIs without creating a document
+ * directly through to the underlying APIs without creating a document
* fragment to be sanitized.
*/
static const trusted = const _TrustedHtmlTreeSanitizer();
@@ -87,7 +87,7 @@ class _TrustedHtmlTreeSanitizer implements NodeTreeSanitizer {
sanitizeTree(Node node) {}
}
-
+
/**
* Defines the policy for what types of uris are allowed for particular
* attribute values.
@@ -141,14 +141,14 @@ class _ThrowsNodeValidator implements NodeValidator {
bool allowsElement(Element element) {
if (!validator.allowsElement(element)) {
- throw new ArgumentError(element.tagName);
+ throw new ArgumentError(element._safeTagName);
}
return true;
}
bool allowsAttribute(Element element, String attributeName, String value) {
if (!validator.allowsAttribute(element, attributeName, value)) {
- throw new ArgumentError('${element.tagName}[$attributeName="$value"]');
+ throw new ArgumentError('${element._safeTagName}[$attributeName="$value"]');
}
}
}
@@ -213,10 +213,7 @@ class _ValidatingTreeSanitizer implements NodeTreeSanitizer {
try {
elementText = element.toString();
} catch(e) {}
- var elementTagName = 'element tag unavailable';
- try {
- elementTagName = element.tagName;
- } catch(e) {}
+ var elementTagName = element._safeTagName;
_sanitizeElement(element, parent, corrupted, elementText, elementTagName,
attrs, isAttr);
}
« no previous file with comments | « tools/dom/src/NodeValidatorBuilder.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698