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

Unified Diff: ui/webui/resources/js/parse_html_subset.js

Issue 1907653002: WebUI: allow target="_blank" by default in parseHtmlSubset(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « chrome/test/data/webui/parse_html_subset_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/parse_html_subset.js
diff --git a/ui/webui/resources/js/parse_html_subset.js b/ui/webui/resources/js/parse_html_subset.js
index 3817b49ceb915f0837bcc8c9aede7a1492a7faec..ff0df052be215c3c56b12e131cb3d9a80a6daacf 100644
--- a/ui/webui/resources/js/parse_html_subset.js
+++ b/ui/webui/resources/js/parse_html_subset.js
@@ -22,12 +22,10 @@ var parseHtmlSubset = (function() {
value.indexOf('https://') == 0);
},
'target': function(node, value) {
- // Allow a[target] but reset the value to "".
- if (node.tagName != 'A')
- return false;
- node.setAttribute('target', '');
- return true;
- }
+ // Only allow a[target='_blank'].
+ // TODO(dbeam): are there valid use cases for target != '_blank'?
+ return node.tagName == 'A' && value == '_blank';
+ },
};
/**
« no previous file with comments | « chrome/test/data/webui/parse_html_subset_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698