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

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

Issue 2643613002: Reduce the perf overhead of our dangling markup experiments. (Closed)
Patch Set: unittest 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) {
+ 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,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698