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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2634893003: Experiment with blocking resolution of HTTP URLs containing '\n' and '<'. (Closed)
Patch Set: Culling. Created 3 years, 11 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
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 8dd0107b17f40243126d5ebf82ac2ec8a0e5a7b0..3966b1c70dda7a8b93186e52b093bb1e1db19960 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4947,17 +4947,31 @@ void Document::setEncodingData(const DocumentEncodingData& newData) {
KURL Document::completeURL(const String& url) const {
String trimmed = url.stripWhiteSpace();
+ KURL completed = completeURLWithOverride(url, m_baseURL);
+
bool newline = trimmed.contains('\n') || trimmed.contains('\r');
- bool brace = trimmed.contains('<');
- if (newline)
- UseCounter::count(*this, UseCounter::DocumentCompleteURLContainingNewline);
- if (brace) {
- UseCounter::count(*this,
- UseCounter::DocumentCompleteURLContainingOpenBrace);
- }
- if (newline && brace) {
+ bool lessThan = trimmed.contains('<');
+ if ((newline || lessThan) && completed.protocolIsInHTTPFamily()) {
+ if (newline) {
+ UseCounter::count(*this,
+ UseCounter::DocumentCompleteURLHTTPContainingNewline);
+ }
+ if (lessThan) {
+ UseCounter::count(*this,
+ UseCounter::DocumentCompleteURLHTTPContainingLessThan);
+ }
+ if (newline && lessThan) {
+ UseCounter::count(
+ *this,
+ UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan);
+
+ if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled())
+ return KURL();
+ }
+ } else if (newline || lessThan) {
UseCounter::count(
- *this, UseCounter::DocumentCompleteURLContainingNewlineAndOpenBrace);
+ *this,
+ UseCounter::DocumentCompleteURLNonHTTPContainingNewlineOrLessThan);
}
return completeURLWithOverride(url, m_baseURL);
}

Powered by Google App Engine
This is Rietveld 408576698