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

Side by Side Diff: tools/dom/src/Validators.dart

Issue 1371543002: Make sure we short-circuit the second corruption test, it might be crashing firefox (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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:
View unified diff | Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.dom.html; 5 part of dart.dom.html;
6 6
7 7
8 /** 8 /**
9 * Interface used to validate that only accepted elements and attributes are 9 * Interface used to validate that only accepted elements and attributes are
10 * allowed while parsing HTML strings into DOM nodes. 10 * allowed while parsing HTML strings into DOM nodes.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 var isAttr; 207 var isAttr;
208 try { 208 try {
209 // If getting/indexing attributes throws, count that as corrupt. 209 // If getting/indexing attributes throws, count that as corrupt.
210 attrs = element.attributes; 210 attrs = element.attributes;
211 isAttr = attrs['is']; 211 isAttr = attrs['is'];
212 var corruptedTest1 = Element._hasCorruptedAttributes(element); 212 var corruptedTest1 = Element._hasCorruptedAttributes(element);
213 213
214 // On IE, erratically, the hasCorruptedAttributes test can return false, 214 // On IE, erratically, the hasCorruptedAttributes test can return false,
215 // even though it clearly is corrupted. A separate copy of the test 215 // even though it clearly is corrupted. A separate copy of the test
216 // inlining just the basic check seems to help. 216 // inlining just the basic check seems to help.
217 var corruptedTest2 = Element._hasCorruptedAttributesAdditionalCheck(elemen t); 217 corrupted = corruptedTest1 ? true : Element._hasCorruptedAttributesAdditio nalCheck(element);
218 corrupted = corruptedTest1 || corruptedTest2;
219 } catch(e) {} 218 } catch(e) {}
220 var elementText = 'element unprintable'; 219 var elementText = 'element unprintable';
221 try { 220 try {
222 elementText = element.toString(); 221 elementText = element.toString();
223 } catch(e) {} 222 } catch(e) {}
224 try { 223 try {
225 var elementTagName = Element._safeTagName(element); 224 var elementTagName = Element._safeTagName(element);
226 _sanitizeElement(element, parent, corrupted, elementText, elementTagName, 225 _sanitizeElement(element, parent, corrupted, elementText, elementTagName,
227 attrs, isAttr); 226 attrs, isAttr);
228 } on ArgumentError { // Thrown by _ThrowsNodeValidator 227 } on ArgumentError { // Thrown by _ThrowsNodeValidator
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 case Node.COMMENT_NODE: 287 case Node.COMMENT_NODE:
289 case Node.DOCUMENT_FRAGMENT_NODE: 288 case Node.DOCUMENT_FRAGMENT_NODE:
290 case Node.TEXT_NODE: 289 case Node.TEXT_NODE:
291 case Node.CDATA_SECTION_NODE: 290 case Node.CDATA_SECTION_NODE:
292 break; 291 break;
293 default: 292 default:
294 _removeNode(node, parent); 293 _removeNode(node, parent);
295 } 294 }
296 } 295 }
297 } 296 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698