| 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 25d91f6ec164c1a4b3897437e8bd5367cc704467..a6962e285fe5dbac192778036838dbec86172948 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -40729,24 +40729,49 @@ class _ValidatingTreeSanitizer implements NodeTreeSanitizer {
|
| switch (node.nodeType) {
|
| case Node.ELEMENT_NODE:
|
| Element element = node;
|
| - if (element._hasCorruptedAttributes) {
|
| - window.console.warn('Removing element due to corrupted attributes on <${element}>');
|
| + // If the _hasCorruptedAttributes does not successfully return false,
|
| + // then we consider it corrupted and remove.
|
| + // TODO(alanknight): This is a workaround because on Firefox
|
| + // embed/object
|
| + // tags typeof is "function", not "object". We don't recognize them, and
|
| + // can't call methods. This does mean that you can't explicitly allow an
|
| + // embed tag. The only thing that will let it through is a null
|
| + // sanitizer that doesn't traverse the tree at all. But sanitizing while
|
| + // allowing embeds seems quite unlikely.
|
| + var corrupted = true;
|
| + var attrs;
|
| + var isAttr;
|
| + try {
|
| + // If getting/indexing attributes throws, count that as corrupt.
|
| + attrs = element.attributes;
|
| + isAttr = attrs['is'];
|
| + corrupted = element._hasCorruptedAttributes;
|
| + } catch(e) {}
|
| + var elementText = 'element unprintable';
|
| + try {
|
| + elementText = element.toString();
|
| + } catch(e) {}
|
| + var elementTagName = 'element tag unavailable';
|
| + try {
|
| + elementTagName = element.tagName;
|
| + } catch(e) {}
|
| + if (corrupted) {
|
| + window.console.warn(
|
| + 'Removing element due to corrupted attributes on <$elementText>');
|
| _removeNode(node, parent);
|
| break;
|
| }
|
| - var attrs = element.attributes;
|
| if (!validator.allowsElement(element)) {
|
| window.console.warn(
|
| - 'Removing disallowed element <${element.tagName}>');
|
| + 'Removing disallowed element <$elementTagName>');
|
| _removeNode(node, parent);
|
| break;
|
| }
|
|
|
| - var isAttr = attrs['is'];
|
| if (isAttr != null) {
|
| if (!validator.allowsAttribute(element, 'is', isAttr)) {
|
| window.console.warn('Removing disallowed type extension '
|
| - '<${element.tagName} is="$isAttr">');
|
| + '<$elementTagName is="$isAttr">');
|
| _removeNode(node, parent);
|
| break;
|
| }
|
|
|