| 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 7b1715456fb692d4587ca85eabda81f4f3046005..dc76ced22ca705d1b1ff69b561f862e09cc8055a 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -43724,10 +43724,21 @@ class _ValidatingTreeSanitizer implements NodeTreeSanitizer {
|
| sanitizeNode(node, parent);
|
|
|
| var child = node.lastChild;
|
| - while (child != null) {
|
| - // Child may be removed during the walk.
|
| - var nextChild = child.previousNode;
|
| - walk(child, node);
|
| + while (null != child) {
|
| + var nextChild;
|
| + try {
|
| + // Child may be removed during the walk, and we may not
|
| + // even be able to get its previousNode.
|
| + nextChild = child.previousNode;
|
| + } catch (e) {
|
| + // Child appears bad, remove it. We want to check the rest of the
|
| + // children of node and, but we have no way of getting to the next
|
| + // child, so start again from the last child.
|
| + _removeNode(child, node);
|
| + child = null;
|
| + nextChild = node.lastChild;
|
| + }
|
| + if (child != null) walk(child, node);
|
| child = nextChild;
|
| }
|
| }
|
|
|