Chromium Code Reviews| 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 5f1e6c6e1cac28260e164ab7704fe4efa8d79b14..2a3568931aebd9db5f7411183399b17c5af643d6 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -4945,34 +4945,27 @@ 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 lessThan = trimmed.contains('<'); |
| - if ((newline || lessThan) && completed.protocolIsInHTTPFamily()) { |
| - if (newline) { |
| + if (completed.whitespaceRemoved()) { |
|
Charlie Harrison
2017/01/19 13:06:49
Optional: I think an early return here would be ni
|
| + if (completed.protocolIsInHTTPFamily()) { |
| UseCounter::count(*this, |
| UseCounter::DocumentCompleteURLHTTPContainingNewline); |
| - } |
| - if (lessThan) { |
| - UseCounter::count(*this, |
| - UseCounter::DocumentCompleteURLHTTPContainingLessThan); |
| - } |
| - if (newline && lessThan) { |
| + bool lessThan = url.contains('<'); |
| + if (lessThan) { |
| + UseCounter::count( |
| + *this, |
| + UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan); |
| + |
| + if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled()) |
| + return KURL(); |
| + } |
| + } else { |
| UseCounter::count( |
| - *this, |
| - UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan); |
| - |
| - if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled()) |
| - return KURL(); |
| + *this, UseCounter::DocumentCompleteURLNonHTTPContainingNewline); |
| } |
| - } else if (newline || lessThan) { |
| - UseCounter::count( |
| - *this, |
| - UseCounter::DocumentCompleteURLNonHTTPContainingNewlineOrLessThan); |
| } |
| - return completeURLWithOverride(url, m_baseURL); |
| + return completed; |
| } |
| KURL Document::completeURLWithOverride(const String& url, |