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

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

Issue 1154423009: Make it easier and more efficient to use trusted HTML text (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Formatting Created 5 years, 7 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
Index: tools/dom/src/Validators.dart
diff --git a/tools/dom/src/Validators.dart b/tools/dom/src/Validators.dart
index 572477037bad32afeedd662347e525359a5c188f..809f8e58d2f89c68c42653038edbea87058fef7a 100644
--- a/tools/dom/src/Validators.dart
+++ b/tools/dom/src/Validators.dart
@@ -68,9 +68,27 @@ abstract class NodeTreeSanitizer {
* will mark the entire tree as unsafe.
*/
void sanitizeTree(Node node);
+
+ /**
+ * 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
+ * fragment to be sanitized.
+ */
+ static const trusted = const _TrustedHtmlTreeSanitizer();
}
/**
+ * A sanitizer for trees that we trust. It does no validation and allows
+ * any elements.
+ */
+class _TrustedHtmlTreeSanitizer implements NodeTreeSanitizer {
+ const _TrustedHtmlTreeSanitizer();
+
+ sanitizeTree(Node node) {}
+}
+
+/**
* Defines the policy for what types of uris are allowed for particular
* attribute values.
*
« no previous file with comments | « tests/html/trusted_html_tree_sanitizer_test.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698