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

Unified Diff: tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart

Issue 1123173003: Another try at appendHtml and insertAdjacentHtml should be consistently sanitized (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/co19/co19-dartium.status ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
diff --git a/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart b/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
index cb0196d7393693b2d0fa3f8ce35dc06b31ca91a2..4a5fe71550fd2b61ecb64cbb17e4fa10b4fbc4a1 100644
--- a/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
+++ b/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
@@ -137,6 +137,24 @@ main() {
validateNodeTree(template.content, expectedContent);
});
+
+ test("appendHtml is sanitized", () {
+ var html = '<body background="s"></body><div></div>';
+ document.body.appendHtml('<div id="stuff"></div>');
+ var stuff = document.querySelector("#stuff");
+ stuff.appendHtml(html);
+ expect(stuff.childNodes.length, 1);
+ stuff.remove();
+ });
+
+ test("documentFragment.appendHtml is sanitized", () {
+ var html = '<div id="things></div>';
+ var fragment = new DocumentFragment.html(html);
+ fragment.appendHtml('<div id="bad"><script></script></div>');
+ expect(fragment.childNodes.length, 1);
+ expect(fragment.childNodes[0].id, "bad");
+ expect(fragment.childNodes[0].childNodes.length, 0);
+ });
});
group('URI_sanitization', () {
« no previous file with comments | « tests/co19/co19-dartium.status ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698