| 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 bbb5d14822c8b830ede0351375230e2b5012f76c..a98fee0caf2326c71268c42d6b905ee3d8b5959f 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -50251,9 +50251,18 @@ 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;
|
| + while (!identical(child, null)) {
|
| + 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 and restart the traversal without it.
|
| + _removeNode(child, node);
|
| + walk(node, parent);
|
| + return;
|
| + }
|
| walk(child, node);
|
| child = nextChild;
|
| }
|
|
|