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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 1825373004: Check for the case where previousNode fails in sanitization. Can happen with object tags (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review fixes Created 4 years, 9 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:
Download patch
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/src/Validators.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e5d710a6e0ff0d011676dd52eecd5da094388a29 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -50251,10 +50251,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;
}
}
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/src/Validators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698