| 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 5ab6241ee4e47d93cb7c2ca1fae7ac7e4579d59b..1de3e1cc28e3865a0fea7f8051e264284cb7a318 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -12423,8 +12423,12 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode,
|
| */
|
| void insertAdjacentHtml(String where, String html, {NodeValidator validator,
|
| NodeTreeSanitizer treeSanitizer}) {
|
| - _insertAdjacentNode(where, new DocumentFragment.html(html,
|
| - validator: validator, treeSanitizer: treeSanitizer));
|
| + if (treeSanitizer is _TrustedHtmlTreeSanitizer) {
|
| + _insertAdjacentHtml(where, html);
|
| + } else {
|
| + _insertAdjacentNode(where, new DocumentFragment.html(html,
|
| + validator: validator, treeSanitizer: treeSanitizer));
|
| + }
|
| }
|
|
|
|
|
| @@ -12695,8 +12699,12 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode,
|
| void setInnerHtml(String html,
|
| {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
| text = null;
|
| - append(createFragment(
|
| - html, validator: validator, treeSanitizer: treeSanitizer));
|
| + if (treeSanitizer is _TrustedHtmlTreeSanitizer) {
|
| + _innerHtml = html;
|
| + } else {
|
| + append(createFragment(
|
| + html, validator: validator, treeSanitizer: treeSanitizer));
|
| + }
|
| }
|
| String get innerHtml => _innerHtml;
|
|
|
| @@ -40622,9 +40630,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.
|
| *
|
|
|